| 1001010.com |
one zero zero one zero one zero dot com |
The crash capturing api is very usefull as a foundation for you're own crash reporting system
WINBASEAPI LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter );.
It allows you to define a callback function to be used as a filter when NO OTHER code or debugger is present to catch the exception.
However that introduces a slight problem - debugging the filter function.
If you're in a debugger, it never gets called
If you're not in a debugger, no amount of assert()'s nor _asm {int 3} lines in the filter function will do any good. It's probably a good thing that it doesn't work anyways - horrible recursion could result.
So how do you debug the undebuggable?
Well, I pop up a message box from the UnhandeledExceptionFilter in debug builds and tell my debugger to attach to the process, set a breakpoint on the line after the MessageBox - and debug away!