??
http://rendao.org/blog/1999/
//崩溃后的回调函数,在这里创建dump文件
inline
LONG
WINAPI
CrashReportEx
(
LPEXCEPTION_POINTERS
ExceptionInfo
)
{
char
szFileName
[
MAX_PATH
]
=
{
0x00
}
;
UINT
nRet
=
0
;
// 重启程序,也可以不重启,因为如果是启动时程序就崩溃的话,将产生多个dump文件
//::GetModuleFileName(NULL, szFileName, MAX_PATH);
//nRet = WinExec(szFileName, SW_SHOW);
// 创建DUMP文件
Create_Dump
(
ExceptionInfo
,
1
,
1
)
;
return
EXCEPTION_EXECUTE_HANDLER
;
}
//对外接口,一般在程序初始化时调用此函数,然后此程序即拥有了崩溃后生成dump文件的功能
inline
void
*
minidump_startup
(
)
{
SetUnhandledExceptionFilter
(
CrashReportEx
)
;
//CrashReportEx是回调函数
debug信息函数:
BOOL WINAPI MiniDumpWriteDump(
_In_ HANDLE hProcess,
_In_ DWORD ProcessId,
_In_ HANDLE hFile,
_In_ MINIDUMP_TYPE DumpType,
_In_ PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
_In_ PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
_In_ PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);
_In_ HANDLE hProcess,
_In_ DWORD ProcessId,
_In_ HANDLE hFile,
_In_ MINIDUMP_TYPE DumpType,
_In_ PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
_In_ PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
_In_ PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);
Dbghelp.lib
http://blog.csdn.net/breaksoftware/article/details/23134445
??
??