本文整理汇总了C++中MiniDumpWriteDump函数的典型用法代码示例。如果您正苦于以下问题:C++ MiniDumpWriteDump函数的具体用法?C++ MiniDumpWriteDump怎么用?C++ MiniDumpWriteDump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MiniDumpWriteDump函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: minidump_write
void minidump_write(const char* file, const EXCEPTION_RECORD* rec)
{
HANDLE hFile;
MINIDUMP_EXCEPTION_INFORMATION mei;
EXCEPTION_POINTERS ep;
DWORD wine_opt;
hFile = CreateFile(file, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) return;
if (rec)
{
mei.ThreadId = dbg_curr_thread->tid;
mei.ExceptionPointers = &ep;
ep.ExceptionRecord = (EXCEPTION_RECORD*)rec;
ep.ContextRecord = &dbg_context;
mei.ClientPointers = FALSE;
}
/* this is a wine specific options to return also ELF modules in the
* dumping
*/
SymSetOptions((wine_opt = SymGetOptions()) | 0x40000000);
MiniDumpWriteDump(dbg_curr_process->handle, dbg_curr_process->pid,
hFile, MiniDumpNormal/*|MiniDumpWithDataSegs*/,
rec ? &mei : NULL, NULL, NULL);
SymSetOptions(wine_opt);
CloseHandle(hFile);
}
开发者ID:howard5888,项目名称:wineT,代码行数:30,代码来源:tgt_minidump.c
示例2: sprintf
int32 CrashHandler::DumpFile(MY_EXCEPTION_POINTERS* pExceptionPointers, const char* sAppName)
{
char szFileName[MAX_PATH];
uint32 dwBufferSize = MAX_PATH;
SYSTEMTIME stLocalTime;
::GetLocalTime(&stLocalTime);
sprintf( szFileName, "%s-%04d%02d%02d-%02d%02d%02d.dmp", sAppName,
stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond);
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
ExpParam.ThreadId = ::GetCurrentThreadId();
ExpParam.ExceptionPointers = pExceptionPointers;
ExpParam.ClientPointers = NULL;
HANDLE hDumpFile = ::CreateFile( szFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
MINIDUMP_TYPE mDumpValue = (MINIDUMP_TYPE)(
MiniDumpNormal |
MiniDumpWithIndirectlyReferencedMemory |
MiniDumpWithDataSegs |
MiniDumpWithFullMemory
);
bool bMiniDumpSucessful = MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(),
hDumpFile, mDumpValue, &ExpParam, NULL, NULL);
::CloseHandle(hDumpFile);
return bMiniDumpSucessful;
}
开发者ID:singmelody,项目名称:Test,代码行数:33,代码来源:CrashHandler.cpp
示例3: TVPWriteHWEDumpFile
int TVPWriteHWEDumpFile( EXCEPTION_POINTERS* pExceptionPointers ) {
BOOL bMiniDumpSuccessful;
WCHAR szPath[MAX_PATH];
WCHAR szFileName[MAX_PATH];
const wchar_t* szAppName = TVPKirikiri;
const wchar_t* szVersion = TVPGetVersionString().c_str();
TVPEnsureDataPathDirectory();
TJS_strcpy(szPath, TVPNativeDataPath.c_str());
SYSTEMTIME stLocalTime;
::GetLocalTime( &stLocalTime );
StringCchPrintf( szFileName, MAX_PATH, L"%s%s%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp",
szPath, szAppName, szVersion,
stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond,
GetCurrentProcessId(), GetCurrentThreadId());
HANDLE hDumpFile = ::CreateFile(szFileName, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
ExpParam.ThreadId = ::GetCurrentThreadId();
ExpParam.ExceptionPointers = pExceptionPointers;
ExpParam.ClientPointers = TRUE;
bMiniDumpSuccessful = MiniDumpWriteDump( ::GetCurrentProcess(), ::GetCurrentProcessId(), hDumpFile, MiniDumpWithDataSegs, &ExpParam, NULL, NULL);
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:DollStudio,项目名称:krkrz,代码行数:27,代码来源:Application.cpp
示例4: GetModuleFileName
//===========================================================
// Entry point where control comes on an unhandled exception
//===========================================================
LONG WINAPI WheatyExceptionReport::WheatyUnhandledExceptionFilter(
PEXCEPTION_POINTERS pExceptionInfo) {
TCHAR module_folder_name[MAX_PATH];
GetModuleFileName(0, module_folder_name, MAX_PATH);
TCHAR* pos = _tcsrchr(module_folder_name, '\\');
if (!pos)
return 0;
pos[0] = '\0';
++pos;
TCHAR crash_folder_path[MAX_PATH];
sprintf(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder);
if (!CreateDirectory(crash_folder_path, NULL)) {
if (GetLastError() != ERROR_ALREADY_EXISTS)
return 0;
}
SYSTEMTIME systime;
GetLocalTime(&systime);
sprintf(m_szDumpFileName, "%s\\%s_%s_[%u-%u_%u-%u-%u].dmp",
crash_folder_path, _HASH, pos, systime.wDay, systime.wMonth,
systime.wHour, systime.wMinute, systime.wSecond);
sprintf(m_szLogFileName, "%s\\%s_%s_[%u-%u_%u-%u-%u].txt",
crash_folder_path, _HASH, pos, systime.wDay, systime.wMonth,
systime.wHour, systime.wMinute, systime.wSecond);
m_hDumpFile = CreateFile(m_szDumpFileName, GENERIC_WRITE, 0, 0, OPEN_ALWAYS,
FILE_FLAG_WRITE_THROUGH, 0);
m_hReportFile = CreateFile(m_szLogFileName, GENERIC_WRITE, 0, 0,
OPEN_ALWAYS, FILE_FLAG_WRITE_THROUGH, 0);
if (m_hDumpFile) {
MINIDUMP_EXCEPTION_INFORMATION info;
info.ClientPointers = FALSE;
info.ExceptionPointers = pExceptionInfo;
info.ThreadId = GetCurrentThreadId();
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
m_hDumpFile, MiniDumpWithIndirectlyReferencedMemory, &info, 0,
0);
CloseHandle(m_hDumpFile);
}
if (m_hReportFile) {
SetFilePointer(m_hReportFile, 0, 0, FILE_END);
GenerateExceptionReport(pExceptionInfo);
CloseHandle(m_hReportFile);
m_hReportFile = 0;
}
if (m_previousFilter)
return m_previousFilter(pExceptionInfo);
else
return EXCEPTION_EXECUTE_HANDLER/*EXCEPTION_CONTINUE_SEARCH*/;
}
开发者ID:jsj2008,项目名称:StarGate-Plus-EMU,代码行数:63,代码来源:WheatyExceptionReport.cpp
示例5: ExceptionHandler
static LONG WINAPI ExceptionHandler(struct _EXCEPTION_POINTERS *excp)
{
printf("#### Unhandled exception caught: data @ %p\n", (void *)excp);
#if defined(_MSC_VER)
if (0 != excp)
{
char *miniDumpPathName = "minidumptest.dmp";
HANDLE currentProcessHandle = GetCurrentProcess();
DWORD processId = GetCurrentProcessId();
MINIDUMP_TYPE type = MiniDumpNormal;
HANDLE outputFileHandle = CreateFile(miniDumpPathName, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
MINIDUMP_EXCEPTION_INFORMATION exceptionInfo;
exceptionInfo.ThreadId = GetCurrentThreadId();
exceptionInfo.ExceptionPointers = excp;
exceptionInfo.ClientPointers = FALSE;
if (INVALID_HANDLE_VALUE != outputFileHandle)
{
MiniDumpWriteDump(currentProcessHandle, processId, outputFileHandle, type, &exceptionInfo, 0, 0);
CloseHandle(outputFileHandle);
}
else
{
printf("Cannot create minidump file '%s'\n", miniDumpPathName);
}
}
#endif /* defined(_MSC_VER) */
return EXCEPTION_CONTINUE_SEARCH;
}
开发者ID:knocte,项目名称:BuildAMation,代码行数:29,代码来源:main.c
示例6: wcscat_s
LONG WINAPI DebugTools::SelfUnhandledException(struct _EXCEPTION_POINTERS *ExceptionInfo)
{
wchar_t path[MAX_PATH];
::GetModuleFileNameW(nullptr,path,MAX_PATH);
wcscat_s(path,L".dmp");
HANDLE hDumpFile=CreateFileW(path,GENERIC_WRITE,0,nullptr,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,nullptr);
MINIDUMP_EXCEPTION_INFORMATION eInfo;
eInfo.ThreadId = GetCurrentThreadId();
eInfo.ExceptionPointers = ExceptionInfo;
eInfo.ClientPointers = FALSE;
MINIDUMP_CALLBACK_INFORMATION cbMiniDump;
cbMiniDump.CallbackRoutine = 0;
cbMiniDump.CallbackParam = 0;
MiniDumpWriteDump(
GetCurrentProcess(),
GetCurrentProcessId(),
hDumpFile,
MiniDumpNormal,
&eInfo,
nullptr,
&cbMiniDump);
CloseHandle(hDumpFile);
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:hkg36,项目名称:My_EXLIB,代码行数:27,代码来源:cexarray.cpp
示例7: ExceptionFilter
long WINAPI ExceptionFilter(EXCEPTION_POINTERS * lParam)
{
//DateTime dateTime(GetCurDateTime());
char strFileName[64] = "leeloo_webserver.dmp";
//std::string stdstrDumpName = ConfigSingleton::Instance().GetItem(ICEARK_DUMPNAME_SYSTEM_CONFIG);
//if(stdstrDumpName.compare(ICEARK_BLANK_SYSTEM_CONFIG) == 0)
// stdstrDumpName = "iceark";
//std::string stdstrOutputpath = ConfigSingleton::Instance().GetItem(ICEARK_OUTPUTPATH_SYSTEM_CONFIG);
//if(stdstrOutputpath.compare(ICEARK_BLANK_SYSTEM_CONFIG) == 0)
// sprintf(strFileName, "dump_%s_%04d_%02d_%02d_%02d_%02d_%02d.dmp", stdstrDumpName.c_str(), dateTime.year(), dateTime.month(), dateTime.day(), dateTime.hour(), dateTime.minute(), dateTime.second());
//else
// sprintf(strFileName, "%sdump_%s_%04d_%02d_%02d_%02d_%02d_%02d.dmp", stdstrOutputpath.c_str(), stdstrDumpName.c_str(), dateTime.year(), dateTime.month(), dateTime.day(), dateTime.hour(), dateTime.minute(), dateTime.second());
//strFileName = "ztcache.dmp";
HANDLE hFile = ::CreateFile( strFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if( hFile != INVALID_HANDLE_VALUE)
{
MINIDUMP_EXCEPTION_INFORMATION einfo;
einfo.ThreadId = ::GetCurrentThreadId();
einfo.ExceptionPointers = lParam;
einfo.ClientPointers = FALSE;
MiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(), hFile, MiniDumpNormal, &einfo, NULL, NULL);
CloseHandle(hFile);
}
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:machunji,项目名称:uniondb,代码行数:25,代码来源:uniondb_webserver.cpp
示例8: GetTempPath
void CrashHandlerWindows::writeCrashDump(PEXCEPTION_POINTERS pointers) {
GetTempPath(boost::size(m_pCrashInfo->miniDumpTmpFile), m_pCrashInfo->miniDumpTmpFile);
WCHAR tick[24];
_ultow(GetTickCount(), tick, 10);
wcscat(m_pCrashInfo->miniDumpTmpFile, tick);
wcscat(m_pCrashInfo->miniDumpTmpFile, L"-arx-crash.dmp");
HANDLE file = CreateFileW(m_pCrashInfo->miniDumpTmpFile, GENERIC_READ | GENERIC_WRITE,
0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(file == INVALID_HANDLE_VALUE) {
return;
}
MINIDUMP_TYPE miniDumpType = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory
| MiniDumpScanMemory);
MINIDUMP_EXCEPTION_INFORMATION exceptionInfo;
exceptionInfo.ThreadId = m_pCrashInfo->threadId;
exceptionInfo.ExceptionPointers = pointers;
exceptionInfo.ClientPointers = TRUE;
// Write the minidump
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), file, miniDumpType,
&exceptionInfo, NULL, NULL);
CloseHandle(file);
}
开发者ID:BSzili,项目名称:ArxLibertatis,代码行数:29,代码来源:CrashHandlerWindows.cpp
示例9: GenerateDump
int GenerateDump(EXCEPTION_POINTERS *pExceptionPointers)
{
bool bMiniDumpSuccessful;
DWORD dwBufferSize = MAX_PATH;
HANDLE hDumpFile;
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
hDumpFile = CreateFile(p_filenames->MiniDumpFilename(),
GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ,
0, CREATE_ALWAYS, 0, 0);
ExpParam.ThreadId = GetCurrentThreadId();
ExpParam.ExceptionPointers = pExceptionPointers;
ExpParam.ClientPointers = TRUE;
MINIDUMP_TYPE mdt = (MINIDUMP_TYPE) (MiniDumpWithPrivateReadWriteMemory |
MiniDumpWithDataSegs |
MiniDumpWithHandleData |
MiniDumpWithFullMemoryInfo |
MiniDumpWithThreadInfo |
MiniDumpWithUnloadedModules);
bMiniDumpSuccessful = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile,
mdt, &ExpParam, NULL, NULL);
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:ohzooboy,项目名称:oh,代码行数:28,代码来源:debug.cpp
示例10: create_mini_dump
static void create_mini_dump(PEXCEPTION_POINTERS pep, LPCTSTR filename)
{
HANDLE file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE,
0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (file && file != INVALID_HANDLE_VALUE)
{
MINIDUMP_EXCEPTION_INFORMATION mei;
mei.ThreadId = GetCurrentThreadId();
mei.ExceptionPointers = pep;
mei.ClientPointers = FALSE;
MINIDUMP_CALLBACK_INFORMATION mci;
mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)mini_dump_callback;
mci.CallbackParam = 0;
MINIDUMP_TYPE mdt = (MINIDUMP_TYPE)(MiniDumpWithPrivateReadWriteMemory |
MiniDumpWithDataSegs |
MiniDumpWithHandleData |
MiniDumpWithFullMemoryInfo |
MiniDumpWithThreadInfo |
MiniDumpWithUnloadedModules);
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
file, mdt, (pep != 0) ? &mei : 0, 0, &mci);
CloseHandle(file);
}
}
开发者ID:Artoria2e5,项目名称:avbot,代码行数:25,代码来源:minidump.cpp
示例11: DetourUnhandledExceptionFilter
LONG WINAPI DetourUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo)
{
// 记录用户出错信息
if (NULL != ExceptionInfo)
{
WCHAR szDumpFile[MAX_PATH] = {0};
ExpandEnvironmentStringsW(L"%APPDATA%\\MoneyHub\\MoneyhubDmp.dmp", szDumpFile, MAX_PATH);
HANDLE hDumpFile = CreateFile(szDumpFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL ,NULL);
MINIDUMP_EXCEPTION_INFORMATION stMiniDumpExceptionInfo;
stMiniDumpExceptionInfo.ExceptionPointers = ExceptionInfo;
stMiniDumpExceptionInfo.ThreadId = GetCurrentThreadId();
stMiniDumpExceptionInfo.ClientPointers = TRUE;
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile,
MiniDumpNormal, &stMiniDumpExceptionInfo, NULL, NULL);
CloseHandle(hDumpFile);
DWORD dwAddr = (DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress;
CRecordProgram::GetInstance()->FeedbackError(MY_ERROR_PRO_CORE, ERR_UNHANDLE_EXCEPT,
CRecordProgram::GetInstance()->GetRecordInfo(L"UnhandledException Errorcode = %d, ErrAddress = %08x", ExceptionInfo->ExceptionRecord->ExceptionCode, dwAddr));
exit(0);
return 0;
}
return OldUnhandledExceptionFilter(ExceptionInfo);
}
开发者ID:Williamzuckerberg,项目名称:chtmoneyhub,代码行数:27,代码来源:RegMonitor.cpp
示例12: GetTempPath
void CrashHandlerWindows::writeCrashDump(PEXCEPTION_POINTERS pExceptionPointers) {
// Build the temporary path to store the minidump
CHAR* tempPathBuffer = m_pCrashInfo->miniDumpTmpFile;
GetTempPath(MAX_PATH, m_pCrashInfo->miniDumpTmpFile);
DWORD tick = GetTickCount();
char tickChar[24];
_ultoa(tick, tickChar, 10);
strcat(&tempPathBuffer[0], tickChar);
strcat(&tempPathBuffer[0], ".dmp");
// Create the minidump file
HANDLE hFile = CreateFile(tempPathBuffer, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
return;
MINIDUMP_TYPE miniDumpType = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory);
MINIDUMP_EXCEPTION_INFORMATION exceptionInfo;
exceptionInfo.ThreadId = GetCurrentThreadId();
exceptionInfo.ExceptionPointers = pExceptionPointers;
exceptionInfo.ClientPointers = TRUE;
MINIDUMP_CALLBACK_INFORMATION callbackInfo;
callbackInfo.CallbackRoutine = miniDumpCallback;
callbackInfo.CallbackParam = 0;
// Write the minidump
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, miniDumpType, &exceptionInfo, NULL, NULL);
CloseHandle(hFile);
}
开发者ID:EstrangedGames,项目名称:ArxLibertatis,代码行数:31,代码来源:CrashHandlerWindows.cpp
示例13: MiniDumpWriteDump
LONG WINAPI CMiniDumpHelp::ProcessMiniDump(__in PEXCEPTION_POINTERS pExceptionPointer)
{
MINIDUMP_EXCEPTION_INFORMATION MinidumpExceptionInformation;
std::wstring dump_filename = CMiniDumpHelp::GetDumpFilename();
MinidumpExceptionInformation.ThreadId = ::GetCurrentThreadId();
MinidumpExceptionInformation.ExceptionPointers = pExceptionPointer;
MinidumpExceptionInformation.ClientPointers = FALSE;
if (dump_filename.empty() == true)
{
::TerminateProcess(::GetCurrentProcess(), 0);
}
HANDLE hDumpFile = ::CreateFileW( dump_filename.c_str()
, GENERIC_WRITE
, FILE_SHARE_WRITE
, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL);
MiniDumpWriteDump( GetCurrentProcess()
, GetCurrentProcessId()
, hDumpFile
, MiniDumpNormal
, &MinidumpExceptionInformation
, NULL
, NULL);
::TerminateProcess(::GetCurrentProcess(), 0);
return 0;
}
开发者ID:Ho-Gyu-Lee,项目名称:Simple-Game-Server,代码行数:34,代码来源:MiniDumpHelp.cpp
示例14: GenerateDump
int GenerateDump(EXCEPTION_POINTERS* pExceptionPointers)
{
BOOL bMiniDumpSuccessful;
TCHAR szPath[MAX_PATH];
TCHAR szFileName[MAX_PATH];
TCHAR* szAppName = "GameWorld";
DWORD dwBufferSize = MAX_PATH;
HANDLE hDumpFile;
SYSTEMTIME stLocalTime;
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
GetLocalTime( &stLocalTime );
GetTempPath( dwBufferSize, szPath );
StringCchPrintf( szFileName, MAX_PATH, "%s%s", szPath, szAppName );
CreateDirectory( szFileName, NULL );
StringCchPrintf( szFileName, MAX_PATH, "Data\\Online\\%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp",
stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond,
GetCurrentProcessId(), GetCurrentThreadId());
hDumpFile = CreateFile(szFileName, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
ExpParam.ThreadId = GetCurrentThreadId();
ExpParam.ExceptionPointers = pExceptionPointers;
ExpParam.ClientPointers = TRUE;
bMiniDumpSuccessful = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
hDumpFile, MiniDumpWithDataSegs, &ExpParam, NULL, NULL);
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:Agentomega,项目名称:SkyrimOnline,代码行数:33,代码来源:main.cpp
示例15: generate_dump
int generate_dump(EXCEPTION_POINTERS* pExceptionPointers)
{
// Add a hardcoded check to guarantee we only write a dump file of the first crash exception that is received.
// Sometimes a crash is so bad that writing the dump below causes another exception to occur, in which case
// this function would be recursively called, spawning tons of error dialogs to the user.
static bool dumpGenerated = false;
if (dumpGenerated)
{
printf("WARNING: Not generating another dump, one has been generated already!\n");
return 0;
}
dumpGenerated = true;
BOOL bMiniDumpSuccessful;
WCHAR szPath[MAX_PATH];
WCHAR szFileName[MAX_PATH];
// Can't use Application for application name and version,
// since it might have not been initialized yet, or it might have caused
// the exception in the first place
WCHAR* szAppName = L"realXtend";
WCHAR* szVersion = L"Tundra_v2.0";
DWORD dwBufferSize = MAX_PATH;
HANDLE hDumpFile;
SYSTEMTIME stLocalTime;
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
GetLocalTime( &stLocalTime );
GetTempPathW( dwBufferSize, szPath );
StringCchPrintf( szFileName, MAX_PATH, L"%s%s", szPath, szAppName );
CreateDirectoryW( szFileName, 0 );
StringCchPrintf( szFileName, MAX_PATH, L"%s%s\\%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp",
szPath, szAppName, szVersion,
stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond,
GetCurrentProcessId(), GetCurrentThreadId());
hDumpFile = CreateFileW(szFileName, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
ExpParam.ThreadId = GetCurrentThreadId();
ExpParam.ExceptionPointers = pExceptionPointers;
ExpParam.ClientPointers = TRUE;
bMiniDumpSuccessful = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
hDumpFile, MiniDumpWithDataSegs, &ExpParam, 0, 0);
std::wstring message(L"Program ");
message += szAppName;
message += L" encountered an unexpected error.\n\nCrashdump was saved to location:\n";
message += szFileName;
if (bMiniDumpSuccessful)
Application::Message(L"Minidump generated!", message);
else
Application::Message(szAppName, L"Unexpected error was encountered while generating minidump!");
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:Ilikia,项目名称:naali,代码行数:60,代码来源:main.cpp
示例16: MyUnhandledExceptionFilter
LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo)
{
std::string str;
{
char buf[260];
memset(buf,0, sizeof(buf));
GetModuleFileName(NULL, buf, 259);
std::string s;
s = buf;
std::string::size_type pos = s.rfind("\\");
if (pos != std::string::npos)
{
s.substr(pos, std::string::npos);
}
str = s;
tm t;
time_t tt=time(NULL);
localtime_s(&t, &tt);
sprintf(buf, "_%04d_%02d_%02d_%02d_%02d_%02d", t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
str += buf;
}
str += ".dmp";
HANDLE lhDumpFile = CreateFile(str.c_str(), GENERIC_WRITE, 0, NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL ,NULL);
MINIDUMP_EXCEPTION_INFORMATION loExceptionInfo;
loExceptionInfo.ExceptionPointers = ExceptionInfo;
loExceptionInfo.ThreadId = GetCurrentThreadId();
loExceptionInfo.ClientPointers = TRUE;
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),lhDumpFile, MiniDumpNormal, &loExceptionInfo, NULL, NULL);
CloseHandle(lhDumpFile);
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:854825967,项目名称:zsummer,代码行数:34,代码来源:MiniDump.cpp
示例17: QString
clsProcessDump::clsProcessDump(HANDLE processHandle, DWORD processID, QString filePath, QWidget *pParent)
{
QString dumpFilePath = QFileDialog::getSaveFileName(pParent,
"Please select a path to save the dump",
QString("DUMP_%1_%2.dmp").arg(filePath).arg(processID,6,10,QChar('0')),
"Dump files (*.dmp)",
NULL,
QFileDialog::DontUseNativeDialog);
if(dumpFilePath.length() <= 0) return;
HANDLE dumpFile = CreateFileW(dumpFilePath.toStdWString().c_str(), GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(dumpFile != INVALID_HANDLE_VALUE)
{
MINIDUMP_TYPE dumpTyp = (MINIDUMP_TYPE)( MiniDumpWithFullMemoryInfo |
MiniDumpWithIndirectlyReferencedMemory |
MiniDumpWithFullMemory |
MiniDumpWithHandleData |
MiniDumpWithProcessThreadData |
MiniDumpWithThreadInfo |
MiniDumpWithUnloadedModules );
if(MiniDumpWriteDump(processHandle, processID, dumpFile, dumpTyp, NULL, NULL, NULL))
QMessageBox::information(pParent,"Nanomite","Process dump was successfull!",QMessageBox::Ok,QMessageBox::Ok);
CloseHandle(dumpFile);
return;
}
QMessageBox::critical(pParent,"Nanomite","Process dump has failed!",QMessageBox::Ok,QMessageBox::Ok);
}
开发者ID:SamirMahmudzade,项目名称:Nanomite,代码行数:32,代码来源:clsProcessDump.cpp
示例18: GenerateDump
int GenerateDump(EXCEPTION_POINTERS *pExceptionPointers)
{
bool bMiniDumpSuccessful;
char szFileName[MAX_PATH];
DWORD dwBufferSize = MAX_PATH;
HANDLE hDumpFile;
SYSTEMTIME stLocalTime;
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
GetLocalTime(&stLocalTime);
sprintf_s(szFileName, MAX_PATH, "%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", _startup_path,
"ManualMode", VERSION_TEXT, stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond, GetCurrentProcessId(),
GetCurrentThreadId());
hDumpFile = CreateFile(szFileName, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ,
0, CREATE_ALWAYS, 0, 0);
ExpParam.ThreadId = GetCurrentThreadId();
ExpParam.ExceptionPointers = pExceptionPointers;
ExpParam.ClientPointers = TRUE;
MINIDUMP_TYPE mdt = (MINIDUMP_TYPE) (MiniDumpWithPrivateReadWriteMemory |
MiniDumpWithDataSegs |
MiniDumpWithHandleData |
MiniDumpWithFullMemoryInfo |
MiniDumpWithThreadInfo |
MiniDumpWithUnloadedModules);
bMiniDumpSuccessful = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile,
mdt, &ExpParam, NULL, NULL);
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:buranela,项目名称:OpenHoldemV12,代码行数:35,代码来源:debug.cpp
示例19: Handler
// Handler function that writes out a dump file
LONG WINAPI Handler(_EXCEPTION_POINTERS * exPointers)
{
HANDLE theFile = CreateFileA("myDumpFile.mdmp",
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (theFile != INVALID_HANDLE_VALUE)
{
_MINIDUMP_EXCEPTION_INFORMATION exInfo;
exInfo.ClientPointers = NULL;
exInfo.ThreadId = GetCurrentThreadId();
exInfo.ExceptionPointers = exPointers;
// Write The Minidump
MiniDumpWriteDump(GetCurrentProcess(),
GetCurrentProcessId(),
theFile,
MiniDumpNormal,
&exInfo,
NULL,
NULL);
MessageBoxA(0, "myDumpFile.mdmp", "MiniDump was saved",MB_OK);
}
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:BGCX261,项目名称:zombie-maul-svn-to-git,代码行数:33,代码来源:WinMain.cpp
示例20: MyUnhandledExceptionFilter
LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo)
{
// 先生成目录
easygame::Platform::createDirectorys(g_dumpPath.c_str());
// 输出minidump文件
string timestamp = getTimeStamp();
string strFilePrev = g_dumpPath;
strFilePrev += g_dumpName;
strFilePrev += "_";
strFilePrev += timestamp;
string strDumpFile = strFilePrev;
strDumpFile += ".dmp";
HANDLE lhDumpFile = CreateFile(strDumpFile.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL ,NULL);
MINIDUMP_EXCEPTION_INFORMATION loExceptionInfo;
loExceptionInfo.ExceptionPointers = ExceptionInfo;
loExceptionInfo.ThreadId = GetCurrentThreadId();
loExceptionInfo.ClientPointers = TRUE;
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),lhDumpFile, MiniDumpNormal, &loExceptionInfo, NULL, NULL);
CloseHandle(lhDumpFile);
// 日志文件
string strStackFile = strFilePrev;
strStackFile += ".txt";
FileStackWalker fsw(strStackFile.c_str());
fsw.ShowCallstack(GetCurrentThread(), ExceptionInfo->ContextRecord);
return EXCEPTION_EXECUTE_HANDLER;
}
开发者ID:ueverything,项目名称:easyserver,代码行数:29,代码来源:MiniDump.cpp
注:本文中的MiniDumpWriteDump函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论