LONG WINAPI MyUnHandledExceptionFilter(EXCEPTION_POINTERS *pExceptionPointers) { // Create a minidump GenerateDump(pExceptionPointers); OH_MessageBox_Error_Warning( "OpenHoldem is about to crash.\n" "A minidump has been created in your\n" "OpenHoldem startup directory.\n" "\n" "OpenHoldem will shut down when you click OK.", "FATAL ERROR"); return EXCEPTION_EXECUTE_HANDLER; }
LONG WINAPI MyUnHandledExceptionFilter(EXCEPTION_POINTERS *pExceptionPointers) { char flpath[MAX_PATH]; char msg[1000]; // Create a minidump GenerateDump(pExceptionPointers); sprintf_s(flpath, MAX_PATH, "%s\\fatal error.log", _startup_path); strcpy_s(msg, 1000, "OpenHoldem is about to crash.\n"); strcat_s(msg, 1000, "A minidump has been created in your\n"); strcat_s(msg, 1000, "OpenHoldem startup directory.\n"); strcat_s(msg, 1000, "\n\nOpenHoldem will shut down when you click OK."); OH_MessageBox(msg, "FATAL ERROR", MB_OK | MB_ICONEXCLAMATION | MB_TOPMOST); return EXCEPTION_EXECUTE_HANDLER; }
LONG WINAPI MyUnHandledExceptionFilter(EXCEPTION_POINTERS *pExceptionPointers) { char flpath[MAX_PATH]; char msg[1000]; /* logfatal("########################################################################\n"); logfatal("FATAL ERROR (See above for call stack)\n"); logfatal("########################################################################\n"); logfatal("Address: %x\n", pExceptionPointers->ExceptionRecord->ExceptionAddress); logfatal("Code: %x\n", pExceptionPointers->ExceptionRecord->ExceptionCode); logfatal("Flags: %x\n", pExceptionPointers->ExceptionRecord->ExceptionFlags); logfatal("Information: %x\n", pExceptionPointers->ExceptionRecord->ExceptionInformation); logfatal("Record: %x\n", pExceptionPointers->ExceptionRecord->ExceptionRecord); logfatal("Num Params: %x\n", pExceptionPointers->ExceptionRecord->NumberParameters); switch (pExceptionPointers->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: logfatal("Desc: EXCEPTION_ACCESS_VIOLATION The thread tried to read from or write to a virtual address\n"); logfatal(" for which it does not have the appropriate access.\n"); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: logfatal("Desc: EXCEPTION_ARRAY_BOUNDS_EXCEEDED The thread tried to access an array element that is out\n"); logfatal(" of bounds and the underlying hardware supports bounds checking.\n"); break; case EXCEPTION_BREAKPOINT: logfatal("Desc: EXCEPTION_BREAKPOINT A breakpoint was encountered.\n"); break; case EXCEPTION_DATATYPE_MISALIGNMENT: logfatal("Desc: EXCEPTION_DATATYPE_MISALIGNMENT The thread tried to read or write data that is misaligned on\n"); logfatal(" hardware that does not provide alignment. For example, 16-bit values must be aligned on 2-byte\n"); logfatal(" boundaries; 32-bit values on 4-byte boundaries, and so on.\n"); break; case EXCEPTION_FLT_DENORMAL_OPERAND: logfatal("Desc: EXCEPTION_FLT_DENORMAL_OPERAND One of the operands in a floating-point operation is denormal. A\n"); logfatal(" denormal value is one that is too small to represent as a standard floating-point value.\n"); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: logfatal("Desc: EXCEPTION_FLT_DIVIDE_BY_ZERO The thread tried to divide a floating-point value by a floating-point\n"); logfatal(" divisor of zero.\n"); break; case EXCEPTION_FLT_INEXACT_RESULT: logfatal("Desc: EXCEPTION_FLT_INEXACT_RESULT The result of a floating-point operation cannot be represented exactly\n"); logfatal(" as a decimal fraction.\n"); break; case EXCEPTION_FLT_INVALID_OPERATION: logfatal("Desc: EXCEPTION_FLT_INVALID_OPERATION This exception represents any floating-point exception not included\n"); logfatal(" in this list.\n"); break; case EXCEPTION_FLT_OVERFLOW: logfatal("Desc: EXCEPTION_FLT_OVERFLOW The exponent of a floating-point operation is greater than the magnitude\n"); logfatal(" allowed by the corresponding type.\n"); break; case EXCEPTION_FLT_STACK_CHECK: logfatal("Desc: EXCEPTION_FLT_STACK_CHECK The stack overflowed or underflowed as the result of a floating-point\n"); logfatal(" operation.\n"); break; case EXCEPTION_FLT_UNDERFLOW: logfatal("Desc: EXCEPTION_FLT_UNDERFLOW The exponent of a floating-point operation is less than the magnitude\n"); logfatal(" allowed by the corresponding type.\n"); break; case EXCEPTION_ILLEGAL_INSTRUCTION: logfatal("Desc: EXCEPTION_ILLEGAL_INSTRUCTION The thread tried to execute an invalid instruction.\n"); break; case EXCEPTION_IN_PAGE_ERROR: logfatal("Desc: EXCEPTION_IN_PAGE_ERROR The thread tried to access a page that was not present, and the system\n"); logfatal(" was unable to load the page. For example, this exception might occur if a network connection is lost while running a program over the network.\n"); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: logfatal("Desc: EXCEPTION_INT_DIVIDE_BY_ZERO The thread tried to divide an integer value by an integer divisor\n"); logfatal(" of zero.\n"); break; case EXCEPTION_INT_OVERFLOW: logfatal("Desc: EXCEPTION_INT_OVERFLOW The result of an integer operation caused a carry out of the most significant\n"); logfatal(" bit of the result.\n"); break; case EXCEPTION_INVALID_DISPOSITION: logfatal("Desc: EXCEPTION_INVALID_DISPOSITION An exception handler returned an invalid disposition to the exception\n"); logfatal(" dispatcher. Programmers using a high-level language such as C should never encounter this exception.\n"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: logfatal("Desc: EXCEPTION_NONCONTINUABLE_EXCEPTION The thread tried to continue execution after a noncontinuable\n"); logfatal(" exception occurred.\n"); break; case EXCEPTION_PRIV_INSTRUCTION: logfatal("Desc: EXCEPTION_PRIV_INSTRUCTION The thread tried to execute an instruction whose operation is not allowed\n"); logfatal(" in the current machine mode.\n"); break; case EXCEPTION_SINGLE_STEP: logfatal("Desc: EXCEPTION_SINGLE_STEP A trace trap or other single-instruction mechanism signaled that one\n"); logfatal(" instruction has been executed.\n"); break; case EXCEPTION_STACK_OVERFLOW: logfatal("Desc: EXCEPTION_STACK_OVERFLOW The thread used up its stack.\n"); break; default: logfatal("Desc: Unknown.\n"); break; } logfatal("########################################################################\n"); logfatal("########################################################################\n\n\n"); */ // Create a minidump GenerateDump(pExceptionPointers); sprintf_s(flpath, MAX_PATH, "%s\\fatal error.log", _startup_path); strcpy_s(msg, 1000, "OpenScrape is about to crash.\n"); strcat_s(msg, 1000, "A minidump has been created in your\n"); strcat_s(msg, 1000, "OpenScrape startup directory.\n"); strcat_s(msg, 1000, "\n\nOpenScrape will shut down when you click OK."); MessageBox(NULL, msg, "FATAL ERROR", MB_OK | MB_ICONEXCLAMATION | MB_TOPMOST); return EXCEPTION_EXECUTE_HANDLER; }
int WINAPI GenerateDumpi(EXCEPTION_POINTERS* pExceptionPointers) { return (int)GenerateDump(pExceptionPointers); }