Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51214 Signed-off-by: Bernhard Übelacker bernhardu@mailbox.org --- v2: Supersede 208473 Correction to subject and Wine-Bug line, added signed-off-by
This patch is kind of related to commits: bb065801a69 and a0425b9610a.
These are the events that seem to lead to the failure: - Loading of module rundll.exe16 fails - Therefore hPrevInstance is zero, which is put into context.Esi - Somehow this seem to lead to the segfault. Unfortunately the last instructions are not shown properly.
2918 WARN("Failed to load module %s; status=%x\n", debugstr_w(libname), nts); 1: x/i $pc => 0x7bc30b49 <load_dll+217>: test $0x4,%al (rr) bt #0 load_dll (load_path=<optimized out>, libname=<optimized out>, default_ext=<optimized out>, flags=<error reading variable: Could not find the frame base for "load_dll".>, pwm=<optimized out>) at .../wine-git/dlls/ntdll/loader.c:2918 #1 0x7bc328c3 in LdrLoadDll@16 (path_name=<error reading variable: Could not find the frame base for "LdrLoadDll@16".>, flags=<optimized out>, libname=<optimized out>, hModule=<optimized out>) at .../wine-git/dlls/ntdll/loader.c:2966 #2 0x7b026d63 in load_library (libname=0x21fa78, flags=0) at .../wine-git/dlls/kernelbase/loader.c:168 #3 0x7b027bd9 in LoadLibraryExW@12 (name=0x7ffc2c00, file=0x0, flags=0) at .../wine-git/dlls/kernelbase/loader.c:517 #4 0x7b027d35 in LoadLibraryA@4 (name=0x21fb54 "rundll.exe16") at .../wine-git/dlls/kernelbase/loader.c:499 #5 0x664275ca in MODULE_LoadModule16 (libname=0x2a267b "C:\windows\rundll.exe", implicit=0, lib_only=0) at .../wine-git/dlls/krnl386.exe16/ne_module.c:959 #6 0x664282fe in LoadModule16@8 (name=0x2a267b "C:\windows\rundll.exe", paramBlock=0x21fe92) at .../wine-git/dlls/krnl386.exe16/ne_module.c:1130 #7 0x7eba1c1c in main (argc=4, argv=0x2a2590) at .../wine-git/programs/winevdm/winevdm.c:556 ...
(rr) step 1176 hPrevInstance = NE_GetInstance( pModule ); ...
0x66429023 in NE_StartTask () at /home/bernhard/data/entwicklung/2021/wine/wine-git/wine-git/dlls/krnl386.exe16/ne_module.c:1233 1233 context.Esi = pTask->hPrevInstance; ...
(rr) bt #0 0x6640395f in wine_call_to_16_regs@12 () #1 0x6643f0e5 in K32WOWCallback16Ex@20 (vpfn16=0, dwFlags=2, cbArgs=4, pArgs=0x0, pdwRetCode=0x13cfc14) at .../wine-git/dlls/krnl386.exe16/wowthunk.c:439 #2 0x66429060 in NE_StartTask () at .../wine-git/dlls/krnl386.exe16/ne_module.c:1240 #3 0x66432e53 in task_start (p=0x26fc58) at .../wine-git/dlls/krnl386.exe16/task.c:475 #4 0x7b62e250 in WriteTapemark@16 () #5 0x7bc555a7 in call_thread_func_wrapper () #6 0x7bc55c60 in call_thread_func (entry=0x66432df0 <task_start>, arg=0x26fc58) at .../wine-git/dlls/ntdll/thread.c:225 ...
(rr) stepi 0x6640398e in wine_call_to_16_regs@12 () 1: x/i $pc => 0x6640398e <wine_call_to_16_regs@12+178>: mov 0xa0(%edx),%esi (rr) x/1xw $edx + 0xa0 0x13cfcb4: 0x00000000 (rr) stepi 0x66403994 in wine_call_to_16_regs@12 () 1: x/i $pc => 0x66403994 <wine_call_to_16_regs@12+184>: mov 0x9c(%edx),%edi (rr) 0x6640399a in wine_call_to_16_regs@12 () 1: x/i $pc => 0x6640399a <wine_call_to_16_regs@12+190>: mov 0xb0(%edx),%eax (rr) 0x664039a0 in wine_call_to_16_regs@12 () 1: x/i $pc => 0x664039a0 <wine_call_to_16_regs@12+196>: mov 0xa4(%edx),%ebx (rr) 0x664039a6 in wine_call_to_16_regs@12 () 1: x/i $pc => 0x664039a6 <wine_call_to_16_regs@12+202>: mov 0xac(%edx),%ecx (rr) 0x664039ac in wine_call_to_16_regs@12 () 1: x/i $pc => 0x664039ac <wine_call_to_16_regs@12+208>: mov 0xa8(%edx),%edx (rr) 0x664039b2 in wine_call_to_16_regs@12 () 1: x/i $pc => 0x664039b2 <wine_call_to_16_regs@12+214>: popw %ds (rr) 0x664039b4 in wine_call_to_16_regs@12 () 1: x/i $pc => 0x664039b4 <wine_call_to_16_regs@12+216>: lretw (rr) 0x00000020 in ?? () 1: x/i $pc => 0x20: <error: Cannot access memory at address 0x20> (rr) 0x00000022 in ?? () 1: x/i $pc => 0x22: <error: Cannot access memory at address 0x22> (rr) 0x00000027 in ?? () 1: x/i $pc => 0x27: <error: Cannot access memory at address 0x27> (rr) 0x00000000 in ?? () 1: x/i $pc => 0x0: <error: Cannot access memory at address 0x0> (rr) 0x00000005 in ?? () 1: x/i $pc => 0x5: <error: Cannot access memory at address 0x5> (rr)
Thread 8 received signal SIGSEGV, Segmentation fault. 0x00000005 in ?? () 1: x/i $pc => 0x5: <error: Cannot access memory at address 0x5> --- dlls/ntdll/loader.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 54806b0ab22..da539258eb3 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2675,6 +2675,7 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne
if (!get_env_var( L"WINEBUILDDIR", 20 + 2 * wcslen(name), new_name )) { + len = new_name->Length; RtlAppendUnicodeToString( new_name, L"\dlls\" ); RtlAppendUnicodeToString( new_name, name ); if ((ext = wcsrchr( name, '.' )) && !wcscmp( ext, L".dll" )) new_name->Length -= 4 * sizeof(WCHAR); @@ -2685,6 +2686,17 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne RtlAppendUnicodeToString( new_name, L".fake" ); status = open_dll_file( new_name, pwm, mapping, image_info, id ); if (status != STATUS_DLL_NOT_FOUND) goto done; + + new_name->Length = len; + RtlAppendUnicodeToString( new_name, L"\programs\" ); + RtlAppendUnicodeToString( new_name, name ); + RtlAppendUnicodeToString( new_name, L"\" ); + RtlAppendUnicodeToString( new_name, name ); + status = open_dll_file( new_name, pwm, mapping, image_info, id ); + if (status != STATUS_DLL_NOT_FOUND) goto done; + RtlAppendUnicodeToString( new_name, L".fake" ); + status = open_dll_file( new_name, pwm, mapping, image_info, id ); + if (status != STATUS_DLL_NOT_FOUND) goto done; RtlFreeUnicodeString( new_name ); }