From 8b9c9e93f83197a516ac4ad022fc00d306ff15ba Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 17 Nov 2019 21:38:42 +0000 Subject: [PATCH] Win32: Load AddVectoredExceptionHandler function at run time See: #116 --- src/os/windows/crashlog_win.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index d06c678b72..4c642b943e 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -622,7 +622,12 @@ static void CDECL CustomAbort(int signal) _set_abort_behavior(0, _WRITE_ABORT_MSG); #endif SetUnhandledExceptionFilter(ExceptionHandler); - AddVectoredExceptionHandler(1, VectoredExceptionHandler); + + using VEX_HANDLER_TYPE = LONG WINAPI (EXCEPTION_POINTERS *); + void* (WINAPI *AddVectoredExceptionHandler)(ULONG, VEX_HANDLER_TYPE*); + if (LoadLibraryList((Function*)&AddVectoredExceptionHandler, "kernel32.dll\0AddVectoredExceptionHandler\0\0")) { + AddVectoredExceptionHandler(1, VectoredExceptionHandler); + } BOOL (WINAPI *SetThreadStackGuarantee)(PULONG); if (LoadLibraryList((Function*)&SetThreadStackGuarantee, "kernel32.dll\0SetThreadStackGuarantee\0\0")) {