aboutsummaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-02-24 17:02:31 -0600
committerSean Hall <r.sean.hall@gmail.com>2021-03-02 15:47:43 -0600
commitb5c4d92528dd088d0065c634eb1a353c424a4441 (patch)
tree428d6caf8bd414f0735b5fbc28b1add950324d15 /src/engine
parenta98115d996d65834e7c8d593c10d2cfa66096ccd (diff)
downloadwix-b5c4d92528dd088d0065c634eb1a353c424a4441.tar.gz
wix-b5c4d92528dd088d0065c634eb1a353c424a4441.tar.bz2
wix-b5c4d92528dd088d0065c634eb1a353c424a4441.zip
Always remove all dependencies the bundle could have registered.
#6297
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/apply.cpp2
-rw-r--r--src/engine/dependency.cpp17
-rw-r--r--src/engine/dependency.h3
-rw-r--r--src/engine/elevation.cpp6
-rw-r--r--src/engine/registration.cpp3
-rw-r--r--src/engine/registration.h1
6 files changed, 26 insertions, 6 deletions
diff --git a/src/engine/apply.cpp b/src/engine/apply.cpp
index 44ff9429..f57a56fe 100644
--- a/src/engine/apply.cpp
+++ b/src/engine/apply.cpp
@@ -435,7 +435,7 @@ extern "C" HRESULT ApplyUnregister(
435 } 435 }
436 else 436 else
437 { 437 {
438 hr = RegistrationSessionEnd(&pEngineState->registration, resumeMode, restart, pEngineState->plan.dependencyRegistrationAction); 438 hr = RegistrationSessionEnd(&pEngineState->registration, &pEngineState->packages, resumeMode, restart, pEngineState->plan.dependencyRegistrationAction);
439 ExitOnFailure(hr, "Failed to end session in per-user process."); 439 ExitOnFailure(hr, "Failed to end session in per-user process.");
440 } 440 }
441 441
diff --git a/src/engine/dependency.cpp b/src/engine/dependency.cpp
index 3d978740..4833de94 100644
--- a/src/engine/dependency.cpp
+++ b/src/engine/dependency.cpp
@@ -680,10 +680,12 @@ LExit:
680} 680}
681 681
682extern "C" void DependencyUnregisterBundle( 682extern "C" void DependencyUnregisterBundle(
683 __in const BURN_REGISTRATION* pRegistration 683 __in const BURN_REGISTRATION* pRegistration,
684 __in const BURN_PACKAGES* pPackages
684 ) 685 )
685{ 686{
686 HRESULT hr = S_OK; 687 HRESULT hr = S_OK;
688 LPCWSTR wzDependentProviderKey = pRegistration->sczId;
687 689
688 // Remove the bundle provider key. 690 // Remove the bundle provider key.
689 hr = DepUnregisterDependency(pRegistration->hkRoot, pRegistration->sczProviderKey); 691 hr = DepUnregisterDependency(pRegistration->hkRoot, pRegistration->sczProviderKey);
@@ -695,6 +697,19 @@ extern "C" void DependencyUnregisterBundle(
695 { 697 {
696 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_BUNDLE_UNREGISTERED_FAILED, pRegistration->sczProviderKey, hr); 698 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_BUNDLE_UNREGISTERED_FAILED, pRegistration->sczProviderKey, hr);
697 } 699 }
700
701 // Best effort to make sure this bundle is not registered as a dependent for anything.
702 for (DWORD i = 0; i < pPackages->cPackages; ++i)
703 {
704 const BURN_PACKAGE* pPackage = pPackages->rgPackages + i;
705 UnregisterPackageDependency(pPackage->fPerMachine, pPackage, wzDependentProviderKey);
706 }
707
708 for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i)
709 {
710 const BURN_PACKAGE* pPackage = &pRegistration->relatedBundles.rgRelatedBundles[i].package;
711 UnregisterPackageDependency(pPackage->fPerMachine, pPackage, wzDependentProviderKey);
712 }
698} 713}
699 714
700// internal functions 715// internal functions
diff --git a/src/engine/dependency.h b/src/engine/dependency.h
index 5390bede..efb9f2f2 100644
--- a/src/engine/dependency.h
+++ b/src/engine/dependency.h
@@ -169,7 +169,8 @@ HRESULT DependencyProcessDependentRegistration(
169 Note: Does not check for existing dependents before removing the key. 169 Note: Does not check for existing dependents before removing the key.
170*********************************************************************/ 170*********************************************************************/
171void DependencyUnregisterBundle( 171void DependencyUnregisterBundle(
172 __in const BURN_REGISTRATION* pRegistration 172 __in const BURN_REGISTRATION* pRegistration,
173 __in const BURN_PACKAGES* pPackages
173 ); 174 );
174 175
175#if defined(__cplusplus) 176#if defined(__cplusplus)
diff --git a/src/engine/elevation.cpp b/src/engine/elevation.cpp
index c9ed9810..7c5dae4b 100644
--- a/src/engine/elevation.cpp
+++ b/src/engine/elevation.cpp
@@ -154,6 +154,7 @@ static HRESULT OnSessionResume(
154 __in DWORD cbData 154 __in DWORD cbData
155 ); 155 );
156static HRESULT OnSessionEnd( 156static HRESULT OnSessionEnd(
157 __in BURN_PACKAGES* pPackages,
157 __in BURN_REGISTRATION* pRegistration, 158 __in BURN_REGISTRATION* pRegistration,
158 __in BYTE* pbData, 159 __in BYTE* pbData,
159 __in DWORD cbData 160 __in DWORD cbData
@@ -1637,7 +1638,7 @@ static HRESULT ProcessElevatedChildMessage(
1637 break; 1638 break;
1638 1639
1639 case BURN_ELEVATION_MESSAGE_TYPE_SESSION_END: 1640 case BURN_ELEVATION_MESSAGE_TYPE_SESSION_END:
1640 hrResult = OnSessionEnd(pContext->pRegistration, (BYTE*)pMsg->pvData, pMsg->cbData); 1641 hrResult = OnSessionEnd(pContext->pPackages, pContext->pRegistration, (BYTE*)pMsg->pvData, pMsg->cbData);
1641 break; 1642 break;
1642 1643
1643 case BURN_ELEVATION_MESSAGE_TYPE_SAVE_STATE: 1644 case BURN_ELEVATION_MESSAGE_TYPE_SAVE_STATE:
@@ -1954,6 +1955,7 @@ LExit:
1954} 1955}
1955 1956
1956static HRESULT OnSessionEnd( 1957static HRESULT OnSessionEnd(
1958 __in BURN_PACKAGES* pPackages,
1957 __in BURN_REGISTRATION* pRegistration, 1959 __in BURN_REGISTRATION* pRegistration,
1958 __in BYTE* pbData, 1960 __in BYTE* pbData,
1959 __in DWORD cbData 1961 __in DWORD cbData
@@ -1976,7 +1978,7 @@ static HRESULT OnSessionEnd(
1976 ExitOnFailure(hr, "Failed to read dependency registration action."); 1978 ExitOnFailure(hr, "Failed to read dependency registration action.");
1977 1979
1978 // suspend session in per-machine process 1980 // suspend session in per-machine process
1979 hr = RegistrationSessionEnd(pRegistration, (BURN_RESUME_MODE)dwResumeMode, (BOOTSTRAPPER_APPLY_RESTART)dwRestart, (BURN_DEPENDENCY_REGISTRATION_ACTION)dwDependencyRegistrationAction); 1981 hr = RegistrationSessionEnd(pRegistration, pPackages, (BURN_RESUME_MODE)dwResumeMode, (BOOTSTRAPPER_APPLY_RESTART)dwRestart, (BURN_DEPENDENCY_REGISTRATION_ACTION)dwDependencyRegistrationAction);
1980 ExitOnFailure(hr, "Failed to suspend registration session."); 1982 ExitOnFailure(hr, "Failed to suspend registration session.");
1981 1983
1982LExit: 1984LExit:
diff --git a/src/engine/registration.cpp b/src/engine/registration.cpp
index 9c821422..dc4b88bf 100644
--- a/src/engine/registration.cpp
+++ b/src/engine/registration.cpp
@@ -869,6 +869,7 @@ LExit:
869 *******************************************************************/ 869 *******************************************************************/
870extern "C" HRESULT RegistrationSessionEnd( 870extern "C" HRESULT RegistrationSessionEnd(
871 __in BURN_REGISTRATION* pRegistration, 871 __in BURN_REGISTRATION* pRegistration,
872 __in BURN_PACKAGES* pPackages,
872 __in BURN_RESUME_MODE resumeMode, 873 __in BURN_RESUME_MODE resumeMode,
873 __in BOOTSTRAPPER_APPLY_RESTART restart, 874 __in BOOTSTRAPPER_APPLY_RESTART restart,
874 __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction 875 __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction
@@ -912,7 +913,7 @@ extern "C" HRESULT RegistrationSessionEnd(
912 BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER == dependencyRegistrationAction) 913 BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER == dependencyRegistrationAction)
913 { 914 {
914 // Remove the bundle dependency key. 915 // Remove the bundle dependency key.
915 DependencyUnregisterBundle(pRegistration); 916 DependencyUnregisterBundle(pRegistration, pPackages);
916 } 917 }
917 918
918 // Delete update registration key. 919 // Delete update registration key.
diff --git a/src/engine/registration.h b/src/engine/registration.h
index 56bcb1f0..4aca5a05 100644
--- a/src/engine/registration.h
+++ b/src/engine/registration.h
@@ -196,6 +196,7 @@ HRESULT RegistrationSessionResume(
196 ); 196 );
197HRESULT RegistrationSessionEnd( 197HRESULT RegistrationSessionEnd(
198 __in BURN_REGISTRATION* pRegistration, 198 __in BURN_REGISTRATION* pRegistration,
199 __in BURN_PACKAGES* pPackages,
199 __in BURN_RESUME_MODE resumeMode, 200 __in BURN_RESUME_MODE resumeMode,
200 __in BOOTSTRAPPER_APPLY_RESTART restart, 201 __in BOOTSTRAPPER_APPLY_RESTART restart,
201 __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction 202 __in BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction