void Base::Run(Output output) { INFO(boca::Name(output)); Initialize(); // analysis.PreRequisits<analysis.Tagger()::type>(analysis,run); FlagSwitch(output, [&](Output output_2) { switch (output_2) { case Output::fast : RunFast(); break; case Output::normal : RunNormal(); break; case Output::efficiency : RunFullEfficiency(); break; case Output::significance : RunFullSignificance(); break; case Output::plot : RunPlots(); break; case Output::cut : RunCut(); break; case Output::plot_hist : RunPlotHist(); break; DEFAULT(boca::Name(output_2)); } }); }
static HRESULT RunEmbedded( __in HINSTANCE hInstance, __in BURN_ENGINE_STATE* pEngineState ) { HRESULT hr = S_OK; // Disable system restore since the parent bundle may have done it. pEngineState->fDisableSystemRestore = TRUE; // Connect to parent process. hr = PipeChildConnect(&pEngineState->embeddedConnection, FALSE); ExitOnFailure(hr, "Failed to connect to parent of embedded process."); // Do not register the bundle to automatically restart if embedded. if (BOOTSTRAPPER_DISPLAY_EMBEDDED == pEngineState->command.display) { pEngineState->registration.fDisableResume = TRUE; } // Now run the application like normal. hr = RunNormal(hInstance, pEngineState); ExitOnFailure(hr, "Failed to run bootstrapper application embedded."); LExit: return hr; }
static HRESULT RunEmbedded( __in HINSTANCE hInstance, __in BURN_ENGINE_STATE* pEngineState ) { HRESULT hr = S_OK; // Connect to parent process. hr = PipeChildConnect(&pEngineState->embeddedConnection, FALSE); ExitOnFailure(hr, "Failed to connect to parent of embedded process."); // Now run the application like normal. hr = RunNormal(hInstance, pEngineState); ExitOnFailure(hr, "Failed to run bootstrapper application embedded."); LExit: return hr; }
extern "C" HRESULT EngineRun( __in HINSTANCE hInstance, __in_z_opt LPCWSTR wzCommandLine, __in int nCmdShow, __out DWORD* pdwExitCode ) { HRESULT hr = S_OK; BOOL fComInitialized = FALSE; BOOL fLogInitialized = FALSE; BOOL fRegInitialized = FALSE; BOOL fWiuInitialized = FALSE; BOOL fXmlInitialized = FALSE; OSVERSIONINFOEXW ovix = { }; LPWSTR sczExePath = NULL; BOOL fRunNormal = FALSE; BOOL fRestart = FALSE; BURN_ENGINE_STATE engineState = { }; hr = InitializeEngineState(&engineState); ExitOnFailure(hr, "Failed to initialize engine state."); engineState.command.nCmdShow = nCmdShow; // Ensure that log contains approriate level of information #ifdef _DEBUG LogSetLevel(REPORT_DEBUG, FALSE); #else LogSetLevel(REPORT_VERBOSE, FALSE); // FALSE means don't write an additional text line to the log saying the level changed #endif // initialize platform layer PlatformInitialize(); // initialize COM hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); ExitOnFailure(hr, "Failed to initialize COM."); fComInitialized = TRUE; // Initialize dutil. LogInitialize(::GetModuleHandleW(NULL)); fLogInitialized = TRUE; hr = RegInitialize(); ExitOnFailure(hr, "Failed to initialize Regutil."); fRegInitialized = TRUE; hr = WiuInitialize(); ExitOnFailure(hr, "Failed to initialize Wiutil."); fWiuInitialized = TRUE; hr = XmlInitialize(); ExitOnFailure(hr, "Failed to initialize XML util."); fXmlInitialized = TRUE; ovix.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); if (!::GetVersionExW((LPOSVERSIONINFOW)&ovix)) { ExitWithLastError(hr, "Failed to get OS info."); } PathForCurrentProcess(&sczExePath, NULL); // Ignore failure. LogId(REPORT_STANDARD, MSG_BURN_INFO, szVerMajorMinorBuild, ovix.dwMajorVersion, ovix.dwMinorVersion, ovix.dwBuildNumber, ovix.wServicePackMajor, sczExePath, wzCommandLine ? wzCommandLine : L""); ReleaseNullStr(sczExePath); // initialize core hr = CoreInitialize(wzCommandLine, &engineState); ExitOnFailure(hr, "Failed to initialize core."); // select run mode switch (engineState.mode) { case BURN_MODE_NORMAL: fRunNormal = TRUE; hr = RunNormal(hInstance, &engineState); ExitOnFailure(hr, "Failed to run per-user mode."); break; case BURN_MODE_ELEVATED: hr = RunElevated(hInstance, wzCommandLine, &engineState); ExitOnFailure(hr, "Failed to run per-machine mode."); break; case BURN_MODE_EMBEDDED: fRunNormal = TRUE; hr = RunEmbedded(hInstance, &engineState); ExitOnFailure(hr, "Failed to run embedded mode."); break; case BURN_MODE_RUNONCE: hr = RunRunOnce(wzCommandLine, nCmdShow); ExitOnFailure(hr, "Failed to run RunOnce mode."); break; default: hr = E_UNEXPECTED; ExitOnFailure(hr, "Invalid run mode."); } // set exit code and remember if we are supposed to restart. *pdwExitCode = engineState.userExperience.dwExitCode; fRestart = engineState.fRestart; LExit: ReleaseStr(sczExePath); // If anything went wrong but the log was never open, try to open a "failure" log // and that will dump anything captured in the log memory buffer to the log. if (FAILED(hr) && BURN_LOGGING_STATE_CLOSED == engineState.log.state) { LogOpen(NULL, L"Setup", L"_Failed", L"txt", FALSE, FALSE, NULL); } UserExperienceRemove(&engineState.userExperience); CacheRemoveWorkingFolder(engineState.registration.sczId); // If this is a related bundle (but not an update) suppress restart and return the standard restart error code. if (fRestart && BOOTSTRAPPER_RELATION_NONE != engineState.command.relationType && BOOTSTRAPPER_RELATION_UPDATE != engineState.command.relationType) { LogId(REPORT_STANDARD, MSG_RESTART_ABORTED, LoggingRelationTypeToString(engineState.command.relationType)); fRestart = FALSE; hr = HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED); } UninitializeEngineState(&engineState); if (fXmlInitialized) { XmlUninitialize(); } if (fWiuInitialized) { WiuUninitialize(); } if (fRegInitialized) { RegUninitialize(); } if (fComInitialized) { ::CoUninitialize(); } if (fRunNormal) { LogId(REPORT_STANDARD, MSG_EXITING, FAILED(hr) ? (int)hr : *pdwExitCode, LoggingBoolToString(fRestart)); if (fRestart) { LogId(REPORT_STANDARD, MSG_RESTARTING); } } if (fLogInitialized) { LogClose(FALSE); } if (fRestart) { Restart(); } if (fLogInitialized) { LogUninitialize(FALSE); } return hr; }
void Base::RunFullEfficiency() { INFO0; RunNormal(); RunEfficiency(); }
void Base::RunFullSignificance() { INFO0; RunNormal(); RunSignificance(); }