views:

39

answers:

1

This is kinda a very low-level type question, but maybe someone here has some insight...

I'm having an issue where unhandled SEH exceptions (such as Access Violations) are seemingly being caught at the Win32 message dispatch level, rather than terminating the program. I found the following reference blog, which explains the problem, but in the context of WM_TIMER messages only: http://bugswar.blogspot.com/2010/07/why-its-not-crashing.html

I'm experiencing the issue with Win 2008R2, and on "normal" messages (eg: WM_COMMAND, etc.). I suspect it might be Windows trying to "help" by masking exceptions, but I want it to error out; the "continue and ignore" behavior is causing problems with the application in general. I realize I could try to wrap every function in a try/catch, and use the compiler option /EHa to convert SEH exceptions into C++ exceptions (which is itself very discouraged and dangerous), but this is obviously sub-optimal.

According to the referenced blog, there's a flag in the AppCompatFlags2 in the TIB structure (http://en.wikipedia.org/wiki/Win32_Thread_Information_Block) which can cause the Win32 handler to not catch/discard the SEH exception, but I have no idea how to set/enable it. Anyone have any insight on this? Is there an AppCompat setting I can enable to have Windows not catch and ignore exceptions?

A: 

I don't know how the compatibility settings affect this particular aspect, but you can choose among several compatibility modes from the Properties page of an EXE in Explorer (on W7 and Vista, at least). I seem to recall that you can also request a specific one from the manifest.

500 - Internal Server Error
You can, but that's not really what I'm looking for, as I very much want to use some of the features in the latest versions of Windows, and I very much don't want the wrong version information sent to my application. The properties here are a subset of what you can specify with AppCompat (as far as I know), and some are settable via the manifest; I don't know how to set the behavior I'm concerned with, though.
Nick