[PSEH] Add implementation for GCC amd64

Also, put include directory next to the library and use
target_include_directories(.. INTERFACE ..) to get this right.
This is because :
 - Having includes & implementation in two different places buggers me
 - This makes sure that there is no "if it compiles everything is fine" behaviour from anyone
   because now even static libraries need it for GCC amd64 build
Also add __USE_PSEH2__ define for the non SEH-aware compilers out there and use it in a few headers
where we define macros involving __try
This commit is contained in:
Jérôme Gardou 2021-04-22 11:11:34 +02:00 committed by Jérôme Gardou
parent d31856cda1
commit ba74a05a17
14 changed files with 230 additions and 50 deletions

View file

@ -8,12 +8,13 @@
#include <wine/test.h>
#undef WIN32_NO_STATUS
#include <pseh/pseh2.h>
/* See kmtests/include/kmt_test.h */
#define InvalidPointer ((PVOID)0x5555555555555555ULL)
// #define InvalidPointer ((PVOID)0x0123456789ABCDEFULL)
#ifdef __USE_PSEH2__
#include <pseh/pseh2.h>
#define StartSeh() \
{ \
NTSTATUS ExceptionStatus = STATUS_SUCCESS; \
@ -31,6 +32,24 @@
"Exception 0x%08lx, expected 0x%08lx\n", \
ExceptionStatus, (ExpectedStatus)); \
}
#else
#define StartSeh() \
{ \
NTSTATUS ExceptionStatus = STATUS_SUCCESS; \
__try \
{
#define EndSeh(ExpectedStatus) \
} \
__except(EXCEPTION_EXECUTE_HANDLER) \
{ \
ExceptionStatus = GetExceptionCode(); \
} \
ok(ExceptionStatus == (ExpectedStatus), \
"Exception 0x%08lx, expected 0x%08lx\n", \
ExceptionStatus, (ExpectedStatus)); \
}
#endif
#define ok_hr(status, expected) ok_hex(status, expected)
#define ok_hr_(file, line, status, expected) ok_hex_(file, line, status, expected)