Exceptions silently caught by Windows, how to handle manually? Exceptions silently caught by Windows, how to handle manually? windows windows

Exceptions silently caught by Windows, how to handle manually?


After browsing similar questions I stumbled across this answer:OpenGL suppresses exceptions in MFC dialog-based application

"Ok, I found out some more information about this. In my case it's windows 7 that installs KiUserCallbackExceptionHandler as exception handler, before calling my WndProc and giving me execution control. This is done by ntdll!KiUserCallbackDispatcher. I suspect that this is a security measure taken by Microsoft to prevent hacking into SEH.

The solution is to wrap your wndproc (or hookproc) with a try/except frame."

I've filed a bug report with Microsoft, you can see their response here:
http://connect.microsoft.com/VisualStudio/feedback/details/550944/hardware-exceptions-on-x64-machines-are-silently-caught-in-wndproc-messages

From Microsoft:

Thanks for the report. I've found out that this is a Windows issue, and there is a hot fix available. Please see http://support.microsoft.com/kb/976038 for a fix that you can install if you wish.


functions that may be of interest:

SetUnhandledExceptionFilter()_set_invalid_parameter_handler()_RTC_SetErrorFuncW()_CrtSetReportHookW2()

PS, be aware that SetUnhandledExceptionFilter() can be overriden by other dlls loaded into your .exe. eg, flash and nvidia direct3d do this. I use api hooking to cure this.