aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/apply.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/apply.cpp')
-rw-r--r--src/burn/engine/apply.cpp73
1 files changed, 48 insertions, 25 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp
index 283c0ada..0467132e 100644
--- a/src/burn/engine/apply.cpp
+++ b/src/burn/engine/apply.cpp
@@ -191,7 +191,6 @@ static HRESULT DoExecuteAction(
191 __in BURN_ENGINE_STATE* pEngineState, 191 __in BURN_ENGINE_STATE* pEngineState,
192 __in BURN_EXECUTE_ACTION* pExecuteAction, 192 __in BURN_EXECUTE_ACTION* pExecuteAction,
193 __in BURN_EXECUTE_CONTEXT* pContext, 193 __in BURN_EXECUTE_CONTEXT* pContext,
194 __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary,
195 __inout BURN_EXECUTE_ACTION_CHECKPOINT** ppCheckpoint, 194 __inout BURN_EXECUTE_ACTION_CHECKPOINT** ppCheckpoint,
196 __out BOOL* pfSuspend, 195 __out BOOL* pfSuspend,
197 __out BOOTSTRAPPER_APPLY_RESTART* pRestart 196 __out BOOTSTRAPPER_APPLY_RESTART* pRestart
@@ -657,8 +656,7 @@ extern "C" HRESULT ApplyExecute(
657 HRESULT hrRollback = S_OK; 656 HRESULT hrRollback = S_OK;
658 BURN_EXECUTE_ACTION_CHECKPOINT* pCheckpoint = NULL; 657 BURN_EXECUTE_ACTION_CHECKPOINT* pCheckpoint = NULL;
659 BURN_EXECUTE_CONTEXT context = { }; 658 BURN_EXECUTE_CONTEXT context = { };
660 BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; 659 BOOL fSeekRollbackBoundaryEnd = FALSE;
661 BOOL fSeekNextRollbackBoundary = FALSE;
662 660
663 context.pCache = pEngineState->plan.pCache; 661 context.pCache = pEngineState->plan.pCache;
664 context.pUX = &pEngineState->userExperience; 662 context.pUX = &pEngineState->userExperience;
@@ -680,21 +678,41 @@ extern "C" HRESULT ApplyExecute(
680 continue; 678 continue;
681 } 679 }
682 680
683 // If we are seeking the next rollback boundary, skip if this action wasn't it. 681 // If we are seeking the end of the rollback boundary, skip if this action wasn't it.
684 if (fSeekNextRollbackBoundary) 682 if (fSeekRollbackBoundaryEnd)
685 { 683 {
686 if (BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY == pExecuteAction->type) 684 if (BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END != pExecuteAction->type)
687 { 685 {
686 LPCWSTR wzId = NULL;
687 switch (pExecuteAction->type)
688 {
689 case BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE:
690 wzId = pExecuteAction->exePackage.pPackage->sczId;
691 break;
692 case BURN_EXECUTE_ACTION_TYPE_MSI_PACKAGE:
693 wzId = pExecuteAction->msiPackage.pPackage->sczId;
694 break;
695 case BURN_EXECUTE_ACTION_TYPE_MSP_TARGET:
696 wzId = pExecuteAction->mspTarget.pPackage->sczId;
697 break;
698 case BURN_EXECUTE_ACTION_TYPE_MSU_PACKAGE:
699 wzId = pExecuteAction->msuPackage.pPackage->sczId;
700 break;
701 }
702
703 if (wzId)
704 {
705 LogId(REPORT_WARNING, MSG_APPLY_SKIPPING_NONVITAL_ROLLBACK_BOUNDARY_PACKAGE, wzId);
706 }
707
688 continue; 708 continue;
689 } 709 }
690 else 710
691 { 711 fSeekRollbackBoundaryEnd = FALSE;
692 fSeekNextRollbackBoundary = FALSE;
693 }
694 } 712 }
695 713
696 // Execute the action. 714 // Execute the action.
697 hr = DoExecuteAction(pEngineState, pExecuteAction, &context, &pRollbackBoundary, &pCheckpoint, pfSuspend, pRestart); 715 hr = DoExecuteAction(pEngineState, pExecuteAction, &context, &pCheckpoint, pfSuspend, pRestart);
698 716
699 if (*pfSuspend || BOOTSTRAPPER_APPLY_RESTART_INITIATED == *pRestart) 717 if (*pfSuspend || BOOTSTRAPPER_APPLY_RESTART_INITIATED == *pRestart)
700 { 718 {
@@ -737,19 +755,24 @@ extern "C" HRESULT ApplyExecute(
737 755
738 hrRollback = DoRollbackActions(pEngineState, &context, pCheckpoint->dwId, pRestart); 756 hrRollback = DoRollbackActions(pEngineState, &context, pCheckpoint->dwId, pRestart);
739 IgnoreRollbackError(hrRollback, "Failed rollback actions"); 757 IgnoreRollbackError(hrRollback, "Failed rollback actions");
740 }
741 758
742 // If the rollback boundary is vital, end execution here. 759 if (pCheckpoint->pActiveRollbackBoundary)
743 if (pRollbackBoundary && pRollbackBoundary->fVital) 760 {
744 { 761 if (pCheckpoint->pActiveRollbackBoundary->fVital)
745 break; 762 {
763 // If the rollback boundary is vital, end execution here.
764 break;
765 }
766
767 // Move forward to the end of this rollback boundary.
768 fSeekRollbackBoundaryEnd = TRUE;
769
770 LogId(REPORT_WARNING, MSG_APPLY_SKIPPING_REST_OF_NONVITAL_ROLLBACK_BOUNDARY, pCheckpoint->pActiveRollbackBoundary->sczId);
771 }
746 } 772 }
747 773
748 // Ignore failure inside of a non-vital rollback boundary. 774 // Ignore failure outside of a vital rollback boundary.
749 hr = S_OK; 775 hr = S_OK;
750
751 // Move forward to next rollback boundary.
752 fSeekNextRollbackBoundary = TRUE;
753 } 776 }
754 } 777 }
755 778
@@ -2207,7 +2230,6 @@ static HRESULT DoExecuteAction(
2207 __in BURN_ENGINE_STATE* pEngineState, 2230 __in BURN_ENGINE_STATE* pEngineState,
2208 __in BURN_EXECUTE_ACTION* pExecuteAction, 2231 __in BURN_EXECUTE_ACTION* pExecuteAction,
2209 __in BURN_EXECUTE_CONTEXT* pContext, 2232 __in BURN_EXECUTE_CONTEXT* pContext,
2210 __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary,
2211 __inout BURN_EXECUTE_ACTION_CHECKPOINT** ppCheckpoint, 2233 __inout BURN_EXECUTE_ACTION_CHECKPOINT** ppCheckpoint,
2212 __out BOOL* pfSuspend, 2234 __out BOOL* pfSuspend,
2213 __out BOOTSTRAPPER_APPLY_RESTART* pRestart 2235 __out BOOTSTRAPPER_APPLY_RESTART* pRestart
@@ -2226,7 +2248,7 @@ static HRESULT DoExecuteAction(
2226 2248
2227 do 2249 do
2228 { 2250 {
2229 fInsideMsiTransaction = *ppRollbackBoundary && (*ppRollbackBoundary)->fActiveTransaction; 2251 fInsideMsiTransaction = *ppCheckpoint && (*ppCheckpoint)->pActiveRollbackBoundary && (*ppCheckpoint)->pActiveRollbackBoundary->fActiveTransaction;
2230 2252
2231 switch (pExecuteAction->type) 2253 switch (pExecuteAction->type)
2232 { 2254 {
@@ -2296,8 +2318,9 @@ static HRESULT DoExecuteAction(
2296 2318
2297 break; 2319 break;
2298 2320
2299 case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY: 2321 case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START: __fallthrough;
2300 *ppRollbackBoundary = pExecuteAction->rollbackBoundary.pRollbackBoundary; 2322 case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END:
2323 *ppCheckpoint = NULL;
2301 break; 2324 break;
2302 2325
2303 case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION: 2326 case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION:
@@ -2406,7 +2429,7 @@ static HRESULT DoRollbackActions(
2406 IgnoreRollbackError(hr, "Failed to rollback dependency action."); 2429 IgnoreRollbackError(hr, "Failed to rollback dependency action.");
2407 break; 2430 break;
2408 2431
2409 case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY: 2432 case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START:
2410 ExitFunction1(hr = S_OK); 2433 ExitFunction1(hr = S_OK);
2411 2434
2412 case BURN_EXECUTE_ACTION_TYPE_UNCACHE_PACKAGE: 2435 case BURN_EXECUTE_ACTION_TYPE_UNCACHE_PACKAGE: