Alexandre Julliard : ntdll: The meaning of the flag is inverted between RtlWow64EnableFsRedirection and RtlWow64EnableFsRedirectionEx .

Alexandre Julliard julliard at winehq.org
Wed Oct 28 10:12:23 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 28 10:54:22 2009 +0100

ntdll: The meaning of the flag is inverted between RtlWow64EnableFsRedirection and RtlWow64EnableFsRedirectionEx.

---

 dlls/kernel32/path.c         |    2 +-
 dlls/ntdll/directory.c       |    6 ++--
 dlls/ntdll/tests/directory.c |   48 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 299db1c..e9463bb 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1583,7 +1583,7 @@ BOOL WINAPI Wow64DisableWow64FsRedirection( PVOID *old_value )
  */
 BOOL WINAPI Wow64RevertWow64FsRedirection( PVOID old_value )
 {
-    NTSTATUS status = RtlWow64EnableFsRedirection( (UINT_PTR)old_value );
+    NTSTATUS status = RtlWow64EnableFsRedirection( !old_value );
     if (status) SetLastError( RtlNtStatusToDosError(status) );
     return !status;
 }
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 18628fc..e7f1dd4 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -2413,11 +2413,11 @@ NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable )
 /******************************************************************
  *		RtlWow64EnableFsRedirectionEx   (NTDLL.@)
  */
-NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG enable, ULONG *old_value )
+NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG disable, ULONG *old_value )
 {
     if (!is_wow64) return STATUS_NOT_IMPLEMENTED;
-    *old_value = ntdll_get_thread_data()->wow64_redir;
-    ntdll_get_thread_data()->wow64_redir = enable;
+    *old_value = !ntdll_get_thread_data()->wow64_redir;
+    ntdll_get_thread_data()->wow64_redir = !disable;
     return STATUS_SUCCESS;
 }
 
diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c
index ea722dd..60c0158 100644
--- a/dlls/ntdll/tests/directory.c
+++ b/dlls/ntdll/tests/directory.c
@@ -45,6 +45,8 @@ static BOOL     (WINAPI *pRtlDosPathNameToNtPathName_U)( LPCWSTR, PUNICODE_STRIN
 static VOID     (WINAPI *pRtlInitUnicodeString)( PUNICODE_STRING, LPCWSTR );
 static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen,
                                                    LPCSTR src, DWORD srclen );
+static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirection)( BOOLEAN enable );
+static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG *old_value );
 
 /* The attribute sets to test */
 struct testfile_s {
@@ -221,6 +223,49 @@ done:
     tear_down_attribute_test(testdirA);
 }
 
+static void test_redirection(void)
+{
+    ULONG old, cur;
+    NTSTATUS status;
+
+    if (!pRtlWow64EnableFsRedirection || !pRtlWow64EnableFsRedirectionEx)
+    {
+        skip( "Wow64 redirection not supported\n" );
+        return;
+    }
+    status = pRtlWow64EnableFsRedirectionEx( FALSE, &old );
+    if (status == STATUS_NOT_IMPLEMENTED)
+    {
+        skip( "Wow64 redirection not supported\n" );
+        return;
+    }
+    ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
+
+    status = pRtlWow64EnableFsRedirectionEx( FALSE, &cur );
+    ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
+    ok( !cur, "RtlWow64EnableFsRedirectionEx got %u\n", cur );
+
+    status = pRtlWow64EnableFsRedirectionEx( TRUE, &cur );
+    ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
+    status = pRtlWow64EnableFsRedirectionEx( TRUE, &cur );
+    ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
+    ok( cur == 1, "RtlWow64EnableFsRedirectionEx got %u\n", cur );
+
+    status = pRtlWow64EnableFsRedirection( TRUE );
+    ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
+    status = pRtlWow64EnableFsRedirectionEx( TRUE, &cur );
+    ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
+    ok( !cur, "RtlWow64EnableFsRedirectionEx got %u\n", cur );
+
+    status = pRtlWow64EnableFsRedirection( FALSE );
+    ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
+    status = pRtlWow64EnableFsRedirectionEx( FALSE, &cur );
+    ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
+    ok( cur == 1, "RtlWow64EnableFsRedirectionEx got %u\n", cur );
+
+    pRtlWow64EnableFsRedirectionEx( old, &cur );
+}
+
 START_TEST(directory)
 {
     HMODULE hntdll = GetModuleHandleA("ntdll.dll");
@@ -237,6 +282,9 @@ START_TEST(directory)
     pRtlDosPathNameToNtPathName_U = (void *)GetProcAddress(hntdll, "RtlDosPathNameToNtPathName_U");
     pRtlInitUnicodeString   = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
     pRtlMultiByteToUnicodeN = (void *)GetProcAddress(hntdll,"RtlMultiByteToUnicodeN");
+    pRtlWow64EnableFsRedirection = (void *)GetProcAddress(hntdll,"RtlWow64EnableFsRedirection");
+    pRtlWow64EnableFsRedirectionEx = (void *)GetProcAddress(hntdll,"RtlWow64EnableFsRedirectionEx");
 
     test_NtQueryDirectoryFile();
+    test_redirection();
 }




More information about the wine-cvs mailing list