1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

wow64: Use setjmp/longjmp from ntdll.

This commit is contained in:
Alexandre Julliard 2024-03-22 13:08:50 +01:00
parent 567b31d7f3
commit 117fefa274

View file

@ -19,6 +19,7 @@
*/
#include <stdarg.h>
#include <setjmp.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
@ -26,7 +27,7 @@
#include "winbase.h"
#include "winnt.h"
#include "winternl.h"
#include "wine/exception.h"
#include "rtlsupportapi.h"
#include "wine/unixlib.h"
#include "wine/asm.h"
#include "wow64_private.h"
@ -77,7 +78,7 @@ struct user_callback_frame
void **ret_ptr;
ULONG *ret_len;
NTSTATUS status;
__wine_jmp_buf jmpbuf;
jmp_buf jmpbuf;
};
/* stack frame for user APCs */
@ -114,8 +115,6 @@ NTSTATUS (WINAPI *pBTCpuResetToConsistentState)( EXCEPTION_POINTERS * ) = NULL;
void (WINAPI *pBTCpuUpdateProcessorInformation)( SYSTEM_CPU_INFORMATION * ) = NULL;
void (WINAPI *pBTCpuThreadTerm)( HANDLE ) = NULL;
void *dummy = RtlUnwind;
BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved )
{
if (reason == DLL_PROCESS_ATTACH) LdrDisableThreadCalloutsForDll( inst );
@ -465,7 +464,8 @@ NTSTATUS WINAPI wow64_NtCallbackReturn( UINT *args )
*frame->ret_ptr = ret_ptr;
*frame->ret_len = ret_len;
frame->status = status;
__wine_longjmp( &frame->jmpbuf, 1 );
longjmp( frame->jmpbuf, 1 );
return STATUS_SUCCESS;
}
@ -1232,7 +1232,7 @@ NTSTATUS WINAPI Wow64KiUserCallbackDispatcher( ULONG id, void *args, ULONG len,
ctx.Eip = pLdrSystemDllInitBlock->pKiUserCallbackDispatcher;
pBTCpuSetContext( GetCurrentThread(), GetCurrentProcess(), NULL, &ctx );
if (!__wine_setjmpex( &frame.jmpbuf, NULL ))
if (!setjmp( frame.jmpbuf ))
cpu_simulate();
else
pBTCpuSetContext( GetCurrentThread(), GetCurrentProcess(), NULL, &orig_ctx );
@ -1257,7 +1257,7 @@ NTSTATUS WINAPI Wow64KiUserCallbackDispatcher( ULONG id, void *args, ULONG len,
ctx.Pc = pLdrSystemDllInitBlock->pKiUserCallbackDispatcher;
pBTCpuSetContext( GetCurrentThread(), GetCurrentProcess(), NULL, &ctx );
if (!__wine_setjmpex( &frame.jmpbuf, NULL ))
if (!setjmp( frame.jmpbuf ))
cpu_simulate();
else
pBTCpuSetContext( GetCurrentThread(), GetCurrentProcess(), NULL, &orig_ctx );