ntdll: Catch page fault in RtlWow64EnableFsRedirectionEx.

Signed-off-by: Matt Robinson <git@nerdoftheherd.com>
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Matt Robinson 2016-08-06 23:00:21 +01:00 committed by Alexandre Julliard
parent 9bc7aea4f8
commit 4a6bd3d200
2 changed files with 13 additions and 2 deletions

View File

@ -106,6 +106,7 @@
#include "wine/list.h"
#include "wine/library.h"
#include "wine/debug.h"
#include "wine/exception.h"
WINE_DEFAULT_DEBUG_CHANNEL(file);
@ -2996,9 +2997,17 @@ NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable )
NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG disable, ULONG *old_value )
{
if (!is_wow64) return STATUS_NOT_IMPLEMENTED;
if (((ULONG_PTR)old_value >> 16) == 0) return STATUS_ACCESS_VIOLATION;
*old_value = !ntdll_get_thread_data()->wow64_redir;
__TRY
{
*old_value = !ntdll_get_thread_data()->wow64_redir;
}
__EXCEPT_PAGE_FAULT
{
return STATUS_ACCESS_VIOLATION;
}
__ENDTRY
ntdll_get_thread_data()->wow64_redir = !disable;
return STATUS_SUCCESS;
}

View File

@ -861,6 +861,8 @@ static void test_redirection(void)
ok( status == STATUS_ACCESS_VIOLATION, "RtlWow64EnableFsRedirectionEx failed with status %x\n", status );
status = pRtlWow64EnableFsRedirectionEx( TRUE, (void*)1 );
ok( status == STATUS_ACCESS_VIOLATION, "RtlWow64EnableFsRedirectionEx failed with status %x\n", status );
status = pRtlWow64EnableFsRedirectionEx( TRUE, (void*)0xDEADBEEF );
ok( status == STATUS_ACCESS_VIOLATION, "RtlWow64EnableFsRedirectionEx failed with status %x\n", status );
status = pRtlWow64EnableFsRedirection( FALSE );
ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );