diff options
author | midipix <writeonce@midipix.org> | 2017-12-08 02:39:20 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-12-08 02:51:09 -0500 |
commit | 8e91ccf95ec9e12b1743cf0746c53b93557cdd48 (patch) | |
tree | be4df948ef1e1d499548336acd4aee2560dfd8b1 | |
parent | da3cfa96f27ac47f6193b1b631db510c234f9bdc (diff) | |
download | ntapi-8e91ccf95ec9e12b1743cf0746c53b93557cdd48.tar.bz2 ntapi-8e91ccf95ec9e12b1743cf0746c53b93557cdd48.tar.xz |
__ntapi_ldr_load_system_dll(): added 'downlevel' support...
-rw-r--r-- | src/ldr/ntapi_ldr_load_system_dll.c | 33 |
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, |