diff --git a/sdk/include/psdk/rpc.h b/sdk/include/psdk/rpc.h index b35c35fcad1..257823505d9 100644 --- a/sdk/include/psdk/rpc.h +++ b/sdk/include/psdk/rpc.h @@ -5,10 +5,6 @@ #endif /* _INC_WINDOWS */ #endif -#if defined(__USE_PSEH2__) && !defined(RC_INVOKED) -#include -#endif - #ifndef __RPC_H__ #define __RPC_H__ diff --git a/sdk/include/reactos/wine/exception.h b/sdk/include/reactos/wine/exception.h index f9333e8ff2a..8d0b3ea46c0 100644 --- a/sdk/include/reactos/wine/exception.h +++ b/sdk/include/reactos/wine/exception.h @@ -3,10 +3,7 @@ #include #include -#ifdef __USE_PSEH2__ -# include -# include -#endif +#include #ifdef __cplusplus extern "C" { @@ -63,7 +60,7 @@ typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD #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(_SEH_EXECUTE_HANDLER) +#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 diff --git a/sdk/include/vcruntime/excpt.h b/sdk/include/vcruntime/excpt.h index 8bd6e90cc46..faf5f2fe405 100644 --- a/sdk/include/vcruntime/excpt.h +++ b/sdk/include/vcruntime/excpt.h @@ -74,7 +74,7 @@ typedef enum _EXCEPTION_DISPOSITION #endif -#if defined(_MSC_VER) || (defined(__clang__) && defined(__SEH__)) +#if (defined(_MSC_VER) || (defined(__clang__) && defined(__SEH__))) && !defined(_exception_code) unsigned long __cdecl _exception_code(void); void *__cdecl _exception_info(void); int __cdecl _abnormal_termination(void); diff --git a/sdk/lib/pseh/CMakeLists.txt b/sdk/lib/pseh/CMakeLists.txt index b2d23bb3588..e36a3f5fd87 100644 --- a/sdk/lib/pseh/CMakeLists.txt +++ b/sdk/lib/pseh/CMakeLists.txt @@ -57,5 +57,4 @@ target_include_directories(pseh INTERFACE include) # Make it clear that we are using PSEH2 if ((CMAKE_C_COMPILER_ID STREQUAL "GNU") OR ((CMAKE_C_COMPILER_ID STREQUAL "Clang") AND (NOT (ARCH STREQUAL "amd64")))) - target_compile_definitions(pseh INTERFACE __USE_PSEH2__) endif() diff --git a/sdk/lib/pseh/include/pseh/pseh2.h b/sdk/lib/pseh/include/pseh/pseh2.h index 523d9ddd161..a6d0ab5a3a2 100644 --- a/sdk/lib/pseh/include/pseh/pseh2.h +++ b/sdk/lib/pseh/include/pseh/pseh2.h @@ -23,6 +23,8 @@ #ifndef KJK_PSEH2_H_ #define KJK_PSEH2_H_ +#define __USE_PSEH2__ + #if defined(_USE_NATIVE_SEH) || (defined(_MSC_VER) && !(defined(__clang__) && defined(_M_AMD64))) #define _SEH2_TRY __try @@ -86,6 +88,14 @@ _Pragma("GCC diagnostic pop") #define _SEH2_LEAVE goto __seh2_scope_end__; #define _SEH2_VOLATILE volatile +#define __try _SEH2_TRY +#define __except _SEH2_EXCEPT +#define __finally _SEH2_FINALLY +#define __endtry _SEH2_END +#define __leave _SEH2_LEAVE +#define _exception_code() 0 +#define _exception_info() ((void*)0) + #elif defined(_USE_PSEH3) #include "pseh3.h"