| 129 | static TCHAR s_szExceptionLogFileName[_MAX_PATH] = _T("\\exceptions.log"); // default |
| 130 | static BOOL s_bUnhandledExeptionFilterSet = FALSE; |
| 131 | static LONG __stdcall CrashHandlerExceptionFilter(EXCEPTION_POINTERS* pExPtrs) |
| 132 | { |
| 133 | #ifdef _M_IX86 |
| 134 | if (pExPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) |
| 135 | { |
| 136 | static char MyStack[1024 * 128]; // be sure that we have enough space... |
| 137 | // it assumes that DS and SS are the same!!! (this is the case for Win32) |
| 138 | // change the stack only if the selectors are the same (this is the case for Win32) |
| 139 | //__asm push offset MyStack[1024*128]; |
| 140 | //__asm pop esp; |
| 141 | __asm mov eax, offset MyStack[1024 * 128]; |
| 142 | __asm mov esp, eax; |
| 143 | } |
| 144 | #endif |
| 145 | |
| 146 | StackWalkerToConsole sw; // output to console |
| 147 | sw.ShowCallstack(GetCurrentThread(), pExPtrs->ContextRecord); |
| 148 | TCHAR lString[500]; |
| 149 | _stprintf_s(lString, |
| 150 | _T("*** Unhandled Exception! See console output for more infos!\n") |
| 151 | _T(" ExpCode: 0x%8.8X\n") |
| 152 | _T(" ExpFlags: %d\n") |
| 153 | #if _MSC_VER >= 1900 |
| 154 | _T(" ExpAddress: 0x%8.8p\n") |
| 155 | #else |
| 156 | _T(" ExpAddress: 0x%8.8X\n") |
| 157 | #endif |
| 158 | _T(" Please report!"), |
| 159 | pExPtrs->ExceptionRecord->ExceptionCode, pExPtrs->ExceptionRecord->ExceptionFlags, |
| 160 | pExPtrs->ExceptionRecord->ExceptionAddress); |
| 161 | FatalAppExit(-1, lString); |
| 162 | return EXCEPTION_CONTINUE_SEARCH; |
| 163 | } |
| 164 | |
| 165 | static void InitUnhandledExceptionFilter() |
| 166 | { |
nothing calls this directly
no outgoing calls
no test coverage detected