windows SetUnhandledExceptionFilter
EXCEPTION_RECORD: "https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-exception_record"
SetUnhandledExceptionFilter:
bool g_showCrashDialog = false; LONG WINAPI OurCrashHandler(EXCEPTION_POINTERS * /*ExceptionInfo*/) { std::cout << "Gotcha!" << std::endl; return g_showCrashDialog ? EXCEPTION_CONTINUE_SEARCH : EXCEPTION_EXECUTE_HANDLER; }
int main()
{
::SetUnhandledExceptionFilter(OurCrashHandler);
std::cout << "Normal null pointer crash" << std::endl;
char *p = 0;
*p = 5;
}