Brendan Shanks : ntdll: Enable WoW64 filesystem redirection when loading libraries.

Alexandre Julliard julliard at winehq.org
Mon Oct 28 16:43:37 CDT 2019


Module: wine
Branch: master
Commit: aa51aee1a92ddbdd39875af81b002654f8ad4fc7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=aa51aee1a92ddbdd39875af81b002654f8ad4fc7

Author: Brendan Shanks <bshanks at codeweavers.com>
Date:   Thu Oct 24 15:12:12 2019 -0700

ntdll: Enable WoW64 filesystem redirection when loading libraries.

This matches the behavior seen on Windows 7/2008R2 and newer.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47912
Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/loader.c | 2 +-
 dlls/ntdll/loader.c          | 5 +++++
 2 files changed, 6 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..55b341ff3a 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2881,6 +2881,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
 {
     WCHAR *ext, *dllname;
     NTSTATUS status;
+    ULONG wow64_old_value = 0;
 
     /* first append .dll if needed */
 
@@ -2897,6 +2898,9 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
         libname = dllname;
     }
 
+    /* Win 7/2008R2 and up seem to re-enable WoW64 FS redirection when loading libraries */
+    if (is_wow64) RtlWow64EnableFsRedirectionEx( 0, &wow64_old_value );
+
     nt_name->Buffer = NULL;
 
     if (!contains_path( libname ))
@@ -2930,6 +2934,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
 
 done:
     RtlFreeHeap( GetProcessHeap(), 0, dllname );
+    if (wow64_old_value) RtlWow64EnableFsRedirectionEx( 1, &wow64_old_value );
     return status;
 }
 




More information about the wine-cvs mailing list