diff options
Diffstat (limited to 'src/burn/engine/apply.cpp')
-rw-r--r-- | src/burn/engine/apply.cpp | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index e2939f40..99884234 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
@@ -201,6 +201,15 @@ static HRESULT DoRollbackActions( | |||
201 | __in DWORD dwCheckpoint, | 201 | __in DWORD dwCheckpoint, |
202 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | 202 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart |
203 | ); | 203 | ); |
204 | static HRESULT ExecuteRelatedBundle( | ||
205 | __in BURN_ENGINE_STATE* pEngineState, | ||
206 | __in BURN_EXECUTE_ACTION* pExecuteAction, | ||
207 | __in BURN_EXECUTE_CONTEXT* pContext, | ||
208 | __in BOOL fRollback, | ||
209 | __out BOOL* pfRetry, | ||
210 | __out BOOL* pfSuspend, | ||
211 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | ||
212 | ); | ||
204 | static HRESULT ExecuteExePackage( | 213 | static HRESULT ExecuteExePackage( |
205 | __in BURN_ENGINE_STATE* pEngineState, | 214 | __in BURN_ENGINE_STATE* pEngineState, |
206 | __in BURN_EXECUTE_ACTION* pExecuteAction, | 215 | __in BURN_EXECUTE_ACTION* pExecuteAction, |
@@ -686,6 +695,9 @@ extern "C" HRESULT ApplyExecute( | |||
686 | LPCWSTR wzId = NULL; | 695 | LPCWSTR wzId = NULL; |
687 | switch (pExecuteAction->type) | 696 | switch (pExecuteAction->type) |
688 | { | 697 | { |
698 | case BURN_EXECUTE_ACTION_TYPE_RELATED_BUNDLE: | ||
699 | wzId = pExecuteAction->relatedBundle.pRelatedBundle->package.sczId; | ||
700 | break; | ||
689 | case BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE: | 701 | case BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE: |
690 | wzId = pExecuteAction->exePackage.pPackage->sczId; | 702 | wzId = pExecuteAction->exePackage.pPackage->sczId; |
691 | break; | 703 | break; |
@@ -2285,6 +2297,11 @@ static HRESULT DoExecuteAction( | |||
2285 | } | 2297 | } |
2286 | break; | 2298 | break; |
2287 | 2299 | ||
2300 | case BURN_EXECUTE_ACTION_TYPE_RELATED_BUNDLE: | ||
2301 | hr = ExecuteRelatedBundle(pEngineState, pExecuteAction, pContext, FALSE, &fRetry, pfSuspend, &restart); | ||
2302 | ExitOnFailure(hr, "Failed to execute related bundle."); | ||
2303 | break; | ||
2304 | |||
2288 | case BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE: | 2305 | case BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE: |
2289 | hr = ExecuteExePackage(pEngineState, pExecuteAction, pContext, FALSE, &fRetry, pfSuspend, &restart); | 2306 | hr = ExecuteExePackage(pEngineState, pExecuteAction, pContext, FALSE, &fRetry, pfSuspend, &restart); |
2290 | ExitOnFailure(hr, "Failed to execute EXE package."); | 2307 | ExitOnFailure(hr, "Failed to execute EXE package."); |
@@ -2399,6 +2416,11 @@ static HRESULT DoRollbackActions( | |||
2399 | case BURN_EXECUTE_ACTION_TYPE_CHECKPOINT: | 2416 | case BURN_EXECUTE_ACTION_TYPE_CHECKPOINT: |
2400 | break; | 2417 | break; |
2401 | 2418 | ||
2419 | case BURN_EXECUTE_ACTION_TYPE_RELATED_BUNDLE: | ||
2420 | hr = ExecuteRelatedBundle(pEngineState, pRollbackAction, pContext, TRUE, &fRetryIgnored, &fSuspendIgnored, &restart); | ||
2421 | ExitOnFailure(hr, "Failed to execute related bundle."); | ||
2422 | break; | ||
2423 | |||
2402 | case BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE: | 2424 | case BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE: |
2403 | hr = ExecuteExePackage(pEngineState, pRollbackAction, pContext, TRUE, &fRetryIgnored, &fSuspendIgnored, &restart); | 2425 | hr = ExecuteExePackage(pEngineState, pRollbackAction, pContext, TRUE, &fRetryIgnored, &fSuspendIgnored, &restart); |
2404 | IgnoreRollbackError(hr, "Failed to rollback EXE package."); | 2426 | IgnoreRollbackError(hr, "Failed to rollback EXE package."); |
@@ -2462,6 +2484,78 @@ LExit: | |||
2462 | return hr; | 2484 | return hr; |
2463 | } | 2485 | } |
2464 | 2486 | ||
2487 | static HRESULT ExecuteRelatedBundle( | ||
2488 | __in BURN_ENGINE_STATE* pEngineState, | ||
2489 | __in BURN_EXECUTE_ACTION* pExecuteAction, | ||
2490 | __in BURN_EXECUTE_CONTEXT* pContext, | ||
2491 | __in BOOL fRollback, | ||
2492 | __out BOOL* pfRetry, | ||
2493 | __out BOOL* pfSuspend, | ||
2494 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | ||
2495 | ) | ||
2496 | { | ||
2497 | HRESULT hr = S_OK; | ||
2498 | HRESULT hrExecute = S_OK; | ||
2499 | GENERIC_EXECUTE_MESSAGE message = { }; | ||
2500 | int nResult = 0; | ||
2501 | BOOL fBeginCalled = FALSE; | ||
2502 | BURN_RELATED_BUNDLE* pRelatedBundle = pExecuteAction->relatedBundle.pRelatedBundle; | ||
2503 | BURN_PACKAGE* pPackage = &pRelatedBundle->package; | ||
2504 | |||
2505 | if (FAILED(pPackage->hrCacheResult)) | ||
2506 | { | ||
2507 | LogId(REPORT_STANDARD, MSG_APPLY_SKIPPED_FAILED_CACHED_PACKAGE, pPackage->sczId, pPackage->hrCacheResult); | ||
2508 | ExitFunction1(hr = S_OK); | ||
2509 | } | ||
2510 | |||
2511 | Assert(pContext->fRollback == fRollback); | ||
2512 | pContext->pExecutingPackage = pPackage; | ||
2513 | fBeginCalled = TRUE; | ||
2514 | |||
2515 | // Send package execute begin to BA. | ||
2516 | hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pPackage->sczId, !fRollback, pExecuteAction->relatedBundle.action, INSTALLUILEVEL_NOCHANGE, FALSE); | ||
2517 | ExitOnRootFailure(hr, "BA aborted execute related bundle begin."); | ||
2518 | |||
2519 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; | ||
2520 | message.dwUIHint = MB_OKCANCEL; | ||
2521 | message.progress.dwPercentage = fRollback ? 100 : 0; | ||
2522 | nResult = GenericExecuteMessageHandler(&message, pContext); | ||
2523 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | ||
2524 | ExitOnRootFailure(hr, "BA aborted related bundle progress."); | ||
2525 | |||
2526 | // Execute package. | ||
2527 | if (pPackage->fPerMachine) | ||
2528 | { | ||
2529 | hrExecute = ElevationExecuteRelatedBundle(pEngineState->companionConnection.hPipe, pExecuteAction, &pEngineState->variables, fRollback, GenericExecuteMessageHandler, pContext, pRestart); | ||
2530 | ExitOnFailure(hrExecute, "Failed to configure per-machine related bundle."); | ||
2531 | } | ||
2532 | else | ||
2533 | { | ||
2534 | hrExecute = BundlePackageEngineExecuteRelatedBundle(pExecuteAction, pContext->pCache, &pEngineState->variables, fRollback, GenericExecuteMessageHandler, pContext, pRestart); | ||
2535 | ExitOnFailure(hrExecute, "Failed to configure per-user related bundle."); | ||
2536 | } | ||
2537 | |||
2538 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; | ||
2539 | message.dwUIHint = MB_OKCANCEL; | ||
2540 | message.progress.dwPercentage = fRollback ? 0 : 100; | ||
2541 | nResult = GenericExecuteMessageHandler(&message, pContext); | ||
2542 | hr = UserExperienceInterpretExecuteResult(&pEngineState->userExperience, fRollback, message.dwUIHint, nResult); | ||
2543 | ExitOnRootFailure(hr, "BA aborted related bundle progress."); | ||
2544 | |||
2545 | pContext->cExecutedPackages += fRollback ? -1 : 1; | ||
2546 | |||
2547 | hr = ReportOverallProgressTicks(&pEngineState->userExperience, fRollback, pEngineState->plan.cOverallProgressTicksTotal, pContext->pApplyContext); | ||
2548 | ExitOnRootFailure(hr, "BA aborted related bundle execute progress."); | ||
2549 | |||
2550 | LExit: | ||
2551 | if (fBeginCalled) | ||
2552 | { | ||
2553 | hr = ExecutePackageComplete(&pEngineState->userExperience, &pEngineState->variables, pPackage, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); | ||
2554 | } | ||
2555 | |||
2556 | return hr; | ||
2557 | } | ||
2558 | |||
2465 | static HRESULT ExecuteExePackage( | 2559 | static HRESULT ExecuteExePackage( |
2466 | __in BURN_ENGINE_STATE* pEngineState, | 2560 | __in BURN_ENGINE_STATE* pEngineState, |
2467 | __in BURN_EXECUTE_ACTION* pExecuteAction, | 2561 | __in BURN_EXECUTE_ACTION* pExecuteAction, |