diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-02-10 18:09:34 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-02-10 19:51:19 -0600 |
| commit | 27a0db4070a2b5756282bf15b957dd7f0021417f (patch) | |
| tree | 2d0cdfe80d5ccd6d207bdf664a4f8e512281c1cf /src/burn/engine/apply.cpp | |
| parent | 091573d459d6ab4947bd39bd3bc8faee3d18b4fc (diff) | |
| download | wix-27a0db4070a2b5756282bf15b957dd7f0021417f.tar.gz wix-27a0db4070a2b5756282bf15b957dd7f0021417f.tar.bz2 wix-27a0db4070a2b5756282bf15b957dd7f0021417f.zip | |
When rolling back a bundle failure, reinstall all upgrade related bundles.
Fixes #3421
Diffstat (limited to 'src/burn/engine/apply.cpp')
| -rw-r--r-- | src/burn/engine/apply.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index 5cc63d02..73f8fc72 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
| @@ -210,6 +210,11 @@ static HRESULT ExecuteRelatedBundle( | |||
| 210 | __out BOOL* pfSuspend, | 210 | __out BOOL* pfSuspend, |
| 211 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | 211 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart |
| 212 | ); | 212 | ); |
| 213 | static HRESULT DoRestoreRelatedBundleActions( | ||
| 214 | __in BURN_ENGINE_STATE* pEngineState, | ||
| 215 | __in BURN_EXECUTE_CONTEXT* pContext, | ||
| 216 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | ||
| 217 | ); | ||
| 213 | static HRESULT ExecuteExePackage( | 218 | static HRESULT ExecuteExePackage( |
| 214 | __in BURN_ENGINE_STATE* pEngineState, | 219 | __in BURN_ENGINE_STATE* pEngineState, |
| 215 | __in BURN_EXECUTE_ACTION* pExecuteAction, | 220 | __in BURN_EXECUTE_ACTION* pExecuteAction, |
| @@ -788,6 +793,9 @@ extern "C" HRESULT ApplyExecute( | |||
| 788 | { | 793 | { |
| 789 | if (pCheckpoint->pActiveRollbackBoundary->fVital) | 794 | if (pCheckpoint->pActiveRollbackBoundary->fVital) |
| 790 | { | 795 | { |
| 796 | hrRollback = DoRestoreRelatedBundleActions(pEngineState, &context, pRestart); | ||
| 797 | IgnoreRollbackError(hrRollback, "Failed rollback actions"); | ||
| 798 | |||
| 791 | // If the rollback boundary is vital, end execution here. | 799 | // If the rollback boundary is vital, end execution here. |
| 792 | break; | 800 | break; |
| 793 | } | 801 | } |
| @@ -2590,6 +2598,48 @@ LExit: | |||
| 2590 | return hr; | 2598 | return hr; |
| 2591 | } | 2599 | } |
| 2592 | 2600 | ||
| 2601 | static HRESULT DoRestoreRelatedBundleActions( | ||
| 2602 | __in BURN_ENGINE_STATE* pEngineState, | ||
| 2603 | __in BURN_EXECUTE_CONTEXT* pContext, | ||
| 2604 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | ||
| 2605 | ) | ||
| 2606 | { | ||
| 2607 | HRESULT hr = S_OK; | ||
| 2608 | BOOL fRetryIgnored = FALSE; | ||
| 2609 | BOOL fSuspendIgnored = FALSE; | ||
| 2610 | |||
| 2611 | // execute restore related bundle actions | ||
| 2612 | for (DWORD i = 0; i < pEngineState->plan.cRestoreRelatedBundleActions; ++i) | ||
| 2613 | { | ||
| 2614 | BURN_EXECUTE_ACTION* pRestoreRelatedBundleAction = &pEngineState->plan.rgRestoreRelatedBundleActions[i]; | ||
| 2615 | if (pRestoreRelatedBundleAction->fDeleted) | ||
| 2616 | { | ||
| 2617 | continue; | ||
| 2618 | } | ||
| 2619 | |||
| 2620 | BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; | ||
| 2621 | switch (pRestoreRelatedBundleAction->type) | ||
| 2622 | { | ||
| 2623 | case BURN_EXECUTE_ACTION_TYPE_RELATED_BUNDLE: | ||
| 2624 | hr = ExecuteRelatedBundle(pEngineState, pRestoreRelatedBundleAction, pContext, TRUE, &fRetryIgnored, &fSuspendIgnored, &restart); | ||
| 2625 | IgnoreRollbackError(hr, "Failed to restore related bundle package."); | ||
| 2626 | break; | ||
| 2627 | |||
| 2628 | default: | ||
| 2629 | hr = E_UNEXPECTED; | ||
| 2630 | ExitOnFailure(hr, "Invalid restore related bundle action: %d.", pRestoreRelatedBundleAction->type); | ||
| 2631 | } | ||
| 2632 | |||
| 2633 | if (*pRestart < restart) | ||
| 2634 | { | ||
| 2635 | *pRestart = restart; | ||
| 2636 | } | ||
| 2637 | } | ||
| 2638 | |||
| 2639 | LExit: | ||
| 2640 | return hr; | ||
| 2641 | } | ||
| 2642 | |||
| 2593 | static HRESULT ExecuteExePackage( | 2643 | static HRESULT ExecuteExePackage( |
| 2594 | __in BURN_ENGINE_STATE* pEngineState, | 2644 | __in BURN_ENGINE_STATE* pEngineState, |
| 2595 | __in BURN_EXECUTE_ACTION* pExecuteAction, | 2645 | __in BURN_EXECUTE_ACTION* pExecuteAction, |
