c++程序出错:requested the runtime to terminate it in an unusual way
本帖最后由 守护_骑士 于 2014-10-10 10:45 编辑如题
错误提示是:this application has requested the runtime to terminate it in an unusual way。Please contact the application's support team for more information.
程序用的vs2005写的。运行的环境是win7 64位系统。
我使用MiniDumpWriteDump想抓取这个异常的。结果生成的文件大小是0Kb。
代码如下:
//处理未捕获的异常
LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo)
{
HANDLE lhDumpFile = CreateFile(_T("GradeFrm_DumpFile.dmp"), GENERIC_READ | GENERIC_WRITE,
0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL , NULL);
printf("--------------------------------------------------有异常!------------------------------------------------\n");
if( ( lhDumpFile != NULL ) && ( lhDumpFile != INVALID_HANDLE_VALUE ) )
{
MINIDUMP_EXCEPTION_INFORMATION loExceptionInfo;
loExceptionInfo.ExceptionPointers = ExceptionInfo;
loExceptionInfo.ThreadId = GetCurrentThreadId();
loExceptionInfo.ClientPointers = FALSE;
MINIDUMP_TYPE mdt= (MINIDUMP_TYPE)(MiniDumpWithFullMemory |
MiniDumpWithFullMemoryInfo |
MiniDumpWithHandleData |
MiniDumpWithThreadInfo |
MiniDumpWithUnloadedModules );
BOOL rv = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), lhDumpFile, mdt,
(NULL != ExceptionInfo) ? &loExceptionInfo : NULL, NULL, NULL);
if( !rv )
{
//NSDumpFile::ShowLastError();
_tprintf( _T("MiniDumpWriteDump failed. Error: %u \n"), GetLastError() );
}
else
{
_tprintf( _T("Minidump created.\n") );
}
}
else
{
//NSDumpFile::ShowLastError();
_tprintf( _T("CreateFile failed. Error: %u \n"), GetLastError() );
}
CloseHandle(lhDumpFile);
return EXCEPTION_EXECUTE_HANDLER;
}求大神指教怎么办。才能找到错误点。
页:
[1]