From 0453ed98dfd9902d24d4abd91b3462d5280a3f7f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 7 May 2025 20:00:29 +0300 Subject: [PATCH] [WINE] Improve wine/exception.h --- sdk/include/reactos/wine/exception.h | 34 +++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/sdk/include/reactos/wine/exception.h b/sdk/include/reactos/wine/exception.h index 409d1e64407..58e35fd15c6 100644 --- a/sdk/include/reactos/wine/exception.h +++ b/sdk/include/reactos/wine/exception.h @@ -55,14 +55,14 @@ typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD #define PEXCEPTION_REGISTRATION_RECORD PWINE_EXCEPTION_REGISTRATION_RECORD #endif -#define __TRY _SEH2_TRY -#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation())) -#define __EXCEPT_CTX(func, ctx) _SEH2_EXCEPT((func)(GetExceptionInformation(), ctx)) -#define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) -#define __EXCEPT_ALL _SEH2_EXCEPT(1) -#define __ENDTRY _SEH2_END -#define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); } -#define __FINALLY_CTX(func, ctx) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination(), ctx); }; _SEH2_END +#define __TRY _SEH2_TRY { +#define __EXCEPT(func) } _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation())) { +#define __EXCEPT_CTX(func, ctx) } _SEH2_EXCEPT((func)(GetExceptionInformation(), ctx)) { +#define __EXCEPT_PAGE_FAULT } _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) { +#define __EXCEPT_ALL } _SEH2_EXCEPT(1) { +#define __ENDTRY } _SEH2_END +#define __FINALLY(func) } _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); } { +#define __FINALLY_CTX(func, ctx) } _SEH2_FINALLY { func(!_SEH2_AbnormalTermination(), ctx); }; _SEH2_END #ifndef GetExceptionCode #define GetExceptionCode() _SEH2_GetExceptionCode() @@ -87,6 +87,24 @@ typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD #pragma warning(disable:4733) #endif +#ifndef __wine_jmp_buf // Conflict with CRT hack +#ifdef __i386__ +typedef struct { int reg[16]; } __wine_jmp_buf; +#elif defined(__x86_64__) +typedef struct { DECLSPEC_ALIGN(16) struct { unsigned __int64 Part[2]; } reg[16]; } __wine_jmp_buf; +#elif defined(__arm__) +typedef struct { int reg[28]; } __wine_jmp_buf; +#elif defined(__aarch64__) +typedef struct { __int64 reg[24]; } __wine_jmp_buf; +#else +typedef struct { int reg; } __wine_jmp_buf; +#endif +#endif + +DECLSPEC_NORETURN extern void __cdecl __wine_longjmp( __wine_jmp_buf *buf, int retval ); +DECLSPEC_NORETURN extern void __cdecl __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *record, + void (*target)(void) ); + static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame ) { #ifdef __i386__