diff options
Diffstat (limited to 'src/burn/engine/core.cpp')
-rw-r--r-- | src/burn/engine/core.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 601f29a0..aab49cb7 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -467,6 +467,7 @@ extern "C" HRESULT CorePlan( | |||
467 | pEngineState->plan.wzBundleId = pEngineState->registration.sczId; | 467 | pEngineState->plan.wzBundleId = pEngineState->registration.sczId; |
468 | pEngineState->plan.wzBundleProviderKey = pEngineState->registration.sczId; | 468 | pEngineState->plan.wzBundleProviderKey = pEngineState->registration.sczId; |
469 | pEngineState->plan.fDisableRollback = pEngineState->fDisableRollback; | 469 | pEngineState->plan.fDisableRollback = pEngineState->fDisableRollback; |
470 | pEngineState->plan.fBundleAlreadyRegistered = pEngineState->registration.fInstalled; | ||
470 | 471 | ||
471 | hr = PlanSetVariables(action, &pEngineState->variables); | 472 | hr = PlanSetVariables(action, &pEngineState->variables); |
472 | ExitOnFailure(hr, "Failed to update action."); | 473 | ExitOnFailure(hr, "Failed to update action."); |
@@ -613,6 +614,7 @@ extern "C" HRESULT CoreApply( | |||
613 | BURN_APPLY_CONTEXT applyContext = { }; | 614 | BURN_APPLY_CONTEXT applyContext = { }; |
614 | BOOL fDeleteApplyCs = FALSE; | 615 | BOOL fDeleteApplyCs = FALSE; |
615 | BURN_CACHE_THREAD_CONTEXT cacheThreadContext = { }; | 616 | BURN_CACHE_THREAD_CONTEXT cacheThreadContext = { }; |
617 | BOOL fRollbackCache = FALSE; | ||
616 | DWORD dwPhaseCount = 0; | 618 | DWORD dwPhaseCount = 0; |
617 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION applyCompleteAction = BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE; | 619 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION applyCompleteAction = BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE; |
618 | 620 | ||
@@ -713,6 +715,8 @@ extern "C" HRESULT CoreApply( | |||
713 | applyContext.hCacheThread = ::CreateThread(NULL, 0, CacheThreadProc, &cacheThreadContext, 0, NULL); | 715 | applyContext.hCacheThread = ::CreateThread(NULL, 0, CacheThreadProc, &cacheThreadContext, 0, NULL); |
714 | ExitOnNullWithLastError(applyContext.hCacheThread, hr, "Failed to create cache thread."); | 716 | ExitOnNullWithLastError(applyContext.hCacheThread, hr, "Failed to create cache thread."); |
715 | 717 | ||
718 | fRollbackCache = TRUE; | ||
719 | |||
716 | // If we're not caching in parallel, wait for the cache thread to terminate. | 720 | // If we're not caching in parallel, wait for the cache thread to terminate. |
717 | if (!pEngineState->fParallelCacheAndExecute) | 721 | if (!pEngineState->fParallelCacheAndExecute) |
718 | { | 722 | { |
@@ -740,23 +744,32 @@ extern "C" HRESULT CoreApply( | |||
740 | } | 744 | } |
741 | } | 745 | } |
742 | 746 | ||
743 | // If something went wrong or force restarted, skip cleaning. | 747 | if (fSuspend || BOOTSTRAPPER_APPLY_RESTART_INITIATED == restart) |
744 | if (FAILED(hr) || applyContext.fRollback || fSuspend || BOOTSTRAPPER_APPLY_RESTART_INITIATED == restart) | ||
745 | { | 748 | { |
746 | ExitFunction(); | 749 | // Leave cache alone. |
750 | fRollbackCache = FALSE; | ||
747 | } | 751 | } |
748 | 752 | else if (SUCCEEDED(hr)) | |
749 | // Clean. | ||
750 | if (pEngineState->plan.cCleanActions) | ||
751 | { | 753 | { |
752 | ApplyClean(&pEngineState->userExperience, &pEngineState->plan, pEngineState->companionConnection.hPipe); | 754 | // Clean. |
755 | fRollbackCache = FALSE; | ||
756 | |||
757 | if (pEngineState->plan.cCleanActions) | ||
758 | { | ||
759 | ApplyClean(&pEngineState->userExperience, &pEngineState->plan, pEngineState->companionConnection.hPipe); | ||
760 | } | ||
753 | } | 761 | } |
754 | 762 | ||
755 | LExit: | 763 | LExit: |
764 | if (fRollbackCache) | ||
765 | { | ||
766 | ApplyCacheRollback(&pEngineState->userExperience, &pEngineState->plan, pEngineState->companionConnection.hCachePipe, &applyContext); | ||
767 | } | ||
768 | |||
756 | // Unregister. | 769 | // Unregister. |
757 | if (fRegistered) | 770 | if (fRegistered) |
758 | { | 771 | { |
759 | ApplyUnregister(pEngineState, FAILED(hr) || applyContext.fRollback, fSuspend, restart); | 772 | ApplyUnregister(pEngineState, FAILED(hr), fSuspend, restart); |
760 | } | 773 | } |
761 | 774 | ||
762 | if (fElevated) | 775 | if (fElevated) |