views:

316

answers:

2

I created a minimal debug loop which runs and debugs a process.

When the process hangs and the user tries to close it, Windows gives the message box with the option to wait or end now. I would like to try to detect when they hit end now, so my debugger can gather relevant information. However I cannot seem to figure out how to detect this situation. The thread and process exit codes remain at 0. At one point I thought they were returning 0xCFFFFFFF, but that no longer occurs.

Alternatively, perhaps there are some registry entries that can be modified to run this debugger after the app is closed, like Dr. Watson. Perhaps it is just my machine, but I do not seem to be able to get a debugger (VS JIT debug, Dr. Watson, etc) to launch when closing a hung app.

I know this must be possible somehow because I've seen HUNGAPP dumps around before.

Thanks for any information!

A: 

You can run your app for the same purpose with WinDbg and when application hang it generate dump file for you.

lsalamon
A: 

There's a msdn blog series about that topic, which describes how Windows deals with crashes.

lfaraone