This matches the behavior seen on Windows 7/2008R2 and newer. Fixes Rockstar Games Launcher installer crashing.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47912 Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- dlls/kernel32/tests/loader.c | 2 +- dlls/ntdll/loader.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index e5b8c3b28e..912e8600dd 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -3822,7 +3822,7 @@ static void test_wow64_redirection_for_dll(const char *libname) if (!GetModuleHandleA(libname)) { lib = LoadLibraryExA(libname, NULL, 0); - todo_wine ok (broken(lib == NULL) /* Vista/2008 */ || + ok (broken(lib == NULL) /* Vista/2008 */ || lib != NULL, "Loading %s should succeed with WOW64 redirection disabled\n", libname); if (lib) { diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 2bae3c7bd5..93e1440293 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2881,6 +2881,13 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, { WCHAR *ext, *dllname; NTSTATUS status; + ULONG wow64_old_value = 0; + + /* Win 7/2008R2 and up seem to re-enable WoW64 FS redirection when loading libraries. + * Enable redirection here, and if it was disabled, disable it before returning. + */ + if (is_wow64) + RtlWow64EnableFsRedirectionEx(0, &wow64_old_value);
/* first append .dll if needed */
@@ -2930,6 +2937,8 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
done: RtlFreeHeap( GetProcessHeap(), 0, dllname ); + if (is_wow64 && wow64_old_value == 1) + RtlWow64EnableFsRedirectionEx(1, &wow64_old_value); return status; }
Hi Brendan,
There is a return statement between your enable/disabling redirection.
if (!(dllname = RtlAllocateHeap( GetProcessHeap(), 0, (strlenW(libname) * sizeof(WCHAR)) + sizeof(dllW) ))) return STATUS_NO_MEMORY;
Regards Alistair.
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=58392
Your paranoid android.
=== w1064v1809_ar (32 bit report) ===
kernel32: loader.c:3181: Test failed: child process failed to terminate
=== w1064v1809_he (32 bit report) ===
kernel32: loader.c:3209: Test failed: child process failed to terminate
=== w1064v1809_zh_CN (32 bit report) ===
kernel32: loader.c:3181: Test failed: child process failed to terminate
=== w1064v1809 (64 bit report) ===
kernel32: loader.c:689: Test failed: 1389: got test dll but expected fallback loader.c:689: Test failed: 1395: got test dll but expected fallback loader.c:689: Test failed: 1401: got test dll but expected fallback loader.c:689: Test failed: 1408: got test dll but expected fallback loader.c:689: Test failed: 1435: got test dll but expected fallback