void CrashRptAPITests::Test_crInstallToCurrentThread() { // Call before install - must fail int nResult = crInstallToCurrentThread(); TEST_ASSERT(nResult!=0); // Call before install - must fail int nResult2 = crInstallToCurrentThread2(0); TEST_ASSERT(nResult2!=0); // Install crash handler for the main thread CR_INSTALL_INFO info; memset(&info, 0, sizeof(CR_INSTALL_INFO)); info.cb = sizeof(CR_INSTALL_INFO); info.pszAppVersion = _T("1.0.0"); // Specify app version, otherwise it will fail. int nInstResult = crInstall(&info); TEST_ASSERT(nInstResult==0); // Call in the main thread - must fail int nResult3 = crInstallToCurrentThread2(0); TEST_ASSERT(nResult3!=0); // Run a worker thread HANDLE hThread = CreateThread(NULL, 0, ThreadProc2, NULL, 0, NULL); // Wait until thread exits WaitForSingleObject(hThread, INFINITE); __TEST_CLEANUP__; // Uninstall should succeed crUninstall(); }
BOOL CSafeThread::InitInstance() { #ifndef _DEBUG crInstallToCurrentThread2(0); #endif return CWinThread::InitInstance(); }
crInstallToCurrentThread() { return crInstallToCurrentThread2(0); }
r3dThreadAutoInstallCrashHelper::r3dThreadAutoInstallCrashHelper(DWORD dwFlags) { #ifndef DISABLE_CRASHRPT m_nInstallStatus = crInstallToCurrentThread2(dwFlags); #endif }