Collect crash .dmp and .hdmp files after a crash of C++ service and a user-mode app

左心房为你撑大大i 提交于 2019-12-19 04:18:26

问题


I'm coding in C++/MFC using WinAPIs. My software consists of a local service and a user-mode app that provides user interface for a logged in Windows user. I'm looking for a way to collect .dmp and .hdmp files in case of crash in either of those modules. I know that WER supposedly collects them and submits them to Microsoft. Is there a way to collect those files and keep them somewhere on the hard drive?

PS. I need this to work under Windows XP SP3, Vista, 7, 8.


回答1:


Windows 2000 and XP already save crash dumps using DrWatson. Running drwtsn32.exe allows you to get/configure the path to the log and the dump files.

Windows Vista+ only uses WER, which doesn't save a dump by default, but you can enable creation of user mode dumps.
I set the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\DumpType value to 2 to save full dumps which, by default are stored in %LOCALAPPDATA%\CrashDumps (C:\Users\dee.earley\AppData\Local\CrashDumps).

Installing a debugger like WinDebug will also allow you to catch exceptions from user mode apps and the service as they occur.




回答2:


Microsoft's DebugDiag tool is quite useful for monitoring processes and spitting out dump files on exceptions and crashes.

http://www.microsoft.com/en-us/download/details.aspx?id=26798

I've used this in multiple customer environments to track down problems that I could not reproduce in my own environment.




回答3:


If you are looking a way for handling crash on customers side the best solution is using google-breakpad library. In your case exception handler will write dump files on the disk.



来源:https://stackoverflow.com/questions/11479571/collect-crash-dmp-and-hdmp-files-after-a-crash-of-c-service-and-a-user-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!