summaryrefslogtreecommitdiffhomepage
path: root/src/ldr
diff options
context:
space:
mode:
Diffstat (limited to 'src/ldr')
-rw-r--r--src/ldr/ntapi_ldr_load_system_dll.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ldr/ntapi_ldr_load_system_dll.c b/src/ldr/ntapi_ldr_load_system_dll.c
index 6265cdf..9106395 100644
--- a/src/ldr/ntapi_ldr_load_system_dll.c
+++ b/src/ldr/ntapi_ldr_load_system_dll.c
@@ -17,6 +17,7 @@ int32_t __stdcall __ntapi_ldr_load_system_dll(
__out void ** image_base)
{
int32_t status;
+ wchar16_t * wch;
wchar16_t * sysdir;
nt_unicode_string nt_sysdir;
nt_unicode_string nt_image_name;
@@ -44,6 +45,38 @@ int32_t __stdcall __ntapi_ldr_load_system_dll(
nt_image_name.maxlen = base_name_size;
nt_image_name.buffer = base_name;
+ status = __ntapi->ldr_load_dll(
+ sysdir,0,
+ &nt_image_name,
+ image_base);
+
+ switch (status) {
+ case NT_STATUS_DLL_NOT_FOUND:
+ break;
+
+ default:
+ return status;
+ }
+
+ /* downlevel */
+ for (wch=sysdir; *wch; wch++)
+ (void)0;
+
+ if (&wch[10] > &sysdir[sizeof(buffer)/sizeof(wchar16_t)])
+ return NT_STATUS_BUFFER_TOO_SMALL;
+
+ *wch++ = 'd';
+ *wch++ = 'o';
+ *wch++ = 'w';
+ *wch++ = 'n';
+ *wch++ = 'l';
+ *wch++ = 'e';
+ *wch++ = 'v';
+ *wch++ = 'e';
+ *wch++ = 'l';
+ *wch++ = '\\';
+ *wch++ = 0;
+
return __ntapi->ldr_load_dll(
sysdir,0,
&nt_image_name,