diff options
author | Martin Storsjö <martin@martin.st> | 2021-05-12 14:14:23 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-05-12 14:57:19 +0300 |
commit | 0ced2f9e10f942ba9f59b7f6a75dd13c2389a6d2 (patch) | |
tree | c542eea012b8dc86283d76364e9169c0e08f49e4 /tests | |
parent | d16ddb34aa7995c6ac78e523d1cefd6796a63176 (diff) |
Only call GetModuleHandle and AddVectoredExceptionHandler when targeting Windows Desktop
Don't call them when targeting e.g. UWP.
This requires building with a new enough SDK that does have the
winapifamily.h header (and that it's included implicitly by regular
platform headers); it's been available since the Windows 8.0 SDK
(and since mingw-w64 v3.0.0) so it should be safe.
Also rewrite the GetProcAddress call to avoid calling it if
GetModuleHandleW(L"kernel32.dll") would return NULL for some reason.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkasm/checkasm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 689830e..eeb1d15 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -755,10 +755,12 @@ void checkasm_report(const char *const name, ...) { void checkasm_set_signal_handler_state(const int enabled) { #ifdef _WIN32 +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) if (enabled) AddVectoredExceptionHandler(0, signal_handler); else RemoveVectoredExceptionHandler(signal_handler); +#endif #else void (*const handler)(int) = enabled ? signal_handler : SIG_DFL; signal(SIGBUS, handler); |