diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-10-17 19:12:21 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-10-24 20:07:21 -0500 |
commit | 273c69f34311f4f4e5f6b5896e71d0788f12d96a (patch) | |
tree | 4cf8f42f3ecfa9341a41686b74aa5e48068ede87 /src/engine/detect.cpp | |
parent | 3f8e35223216ebbe7f6683a5031a5a97bbc66d5a (diff) | |
download | wix-273c69f34311f4f4e5f6b5896e71d0788f12d96a.tar.gz wix-273c69f34311f4f4e5f6b5896e71d0788f12d96a.tar.bz2 wix-273c69f34311f4f4e5f6b5896e71d0788f12d96a.zip |
WIXFEAT:6210 Change data type of versions to strings.
Diffstat (limited to 'src/engine/detect.cpp')
-rw-r--r-- | src/engine/detect.cpp | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/engine/detect.cpp b/src/engine/detect.cpp index 7953daf5..9e4681bb 100644 --- a/src/engine/detect.cpp +++ b/src/engine/detect.cpp | |||
@@ -90,6 +90,7 @@ extern "C" HRESULT DetectForwardCompatibleBundle( | |||
90 | HRESULT hr = S_OK; | 90 | HRESULT hr = S_OK; |
91 | BOOL fRecommendIgnore = TRUE; | 91 | BOOL fRecommendIgnore = TRUE; |
92 | BOOL fIgnoreBundle = FALSE; | 92 | BOOL fIgnoreBundle = FALSE; |
93 | int nCompareResult = 0; | ||
93 | 94 | ||
94 | if (pRegistration->sczDetectedProviderKeyBundleId && | 95 | if (pRegistration->sczDetectedProviderKeyBundleId && |
95 | CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRegistration->sczId, -1)) | 96 | CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRegistration->sczId, -1)) |
@@ -122,22 +123,27 @@ extern "C" HRESULT DetectForwardCompatibleBundle( | |||
122 | fIgnoreBundle = fRecommendIgnore; | 123 | fIgnoreBundle = fRecommendIgnore; |
123 | 124 | ||
124 | if (BOOTSTRAPPER_RELATION_UPGRADE == pRelatedBundle->relationType && | 125 | if (BOOTSTRAPPER_RELATION_UPGRADE == pRelatedBundle->relationType && |
125 | pRegistration->qwVersion <= pRelatedBundle->qwVersion && | ||
126 | CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRelatedBundle->package.sczId, -1)) | 126 | CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRelatedBundle->package.sczId, -1)) |
127 | { | 127 | { |
128 | hr = UserExperienceOnDetectForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->qwVersion, &fIgnoreBundle); | 128 | hr = VerCompareParsedVersions(pRegistration->pVersion, pRelatedBundle->pVersion, &nCompareResult); |
129 | ExitOnRootFailure(hr, "BA aborted detect forward compatible bundle."); | 129 | ExitOnFailure(hr, "Failed to compare bundle version '%ls' to related bundle version '%ls'", pRegistration->pVersion->sczVersion, pRelatedBundle->pVersion->sczVersion); |
130 | 130 | ||
131 | if (!fIgnoreBundle) | 131 | if (nCompareResult <= 0) |
132 | { | 132 | { |
133 | hr = PseudoBundleInitializePassthrough(&pRegistration->forwardCompatibleBundle, pCommand, NULL, pRegistration->sczActiveParent, pRegistration->sczAncestors, &pRelatedBundle->package); | 133 | hr = UserExperienceOnDetectForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, &fIgnoreBundle); |
134 | ExitOnFailure(hr, "Failed to initialize update bundle."); | 134 | ExitOnRootFailure(hr, "BA aborted detect forward compatible bundle."); |
135 | 135 | ||
136 | pRegistration->fEnabledForwardCompatibleBundle = TRUE; | 136 | if (!fIgnoreBundle) |
137 | } | 137 | { |
138 | hr = PseudoBundleInitializePassthrough(&pRegistration->forwardCompatibleBundle, pCommand, NULL, pRegistration->sczActiveParent, pRegistration->sczAncestors, &pRelatedBundle->package); | ||
139 | ExitOnFailure(hr, "Failed to initialize update bundle."); | ||
138 | 140 | ||
139 | LogId(REPORT_STANDARD, MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), LoggingVersionToString(pRelatedBundle->qwVersion), LoggingBoolToString(pRegistration->fEnabledForwardCompatibleBundle)); | 141 | pRegistration->fEnabledForwardCompatibleBundle = TRUE; |
140 | break; | 142 | } |
143 | |||
144 | LogId(REPORT_STANDARD, MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion, LoggingBoolToString(pRegistration->fEnabledForwardCompatibleBundle)); | ||
145 | break; | ||
146 | } | ||
141 | } | 147 | } |
142 | } | 148 | } |
143 | } | 149 | } |
@@ -154,6 +160,7 @@ extern "C" HRESULT DetectReportRelatedBundles( | |||
154 | ) | 160 | ) |
155 | { | 161 | { |
156 | HRESULT hr = S_OK; | 162 | HRESULT hr = S_OK; |
163 | int nCompareResult = 0; | ||
157 | 164 | ||
158 | for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle) | 165 | for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle) |
159 | { | 166 | { |
@@ -165,11 +172,14 @@ extern "C" HRESULT DetectReportRelatedBundles( | |||
165 | case BOOTSTRAPPER_RELATION_UPGRADE: | 172 | case BOOTSTRAPPER_RELATION_UPGRADE: |
166 | if (BOOTSTRAPPER_RELATION_UPGRADE != relationType && BOOTSTRAPPER_ACTION_UNINSTALL < action) | 173 | if (BOOTSTRAPPER_RELATION_UPGRADE != relationType && BOOTSTRAPPER_ACTION_UNINSTALL < action) |
167 | { | 174 | { |
168 | if (pRegistration->qwVersion > pRelatedBundle->qwVersion) | 175 | hr = VerCompareParsedVersions(pRegistration->pVersion, pRelatedBundle->pVersion, &nCompareResult); |
176 | ExitOnFailure(hr, "Failed to compare bundle version '%ls' to related bundle version '%ls'", pRegistration->pVersion, pRelatedBundle->pVersion); | ||
177 | |||
178 | if (nCompareResult > 0) | ||
169 | { | 179 | { |
170 | operation = BOOTSTRAPPER_RELATED_OPERATION_MAJOR_UPGRADE; | 180 | operation = BOOTSTRAPPER_RELATED_OPERATION_MAJOR_UPGRADE; |
171 | } | 181 | } |
172 | else if (pRegistration->qwVersion < pRelatedBundle->qwVersion) | 182 | else if (nCompareResult < 0) |
173 | { | 183 | { |
174 | operation = BOOTSTRAPPER_RELATED_OPERATION_DOWNGRADE; | 184 | operation = BOOTSTRAPPER_RELATED_OPERATION_DOWNGRADE; |
175 | } | 185 | } |
@@ -202,9 +212,9 @@ extern "C" HRESULT DetectReportRelatedBundles( | |||
202 | break; | 212 | break; |
203 | } | 213 | } |
204 | 214 | ||
205 | LogId(REPORT_STANDARD, MSG_DETECTED_RELATED_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), LoggingVersionToString(pRelatedBundle->qwVersion), LoggingRelatedOperationToString(operation)); | 215 | LogId(REPORT_STANDARD, MSG_DETECTED_RELATED_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion, LoggingRelatedOperationToString(operation)); |
206 | 216 | ||
207 | hr = UserExperienceOnDetectRelatedBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->qwVersion, operation); | 217 | hr = UserExperienceOnDetectRelatedBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, operation); |
208 | ExitOnRootFailure(hr, "BA aborted detect related bundle."); | 218 | ExitOnRootFailure(hr, "BA aborted detect related bundle."); |
209 | } | 219 | } |
210 | 220 | ||
@@ -405,7 +415,7 @@ static HRESULT DetectAtomFeedUpdate( | |||
405 | 415 | ||
406 | hr = UserExperienceOnDetectUpdate(pUX, pAppUpdateEntry->rgEnclosures ? pAppUpdateEntry->rgEnclosures->wzUrl : NULL, | 416 | hr = UserExperienceOnDetectUpdate(pUX, pAppUpdateEntry->rgEnclosures ? pAppUpdateEntry->rgEnclosures->wzUrl : NULL, |
407 | pAppUpdateEntry->rgEnclosures ? pAppUpdateEntry->rgEnclosures->dw64Size : 0, | 417 | pAppUpdateEntry->rgEnclosures ? pAppUpdateEntry->rgEnclosures->dw64Size : 0, |
408 | pAppUpdateEntry->dw64Version, pAppUpdateEntry->wzTitle, | 418 | pAppUpdateEntry->pVersion, pAppUpdateEntry->wzTitle, |
409 | pAppUpdateEntry->wzSummary, pAppUpdateEntry->wzContentType, pAppUpdateEntry->wzContent, &fStopProcessingUpdates); | 419 | pAppUpdateEntry->wzSummary, pAppUpdateEntry->wzContentType, pAppUpdateEntry->wzContent, &fStopProcessingUpdates); |
410 | ExitOnRootFailure(hr, "BA aborted detect update."); | 420 | ExitOnRootFailure(hr, "BA aborted detect update."); |
411 | 421 | ||