aboutsummaryrefslogtreecommitdiff
path: root/src/burn
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-03-13 23:51:36 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-03-14 14:53:29 -0500
commit9453eaa9a38f78e248526ddd996485140a5d4d9a (patch)
tree8ef6bda85836fd3f1b9c2c6c16cb4a994519e863 /src/burn
parent78125b7c4bd59468275d65b63860bdb68b1bc6f1 (diff)
downloadwix-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')
-rw-r--r--src/burn/engine/core.cpp39
-rw-r--r--src/burn/engine/engine.mc14
-rw-r--r--src/burn/engine/plan.cpp19
-rw-r--r--src/burn/engine/plan.h1
-rw-r--r--src/burn/engine/userexperience.cpp24
-rw-r--r--src/burn/engine/userexperience.h4
-rw-r--r--src/burn/test/BurnUnitTest/PlanTest.cpp88
7 files changed, 178 insertions, 11 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}
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc
index a5c4e2ba..53e6b256 100644
--- a/src/burn/engine/engine.mc
+++ b/src/burn/engine/engine.mc
@@ -499,6 +499,20 @@ Language=English
499Ignoring bundle dependents due to action UnsafeUninstall... 499Ignoring bundle dependents due to action UnsafeUninstall...
500. 500.
501 501
502MessageId=224
503Severity=Warning
504SymbolicName=MSG_PLAN_SKIPPED_DUE_TO_DOWNGRADE
505Language=English
506Plan skipped due to related bundle of plan type Downgrade:
507.
508
509MessageId=225
510Severity=Warning
511SymbolicName=MSG_UPGRADE_BUNDLE_DOWNGRADE
512Language=English
513 id: %1!ls!, version: %2!ls!
514.
515
502MessageId=299 516MessageId=299
503Severity=Success 517Severity=Success
504SymbolicName=MSG_PLAN_COMPLETE 518SymbolicName=MSG_PLAN_COMPLETE
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:
1328extern "C" HRESULT PlanRelatedBundlesInitialize( 1328extern "C" HRESULT PlanRelatedBundlesInitialize(
1329 __in BURN_USER_EXPERIENCE* pUserExperience, 1329 __in BURN_USER_EXPERIENCE* pUserExperience,
1330 __in BURN_REGISTRATION* pRegistration, 1330 __in BURN_REGISTRATION* pRegistration,
1331 __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, 1331 __in BOOTSTRAPPER_RELATION_TYPE relationType,
1332 __in BURN_PLAN* /*pPlan*/ 1332 __in BURN_PLAN* pPlan
1333 ) 1333 )
1334{ 1334{
1335 HRESULT hr = S_OK; 1335 HRESULT hr = S_OK;
1336 BOOL fUninstalling = BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pPlan->action;
1336 1337
1337 for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i) 1338 for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i)
1338 { 1339 {
@@ -1356,6 +1357,19 @@ extern "C" HRESULT PlanRelatedBundlesInitialize(
1356 1357
1357 hr = UserExperienceOnPlanRelatedBundleType(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->planRelationType); 1358 hr = UserExperienceOnPlanRelatedBundleType(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->planRelationType);
1358 ExitOnRootFailure(hr, "BA aborted plan related bundle type."); 1359 ExitOnRootFailure(hr, "BA aborted plan related bundle type.");
1360
1361 if (BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DOWNGRADE == pRelatedBundle->planRelationType &&
1362 pRelatedBundle->fPlannable && !fUninstalling && BOOTSTRAPPER_RELATION_UPGRADE != relationType)
1363 {
1364 if (!pPlan->fDowngrade)
1365 {
1366 pPlan->fDowngrade = TRUE;
1367
1368 LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_DUE_TO_DOWNGRADE);
1369 }
1370
1371 LogId(REPORT_VERBOSE, MSG_UPGRADE_BUNDLE_DOWNGRADE, pRelatedBundle->package.sczId, pRelatedBundle->pVersion->sczVersion);
1372 }
1359 } 1373 }
1360 1374
1361 RelatedBundlesSortPlan(&pRegistration->relatedBundles); 1375 RelatedBundlesSortPlan(&pRegistration->relatedBundles);
@@ -3011,6 +3025,7 @@ extern "C" void PlanDump(
3011 LogStringLine(PlanDumpLevel, " can affect machine state: %hs", LoggingTrueFalseToString(pPlan->fCanAffectMachineState)); 3025 LogStringLine(PlanDumpLevel, " can affect machine state: %hs", LoggingTrueFalseToString(pPlan->fCanAffectMachineState));
3012 LogStringLine(PlanDumpLevel, " disable-rollback: %hs", LoggingTrueFalseToString(pPlan->fDisableRollback)); 3026 LogStringLine(PlanDumpLevel, " disable-rollback: %hs", LoggingTrueFalseToString(pPlan->fDisableRollback));
3013 LogStringLine(PlanDumpLevel, " disallow-removal: %hs", LoggingTrueFalseToString(pPlan->fDisallowRemoval)); 3027 LogStringLine(PlanDumpLevel, " disallow-removal: %hs", LoggingTrueFalseToString(pPlan->fDisallowRemoval));
3028 LogStringLine(PlanDumpLevel, " downgrade: %hs", LoggingTrueFalseToString(pPlan->fDowngrade));
3014 LogStringLine(PlanDumpLevel, " registration options: %hs", LoggingRegistrationOptionsToString(pPlan->dwRegistrationOperations)); 3029 LogStringLine(PlanDumpLevel, " registration options: %hs", LoggingRegistrationOptionsToString(pPlan->dwRegistrationOperations));
3015 LogStringLine(PlanDumpLevel, " estimated size: %llu", pPlan->qwEstimatedSize); 3030 LogStringLine(PlanDumpLevel, " estimated size: %llu", pPlan->qwEstimatedSize);
3016 if (pPlan->sczLayoutDirectory) 3031 if (pPlan->sczLayoutDirectory)
diff --git a/src/burn/engine/plan.h b/src/burn/engine/plan.h
index 1f3fe07c..e73cbcfa 100644
--- a/src/burn/engine/plan.h
+++ b/src/burn/engine/plan.h
@@ -250,6 +250,7 @@ typedef struct _BURN_PLAN
250 BOOL fAffectedMachineState; 250 BOOL fAffectedMachineState;
251 LPWSTR sczLayoutDirectory; 251 LPWSTR sczLayoutDirectory;
252 BOOL fPlanPackageCacheRollback; 252 BOOL fPlanPackageCacheRollback;
253 BOOL fDowngrade;
253 254
254 DWORD64 qwCacheSizeTotal; 255 DWORD64 qwCacheSizeTotal;
255 256
diff --git a/src/burn/engine/userexperience.cpp b/src/burn/engine/userexperience.cpp
index 8668cf6f..81ce8bb9 100644
--- a/src/burn/engine/userexperience.cpp
+++ b/src/burn/engine/userexperience.cpp
@@ -335,6 +335,30 @@ LExit:
335 return hr; 335 return hr;
336} 336}
337 337
338EXTERN_C BAAPI UserExperienceOnApplyDowngrade(
339 __in BURN_USER_EXPERIENCE* pUserExperience,
340 __inout HRESULT* phrStatus
341 )
342{
343 HRESULT hr = S_OK;
344 BA_ONAPPLYDOWNGRADE_ARGS args = { };
345 BA_ONAPPLYDOWNGRADE_RESULTS results = { };
346
347 args.cbSize = sizeof(args);
348 args.hrRecommended = *phrStatus;
349
350 results.cbSize = sizeof(results);
351 results.hrStatus = *phrStatus;
352
353 hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE, &args, &results);
354 ExitOnFailure(hr, "BA OnApplyDowngrade failed.");
355
356 *phrStatus = results.hrStatus;
357
358LExit:
359 return hr;
360}
361
338EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionBegin( 362EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionBegin(
339 __in BURN_USER_EXPERIENCE* pUserExperience, 363 __in BURN_USER_EXPERIENCE* pUserExperience,
340 __in LPCWSTR wzTransactionId 364 __in LPCWSTR wzTransactionId
diff --git a/src/burn/engine/userexperience.h b/src/burn/engine/userexperience.h
index 11344365..2f18acdd 100644
--- a/src/burn/engine/userexperience.h
+++ b/src/burn/engine/userexperience.h
@@ -110,6 +110,10 @@ BAAPI UserExperienceOnApplyComplete(
110 __in BOOTSTRAPPER_APPLY_RESTART restart, 110 __in BOOTSTRAPPER_APPLY_RESTART restart,
111 __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction 111 __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction
112 ); 112 );
113BAAPI UserExperienceOnApplyDowngrade(
114 __in BURN_USER_EXPERIENCE* pUserExperience,
115 __inout HRESULT* phrStatus
116 );
113BAAPI UserExperienceOnBeginMsiTransactionBegin( 117BAAPI UserExperienceOnBeginMsiTransactionBegin(
114 __in BURN_USER_EXPERIENCE* pUserExperience, 118 __in BURN_USER_EXPERIENCE* pUserExperience,
115 __in LPCWSTR wzTransactionId 119 __in LPCWSTR wzTransactionId
diff --git a/src/burn/test/BurnUnitTest/PlanTest.cpp b/src/burn/test/BurnUnitTest/PlanTest.cpp
index a3b58426..0a8ac369 100644
--- a/src/burn/test/BurnUnitTest/PlanTest.cpp
+++ b/src/burn/test/BurnUnitTest/PlanTest.cpp
@@ -67,6 +67,7 @@ namespace Bootstrapper
67 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 67 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
68 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 68 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
69 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 69 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
70 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
70 71
71 BOOL fRollback = FALSE; 72 BOOL fRollback = FALSE;
72 DWORD dwIndex = 0; 73 DWORD dwIndex = 0;
@@ -226,6 +227,7 @@ namespace Bootstrapper
226 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 227 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
227 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 228 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
228 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 229 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
230 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
229 231
230 BOOL fRollback = FALSE; 232 BOOL fRollback = FALSE;
231 DWORD dwIndex = 0; 233 DWORD dwIndex = 0;
@@ -358,6 +360,7 @@ namespace Bootstrapper
358 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 360 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
359 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 361 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
360 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 362 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
363 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
361 364
362 BOOL fRollback = FALSE; 365 BOOL fRollback = FALSE;
363 DWORD dwIndex = 0; 366 DWORD dwIndex = 0;
@@ -457,6 +460,7 @@ namespace Bootstrapper
457 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 460 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
458 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 461 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
459 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 462 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
463 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
460 464
461 BOOL fRollback = FALSE; 465 BOOL fRollback = FALSE;
462 DWORD dwIndex = 0; 466 DWORD dwIndex = 0;
@@ -575,6 +579,7 @@ namespace Bootstrapper
575 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 579 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
576 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 580 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
577 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 581 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
582 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
578 583
579 BOOL fRollback = FALSE; 584 BOOL fRollback = FALSE;
580 DWORD dwIndex = 0; 585 DWORD dwIndex = 0;
@@ -677,6 +682,7 @@ namespace Bootstrapper
677 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 682 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
678 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 683 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
679 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 684 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
685 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
680 686
681 BOOL fRollback = FALSE; 687 BOOL fRollback = FALSE;
682 DWORD dwIndex = 0; 688 DWORD dwIndex = 0;
@@ -742,6 +748,76 @@ namespace Bootstrapper
742 } 748 }
743 749
744 [Fact] 750 [Fact]
751 void SingleMsiDowngradeTest()
752 {
753 HRESULT hr = S_OK;
754 BURN_ENGINE_STATE engineState = { };
755 BURN_ENGINE_STATE* pEngineState = &engineState;
756 BURN_PLAN* pPlan = &engineState.plan;
757
758 InitializeEngineStateForCorePlan(wzSingleMsiManifestFileName, pEngineState);
759 DetectAttachedContainerAsAttached(pEngineState);
760 DetectPackagesAsAbsent(pEngineState);
761 DetectRelatedBundle(pEngineState, L"{AF8355C9-CCDD-4D61-BF5F-EA5F948D8F01}", L"1.1.0.0", BOOTSTRAPPER_RELATION_UPGRADE);
762
763 hr = CorePlan(pEngineState, BOOTSTRAPPER_ACTION_INSTALL);
764 NativeAssert::Succeeded(hr, "CorePlan failed");
765
766 Assert::Equal<DWORD>(BOOTSTRAPPER_ACTION_INSTALL, pPlan->action);
767 NativeAssert::StringEqual(L"{A6F0CBF7-1578-450C-B9D7-9CF2EEC40002}", pPlan->wzBundleId);
768 NativeAssert::StringEqual(L"{A6F0CBF7-1578-450C-B9D7-9CF2EEC40002}", pPlan->wzBundleProviderKey);
769 Assert::Equal<BOOL>(FALSE, pPlan->fEnabledForwardCompatibleBundle);
770 Assert::Equal<BOOL>(TRUE, pPlan->fPerMachine);
771 Assert::Equal<BOOL>(FALSE, pPlan->fCanAffectMachineState);
772 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
773 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
774 Assert::Equal<BOOL>(TRUE, pPlan->fDowngrade);
775
776 BOOL fRollback = FALSE;
777 DWORD dwIndex = 0;
778 Assert::Equal(dwIndex, pPlan->cRegistrationActions);
779
780 fRollback = TRUE;
781 dwIndex = 0;
782 Assert::Equal(dwIndex, pPlan->cRollbackRegistrationActions);
783
784 fRollback = FALSE;
785 dwIndex = 0;
786 Assert::Equal(dwIndex, pPlan->cCacheActions);
787
788 fRollback = TRUE;
789 dwIndex = 0;
790 Assert::Equal(dwIndex, pPlan->cRollbackCacheActions);
791
792 Assert::Equal(0ull, pPlan->qwEstimatedSize);
793 Assert::Equal(0ull, pPlan->qwCacheSizeTotal);
794
795 fRollback = FALSE;
796 dwIndex = 0;
797 Assert::Equal(dwIndex, pPlan->cExecuteActions);
798
799 fRollback = TRUE;
800 dwIndex = 0;
801 Assert::Equal(dwIndex, pPlan->cRollbackActions);
802
803 Assert::Equal(0ul, pPlan->cExecutePackagesTotal);
804 Assert::Equal(0ul, pPlan->cOverallProgressTicksTotal);
805
806 dwIndex = 0;
807 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
808
809 dwIndex = 0;
810 Assert::Equal(dwIndex, pPlan->cCleanActions);
811
812 UINT uIndex = 0;
813 ValidatePlannedProvider(pPlan, uIndex++, L"{A6F0CBF7-1578-450C-B9D7-9CF2EEC40002}", NULL);
814 Assert::Equal(uIndex, pPlan->cPlannedProviders);
815
816 Assert::Equal(1ul, pEngineState->packages.cPackages);
817 ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[0], L"PackageA", BURN_PACKAGE_REGISTRATION_STATE_UNKNOWN, BURN_PACKAGE_REGISTRATION_STATE_UNKNOWN);
818 }
819
820 [Fact]
745 void SingleMsiForceAbsentTest() 821 void SingleMsiForceAbsentTest()
746 { 822 {
747 HRESULT hr = S_OK; 823 HRESULT hr = S_OK;
@@ -770,6 +846,7 @@ namespace Bootstrapper
770 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 846 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
771 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 847 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
772 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 848 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
849 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
773 850
774 BOOL fRollback = FALSE; 851 BOOL fRollback = FALSE;
775 DWORD dwIndex = 0; 852 DWORD dwIndex = 0;
@@ -858,6 +935,7 @@ namespace Bootstrapper
858 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 935 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
859 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 936 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
860 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 937 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
938 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
861 939
862 BOOL fRollback = FALSE; 940 BOOL fRollback = FALSE;
863 DWORD dwIndex = 0; 941 DWORD dwIndex = 0;
@@ -948,6 +1026,7 @@ namespace Bootstrapper
948 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1026 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
949 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1027 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
950 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1028 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1029 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
951 1030
952 BOOL fRollback = FALSE; 1031 BOOL fRollback = FALSE;
953 DWORD dwIndex = 0; 1032 DWORD dwIndex = 0;
@@ -1053,6 +1132,7 @@ namespace Bootstrapper
1053 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1132 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1054 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1133 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1055 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1134 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1135 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1056 1136
1057 BOOL fRollback = FALSE; 1137 BOOL fRollback = FALSE;
1058 DWORD dwIndex = 0; 1138 DWORD dwIndex = 0;
@@ -1131,6 +1211,7 @@ namespace Bootstrapper
1131 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1211 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1132 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1212 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1133 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1213 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1214 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1134 1215
1135 BOOL fRollback = FALSE; 1216 BOOL fRollback = FALSE;
1136 DWORD dwIndex = 0; 1217 DWORD dwIndex = 0;
@@ -1225,6 +1306,7 @@ namespace Bootstrapper
1225 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1306 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1226 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1307 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1227 Assert::Equal<BOOL>(TRUE, pPlan->fDisallowRemoval); 1308 Assert::Equal<BOOL>(TRUE, pPlan->fDisallowRemoval);
1309 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1228 1310
1229 BOOL fRollback = FALSE; 1311 BOOL fRollback = FALSE;
1230 DWORD dwIndex = 0; 1312 DWORD dwIndex = 0;
@@ -1294,6 +1376,7 @@ namespace Bootstrapper
1294 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1376 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1295 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1377 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1296 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1378 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1379 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1297 1380
1298 BOOL fRollback = FALSE; 1381 BOOL fRollback = FALSE;
1299 DWORD dwIndex = 0; 1382 DWORD dwIndex = 0;
@@ -1377,6 +1460,7 @@ namespace Bootstrapper
1377 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1460 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1378 Assert::Equal<BOOL>(TRUE, pPlan->fDisableRollback); 1461 Assert::Equal<BOOL>(TRUE, pPlan->fDisableRollback);
1379 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1462 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1463 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1380 1464
1381 BOOL fRollback = FALSE; 1465 BOOL fRollback = FALSE;
1382 DWORD dwIndex = 0; 1466 DWORD dwIndex = 0;
@@ -1471,6 +1555,7 @@ namespace Bootstrapper
1471 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1555 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1472 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1556 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1473 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1557 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1558 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1474 1559
1475 BOOL fRollback = FALSE; 1560 BOOL fRollback = FALSE;
1476 DWORD dwIndex = 0; 1561 DWORD dwIndex = 0;
@@ -1601,6 +1686,7 @@ namespace Bootstrapper
1601 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1686 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1602 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1687 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1603 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1688 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1689 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1604 1690
1605 BOOL fRollback = FALSE; 1691 BOOL fRollback = FALSE;
1606 DWORD dwIndex = 0; 1692 DWORD dwIndex = 0;
@@ -1716,6 +1802,7 @@ namespace Bootstrapper
1716 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1802 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1717 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1803 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1718 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1804 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1805 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1719 1806
1720 BOOL fRollback = FALSE; 1807 BOOL fRollback = FALSE;
1721 DWORD dwIndex = 0; 1808 DWORD dwIndex = 0;
@@ -1810,6 +1897,7 @@ namespace Bootstrapper
1810 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); 1897 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1811 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); 1898 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1812 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); 1899 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1900 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1813 1901
1814 BOOL fRollback = FALSE; 1902 BOOL fRollback = FALSE;
1815 DWORD dwIndex = 0; 1903 DWORD dwIndex = 0;