Sunday, September 17, 2006

Easily capturing application crash dumps

I've recently found myself in need of getting software crash dumps from computers to which I have no direct access. A tool I released some time ago, FlashMute, which allows people to mute flash movies / browsers exclusively, has gotten a couple of reports of making IE not start. Since these are only two reports, out of between 50.000 and 100.000 downloads + magazine co-distributions, I'm fairly certain the problem isn't inside FlashMute itself. It's more likely that the error is caused by an incompatibility issue with another piece of software (or malware) running on the computers in question.

Having to fetch a crash dump from these computers, without the users having to install complex debuggers, I looked to the SetUnhandledExceptionFilter function (see http://msdn.microsoft.com/library/en-us/debug/base/setunhandledexceptionfilter.asp?frame=true). As it turns out, though, the new C Runtime Libraries (CRT) forces the use of Dr. Watson when a crash happens (see http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=299090&SiteID=1 for a discussion on why) . This is done by resetting whatever custom filter is specified by previous calls to SetUnhandledExceptionFilter, prior to calling through. As a quick resort, I wrote up an application which uses the Microsoft Detours library to override attempts to reset the custom filter. I wrapped it up in a small command line application, which can easily be sent to a customer (or similar troubled being), to catch whatever happens prior to a crash. Upon being notified of an unhandled exception, the application will write a stack and memory dump to file, which can be sent back to you for closer analysis.

You can find the current version of the application at http://www.indev.no/CrashCatcher.rar. Be sure to give me a tell if you come across missing functionality, or similar :) Things to try with the application: "crashcatch --help" and "crashcatch crash.exe". That ought to get you started.

2 kommentarer:

Anonymous said...

Einar,

You seem to have a lot of experience with what I am looking for. You have answered my questions on MSDN Forums. Can you pass out the source code for your application? I am very interested in getting a framework I am working on to accept pluggable modules but not crash because of code in them. This is all in C++ (as close to ANSI/portable as possible).

Your help is much appreciated!

Jonathan Scott

Anonymous said...

I am also having the IE crash problem with FlashMute. Have you come across any solutions?