Commit aadf703f authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: The meaning of the flag is inverted between RtlWow64EnableFsRedirection…

ntdll: The meaning of the flag is inverted between RtlWow64EnableFsRedirection and RtlWow64EnableFsRedirectionEx.
parent 1aa749d9
...@@ -1583,7 +1583,7 @@ BOOL WINAPI Wow64DisableWow64FsRedirection( PVOID *old_value ) ...@@ -1583,7 +1583,7 @@ BOOL WINAPI Wow64DisableWow64FsRedirection( PVOID *old_value )
*/ */
BOOL WINAPI Wow64RevertWow64FsRedirection( 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) ); if (status) SetLastError( RtlNtStatusToDosError(status) );
return !status; return !status;
} }
......
...@@ -2413,11 +2413,11 @@ NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable ) ...@@ -2413,11 +2413,11 @@ NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable )
/****************************************************************** /******************************************************************
* RtlWow64EnableFsRedirectionEx (NTDLL.@) * 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; if (!is_wow64) return STATUS_NOT_IMPLEMENTED;
*old_value = ntdll_get_thread_data()->wow64_redir; *old_value = !ntdll_get_thread_data()->wow64_redir;
ntdll_get_thread_data()->wow64_redir = enable; ntdll_get_thread_data()->wow64_redir = !disable;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
...@@ -45,6 +45,8 @@ static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)( LPCWSTR, PUNICODE_STRIN ...@@ -45,6 +45,8 @@ static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)( LPCWSTR, PUNICODE_STRIN
static VOID (WINAPI *pRtlInitUnicodeString)( PUNICODE_STRING, LPCWSTR ); static VOID (WINAPI *pRtlInitUnicodeString)( PUNICODE_STRING, LPCWSTR );
static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen, static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen,
LPCSTR src, DWORD srclen ); LPCSTR src, DWORD srclen );
static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirection)( BOOLEAN enable );
static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG *old_value );
/* The attribute sets to test */ /* The attribute sets to test */
struct testfile_s { struct testfile_s {
...@@ -221,6 +223,49 @@ done: ...@@ -221,6 +223,49 @@ done:
tear_down_attribute_test(testdirA); 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) START_TEST(directory)
{ {
HMODULE hntdll = GetModuleHandleA("ntdll.dll"); HMODULE hntdll = GetModuleHandleA("ntdll.dll");
...@@ -237,6 +282,9 @@ START_TEST(directory) ...@@ -237,6 +282,9 @@ START_TEST(directory)
pRtlDosPathNameToNtPathName_U = (void *)GetProcAddress(hntdll, "RtlDosPathNameToNtPathName_U"); pRtlDosPathNameToNtPathName_U = (void *)GetProcAddress(hntdll, "RtlDosPathNameToNtPathName_U");
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString"); pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
pRtlMultiByteToUnicodeN = (void *)GetProcAddress(hntdll,"RtlMultiByteToUnicodeN"); pRtlMultiByteToUnicodeN = (void *)GetProcAddress(hntdll,"RtlMultiByteToUnicodeN");
pRtlWow64EnableFsRedirection = (void *)GetProcAddress(hntdll,"RtlWow64EnableFsRedirection");
pRtlWow64EnableFsRedirectionEx = (void *)GetProcAddress(hntdll,"RtlWow64EnableFsRedirectionEx");
test_NtQueryDirectoryFile(); test_NtQueryDirectoryFile();
test_redirection();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment