// Structured exception handler LONG WINAPI crash_handler::seh_handler(PEXCEPTION_POINTERS pExceptionPtrs) { // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); // Unreacheable code return EXCEPTION_EXECUTE_HANDLER; }
// CRT SIGSEGV signal handler void crash_handler::sigsegv_handler(int) { // Invalid storage access (SIGSEGV) PEXCEPTION_POINTERS pExceptionPtrs = (PEXCEPTION_POINTERS)_pxcptinfoptrs; // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); }
// CRT SIGFPE signal handler void crash_handler::sigfpe_handler(int /*code*/, int /* subcode */) { // Floating point exception (SIGFPE) EXCEPTION_POINTERS* pExceptionPtrs = (PEXCEPTION_POINTERS)_pxcptinfoptrs; // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); }
// CRT SIGTERM signal handler void crash_handler::sigterm_handler(int) { // Termination request (SIGTERM) // Retrieve exception information EXCEPTION_POINTERS* pExceptionPtrs = NULL; get_exception_pointers(0, &pExceptionPtrs); // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); }
// CRT Pure virtual method call handler void __cdecl crash_handler::pure_call_handler() { // Pure virtual function call // Retrieve exception information EXCEPTION_POINTERS* pExceptionPtrs = NULL; get_exception_pointers(0, &pExceptionPtrs); // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); }
// CRT unexpected() call handler void __cdecl crash_handler::unexpected_handler() { // Unexpected error (unexpected() function was called) // Retrieve exception information EXCEPTION_POINTERS* pExceptionPtrs = NULL; get_exception_pointers(0, &pExceptionPtrs); // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); }
// CRT SIGABRT signal handler void crash_handler::sigabrt_handler(int) { // Caught SIGABRT C++ signal // Retrieve exception information EXCEPTION_POINTERS* pExceptionPtrs = NULL; get_exception_pointers(0, &pExceptionPtrs); // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); }
// CRT new operator fault handler int __cdecl crash_handler::new_handler(size_t) { // 'new' operator memory allocation exception // Retrieve exception information EXCEPTION_POINTERS* pExceptionPtrs = NULL; get_exception_pointers(0, &pExceptionPtrs); // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); // Unreacheable code return 0; }
// CRT invalid parameter handler void __cdecl crash_handler::invalid_parameter_handler( const wchar_t* /* expression */, const wchar_t* /* function */, const wchar_t* /* file */, unsigned int /* line */, uintptr_t pReserved) { pReserved; // Invalid parameter exception // Retrieve exception information EXCEPTION_POINTERS* pExceptionPtrs = NULL; get_exception_pointers(0, &pExceptionPtrs); // Write minidump file create_mini_dump(pExceptionPtrs); // Terminate process TerminateProcess(GetCurrentProcess(), 1); }
static LONG WINAPI exception_filter(PEXCEPTION_POINTERS exception) { create_mini_dump(exception, TEXT("Exception.dmp")); return EXCEPTION_EXECUTE_HANDLER; }