Windows 7 has added some new application compatibility shims that are sometimes applied automatically when a process crashes. In particular there's DISABLEUSERCALLBACKEXCEPTION.
Is there a way to turn off automatic shimming for specific executables?
The shims are good for apps I use as, for example, they stop Windows Live Messenger from crashing at startup.
However, the shims are really annoying and counter-productive for apps I write (or write plugins for). They get applied if I a bug in my code crashes the app. They then mask similar bugs, so I can't tell they are there, until I turn the shim off again via regedit. They also get applied if I intentionally call _CrtDebugBreak (either directly or by clicking Debug when an assert fails).
(It's not applied for every crash/bug. Crashes or _CrtDebugBreak calls in code called by window message handlers often seem to trigger the shim fairly often.)
I've tried setting the registry values which disable the Vista-style AppCompat shims (which are stored in the same place in the registry) but that doesn't seem to suppress the new Windows 7 shims. I think it just turns off shims that are about OS-version compatibility rather than these new shims that seem more about general bugs/application stability.
Anyone know how to stop these shims? Maybe another registry setting or something we can put in the exe manifest?
If you want to see if your own exes have been shimmed, look for values matching your exe path here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
And here:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Persisted
(Something appearing in the second area isn't neccessarily shimmed, AFAIK, but if it's in the first area it is. I clear my exe from both areas whenever a crash causes the shim to be applied.)