Commit 23081203 authored by Alexandre Julliard's avatar Alexandre Julliard

wow64: Forward 64-bit invalid handle exceptions to the 32-bit guest.

parent e30b56b1
...@@ -1251,3 +1251,24 @@ NTSTATUS WINAPI wow64_NtTerminateThread( UINT *args ) ...@@ -1251,3 +1251,24 @@ NTSTATUS WINAPI wow64_NtTerminateThread( UINT *args )
return NtTerminateThread( handle, exit_code ); return NtTerminateThread( handle, exit_code );
} }
/**********************************************************************
* Wow64PassExceptionToGuest (wow64.@)
*/
void WINAPI Wow64PassExceptionToGuest( EXCEPTION_POINTERS *ptrs )
{
EXCEPTION_RECORD *rec = ptrs->ExceptionRecord;
EXCEPTION_RECORD32 rec32;
ULONG i;
rec32.ExceptionCode = rec->ExceptionCode;
rec32.ExceptionFlags = rec->ExceptionFlags;
rec32.ExceptionRecord = PtrToUlong( rec->ExceptionRecord );
rec32.ExceptionAddress = PtrToUlong( rec->ExceptionAddress );
rec32.NumberParameters = rec->NumberParameters;
for (i = 0; i < rec->NumberParameters; i++)
rec32.ExceptionInformation[i] = rec->ExceptionInformation[i];
call_user_exception_dispatcher( &rec32, NULL, ptrs->ContextRecord );
}
...@@ -520,6 +520,21 @@ static void free_temp_data(void) ...@@ -520,6 +520,21 @@ static void free_temp_data(void)
/********************************************************************** /**********************************************************************
* syscall_filter
*/
static LONG CALLBACK syscall_filter( EXCEPTION_POINTERS *ptrs )
{
switch (ptrs->ExceptionRecord->ExceptionCode)
{
case STATUS_INVALID_HANDLE:
Wow64PassExceptionToGuest( ptrs );
break;
}
return EXCEPTION_EXECUTE_HANDLER;
}
/**********************************************************************
* Wow64SystemServiceEx (NTDLL.@) * Wow64SystemServiceEx (NTDLL.@)
*/ */
NTSTATUS WINAPI Wow64SystemServiceEx( UINT num, UINT *args ) NTSTATUS WINAPI Wow64SystemServiceEx( UINT num, UINT *args )
...@@ -536,7 +551,7 @@ NTSTATUS WINAPI Wow64SystemServiceEx( UINT num, UINT *args ) ...@@ -536,7 +551,7 @@ NTSTATUS WINAPI Wow64SystemServiceEx( UINT num, UINT *args )
syscall_thunk thunk = syscall_thunks[syscall_map[num]]; syscall_thunk thunk = syscall_thunks[syscall_map[num]];
status = thunk( args ); status = thunk( args );
} }
__EXCEPT_ALL __EXCEPT( syscall_filter )
{ {
status = GetExceptionCode(); status = GetExceptionCode();
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
@ stdcall Wow64LdrpInitialize(ptr) @ stdcall Wow64LdrpInitialize(ptr)
@ stub Wow64LogPrint @ stub Wow64LogPrint
@ stub Wow64NotifyUnsimulateComplete @ stub Wow64NotifyUnsimulateComplete
@ stub Wow64PassExceptionToGuest @ stdcall Wow64PassExceptionToGuest(ptr)
@ stub Wow64PrepareForDebuggerAttach @ stub Wow64PrepareForDebuggerAttach
@ stub Wow64PrepareForException @ stub Wow64PrepareForException
@ stub Wow64RaiseException @ stub Wow64RaiseException
......
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
ALL_SYSCALLS ALL_SYSCALLS
#undef SYSCALL_ENTRY #undef SYSCALL_ENTRY
void * WINAPI Wow64AllocateTemp( SIZE_T size ) DECLSPEC_HIDDEN; void * WINAPI Wow64AllocateTemp( SIZE_T size );
void WINAPI Wow64ApcRoutine( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, CONTEXT *context ) DECLSPEC_HIDDEN; void WINAPI Wow64ApcRoutine( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, CONTEXT *context );
void WINAPI Wow64PassExceptionToGuest( EXCEPTION_POINTERS *ptrs );
extern void init_file_redirects(void) DECLSPEC_HIDDEN; extern void init_file_redirects(void) DECLSPEC_HIDDEN;
extern BOOL get_file_redirect( OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN; extern BOOL get_file_redirect( OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
......
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