diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-02 18:09:58 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-02-04 22:16:10 -0600 |
| commit | fd8c2b0899bfbce07386af245c04eb21dc01cbdf (patch) | |
| tree | 33d928124b0028729916189ddb9f239a9574c75d /src/engine/plan.cpp | |
| parent | 39725a1a6d1c72a6748bd3c306af32bcae6dbf8f (diff) | |
| download | wix-fd8c2b0899bfbce07386af245c04eb21dc01cbdf.tar.gz wix-fd8c2b0899bfbce07386af245c04eb21dc01cbdf.tar.bz2 wix-fd8c2b0899bfbce07386af245c04eb21dc01cbdf.zip | |
Update the logic for determining when the bundle should be registered.
The basic rule is that if a non-permanent package is present at the end of the chain, then the bundle should be registered. If no non-permanent packages are present at the end of the chain, then the bundle should not be registered. This required tracking what actually happened with each package during Apply.
Include cache status in registration calculation.
Include dependency ref-counting when determining whether the bundle should be registered.
Diffstat (limited to 'src/engine/plan.cpp')
| -rw-r--r-- | src/engine/plan.cpp | 192 |
1 files changed, 60 insertions, 132 deletions
diff --git a/src/engine/plan.cpp b/src/engine/plan.cpp index 6f5407b9..1aaec252 100644 --- a/src/engine/plan.cpp +++ b/src/engine/plan.cpp | |||
| @@ -6,13 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | // internal struct definitions | 7 | // internal struct definitions |
| 8 | 8 | ||
| 9 | struct PLAN_NONPERMANENT_PACKAGE_INDICES | ||
| 10 | { | ||
| 11 | DWORD iAfterExecuteFirstNonPermanentPackage; | ||
| 12 | DWORD iBeforeRollbackFirstNonPermanentPackage; | ||
| 13 | DWORD iAfterExecuteLastNonPermanentPackage; | ||
| 14 | DWORD iAfterRollbackLastNonPermanentPackage; | ||
| 15 | }; | ||
| 16 | 9 | ||
| 17 | // internal function definitions | 10 | // internal function definitions |
| 18 | 11 | ||
| @@ -39,8 +32,7 @@ static HRESULT ProcessPackage( | |||
| 39 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 32 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 40 | __in_z_opt LPCWSTR wzLayoutDirectory, | 33 | __in_z_opt LPCWSTR wzLayoutDirectory, |
| 41 | __inout HANDLE* phSyncpointEvent, | 34 | __inout HANDLE* phSyncpointEvent, |
| 42 | __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary, | 35 | __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary |
| 43 | __in_opt PLAN_NONPERMANENT_PACKAGE_INDICES* pNonpermanentPackageIndices | ||
| 44 | ); | 36 | ); |
| 45 | static HRESULT ProcessPackageRollbackBoundary( | 37 | static HRESULT ProcessPackageRollbackBoundary( |
| 46 | __in BURN_PLAN* pPlan, | 38 | __in BURN_PLAN* pPlan, |
| @@ -479,7 +471,7 @@ extern "C" HRESULT PlanPackages( | |||
| 479 | __in BURN_PLAN* pPlan, | 471 | __in BURN_PLAN* pPlan, |
| 480 | __in BURN_LOGGING* pLog, | 472 | __in BURN_LOGGING* pLog, |
| 481 | __in BURN_VARIABLES* pVariables, | 473 | __in BURN_VARIABLES* pVariables, |
| 482 | __in BOOL fBundleInstalled, | 474 | __in BOOL /*fBundleInstalled*/, |
| 483 | __in BOOTSTRAPPER_DISPLAY display, | 475 | __in BOOTSTRAPPER_DISPLAY display, |
| 484 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 476 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 485 | __in_z_opt LPCWSTR wzLayoutDirectory, | 477 | __in_z_opt LPCWSTR wzLayoutDirectory, |
| @@ -490,12 +482,6 @@ extern "C" HRESULT PlanPackages( | |||
| 490 | BOOL fBundlePerMachine = pPlan->fPerMachine; // bundle is per-machine if plan starts per-machine. | 482 | BOOL fBundlePerMachine = pPlan->fPerMachine; // bundle is per-machine if plan starts per-machine. |
| 491 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; | 483 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; |
| 492 | 484 | ||
| 493 | PLAN_NONPERMANENT_PACKAGE_INDICES nonpermanentPackageIndices; | ||
| 494 | nonpermanentPackageIndices.iAfterExecuteFirstNonPermanentPackage = BURN_PLAN_INVALID_ACTION_INDEX; | ||
| 495 | nonpermanentPackageIndices.iBeforeRollbackFirstNonPermanentPackage = BURN_PLAN_INVALID_ACTION_INDEX; | ||
| 496 | nonpermanentPackageIndices.iAfterExecuteLastNonPermanentPackage = BURN_PLAN_INVALID_ACTION_INDEX; | ||
| 497 | nonpermanentPackageIndices.iAfterRollbackLastNonPermanentPackage = BURN_PLAN_INVALID_ACTION_INDEX; | ||
| 498 | |||
| 499 | // Plan the packages. | 485 | // Plan the packages. |
| 500 | for (DWORD i = 0; i < pPackages->cPackages; ++i) | 486 | for (DWORD i = 0; i < pPackages->cPackages; ++i) |
| 501 | { | 487 | { |
| @@ -518,34 +504,10 @@ extern "C" HRESULT PlanPackages( | |||
| 518 | } | 504 | } |
| 519 | } | 505 | } |
| 520 | 506 | ||
| 521 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, wzLayoutDirectory, phSyncpointEvent, &pRollbackBoundary, &nonpermanentPackageIndices); | 507 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, wzLayoutDirectory, phSyncpointEvent, &pRollbackBoundary); |
| 522 | ExitOnFailure(hr, "Failed to process package."); | 508 | ExitOnFailure(hr, "Failed to process package."); |
| 523 | } | 509 | } |
| 524 | 510 | ||
| 525 | // Insert the "keep registration" and "remove registration" actions in the plan when installing the first time and anytime we are uninstalling respectively. | ||
| 526 | if (!fBundleInstalled && (BOOTSTRAPPER_ACTION_INSTALL == pPlan->action || BOOTSTRAPPER_ACTION_MODIFY == pPlan->action || BOOTSTRAPPER_ACTION_REPAIR == pPlan->action)) | ||
| 527 | { | ||
| 528 | if (BURN_PLAN_INVALID_ACTION_INDEX == nonpermanentPackageIndices.iAfterExecuteFirstNonPermanentPackage) | ||
| 529 | { | ||
| 530 | nonpermanentPackageIndices.iAfterExecuteFirstNonPermanentPackage = pPlan->cExecuteActions; | ||
| 531 | nonpermanentPackageIndices.iBeforeRollbackFirstNonPermanentPackage = pPlan->cRollbackActions; | ||
| 532 | } | ||
| 533 | |||
| 534 | hr = PlanKeepRegistration(pPlan, nonpermanentPackageIndices.iAfterExecuteFirstNonPermanentPackage, nonpermanentPackageIndices.iBeforeRollbackFirstNonPermanentPackage); | ||
| 535 | ExitOnFailure(hr, "Failed to plan install keep registration."); | ||
| 536 | } | ||
| 537 | else if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) | ||
| 538 | { | ||
| 539 | if (BURN_PLAN_INVALID_ACTION_INDEX == nonpermanentPackageIndices.iAfterExecuteLastNonPermanentPackage) | ||
| 540 | { | ||
| 541 | nonpermanentPackageIndices.iAfterExecuteLastNonPermanentPackage = pPlan->cExecuteActions; | ||
| 542 | nonpermanentPackageIndices.iAfterRollbackLastNonPermanentPackage = pPlan->cRollbackActions; | ||
| 543 | } | ||
| 544 | |||
| 545 | hr = PlanRemoveRegistration(pPlan, nonpermanentPackageIndices.iAfterExecuteLastNonPermanentPackage, nonpermanentPackageIndices.iAfterRollbackLastNonPermanentPackage); | ||
| 546 | ExitOnFailure(hr, "Failed to plan uninstall remove registration."); | ||
| 547 | } | ||
| 548 | |||
| 549 | // If we still have an open rollback boundary, complete it. | 511 | // If we still have an open rollback boundary, complete it. |
| 550 | if (pRollbackBoundary) | 512 | if (pRollbackBoundary) |
| 551 | { | 513 | { |
| @@ -572,9 +534,9 @@ LExit: | |||
| 572 | extern "C" HRESULT PlanRegistration( | 534 | extern "C" HRESULT PlanRegistration( |
| 573 | __in BURN_PLAN* pPlan, | 535 | __in BURN_PLAN* pPlan, |
| 574 | __in BURN_REGISTRATION* pRegistration, | 536 | __in BURN_REGISTRATION* pRegistration, |
| 575 | __in BOOTSTRAPPER_RESUME_TYPE resumeType, | 537 | __in BOOTSTRAPPER_RESUME_TYPE /*resumeType*/, |
| 576 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 538 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 577 | __out BOOL* pfContinuePlanning | 539 | __inout BOOL* pfContinuePlanning |
| 578 | ) | 540 | ) |
| 579 | { | 541 | { |
| 580 | HRESULT hr = S_OK; | 542 | HRESULT hr = S_OK; |
| @@ -583,9 +545,6 @@ extern "C" HRESULT PlanRegistration( | |||
| 583 | 545 | ||
| 584 | pPlan->fRegister = TRUE; // register the bundle since we're modifying machine state. | 546 | pPlan->fRegister = TRUE; // register the bundle since we're modifying machine state. |
| 585 | 547 | ||
| 586 | // Keep the registration if the bundle was already installed or we are planning after a restart. | ||
| 587 | pPlan->fKeepRegistrationDefault = (pRegistration->fInstalled || BOOTSTRAPPER_RESUME_TYPE_REBOOT == resumeType); | ||
| 588 | |||
| 589 | pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed | 548 | pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed |
| 590 | 549 | ||
| 591 | if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) | 550 | if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) |
| @@ -692,7 +651,7 @@ extern "C" HRESULT PlanRegistration( | |||
| 692 | pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE; | 651 | pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE; |
| 693 | pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION; | 652 | pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION; |
| 694 | } | 653 | } |
| 695 | else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action && !CacheBundleRunningFromCache()) // repairing but not not running from the cache. | 654 | else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action && !CacheBundleRunningFromCache()) // repairing but not running from the cache. |
| 696 | { | 655 | { |
| 697 | pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE; | 656 | pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE; |
| 698 | pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION; | 657 | pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION; |
| @@ -786,7 +745,7 @@ extern "C" HRESULT PlanPassThroughBundle( | |||
| 786 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; | 745 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; |
| 787 | 746 | ||
| 788 | // Plan passthrough package. | 747 | // Plan passthrough package. |
| 789 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, NULL, phSyncpointEvent, &pRollbackBoundary, NULL); | 748 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, NULL, phSyncpointEvent, &pRollbackBoundary); |
| 790 | ExitOnFailure(hr, "Failed to process passthrough package."); | 749 | ExitOnFailure(hr, "Failed to process passthrough package."); |
| 791 | 750 | ||
| 792 | // If we still have an open rollback boundary, complete it. | 751 | // If we still have an open rollback boundary, complete it. |
| @@ -820,7 +779,7 @@ extern "C" HRESULT PlanUpdateBundle( | |||
| 820 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; | 779 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; |
| 821 | 780 | ||
| 822 | // Plan update package. | 781 | // Plan update package. |
| 823 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, NULL, phSyncpointEvent, &pRollbackBoundary, NULL); | 782 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, NULL, phSyncpointEvent, &pRollbackBoundary); |
| 824 | ExitOnFailure(hr, "Failed to process update package."); | 783 | ExitOnFailure(hr, "Failed to process update package."); |
| 825 | 784 | ||
| 826 | // If we still have an open rollback boundary, complete it. | 785 | // If we still have an open rollback boundary, complete it. |
| @@ -849,8 +808,7 @@ static HRESULT ProcessPackage( | |||
| 849 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 808 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 850 | __in_z_opt LPCWSTR wzLayoutDirectory, | 809 | __in_z_opt LPCWSTR wzLayoutDirectory, |
| 851 | __inout HANDLE* phSyncpointEvent, | 810 | __inout HANDLE* phSyncpointEvent, |
| 852 | __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary, | 811 | __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary |
| 853 | __in_opt PLAN_NONPERMANENT_PACKAGE_INDICES* pNonpermanentPackageIndices | ||
| 854 | ) | 812 | ) |
| 855 | { | 813 | { |
| 856 | HRESULT hr = S_OK; | 814 | HRESULT hr = S_OK; |
| @@ -871,6 +829,12 @@ static HRESULT ProcessPackage( | |||
| 871 | hr = ProcessPackageRollbackBoundary(pPlan, pEffectiveRollbackBoundary, ppRollbackBoundary); | 829 | hr = ProcessPackageRollbackBoundary(pPlan, pEffectiveRollbackBoundary, ppRollbackBoundary); |
| 872 | ExitOnFailure(hr, "Failed to process package rollback boundary."); | 830 | ExitOnFailure(hr, "Failed to process package rollback boundary."); |
| 873 | 831 | ||
| 832 | if (pPackage->fCanAffectRegistration) | ||
| 833 | { | ||
| 834 | pPackage->expectedCacheRegistrationState = pPackage->cacheRegistrationState; | ||
| 835 | pPackage->expectedInstallRegistrationState = pPackage->installRegistrationState; | ||
| 836 | } | ||
| 837 | |||
| 874 | // If the package is in a requested state, plan it. | 838 | // If the package is in a requested state, plan it. |
| 875 | if (BOOTSTRAPPER_REQUEST_STATE_NONE != pPackage->requested) | 839 | if (BOOTSTRAPPER_REQUEST_STATE_NONE != pPackage->requested) |
| 876 | { | 840 | { |
| @@ -881,26 +845,19 @@ static HRESULT ProcessPackage( | |||
| 881 | } | 845 | } |
| 882 | else | 846 | else |
| 883 | { | 847 | { |
| 884 | if (pPackage->fUninstallable && pNonpermanentPackageIndices) | ||
| 885 | { | ||
| 886 | if (BURN_PLAN_INVALID_ACTION_INDEX == pNonpermanentPackageIndices->iBeforeRollbackFirstNonPermanentPackage) | ||
| 887 | { | ||
| 888 | pNonpermanentPackageIndices->iBeforeRollbackFirstNonPermanentPackage = pPlan->cRollbackActions; | ||
| 889 | } | ||
| 890 | } | ||
| 891 | |||
| 892 | hr = PlanExecutePackage(fBundlePerMachine, display, pUX, pPlan, pPackage, pLog, pVariables, phSyncpointEvent); | 848 | hr = PlanExecutePackage(fBundlePerMachine, display, pUX, pPlan, pPackage, pLog, pVariables, phSyncpointEvent); |
| 893 | ExitOnFailure(hr, "Failed to plan execute package."); | 849 | ExitOnFailure(hr, "Failed to plan execute package."); |
| 894 | 850 | ||
| 895 | if (pPackage->fUninstallable && pNonpermanentPackageIndices) | 851 | if (pPackage->fCanAffectRegistration) |
| 896 | { | 852 | { |
| 897 | if (BURN_PLAN_INVALID_ACTION_INDEX == pNonpermanentPackageIndices->iAfterExecuteFirstNonPermanentPackage) | 853 | if (BOOTSTRAPPER_ACTION_STATE_UNINSTALL < pPackage->execute) |
| 898 | { | 854 | { |
| 899 | pNonpermanentPackageIndices->iAfterExecuteFirstNonPermanentPackage = pPlan->cExecuteActions - 1; | 855 | pPackage->expectedInstallRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_PRESENT; |
| 856 | } | ||
| 857 | else if (BOOTSTRAPPER_ACTION_STATE_UNINSTALL == pPackage->execute) | ||
| 858 | { | ||
| 859 | pPackage->expectedInstallRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_ABSENT; | ||
| 900 | } | 860 | } |
| 901 | |||
| 902 | pNonpermanentPackageIndices->iAfterExecuteLastNonPermanentPackage = pPlan->cExecuteActions; | ||
| 903 | pNonpermanentPackageIndices->iAfterRollbackLastNonPermanentPackage = pPlan->cRollbackActions; | ||
| 904 | } | 861 | } |
| 905 | } | 862 | } |
| 906 | } | 863 | } |
| @@ -920,6 +877,32 @@ static HRESULT ProcessPackage( | |||
| 920 | } | 877 | } |
| 921 | } | 878 | } |
| 922 | 879 | ||
| 880 | if (pPackage->fCanAffectRegistration) | ||
| 881 | { | ||
| 882 | if (BURN_DEPENDENCY_ACTION_REGISTER == pPackage->dependencyExecute) | ||
| 883 | { | ||
| 884 | if (BURN_PACKAGE_REGISTRATION_STATE_IGNORED == pPackage->expectedCacheRegistrationState) | ||
| 885 | { | ||
| 886 | pPackage->expectedCacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_PRESENT; | ||
| 887 | } | ||
| 888 | if (BURN_PACKAGE_REGISTRATION_STATE_IGNORED == pPackage->expectedInstallRegistrationState) | ||
| 889 | { | ||
| 890 | pPackage->expectedInstallRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_PRESENT; | ||
| 891 | } | ||
| 892 | } | ||
| 893 | else if (BURN_DEPENDENCY_ACTION_UNREGISTER == pPackage->dependencyExecute) | ||
| 894 | { | ||
| 895 | if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->expectedCacheRegistrationState) | ||
| 896 | { | ||
| 897 | pPackage->expectedCacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_IGNORED; | ||
| 898 | } | ||
| 899 | if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->expectedInstallRegistrationState) | ||
| 900 | { | ||
| 901 | pPackage->expectedInstallRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_IGNORED; | ||
| 902 | } | ||
| 903 | } | ||
| 904 | } | ||
| 905 | |||
| 923 | // Add the checkpoint after each package and dependency registration action. | 906 | // Add the checkpoint after each package and dependency registration action. |
| 924 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pPackage->execute || BOOTSTRAPPER_ACTION_STATE_NONE != pPackage->rollback || BURN_DEPENDENCY_ACTION_NONE != pPackage->dependencyExecute) | 907 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pPackage->execute || BOOTSTRAPPER_ACTION_STATE_NONE != pPackage->rollback || BURN_DEPENDENCY_ACTION_NONE != pPackage->dependencyExecute) |
| 925 | { | 908 | { |
| @@ -1572,6 +1555,11 @@ extern "C" HRESULT PlanCleanPackage( | |||
| 1572 | pCleanAction->pPackage = pPackage; | 1555 | pCleanAction->pPackage = pPackage; |
| 1573 | 1556 | ||
| 1574 | pPackage->fUncache = TRUE; | 1557 | pPackage->fUncache = TRUE; |
| 1558 | |||
| 1559 | if (pPackage->fCanAffectRegistration) | ||
| 1560 | { | ||
| 1561 | pPackage->expectedCacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_ABSENT; | ||
| 1562 | } | ||
| 1575 | } | 1563 | } |
| 1576 | 1564 | ||
| 1577 | LExit: | 1565 | LExit: |
| @@ -1708,68 +1696,6 @@ LExit: | |||
| 1708 | return hr; | 1696 | return hr; |
| 1709 | } | 1697 | } |
| 1710 | 1698 | ||
| 1711 | extern "C" HRESULT PlanKeepRegistration( | ||
| 1712 | __in BURN_PLAN* pPlan, | ||
| 1713 | __in DWORD iAfterExecutePackageAction, | ||
| 1714 | __in DWORD iBeforeRollbackPackageAction | ||
| 1715 | ) | ||
| 1716 | { | ||
| 1717 | HRESULT hr = S_OK; | ||
| 1718 | BURN_EXECUTE_ACTION* pAction = NULL; | ||
| 1719 | |||
| 1720 | if (BURN_PLAN_INVALID_ACTION_INDEX != iAfterExecutePackageAction) | ||
| 1721 | { | ||
| 1722 | hr = PlanInsertExecuteAction(iAfterExecutePackageAction, pPlan, &pAction); | ||
| 1723 | ExitOnFailure(hr, "Failed to insert keep registration execute action."); | ||
| 1724 | |||
| 1725 | pAction->type = BURN_EXECUTE_ACTION_TYPE_REGISTRATION; | ||
| 1726 | pAction->registration.fKeep = TRUE; | ||
| 1727 | } | ||
| 1728 | |||
| 1729 | if (BURN_PLAN_INVALID_ACTION_INDEX != iBeforeRollbackPackageAction) | ||
| 1730 | { | ||
| 1731 | hr = PlanInsertRollbackAction(iBeforeRollbackPackageAction, pPlan, &pAction); | ||
| 1732 | ExitOnFailure(hr, "Failed to insert keep registration rollback action."); | ||
| 1733 | |||
| 1734 | pAction->type = BURN_EXECUTE_ACTION_TYPE_REGISTRATION; | ||
| 1735 | pAction->registration.fKeep = FALSE; | ||
| 1736 | } | ||
| 1737 | |||
| 1738 | LExit: | ||
| 1739 | return hr; | ||
| 1740 | } | ||
| 1741 | |||
| 1742 | extern "C" HRESULT PlanRemoveRegistration( | ||
| 1743 | __in BURN_PLAN* pPlan, | ||
| 1744 | __in DWORD iAfterExecutePackageAction, | ||
| 1745 | __in DWORD iAfterRollbackPackageAction | ||
| 1746 | ) | ||
| 1747 | { | ||
| 1748 | HRESULT hr = S_OK; | ||
| 1749 | BURN_EXECUTE_ACTION* pAction = NULL; | ||
| 1750 | |||
| 1751 | if (BURN_PLAN_INVALID_ACTION_INDEX != iAfterExecutePackageAction) | ||
| 1752 | { | ||
| 1753 | hr = PlanInsertExecuteAction(iAfterExecutePackageAction, pPlan, &pAction); | ||
| 1754 | ExitOnFailure(hr, "Failed to insert remove registration execute action."); | ||
| 1755 | |||
| 1756 | pAction->type = BURN_EXECUTE_ACTION_TYPE_REGISTRATION; | ||
| 1757 | pAction->registration.fKeep = FALSE; | ||
| 1758 | } | ||
| 1759 | |||
| 1760 | if (BURN_PLAN_INVALID_ACTION_INDEX != iAfterRollbackPackageAction) | ||
| 1761 | { | ||
| 1762 | hr = PlanInsertRollbackAction(iAfterRollbackPackageAction, pPlan, &pAction); | ||
| 1763 | ExitOnFailure(hr, "Failed to insert remove registration rollback action."); | ||
| 1764 | |||
| 1765 | pAction->type = BURN_EXECUTE_ACTION_TYPE_REGISTRATION; | ||
| 1766 | pAction->registration.fKeep = TRUE; | ||
| 1767 | } | ||
| 1768 | |||
| 1769 | LExit: | ||
| 1770 | return hr; | ||
| 1771 | } | ||
| 1772 | |||
| 1773 | extern "C" HRESULT PlanRollbackBoundaryBegin( | 1699 | extern "C" HRESULT PlanRollbackBoundaryBegin( |
| 1774 | __in BURN_PLAN* pPlan, | 1700 | __in BURN_PLAN* pPlan, |
| 1775 | __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary | 1701 | __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary |
| @@ -1925,6 +1851,8 @@ static void ResetPlannedPackageState( | |||
| 1925 | pPackage->dependencyExecute = BURN_DEPENDENCY_ACTION_NONE; | 1851 | pPackage->dependencyExecute = BURN_DEPENDENCY_ACTION_NONE; |
| 1926 | pPackage->dependencyRollback = BURN_DEPENDENCY_ACTION_NONE; | 1852 | pPackage->dependencyRollback = BURN_DEPENDENCY_ACTION_NONE; |
| 1927 | pPackage->fDependencyManagerWasHere = FALSE; | 1853 | pPackage->fDependencyManagerWasHere = FALSE; |
| 1854 | pPackage->expectedCacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_UNKNOWN; | ||
| 1855 | pPackage->expectedInstallRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_UNKNOWN; | ||
| 1928 | 1856 | ||
| 1929 | if (BURN_PACKAGE_TYPE_MSI == pPackage->type && pPackage->Msi.rgFeatures) | 1857 | if (BURN_PACKAGE_TYPE_MSI == pPackage->type && pPackage->Msi.rgFeatures) |
| 1930 | { | 1858 | { |
| @@ -2198,6 +2126,11 @@ static HRESULT AddCachePackageHelper( | |||
| 2198 | // did cache operations to verify the cache is valid so we did not plan the acquisition of the package. | 2126 | // did cache operations to verify the cache is valid so we did not plan the acquisition of the package. |
| 2199 | pPackage->fAcquire = (BURN_CACHE_STATE_COMPLETE != pPackage->cache); | 2127 | pPackage->fAcquire = (BURN_CACHE_STATE_COMPLETE != pPackage->cache); |
| 2200 | 2128 | ||
| 2129 | if (pPackage->fCanAffectRegistration) | ||
| 2130 | { | ||
| 2131 | pPackage->expectedCacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_PRESENT; | ||
| 2132 | } | ||
| 2133 | |||
| 2201 | LExit: | 2134 | LExit: |
| 2202 | return hr; | 2135 | return hr; |
| 2203 | } | 2136 | } |
| @@ -3118,10 +3051,6 @@ static void ExecuteActionLog( | |||
| 3118 | LogStringLine(PlanDumpLevel, "%ls action[%u]: MSU_PACKAGE package id: %ls, action: %hs, log path: %ls", wzBase, iAction, pAction->msuPackage.pPackage->sczId, LoggingActionStateToString(pAction->msuPackage.action), pAction->msuPackage.sczLogPath); | 3051 | LogStringLine(PlanDumpLevel, "%ls action[%u]: MSU_PACKAGE package id: %ls, action: %hs, log path: %ls", wzBase, iAction, pAction->msuPackage.pPackage->sczId, LoggingActionStateToString(pAction->msuPackage.action), pAction->msuPackage.sczLogPath); |
| 3119 | break; | 3052 | break; |
| 3120 | 3053 | ||
| 3121 | case BURN_EXECUTE_ACTION_TYPE_REGISTRATION: | ||
| 3122 | LogStringLine(PlanDumpLevel, "%ls action[%u]: REGISTRATION keep: %ls", wzBase, iAction, pAction->registration.fKeep ? L"yes" : L"no"); | ||
| 3123 | break; | ||
| 3124 | |||
| 3125 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY: | 3054 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY: |
| 3126 | LogStringLine(PlanDumpLevel, "%ls action[%u]: ROLLBACK_BOUNDARY id: %ls, vital: %ls", wzBase, iAction, pAction->rollbackBoundary.pRollbackBoundary->sczId, pAction->rollbackBoundary.pRollbackBoundary->fVital ? L"yes" : L"no"); | 3055 | LogStringLine(PlanDumpLevel, "%ls action[%u]: ROLLBACK_BOUNDARY id: %ls, vital: %ls", wzBase, iAction, pAction->rollbackBoundary.pRollbackBoundary->sczId, pAction->rollbackBoundary.pRollbackBoundary->fVital ? L"yes" : L"no"); |
| 3127 | break; | 3056 | break; |
| @@ -3157,7 +3086,6 @@ extern "C" void PlanDump( | |||
| 3157 | LogStringLine(PlanDumpLevel, "Plan action: %hs", LoggingBurnActionToString(pPlan->action)); | 3086 | LogStringLine(PlanDumpLevel, "Plan action: %hs", LoggingBurnActionToString(pPlan->action)); |
| 3158 | LogStringLine(PlanDumpLevel, " per-machine: %hs", LoggingTrueFalseToString(pPlan->fPerMachine)); | 3087 | LogStringLine(PlanDumpLevel, " per-machine: %hs", LoggingTrueFalseToString(pPlan->fPerMachine)); |
| 3159 | LogStringLine(PlanDumpLevel, " disable-rollback: %hs", LoggingTrueFalseToString(pPlan->fDisableRollback)); | 3088 | LogStringLine(PlanDumpLevel, " disable-rollback: %hs", LoggingTrueFalseToString(pPlan->fDisableRollback)); |
| 3160 | LogStringLine(PlanDumpLevel, " keep registration by default: %hs", LoggingTrueFalseToString(pPlan->fKeepRegistrationDefault)); | ||
| 3161 | LogStringLine(PlanDumpLevel, " estimated size: %llu", pPlan->qwEstimatedSize); | 3089 | LogStringLine(PlanDumpLevel, " estimated size: %llu", pPlan->qwEstimatedSize); |
| 3162 | 3090 | ||
| 3163 | LogStringLine(PlanDumpLevel, "Plan cache size: %llu", pPlan->qwCacheSizeTotal); | 3091 | LogStringLine(PlanDumpLevel, "Plan cache size: %llu", pPlan->qwCacheSizeTotal); |
