让程序在崩溃时输出Dump文件
#include <Windows.h> #include <tchar.h> #include <DbgHelp.h> #include <iostream> #include <vector> // 添加对dbghelp.lib的编译依赖 // #pragma comment(lib, "dbghelp.lib") using namespace std; const int MAX_ADDRESS_LENGTH = 32; const int MAX_NAME_LENGTH = 1024; // 崩溃信息 // struct CrashInfo { CHAR ErrorCode[MAX_ADDRESS_LENGTH]; CHAR Address[MAX_ADDRESS_LENGTH]; CHAR Flags[MAX_ADDRESS_LENGTH]; }; // CallStack信息 // struct CallStackInfo { CHAR ModuleName[MAX_NAME_LENGTH]; CHAR MethodName[MAX_NAME_LENGTH]; CHAR FileName[MAX_NAME_LENGTH]; CHAR LineNumber[MAX_NAME_LENGTH]; }; // 安全拷贝字符串函数 // void SafeStrCpy(char