aboutsummaryrefslogtreecommitdiff
path: root/src/engine/detect.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-03-10 15:47:59 -0600
committerSean Hall <r.sean.hall@gmail.com>2021-03-11 20:24:18 -0600
commit10ef9d5bfbf81f454113a1c2716009831a916222 (patch)
tree9e2fd8c917787ceba5e4c7f873d715eafbda6920 /src/engine/detect.cpp
parent778b65643f19df94947d390a5a17023043d840b4 (diff)
downloadwix-10ef9d5bfbf81f454113a1c2716009831a916222.tar.gz
wix-10ef9d5bfbf81f454113a1c2716009831a916222.tar.bz2
wix-10ef9d5bfbf81f454113a1c2716009831a916222.zip
Determine whether to ignore forward compatible bundles during Plan.
Diffstat (limited to 'src/engine/detect.cpp')
-rw-r--r--src/engine/detect.cpp48
1 files changed, 8 insertions, 40 deletions
diff --git a/src/engine/detect.cpp b/src/engine/detect.cpp
index 4265cf9b..74e8b9ca 100644
--- a/src/engine/detect.cpp
+++ b/src/engine/detect.cpp
@@ -39,9 +39,9 @@ extern "C" void DetectReset(
39{ 39{
40 RelatedBundlesUninitialize(&pRegistration->relatedBundles); 40 RelatedBundlesUninitialize(&pRegistration->relatedBundles);
41 ReleaseNullStr(pRegistration->sczDetectedProviderKeyBundleId); 41 ReleaseNullStr(pRegistration->sczDetectedProviderKeyBundleId);
42 pRegistration->fEnabledForwardCompatibleBundle = FALSE;
43 PackageUninitialize(&pRegistration->forwardCompatibleBundle);
44 pRegistration->fSelfRegisteredAsDependent = FALSE; 42 pRegistration->fSelfRegisteredAsDependent = FALSE;
43 pRegistration->fParentRegisteredAsDependent = FALSE;
44 pRegistration->fForwardCompatibleBundleExists = FALSE;
45 pRegistration->fEligibleForCleanup = FALSE; 45 pRegistration->fEligibleForCleanup = FALSE;
46 46
47 if (pRegistration->rgIgnoredDependencies) 47 if (pRegistration->rgIgnoredDependencies)
@@ -120,46 +120,20 @@ extern "C" void DetectReset(
120 } 120 }
121} 121}
122 122
123extern "C" HRESULT DetectForwardCompatibleBundle( 123extern "C" HRESULT DetectForwardCompatibleBundles(
124 __in BURN_USER_EXPERIENCE* pUX, 124 __in BURN_USER_EXPERIENCE* pUX,
125 __in BOOTSTRAPPER_COMMAND* pCommand,
126 __in BURN_REGISTRATION* pRegistration 125 __in BURN_REGISTRATION* pRegistration
127 ) 126 )
128{ 127{
129 HRESULT hr = S_OK; 128 HRESULT hr = S_OK;
130 BOOL fRecommendIgnore = TRUE;
131 BOOL fIgnoreBundle = FALSE;
132 int nCompareResult = 0; 129 int nCompareResult = 0;
133 130
134 if (pRegistration->sczDetectedProviderKeyBundleId && 131 if (pRegistration->sczDetectedProviderKeyBundleId &&
135 CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRegistration->sczId, -1)) 132 CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRegistration->sczId, -1))
136 { 133 {
137 // Only change the recommendation if an active parent was provided.
138 if (pRegistration->sczActiveParent && *pRegistration->sczActiveParent)
139 {
140 // On install, recommend running the forward compatible bundle because there is an active parent. This
141 // will essentially register the parent with the forward compatible bundle.
142 if (BOOTSTRAPPER_ACTION_INSTALL == pCommand->action)
143 {
144 fRecommendIgnore = FALSE;
145 }
146 else if (BOOTSTRAPPER_ACTION_UNINSTALL == pCommand->action ||
147 BOOTSTRAPPER_ACTION_MODIFY == pCommand->action ||
148 BOOTSTRAPPER_ACTION_REPAIR == pCommand->action)
149 {
150 // When modifying the bundle, only recommend running the forward compatible bundle if the parent
151 // is already registered as a dependent of the provider key.
152 if (DependencyDependentExists(pRegistration, pRegistration->sczActiveParent))
153 {
154 fRecommendIgnore = FALSE;
155 }
156 }
157 }
158
159 for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle) 134 for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle)
160 { 135 {
161 BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + iRelatedBundle; 136 BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + iRelatedBundle;
162 fIgnoreBundle = fRecommendIgnore;
163 137
164 if (BOOTSTRAPPER_RELATION_UPGRADE == pRelatedBundle->relationType && 138 if (BOOTSTRAPPER_RELATION_UPGRADE == pRelatedBundle->relationType &&
165 CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRelatedBundle->package.sczId, -1)) 139 CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRelatedBundle->package.sczId, -1))
@@ -169,19 +143,13 @@ extern "C" HRESULT DetectForwardCompatibleBundle(
169 143
170 if (nCompareResult <= 0) 144 if (nCompareResult <= 0)
171 { 145 {
172 hr = UserExperienceOnDetectForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, &fIgnoreBundle); 146 pRelatedBundle->fForwardCompatible = TRUE;
173 ExitOnRootFailure(hr, "BA aborted detect forward compatible bundle."); 147 pRegistration->fForwardCompatibleBundleExists = TRUE;
174
175 if (!fIgnoreBundle)
176 {
177 hr = PseudoBundleInitializePassthrough(&pRegistration->forwardCompatibleBundle, pCommand, NULL, pRegistration->sczActiveParent, pRegistration->sczAncestors, &pRelatedBundle->package);
178 ExitOnFailure(hr, "Failed to initialize update bundle.");
179 148
180 pRegistration->fEnabledForwardCompatibleBundle = TRUE; 149 hr = UserExperienceOnDetectForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion);
181 } 150 ExitOnRootFailure(hr, "BA aborted detect forward compatible bundle.");
182 151
183 LogId(REPORT_STANDARD, MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion, LoggingBoolToString(pRegistration->fEnabledForwardCompatibleBundle)); 152 LogId(REPORT_STANDARD, MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion);
184 break;
185 } 153 }
186 } 154 }
187 } 155 }