Blame src/ldr/ntapi_ldr_load_system_dll.c

dd89bb
/********************************************************/
dd89bb
/*  ntapi: Native API core library                      */
4256e2
/*  Copyright (C) 2013--2016  Z. Gilboa                 */
dd89bb
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
dd89bb
/********************************************************/
dd89bb
dd89bb
#include <psxtypes/psxtypes.h>
dd89bb
#include <ntapi/nt_ldr.h>
dd89bb
#include <ntapi/ntapi.h>
dd89bb
#include "ntapi_impl.h"
dd89bb
dd89bb
int32_t	__stdcall __ntapi_ldr_load_system_dll(
dd89bb
	__in	void *			hsysdir		__optional,
dd89bb
	__in	wchar16_t *		base_name,
dd89bb
	__in	uint32_t		base_name_size,
dd89bb
	__in	uint32_t *		image_flags	__optional,
dd89bb
	__out	void **			image_base)
dd89bb
{
dd89bb
	int32_t			status;
dd89bb
	nt_unicode_string	nt_image_name;
dd89bb
	uintptr_t		buffer[0x80];
dd89bb
c713d8
	(void)image_flags;
c713d8
dd89bb
	/* stack buffer */
dd89bb
	__ntapi->tt_aligned_block_memset(buffer,0,sizeof(buffer));
dd89bb
dd89bb
	status = __ntapi->tt_get_system_directory_dos_path(
dd89bb
		hsysdir,
dd89bb
		(wchar16_t *)buffer,
dd89bb
		sizeof(buffer),
dd89bb
		base_name,
dd89bb
		base_name_size,
dd89bb
		&nt_image_name);
dd89bb
dd89bb
	if (status != NT_STATUS_SUCCESS)
dd89bb
		return status;
dd89bb
dd89bb
	status = __ntapi->ldr_load_dll(
dd89bb
		0,
dd89bb
		0,
dd89bb
		&nt_image_name,
dd89bb
		image_base);
dd89bb
dd89bb
	return status;
dd89bb
}