GetModuleHandle succeeds when called from WOW64 module callbacks on Windows but without this it would crash on wine.
From: Billy Laws blaws05@gmail.com
GetModuleHandle succeeds when called from WOW64 module callbacks on Windows but without this it would crash on wine. --- dlls/ntdll/loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index bad1492e138..1db987be10b 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2801,10 +2801,6 @@ static WINE_MODREF *build_main_module(void) RTL_USER_PROCESS_PARAMETERS *params = NtCurrentTeb()->Peb->ProcessParameters; void *module = NtCurrentTeb()->Peb->ImageBaseAddress;
- default_load_path = params->DllPath.Buffer; - if (!default_load_path) - get_dll_load_path( params->ImagePathName.Buffer, NULL, dll_safe_mode, &default_load_path ); - NtQueryInformationProcess( GetCurrentProcess(), ProcessImageInformation, &info, sizeof(info), NULL ); if (info.ImageCharacteristics & IMAGE_FILE_DLL) { @@ -4350,6 +4346,10 @@ void loader_init( CONTEXT *context, void **entry ) load_global_options(); version_init();
+ default_load_path = peb->ProcessParameters->DllPath.Buffer; + if (!default_load_path) + get_dll_load_path( peb->ProcessParameters->ImagePathName.Buffer, NULL, dll_safe_mode, &default_load_path ); + if (NtCurrentTeb()->WowTebOffset) init_wow64( context );
wm = build_main_module();