From 9453eaa9a38f78e248526ddd996485140a5d4d9a Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 13 Mar 2022 23:51:36 -0500 Subject: Make engine skip planning if there are any downgrade related bundles. Fixes 6677, 6722 Reverts 6537 --- src/burn/engine/plan.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/burn/engine/plan.cpp') diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index dcb919c7..46680636 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp @@ -1328,11 +1328,12 @@ LExit: extern "C" HRESULT PlanRelatedBundlesInitialize( __in BURN_USER_EXPERIENCE* pUserExperience, __in BURN_REGISTRATION* pRegistration, - __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, - __in BURN_PLAN* /*pPlan*/ + __in BOOTSTRAPPER_RELATION_TYPE relationType, + __in BURN_PLAN* pPlan ) { HRESULT hr = S_OK; + BOOL fUninstalling = BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pPlan->action; for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i) { @@ -1356,6 +1357,19 @@ extern "C" HRESULT PlanRelatedBundlesInitialize( hr = UserExperienceOnPlanRelatedBundleType(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->planRelationType); ExitOnRootFailure(hr, "BA aborted plan related bundle type."); + + if (BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DOWNGRADE == pRelatedBundle->planRelationType && + pRelatedBundle->fPlannable && !fUninstalling && BOOTSTRAPPER_RELATION_UPGRADE != relationType) + { + if (!pPlan->fDowngrade) + { + pPlan->fDowngrade = TRUE; + + LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_DUE_TO_DOWNGRADE); + } + + LogId(REPORT_VERBOSE, MSG_UPGRADE_BUNDLE_DOWNGRADE, pRelatedBundle->package.sczId, pRelatedBundle->pVersion->sczVersion); + } } RelatedBundlesSortPlan(&pRegistration->relatedBundles); @@ -3011,6 +3025,7 @@ extern "C" void PlanDump( LogStringLine(PlanDumpLevel, " can affect machine state: %hs", LoggingTrueFalseToString(pPlan->fCanAffectMachineState)); LogStringLine(PlanDumpLevel, " disable-rollback: %hs", LoggingTrueFalseToString(pPlan->fDisableRollback)); LogStringLine(PlanDumpLevel, " disallow-removal: %hs", LoggingTrueFalseToString(pPlan->fDisallowRemoval)); + LogStringLine(PlanDumpLevel, " downgrade: %hs", LoggingTrueFalseToString(pPlan->fDowngrade)); LogStringLine(PlanDumpLevel, " registration options: %hs", LoggingRegistrationOptionsToString(pPlan->dwRegistrationOperations)); LogStringLine(PlanDumpLevel, " estimated size: %llu", pPlan->qwEstimatedSize); if (pPlan->sczLayoutDirectory) -- cgit v1.2.3-55-g6feb