本文整理汇总了C++中CCrashHandler::IsInitialized方法的典型用法代码示例。如果您正苦于以下问题:C++ CCrashHandler::IsInitialized方法的具体用法?C++ CCrashHandler::IsInitialized怎么用?C++ CCrashHandler::IsInitialized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrashHandler
的用法示例。
在下文中一共展示了CCrashHandler::IsInitialized方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: crUninstall
CRASHRPTAPI(int) crUninstall()
{
crSetErrorMsg(_T("Success."));
CCrashHandler *pCrashHandler =
CCrashHandler::GetCurrentProcessCrashHandler();
if(pCrashHandler==NULL ||
!pCrashHandler->IsInitialized())
{
crSetErrorMsg(_T("Crash handler wasn't preiviously installed for this process."));
return 1;
}
// Uninstall main thread's C++ exception handlers
int nUnset = pCrashHandler->UnSetThreadExceptionHandlers();
if(nUnset!=0)
return 2;
int nDestroy = pCrashHandler->Destroy();
if(nDestroy!=0)
return 3;
delete pCrashHandler;
return 0;
}
示例2: crUninstall
CRASHRPTAPI(int) crUninstall()
{
crSetErrorMsg(_T("Success."));
// Get crash handler singleton
CCrashHandler *pCrashHandler =
CCrashHandler::GetCurrentProcessCrashHandler();
// Check if found
if(pCrashHandler==NULL ||
!pCrashHandler->IsInitialized())
{
crSetErrorMsg(_T("Crash handler wasn't preiviously installed for this process."));
return 1;
}
// Uninstall main thread's C++ exception handlers
int nUnset = pCrashHandler->UnSetThreadExceptionHandlers();
if(nUnset!=0)
return 2;
// Destroy the crash handler.
int nDestroy = pCrashHandler->Destroy();
if(nDestroy!=0)
return 3;
// Free the crash handler object.
delete pCrashHandler;
// Clear last error message list.
g_cs.Lock();
g_sErrorMsg.clear();
g_cs.Unlock();
return 0;
}
示例3: crInstallW
CRASHRPTAPI(int) crInstallW(CR_INSTALL_INFOW* pInfo)
{
int nStatus = -1;
crSetErrorMsg(_T("Success."));
strconv_t strconv;
CCrashHandler *pCrashHandler = NULL;
// Validate input parameters.
if(pInfo==NULL ||
pInfo->cb!=sizeof(CR_INSTALL_INFOW))
{
crSetErrorMsg(_T("pInfo is NULL or pInfo->cb member is not valid."));
nStatus = 1;
goto cleanup;
}
// Check if crInstall() already was called for current process.
pCrashHandler = CCrashHandler::GetCurrentProcessCrashHandler();
if(pCrashHandler!=NULL &&
pCrashHandler->IsInitialized())
{
crSetErrorMsg(_T("Can't install crash handler to the same process twice."));
nStatus = 2;
goto cleanup;
}
if(pCrashHandler==NULL)
{
pCrashHandler = new CCrashHandler();
if(pCrashHandler==NULL)
{
crSetErrorMsg(_T("Error allocating memory for crash handler."));
nStatus = 3;
goto cleanup;
}
}
LPCTSTR ptszAppName = strconv.w2t((LPWSTR)pInfo->pszAppName);
LPCTSTR ptszAppVersion = strconv.w2t((LPWSTR)pInfo->pszAppVersion);
LPCTSTR ptszCrashSenderPath = strconv.w2t((LPWSTR)pInfo->pszCrashSenderPath);
LPCTSTR ptszEmailTo = strconv.w2t((LPWSTR)pInfo->pszEmailTo);
LPCTSTR ptszEmailSubject = strconv.w2t((LPWSTR)pInfo->pszEmailSubject);
LPCTSTR ptszUrl = strconv.w2t((LPWSTR)pInfo->pszUrl);
LPCTSTR ptszPrivacyPolicyURL = strconv.w2t((LPWSTR)pInfo->pszPrivacyPolicyURL);
LPCTSTR ptszDebugHelpDLL_file = strconv.w2t((LPWSTR)pInfo->pszDebugHelpDLL);
MINIDUMP_TYPE miniDumpType = pInfo->uMiniDumpType;
LPCTSTR ptszErrorReportSaveDir = strconv.w2t((LPWSTR)pInfo->pszErrorReportSaveDir);
LPCTSTR ptszRestartCmdLine = strconv.w2t((LPWSTR)pInfo->pszRestartCmdLine);
LPCTSTR ptszLangFilePath = strconv.w2t((LPWSTR)pInfo->pszLangFilePath);
LPCTSTR ptszEmailText = strconv.w2t((LPWSTR)pInfo->pszEmailText);
LPCTSTR ptszSmtpProxy = strconv.w2t((LPWSTR)pInfo->pszSmtpProxy);
int nInitResult = pCrashHandler->Init(
ptszAppName,
ptszAppVersion,
ptszCrashSenderPath,
pInfo->pfnCrashCallback,
ptszEmailTo,
ptszEmailSubject,
ptszUrl,
&pInfo->uPriorities,
pInfo->dwFlags,
ptszPrivacyPolicyURL,
ptszDebugHelpDLL_file,
miniDumpType,
ptszErrorReportSaveDir,
ptszRestartCmdLine,
ptszLangFilePath,
ptszEmailText,
ptszSmtpProxy
);
if(nInitResult!=0)
{
nStatus = 4;
goto cleanup;
}
// OK.
nStatus = 0;
cleanup:
if(nStatus!=0) // If failed
{
if(pCrashHandler!=NULL &&
!pCrashHandler->IsInitialized())
{
// Release crash handler object
CCrashHandler::ReleaseCurrentProcessCrashHandler();
}
}
return nStatus;
}