diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-01 18:54:54 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-02-04 22:16:10 -0600 |
| commit | cede270b2bd3da6bd8d5205b8834e786c8d6c1ce (patch) | |
| tree | fc37ad41e0a03f67fc2a8946231e519551cdcc95 /src/engine/plan.cpp | |
| parent | f1f1a124df59e8639c2bcbfa7d3a4b37fb348bb7 (diff) | |
| download | wix-cede270b2bd3da6bd8d5205b8834e786c8d6c1ce.tar.gz wix-cede270b2bd3da6bd8d5205b8834e786c8d6c1ce.tar.bz2 wix-cede270b2bd3da6bd8d5205b8834e786c8d6c1ce.zip | |
Remove feature to uninstall compatible orphaned MSI packages.
Diffstat (limited to 'src/engine/plan.cpp')
| -rw-r--r-- | src/engine/plan.cpp | 79 |
1 files changed, 6 insertions, 73 deletions
diff --git a/src/engine/plan.cpp b/src/engine/plan.cpp index ffbe495f..a45eab62 100644 --- a/src/engine/plan.cpp +++ b/src/engine/plan.cpp | |||
| @@ -30,7 +30,6 @@ static void ResetPlannedRollbackBoundaryState( | |||
| 30 | ); | 30 | ); |
| 31 | static HRESULT ProcessPackage( | 31 | static HRESULT ProcessPackage( |
| 32 | __in BOOL fBundlePerMachine, | 32 | __in BOOL fBundlePerMachine, |
| 33 | __in_opt BURN_PACKAGE* pCompatiblePackageParent, | ||
| 34 | __in BURN_USER_EXPERIENCE* pUX, | 33 | __in BURN_USER_EXPERIENCE* pUX, |
| 35 | __in BURN_PLAN* pPlan, | 34 | __in BURN_PLAN* pPlan, |
| 36 | __in BURN_PACKAGE* pPackage, | 35 | __in BURN_PACKAGE* pPackage, |
| @@ -311,10 +310,6 @@ extern "C" void PlanUninitializeExecuteAction( | |||
| 311 | case BURN_EXECUTE_ACTION_TYPE_PACKAGE_DEPENDENCY: | 310 | case BURN_EXECUTE_ACTION_TYPE_PACKAGE_DEPENDENCY: |
| 312 | ReleaseStr(pExecuteAction->packageDependency.sczBundleProviderKey); | 311 | ReleaseStr(pExecuteAction->packageDependency.sczBundleProviderKey); |
| 313 | break; | 312 | break; |
| 314 | |||
| 315 | case BURN_EXECUTE_ACTION_TYPE_COMPATIBLE_PACKAGE: | ||
| 316 | ReleaseStr(pExecuteAction->compatiblePackage.sczInstalledProductCode); | ||
| 317 | break; | ||
| 318 | } | 313 | } |
| 319 | } | 314 | } |
| 320 | 315 | ||
| @@ -523,39 +518,8 @@ extern "C" HRESULT PlanPackages( | |||
| 523 | } | 518 | } |
| 524 | } | 519 | } |
| 525 | 520 | ||
| 526 | hr = ProcessPackage(fBundlePerMachine, NULL, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, wzLayoutDirectory, phSyncpointEvent, &pRollbackBoundary, &nonpermanentPackageIndices); | 521 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, wzLayoutDirectory, phSyncpointEvent, &pRollbackBoundary, &nonpermanentPackageIndices); |
| 527 | ExitOnFailure(hr, "Failed to process package."); | 522 | ExitOnFailure(hr, "Failed to process package."); |
| 528 | |||
| 529 | // Attempt to remove orphaned packages during uninstall. Currently only MSI packages are supported and should not require source. | ||
| 530 | if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action && BURN_PACKAGE_TYPE_MSI == pPackage->type && pPackage->Msi.fCompatibleInstalled) | ||
| 531 | { | ||
| 532 | BURN_PACKAGE* pCompatiblePackage = NULL; | ||
| 533 | BURN_EXECUTE_ACTION* pAction = NULL; | ||
| 534 | |||
| 535 | // Add the compatible package to the list. | ||
| 536 | hr = MsiEngineAddCompatiblePackage(pPackages, pPackage, &pCompatiblePackage); | ||
| 537 | ExitOnFailure(hr, "Failed to add compatible package for package: %ls", pPackage->sczId); | ||
| 538 | |||
| 539 | // Plan to load the compatible package into the elevated engine before its needed. | ||
| 540 | hr = PlanAppendExecuteAction(pPlan, &pAction); | ||
| 541 | ExitOnFailure(hr, "Failed to append execute action."); | ||
| 542 | |||
| 543 | pAction->type = BURN_EXECUTE_ACTION_TYPE_COMPATIBLE_PACKAGE; | ||
| 544 | pAction->compatiblePackage.pReferencePackage = pPackage; | ||
| 545 | pAction->compatiblePackage.pInstalledVersion = pCompatiblePackage->Msi.pVersion; | ||
| 546 | |||
| 547 | hr = StrAllocString(&pAction->compatiblePackage.sczInstalledProductCode, pCompatiblePackage->Msi.sczProductCode, 0); | ||
| 548 | ExitOnFailure(hr, "Failed to copy installed ProductCode"); | ||
| 549 | |||
| 550 | // Process the compatible MSI package like any other. | ||
| 551 | hr = ProcessPackage(fBundlePerMachine, pPackage, pUX, pPlan, pCompatiblePackage, pLog, pVariables, display, relationType, wzLayoutDirectory, phSyncpointEvent, &pRollbackBoundary, &nonpermanentPackageIndices); | ||
| 552 | ExitOnFailure(hr, "Failed to process compatible package."); | ||
| 553 | |||
| 554 | if (BOOTSTRAPPER_ACTION_STATE_UNINSTALL == pCompatiblePackage->execute) | ||
| 555 | { | ||
| 556 | LogId(REPORT_STANDARD, MSG_PLANNED_ORPHAN_PACKAGE_FROM_PROVIDER, pPackage->sczId, pCompatiblePackage->Msi.sczProductCode, pPackage->Msi.sczProductCode); | ||
| 557 | } | ||
| 558 | } | ||
| 559 | } | 523 | } |
| 560 | 524 | ||
| 561 | // Insert the "keep registration" and "remove registration" actions in the plan when installing the first time and anytime we are uninstalling respectively. | 525 | // Insert the "keep registration" and "remove registration" actions in the plan when installing the first time and anytime we are uninstalling respectively. |
| @@ -601,15 +565,6 @@ extern "C" HRESULT PlanPackages( | |||
| 601 | ExitOnFailure(hr, "Failed to plan clean package."); | 565 | ExitOnFailure(hr, "Failed to plan clean package."); |
| 602 | } | 566 | } |
| 603 | 567 | ||
| 604 | // Plan best-effort clean up of compatible packages. | ||
| 605 | for (DWORD i = 0; i < pPackages->cCompatiblePackages; ++i) | ||
| 606 | { | ||
| 607 | DWORD iPackage = (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) ? pPackages->cCompatiblePackages - 1 - i : i; | ||
| 608 | BURN_PACKAGE* pCompatiblePackage = pPackages->rgCompatiblePackages + iPackage; | ||
| 609 | |||
| 610 | PlanCleanPackage(pPlan, pCompatiblePackage); | ||
| 611 | } | ||
| 612 | |||
| 613 | LExit: | 568 | LExit: |
| 614 | return hr; | 569 | return hr; |
| 615 | } | 570 | } |
| @@ -809,7 +764,7 @@ extern "C" HRESULT PlanPassThroughBundle( | |||
| 809 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; | 764 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; |
| 810 | 765 | ||
| 811 | // Plan passthrough package. | 766 | // Plan passthrough package. |
| 812 | hr = ProcessPackage(fBundlePerMachine, NULL, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, NULL, phSyncpointEvent, &pRollbackBoundary, NULL); | 767 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, NULL, phSyncpointEvent, &pRollbackBoundary, NULL); |
| 813 | ExitOnFailure(hr, "Failed to process passthrough package."); | 768 | ExitOnFailure(hr, "Failed to process passthrough package."); |
| 814 | 769 | ||
| 815 | // If we still have an open rollback boundary, complete it. | 770 | // If we still have an open rollback boundary, complete it. |
| @@ -843,7 +798,7 @@ extern "C" HRESULT PlanUpdateBundle( | |||
| 843 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; | 798 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; |
| 844 | 799 | ||
| 845 | // Plan update package. | 800 | // Plan update package. |
| 846 | hr = ProcessPackage(fBundlePerMachine, NULL, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, NULL, phSyncpointEvent, &pRollbackBoundary, NULL); | 801 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, NULL, phSyncpointEvent, &pRollbackBoundary, NULL); |
| 847 | ExitOnFailure(hr, "Failed to process update package."); | 802 | ExitOnFailure(hr, "Failed to process update package."); |
| 848 | 803 | ||
| 849 | // If we still have an open rollback boundary, complete it. | 804 | // If we still have an open rollback boundary, complete it. |
| @@ -863,7 +818,6 @@ LExit: | |||
| 863 | 818 | ||
| 864 | static HRESULT ProcessPackage( | 819 | static HRESULT ProcessPackage( |
| 865 | __in BOOL fBundlePerMachine, | 820 | __in BOOL fBundlePerMachine, |
| 866 | __in_opt BURN_PACKAGE* pCompatiblePackageParent, | ||
| 867 | __in BURN_USER_EXPERIENCE* pUX, | 821 | __in BURN_USER_EXPERIENCE* pUX, |
| 868 | __in BURN_PLAN* pPlan, | 822 | __in BURN_PLAN* pPlan, |
| 869 | __in BURN_PACKAGE* pPackage, | 823 | __in BURN_PACKAGE* pPackage, |
| @@ -888,18 +842,8 @@ static HRESULT ProcessPackage( | |||
| 888 | pPackage->requested = pPackage->defaultRequested; | 842 | pPackage->requested = pPackage->defaultRequested; |
| 889 | fPlanPackageBegan = TRUE; | 843 | fPlanPackageBegan = TRUE; |
| 890 | 844 | ||
| 891 | if (pCompatiblePackageParent) | 845 | hr = UserExperienceOnPlanPackageBegin(pUX, pPackage->sczId, &pPackage->requested); |
| 892 | { | 846 | ExitOnRootFailure(hr, "BA aborted plan package begin."); |
| 893 | AssertSz(BURN_PACKAGE_TYPE_MSI == pPackage->type, "Currently only MSI packages have compatible packages."); | ||
| 894 | |||
| 895 | hr = UserExperienceOnPlanCompatibleMsiPackageBegin(pUX, pCompatiblePackageParent->sczId, pPackage->sczId, pPackage->Msi.pVersion, &pPackage->requested); | ||
| 896 | ExitOnRootFailure(hr, "BA aborted plan compatible MSI package begin."); | ||
| 897 | } | ||
| 898 | else | ||
| 899 | { | ||
| 900 | hr = UserExperienceOnPlanPackageBegin(pUX, pPackage->sczId, &pPackage->requested); | ||
| 901 | ExitOnRootFailure(hr, "BA aborted plan package begin."); | ||
| 902 | } | ||
| 903 | 847 | ||
| 904 | pEffectiveRollbackBoundary = (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) ? pPackage->pRollbackBoundaryBackward : pPackage->pRollbackBoundaryForward; | 848 | pEffectiveRollbackBoundary = (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) ? pPackage->pRollbackBoundaryBackward : pPackage->pRollbackBoundaryForward; |
| 905 | hr = ProcessPackageRollbackBoundary(pPlan, pEffectiveRollbackBoundary, ppRollbackBoundary); | 849 | hr = ProcessPackageRollbackBoundary(pPlan, pEffectiveRollbackBoundary, ppRollbackBoundary); |
| @@ -964,14 +908,7 @@ static HRESULT ProcessPackage( | |||
| 964 | LExit: | 908 | LExit: |
| 965 | if (fPlanPackageBegan) | 909 | if (fPlanPackageBegan) |
| 966 | { | 910 | { |
| 967 | if (pCompatiblePackageParent) | 911 | UserExperienceOnPlanPackageComplete(pUX, pPackage->sczId, hr, pPackage->currentState, pPackage->requested, pPackage->execute, pPackage->rollback); |
| 968 | { | ||
| 969 | UserExperienceOnPlanCompatibleMsiPackageComplete(pUX, pCompatiblePackageParent->sczId, pPackage->sczId, hr, pPackage->currentState, pPackage->requested, pPackage->execute, pPackage->rollback); | ||
| 970 | } | ||
| 971 | else | ||
| 972 | { | ||
| 973 | UserExperienceOnPlanPackageComplete(pUX, pPackage->sczId, hr, pPackage->currentState, pPackage->requested, pPackage->execute, pPackage->rollback); | ||
| 974 | } | ||
| 975 | } | 912 | } |
| 976 | 913 | ||
| 977 | return hr; | 914 | return hr; |
| @@ -3175,10 +3112,6 @@ static void ExecuteActionLog( | |||
| 3175 | LogStringLine(PlanDumpLevel, "%ls action[%u]: UNCACHE_PACKAGE id: %ls", wzBase, iAction, pAction->uncachePackage.pPackage->sczId); | 3112 | LogStringLine(PlanDumpLevel, "%ls action[%u]: UNCACHE_PACKAGE id: %ls", wzBase, iAction, pAction->uncachePackage.pPackage->sczId); |
| 3176 | break; | 3113 | break; |
| 3177 | 3114 | ||
| 3178 | case BURN_EXECUTE_ACTION_TYPE_COMPATIBLE_PACKAGE: | ||
| 3179 | LogStringLine(PlanDumpLevel, "%ls action[%u]: COMPATIBLE_PACKAGE reference id: %ls, installed ProductCode: %ls", wzBase, iAction, pAction->compatiblePackage.pReferencePackage->sczId, pAction->compatiblePackage.sczInstalledProductCode); | ||
| 3180 | break; | ||
| 3181 | |||
| 3182 | case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION: | 3115 | case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION: |
| 3183 | LogStringLine(PlanDumpLevel, "%ls action[%u]: BEGIN_MSI_TRANSACTION id: %ls", wzBase, iAction, pAction->msiTransaction.pRollbackBoundary->sczId); | 3116 | LogStringLine(PlanDumpLevel, "%ls action[%u]: BEGIN_MSI_TRANSACTION id: %ls", wzBase, iAction, pAction->msiTransaction.pRollbackBoundary->sczId); |
| 3184 | break; | 3117 | break; |
