views:

123

answers:

2

Our application is using mshtml. That dll is causing our application to exit ungracefully due to well known problems in mshtml since we don't install newer browsers on users' machines. We just use what they have already.

The SetUnhandledExceptionFilter() does not handle this, nor does a try/catch block around the calls into mshtml. The exception filter does catch other exceptions.

The exception settings are /EHa.

When I remote debug the crash I see:

unhandled exception - access violation

In mshtml but if I don't attach to the process with a debugger, the application just exits.

What do we need to do to catch the exception?


Edit:

This is an old version of IE6.

+2  A: 

Seems to be that MSHTML functions passes necessary data to a separate thread. That separate thread processes your request and the exception takes place. That's why you cannot catch exception via try/catch block. You should check it in the debugger. If that is true the only way to catch exceptions from other threads is to set hooks for TerminateThread and TerminateProcess functions. Check out CApiHook class by Jeffrey Richter for that purpose(or other implementations). But it will make your program to be incompatible with /NXCOMPAT compiler flag.

Your second option is to install all important OS updates.

Kirill V. Lyadvinsky
Thanks - we'll look at that - and yes, it would be nice to require/install latest IE and other stuff, but that is not really possible right now.
Tim
+1  A: 

Almost there. It's not SetUnhandledExceptionFilter() but AddVectoredExceptionHandler you want. With that said, you can get the first shot at this exception.

Of course I'm wondering what you're going to do afterwards. TherminateThread is probably the only option you have, but that may very well deadlock MSHTML. So that needs killing too.

MSalters
Yes, I'm wondering what I am going to do about it as well... Right now I just want to take a look at what is actually happening.
Tim