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/dependency.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/dependency.cpp')
| -rw-r--r-- | src/engine/dependency.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/engine/dependency.cpp b/src/engine/dependency.cpp index 1c33aaf2..a6a8fe4d 100644 --- a/src/engine/dependency.cpp +++ b/src/engine/dependency.cpp | |||
| @@ -708,6 +708,9 @@ static HRESULT DetectPackageDependents( | |||
| 708 | { | 708 | { |
| 709 | HRESULT hr = S_OK; | 709 | HRESULT hr = S_OK; |
| 710 | HKEY hkHive = pPackage->fPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 710 | HKEY hkHive = pPackage->fPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 711 | BOOL fCanIgnorePresence = pPackage->fCanAffectRegistration && 0 < pPackage->cDependencyProviders && | ||
| 712 | (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->cacheRegistrationState || BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->installRegistrationState); | ||
| 713 | BOOL fBundleRegisteredAsDependent = FALSE; | ||
| 711 | 714 | ||
| 712 | // There's currently no point in getting the dependents if the scope doesn't match, | 715 | // There's currently no point in getting the dependents if the scope doesn't match, |
| 713 | // because they will just get ignored. | 716 | // because they will just get ignored. |
| @@ -729,6 +732,20 @@ static HRESULT DetectPackageDependents( | |||
| 729 | { | 732 | { |
| 730 | pPackage->fPackageProviderExists = TRUE; | 733 | pPackage->fPackageProviderExists = TRUE; |
| 731 | } | 734 | } |
| 735 | |||
| 736 | if (fCanIgnorePresence && !fBundleRegisteredAsDependent) | ||
| 737 | { | ||
| 738 | for (DWORD iDependent = 0; iDependent < pProvider->cDependents; ++iDependent) | ||
| 739 | { | ||
| 740 | DEPENDENCY* pDependent = pProvider->rgDependents + iDependent; | ||
| 741 | |||
| 742 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczId, -1, pDependent->sczKey, -1)) | ||
| 743 | { | ||
| 744 | fBundleRegisteredAsDependent = TRUE; | ||
| 745 | break; | ||
| 746 | } | ||
| 747 | } | ||
| 748 | } | ||
| 732 | } | 749 | } |
| 733 | else | 750 | else |
| 734 | { | 751 | { |
| @@ -747,6 +764,18 @@ static HRESULT DetectPackageDependents( | |||
| 747 | pPackage->fPackageProviderExists = TRUE; | 764 | pPackage->fPackageProviderExists = TRUE; |
| 748 | } | 765 | } |
| 749 | 766 | ||
| 767 | if (fCanIgnorePresence && !fBundleRegisteredAsDependent) | ||
| 768 | { | ||
| 769 | if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->cacheRegistrationState) | ||
| 770 | { | ||
| 771 | pPackage->cacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_IGNORED; | ||
| 772 | } | ||
| 773 | if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->installRegistrationState) | ||
| 774 | { | ||
| 775 | pPackage->installRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_IGNORED; | ||
| 776 | } | ||
| 777 | } | ||
| 778 | |||
| 750 | LExit: | 779 | LExit: |
| 751 | return hr; | 780 | return hr; |
| 752 | } | 781 | } |
