Reactos

[PSEH] Fix SEH compatibility macros for dummy PSEH

This is used with Clang, which does have native SEH, but it's broken and can cause the compiler to crash. Previously some code was not handling this and instead used native SEH for clang. Fix this by always using _SEH2_* macros instead of relying on __USE_PSEH2__ to be defined.

+8 -49
-19
modules/rostests/apitests/include/apitest.h
··· 12 12 #define InvalidPointer ((PVOID)0x5555555555555555ULL) 13 13 // #define InvalidPointer ((PVOID)0x0123456789ABCDEFULL) 14 14 15 - #ifdef __USE_PSEH2__ 16 15 #include <pseh/pseh2.h> 17 16 18 17 #define StartSeh() \ ··· 32 31 "Exception 0x%08lx, expected 0x%08lx\n", \ 33 32 ExceptionStatus, (ExpectedStatus)); \ 34 33 } 35 - #else 36 - #define StartSeh() \ 37 - { \ 38 - NTSTATUS ExceptionStatus = STATUS_SUCCESS; \ 39 - __try \ 40 - { 41 - 42 - #define EndSeh(ExpectedStatus) \ 43 - } \ 44 - __except(EXCEPTION_EXECUTE_HANDLER) \ 45 - { \ 46 - ExceptionStatus = GetExceptionCode(); \ 47 - } \ 48 - ok(ExceptionStatus == (ExpectedStatus), \ 49 - "Exception 0x%08lx, expected 0x%08lx\n", \ 50 - ExceptionStatus, (ExpectedStatus)); \ 51 - } 52 - #endif 53 34 54 35 #define ok_hr(status, expected) ok_hex(status, expected) 55 36 #define ok_hr_(file, line, status, expected) ok_hex_(file, line, status, expected)
+8 -19
sdk/include/psdk/rpc.h
··· 118 118 #include <excpt.h> 119 119 #include <winerror.h> 120 120 121 - #ifndef __USE_PSEH2__ 122 - #define RpcTryExcept __try { 123 - #define RpcExcept(expr) } __except (expr) { 124 - #define RpcEndExcept } 125 - #define RpcTryFinally __try { 126 - #define RpcFinally } __finally { 127 - #define RpcEndFinally } 128 - #define RpcExceptionCode() GetExceptionCode() 129 - #define RpcAbnormalTermination() AbnormalTermination() 130 - #else 131 - #define RpcTryExcept _SEH2_TRY 132 - #define RpcExcept(expr) _SEH2_EXCEPT((expr)) 133 - #define RpcEndExcept _SEH2_END; 134 - #define RpcTryFinally _SEH2_TRY 135 - #define RpcFinally _SEH2_FINALLY 136 - #define RpcEndFinally _SEH2_END; 137 - #define RpcExceptionCode() _SEH2_GetExceptionCode() 138 - #define RpcAbnormalTermination() (_SEH2_GetExceptionCode() != 0) 139 - #endif 121 + #define RpcTryExcept _SEH2_TRY 122 + #define RpcExcept(expr) _SEH2_EXCEPT((expr)) 123 + #define RpcEndExcept _SEH2_END; 124 + #define RpcTryFinally _SEH2_TRY 125 + #define RpcFinally _SEH2_FINALLY 126 + #define RpcEndFinally _SEH2_END; 127 + #define RpcExceptionCode() _SEH2_GetExceptionCode() 128 + #define RpcAbnormalTermination() (_SEH2_GetExceptionCode() != 0) 140 129 #endif 141 130 142 131 #if defined(__RPC_WIN64__)
-11
sdk/include/reactos/wine/exception.h
··· 55 55 #define PEXCEPTION_REGISTRATION_RECORD PWINE_EXCEPTION_REGISTRATION_RECORD 56 56 #endif 57 57 58 - #ifdef __USE_PSEH2__ 59 58 #define __TRY _SEH2_TRY 60 59 #define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation())) 61 60 #define __EXCEPT_CTX(func, ctx) _SEH2_EXCEPT((func)(GetExceptionInformation(), ctx)) ··· 75 74 76 75 #ifndef AbnormalTermination 77 76 #define AbnormalTermination() _SEH2_AbnormalTermination() 78 - #endif 79 - #else 80 - #define __TRY __try 81 - #define __EXCEPT(func) __except(func(GetExceptionInformation())) 82 - #define __EXCEPT_CTX(func, ctx) __except((func)(GetExceptionInformation(), ctx)) 83 - #define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == STATUS_ACCESS_VIOLATION) 84 - #define __EXCEPT_ALL __except(1) 85 - #define __ENDTRY 86 - #define __FINALLY(func) __finally { func(!AbnormalTermination()); } 87 - #define __FINALLY_CTX(func, ctx) __finally { func(!AbnormalTermination(), ctx); } 88 77 #endif 89 78 90 79 #if defined(__MINGW32__) || defined(__CYGWIN__)