If a hardware exception (one where the exception code matches the values defined here http://msdn.microsoft.com/en-us/library/aa363082.aspx) occurs in a WndProc message (such as WM_PAINT) on a x64 machine, the exception will be caught silently, and the only way of spotting the crash is to check the output window.
Here is my example code (I will attach a test application that you can run too):
void CTestView::OnDraw(CDC* /*pDC*/)
*(int*)0 = 0; // Crash
CTestDoc* pDoc = GetDocument();
// TODO: add draw code for native data here
On x86 machines this will generate an error and the program will terminate, however on x64 machines, the application continues to run and if debugging, you will see the following written to the output window:
First-chance exception at 0x13929384 in Test.exe: 0xC0000005: Access violation writing location 0x00000000.
First-chance exception at 0x77c6ee42 in Test.exe: 0xC0150010: The activation context being deactivated is not active for the current thread of execution.
These crashes are important, and we rely on being able to fix our application via the crash reports that get generated by our users. Having x64 machines hide crashes is dangerous as the problem will never get fixed.
What is the recommended way of catching these errors generically and then causing the UnhandledExceptionFilter to run as normal (which isn't called at all on x64 machines in WndProc messages)?
I've tried Vectored Exception Handling, but that's too heavy handed because it catches the errors before __try / __except, so a block of code could be aware that an exception will be generated, but the VEH handler will intercept before hand with no idea of whether we can continue or not (for example, some movie codecs we use anticipate a divide by zero exception, but VEH will pick it up before the codec).