[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.
This commit is contained in:
Timo Kreuzer 2024-11-28 12:25:46 +02:00
parent ca0fa4af1e
commit f1b60c66f0
3 changed files with 8 additions and 49 deletions

View file

@ -118,25 +118,14 @@ typedef int RPC_STATUS;
#include <excpt.h>
#include <winerror.h>
#ifndef __USE_PSEH2__
#define RpcTryExcept __try {
#define RpcExcept(expr) } __except (expr) {
#define RpcEndExcept }
#define RpcTryFinally __try {
#define RpcFinally } __finally {
#define RpcEndFinally }
#define RpcExceptionCode() GetExceptionCode()
#define RpcAbnormalTermination() AbnormalTermination()
#else
#define RpcTryExcept _SEH2_TRY
#define RpcExcept(expr) _SEH2_EXCEPT((expr))
#define RpcEndExcept _SEH2_END;
#define RpcTryFinally _SEH2_TRY
#define RpcFinally _SEH2_FINALLY
#define RpcEndFinally _SEH2_END;
#define RpcExceptionCode() _SEH2_GetExceptionCode()
#define RpcAbnormalTermination() (_SEH2_GetExceptionCode() != 0)
#endif
#define RpcTryExcept _SEH2_TRY
#define RpcExcept(expr) _SEH2_EXCEPT((expr))
#define RpcEndExcept _SEH2_END;
#define RpcTryFinally _SEH2_TRY
#define RpcFinally _SEH2_FINALLY
#define RpcEndFinally _SEH2_END;
#define RpcExceptionCode() _SEH2_GetExceptionCode()
#define RpcAbnormalTermination() (_SEH2_GetExceptionCode() != 0)
#endif
#if defined(__RPC_WIN64__)