diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-13 23:51:36 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-14 14:53:29 -0500 |
commit | 9453eaa9a38f78e248526ddd996485140a5d4d9a (patch) | |
tree | 8ef6bda85836fd3f1b9c2c6c16cb4a994519e863 /src/burn/engine/core.cpp | |
parent | 78125b7c4bd59468275d65b63860bdb68b1bc6f1 (diff) | |
download | wix-9453eaa9a38f78e248526ddd996485140a5d4d9a.tar.gz wix-9453eaa9a38f78e248526ddd996485140a5d4d9a.tar.bz2 wix-9453eaa9a38f78e248526ddd996485140a5d4d9a.zip |
Make engine skip planning if there are any downgrade related bundles.
Fixes 6677, 6722
Reverts 6537
Diffstat (limited to 'src/burn/engine/core.cpp')
-rw-r--r-- | src/burn/engine/core.cpp | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 9d4ea43e..37872e52 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -527,8 +527,15 @@ extern "C" HRESULT CorePlan( | |||
527 | hr = PlanRelatedBundlesInitialize(&pEngineState->userExperience, &pEngineState->registration, pEngineState->command.relationType, &pEngineState->plan); | 527 | hr = PlanRelatedBundlesInitialize(&pEngineState->userExperience, &pEngineState->registration, pEngineState->command.relationType, &pEngineState->plan); |
528 | ExitOnFailure(hr, "Failed to initialize related bundles for plan."); | 528 | ExitOnFailure(hr, "Failed to initialize related bundles for plan."); |
529 | 529 | ||
530 | hr = PlanRegistration(&pEngineState->plan, &pEngineState->registration, &pEngineState->dependencies, pEngineState->command.resumeType, pEngineState->command.relationType, &fContinuePlanning); | 530 | if (pEngineState->plan.fDowngrade) |
531 | ExitOnFailure(hr, "Failed to plan registration."); | 531 | { |
532 | fContinuePlanning = FALSE; | ||
533 | } | ||
534 | else | ||
535 | { | ||
536 | hr = PlanRegistration(&pEngineState->plan, &pEngineState->registration, &pEngineState->dependencies, pEngineState->command.resumeType, pEngineState->command.relationType, &fContinuePlanning); | ||
537 | ExitOnFailure(hr, "Failed to plan registration."); | ||
538 | } | ||
532 | 539 | ||
533 | if (fContinuePlanning) | 540 | if (fContinuePlanning) |
534 | { | 541 | { |
@@ -615,6 +622,7 @@ extern "C" HRESULT CoreApply( | |||
615 | { | 622 | { |
616 | HRESULT hr = S_OK; | 623 | HRESULT hr = S_OK; |
617 | HANDLE hLock = NULL; | 624 | HANDLE hLock = NULL; |
625 | BOOL fApplyBegan = FALSE; | ||
618 | BOOL fApplyInitialize = FALSE; | 626 | BOOL fApplyInitialize = FALSE; |
619 | BOOL fElevated = FALSE; | 627 | BOOL fElevated = FALSE; |
620 | BOOL fRegistered = FALSE; | 628 | BOOL fRegistered = FALSE; |
@@ -627,8 +635,6 @@ extern "C" HRESULT CoreApply( | |||
627 | DWORD dwPhaseCount = 0; | 635 | DWORD dwPhaseCount = 0; |
628 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION applyCompleteAction = BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE; | 636 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION applyCompleteAction = BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE; |
629 | 637 | ||
630 | LogId(REPORT_STANDARD, MSG_APPLY_BEGIN); | ||
631 | |||
632 | if (!pEngineState->fPlanned) | 638 | if (!pEngineState->fPlanned) |
633 | { | 639 | { |
634 | ExitOnFailure(hr = E_INVALIDSTATE, "Apply cannot be done without a successful Plan."); | 640 | ExitOnFailure(hr = E_INVALIDSTATE, "Apply cannot be done without a successful Plan."); |
@@ -638,6 +644,10 @@ extern "C" HRESULT CoreApply( | |||
638 | ExitOnFailure(hr = E_INVALIDSTATE, "Plans cannot be applied multiple times."); | 644 | ExitOnFailure(hr = E_INVALIDSTATE, "Plans cannot be applied multiple times."); |
639 | } | 645 | } |
640 | 646 | ||
647 | fApplyBegan = TRUE; | ||
648 | |||
649 | LogId(REPORT_STANDARD, MSG_APPLY_BEGIN); | ||
650 | |||
641 | // Ensure any previous attempts to execute are reset. | 651 | // Ensure any previous attempts to execute are reset. |
642 | ApplyReset(&pEngineState->userExperience, &pEngineState->packages); | 652 | ApplyReset(&pEngineState->userExperience, &pEngineState->packages); |
643 | 653 | ||
@@ -653,6 +663,14 @@ extern "C" HRESULT CoreApply( | |||
653 | hr = UserExperienceOnApplyBegin(&pEngineState->userExperience, dwPhaseCount); | 663 | hr = UserExperienceOnApplyBegin(&pEngineState->userExperience, dwPhaseCount); |
654 | ExitOnRootFailure(hr, "BA aborted apply begin."); | 664 | ExitOnRootFailure(hr, "BA aborted apply begin."); |
655 | 665 | ||
666 | if (pEngineState->plan.fDowngrade) | ||
667 | { | ||
668 | hr = HRESULT_FROM_WIN32(ERROR_PRODUCT_VERSION); | ||
669 | UserExperienceOnApplyDowngrade(&pEngineState->userExperience, &hr); | ||
670 | |||
671 | ExitFunction(); | ||
672 | } | ||
673 | |||
656 | pEngineState->plan.fAffectedMachineState = pEngineState->plan.fCanAffectMachineState; | 674 | pEngineState->plan.fAffectedMachineState = pEngineState->plan.fCanAffectMachineState; |
657 | 675 | ||
658 | hr = ApplyLock(FALSE, &hLock); | 676 | hr = ApplyLock(FALSE, &hLock); |
@@ -804,13 +822,16 @@ LExit: | |||
804 | DeleteCriticalSection(&applyContext.csApply); | 822 | DeleteCriticalSection(&applyContext.csApply); |
805 | } | 823 | } |
806 | 824 | ||
807 | UserExperienceOnApplyComplete(&pEngineState->userExperience, hr, restart, &applyCompleteAction); | 825 | if (fApplyBegan) |
808 | if (BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART == applyCompleteAction) | ||
809 | { | 826 | { |
810 | pEngineState->fRestart = TRUE; | 827 | UserExperienceOnApplyComplete(&pEngineState->userExperience, hr, restart, &applyCompleteAction); |
811 | } | 828 | if (BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART == applyCompleteAction) |
829 | { | ||
830 | pEngineState->fRestart = TRUE; | ||
831 | } | ||
812 | 832 | ||
813 | LogId(REPORT_STANDARD, MSG_APPLY_COMPLETE, hr, LoggingRestartToString(restart), LoggingBoolToString(pEngineState->fRestart)); | 833 | LogId(REPORT_STANDARD, MSG_APPLY_COMPLETE, hr, LoggingRestartToString(restart), LoggingBoolToString(pEngineState->fRestart)); |
834 | } | ||
814 | 835 | ||
815 | return hr; | 836 | return hr; |
816 | } | 837 | } |