3
votes

This might be silly. When my process crashes, a WerFault.exe has been launched and I can regain control only after I close this window or kill its task.

I'm looking for a simple way of not letting crashed program show this window or any idea for me to catch this crash.

SEH is not useful, by the way. I'm not sure why. The crash also remains when I use SEH.

Thanks!

Now I'm just figuring out how to avoid this WerFault.exe windows and sometimes csrss.exe window and regain control.

2
Not sure whether this is still accurate, but support2.microsoft.com/kb/121434 describes how to assign a default debugger.Harry Johnston
@HarryJohnston It's normal that my process crashes. It runs several tests on a static library.Jim Yang
Have you tried using SetUnhandledExceptionFilter?Jonathan Potter
@JimYang: the idea is that a custom debugger could restart the process automatically.Harry Johnston

2 Answers

2
votes

Use the Application Recovery and Restart API to have Windows Error Reporting (WER) restart and recover your app when it crashes. Use RegisterApplicationRestart() to register your intent to be restarted. Use RegisterApplicationRecoveryCallback() to register your intent to save and recover state data.

0
votes

I have not tried this but this api : WerAddExcludedApplication should disable error raporting: http://msdn.microsoft.com/en-us/library/bb513617%28v=VS.85%29.aspx

As for restarting your app, you could create another background process that will start your main process and monitor how it behaves. If it crashes then restart it.

[edit]

unfortunately this api might not work, as suggested in comments to it - to remove this dialog your will have to FindWindow() and SendMessage(... WM_CLOSE...).