diff options
| author | Bob Arnson <bob@firegiant.com> | 2022-08-21 23:55:26 -0400 |
|---|---|---|
| committer | Bob Arnson <github@bobs.org> | 2022-08-22 08:24:20 -0400 |
| commit | cb3776e5e3e075e8e4fe2ae7231ec19f3345c546 (patch) | |
| tree | 9584fae64312d2fb1d023c6576fc8a37559c7258 | |
| parent | b72f58abdf6dd5d0020f174358027158cb52cb72 (diff) | |
| download | wix-cb3776e5e3e075e8e4fe2ae7231ec19f3345c546.tar.gz wix-cb3776e5e3e075e8e4fe2ae7231ec19f3345c546.tar.bz2 wix-cb3776e5e3e075e8e4fe2ae7231ec19f3345c546.zip | |
Handle downgrade failure detection during Detect.
Fixes https://github.com/wixtoolset/issues/issues/6537.
| -rw-r--r-- | src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp | 44 | ||||
| -rw-r--r-- | src/test/burn/TestData/WixStdBaTests/BundleA/BundleA_v13.wixproj | 15 |
2 files changed, 43 insertions, 16 deletions
diff --git a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp index fc262e0e..d57d78a6 100644 --- a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp +++ b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp | |||
| @@ -322,6 +322,21 @@ public: // IBootstrapperApplication | |||
| 322 | // Best effort | 322 | // Best effort |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | if (BOOTSTRAPPER_ACTION_INSTALL == m_command.action && BOOTSTRAPPER_RELATION_UPGRADE == relationType) | ||
| 326 | { | ||
| 327 | int nResult = 0; | ||
| 328 | HRESULT hr = VerCompareStringVersions(m_sczBundleVersion, wzVersion, TRUE/*fStrict*/, &nResult); | ||
| 329 | BalExitOnFailure(hr, "Failed to compare bundle version: %ls to related bundle version: %ls.", m_sczBundleVersion, wzVersion); | ||
| 330 | |||
| 331 | if (0 > nResult) | ||
| 332 | { | ||
| 333 | m_fDowngrading = TRUE; | ||
| 334 | |||
| 335 | BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "Related bundle version: %ls is a downgrade for bundle version: %ls.", wzVersion, m_sczBundleVersion); | ||
| 336 | } | ||
| 337 | } | ||
| 338 | |||
| 339 | LExit: | ||
| 325 | return CBalBaseBootstrapperApplication::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel); | 340 | return CBalBaseBootstrapperApplication::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel); |
| 326 | } | 341 | } |
| 327 | 342 | ||
| @@ -333,6 +348,15 @@ public: // IBootstrapperApplication | |||
| 333 | { | 348 | { |
| 334 | HRESULT hr = S_OK; | 349 | HRESULT hr = S_OK; |
| 335 | 350 | ||
| 351 | if (m_fSuppressDowngradeFailure && m_fDowngrading) | ||
| 352 | { | ||
| 353 | SetState(WIXSTDBA_STATE_APPLIED, hrStatus); | ||
| 354 | |||
| 355 | BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Bundle downgrade was attempted but downgrade failure has been suppressed."); | ||
| 356 | |||
| 357 | ExitFunction(); | ||
| 358 | } | ||
| 359 | |||
| 336 | // If we're not interacting with the user or we're doing a layout or we're resuming just after a force restart | 360 | // If we're not interacting with the user or we're doing a layout or we're resuming just after a force restart |
| 337 | // then automatically start planning. | 361 | // then automatically start planning. |
| 338 | BOOL fSkipToPlan = SUCCEEDED(hrStatus) && | 362 | BOOL fSkipToPlan = SUCCEEDED(hrStatus) && |
| @@ -365,6 +389,7 @@ public: // IBootstrapperApplication | |||
| 365 | } | 389 | } |
| 366 | } | 390 | } |
| 367 | 391 | ||
| 392 | LExit: | ||
| 368 | return hr; | 393 | return hr; |
| 369 | } | 394 | } |
| 370 | 395 | ||
| @@ -1188,21 +1213,6 @@ public: // IBootstrapperApplication | |||
| 1188 | return hr; | 1213 | return hr; |
| 1189 | } | 1214 | } |
| 1190 | 1215 | ||
| 1191 | virtual STDMETHODIMP OnApplyDowngrade( | ||
| 1192 | __in HRESULT /*hrRecommendation*/, | ||
| 1193 | __in HRESULT* phrStatus | ||
| 1194 | ) | ||
| 1195 | { | ||
| 1196 | HRESULT hr = S_OK; | ||
| 1197 | |||
| 1198 | if (m_fSuppressDowngradeFailure) | ||
| 1199 | { | ||
| 1200 | *phrStatus = S_OK; | ||
| 1201 | } | ||
| 1202 | |||
| 1203 | return hr; | ||
| 1204 | } | ||
| 1205 | |||
| 1206 | virtual STDMETHODIMP OnApplyComplete( | 1216 | virtual STDMETHODIMP OnApplyComplete( |
| 1207 | __in HRESULT hrStatus, | 1217 | __in HRESULT hrStatus, |
| 1208 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 1218 | __in BOOTSTRAPPER_APPLY_RESTART restart, |
| @@ -3888,7 +3898,7 @@ private: | |||
| 3888 | hr = ThemeShowPage(m_pTheme, dwNewPageId, SW_SHOW); | 3898 | hr = ThemeShowPage(m_pTheme, dwNewPageId, SW_SHOW); |
| 3889 | if (FAILED(hr)) | 3899 | if (FAILED(hr)) |
| 3890 | { | 3900 | { |
| 3891 | BalLogError(hr, "Failed to show page: %u", dwOldPageId); | 3901 | BalLogError(hr, "Failed to show page: %u", dwNewPageId); |
| 3892 | } | 3902 | } |
| 3893 | 3903 | ||
| 3894 | // On the install page set the focus to the install button or the next enabled control if install is disabled. | 3904 | // On the install page set the focus to the install button or the next enabled control if install is disabled. |
| @@ -4643,6 +4653,7 @@ public: | |||
| 4643 | m_sczLicenseFile = NULL; | 4653 | m_sczLicenseFile = NULL; |
| 4644 | m_sczLicenseUrl = NULL; | 4654 | m_sczLicenseUrl = NULL; |
| 4645 | m_fSuppressDowngradeFailure = FALSE; | 4655 | m_fSuppressDowngradeFailure = FALSE; |
| 4656 | m_fDowngrading = FALSE; | ||
| 4646 | m_fSuppressRepair = FALSE; | 4657 | m_fSuppressRepair = FALSE; |
| 4647 | m_fSupportCacheOnly = FALSE; | 4658 | m_fSupportCacheOnly = FALSE; |
| 4648 | m_fRequestedCacheOnly = FALSE; | 4659 | m_fRequestedCacheOnly = FALSE; |
| @@ -4949,6 +4960,7 @@ private: | |||
| 4949 | LPWSTR m_sczLicenseFile; | 4960 | LPWSTR m_sczLicenseFile; |
| 4950 | LPWSTR m_sczLicenseUrl; | 4961 | LPWSTR m_sczLicenseUrl; |
| 4951 | BOOL m_fSuppressDowngradeFailure; | 4962 | BOOL m_fSuppressDowngradeFailure; |
| 4963 | BOOL m_fDowngrading; | ||
| 4952 | BOOL m_fSuppressRepair; | 4964 | BOOL m_fSuppressRepair; |
| 4953 | BOOL m_fSupportCacheOnly; | 4965 | BOOL m_fSupportCacheOnly; |
| 4954 | BOOL m_fRequestedCacheOnly; | 4966 | BOOL m_fRequestedCacheOnly; |
diff --git a/src/test/burn/TestData/WixStdBaTests/BundleA/BundleA_v13.wixproj b/src/test/burn/TestData/WixStdBaTests/BundleA/BundleA_v13.wixproj new file mode 100644 index 00000000..0aeb6157 --- /dev/null +++ b/src/test/burn/TestData/WixStdBaTests/BundleA/BundleA_v13.wixproj | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 2 | <Project Sdk="WixToolset.Sdk"> | ||
| 3 | <PropertyGroup> | ||
| 4 | <OutputType>Bundle</OutputType> | ||
| 5 | <UpgradeCode>{7D977157-06C9-4176-A931-AC16E18AAB51}</UpgradeCode> | ||
| 6 | <DefineConstants>$(DefineConstants);Version=1.3</DefineConstants> | ||
| 7 | <OutputName>WixStdBaTest1_v13</OutputName> | ||
| 8 | </PropertyGroup> | ||
| 9 | <ItemGroup> | ||
| 10 | <ProjectReference Include="..\PackageA\PackageA.wixproj" /> | ||
| 11 | </ItemGroup> | ||
| 12 | <ItemGroup> | ||
| 13 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
| 14 | </ItemGroup> | ||
| 15 | </Project> \ No newline at end of file | ||
