aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/mspengine.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-12-07 17:34:09 -0600
committerSean Hall <r.sean.hall@gmail.com>2021-12-08 17:14:11 -0600
commit19d85eed389fbd964f64c2fbb85e40ec20439d26 (patch)
tree29adf2c191ea8a50153238ee457ff34f0d73d059 /src/burn/engine/mspengine.cpp
parent5c7b1a8fa2b02ddd758c0c267f59b7e77b527f62 (diff)
downloadwix-19d85eed389fbd964f64c2fbb85e40ec20439d26.tar.gz
wix-19d85eed389fbd964f64c2fbb85e40ec20439d26.tar.bz2
wix-19d85eed389fbd964f64c2fbb85e40ec20439d26.zip
Add ability to customize file versioning rules for MsiPackage and MspPackage.
Fixes #5911
Diffstat (limited to 'src/burn/engine/mspengine.cpp')
-rw-r--r--src/burn/engine/mspengine.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/burn/engine/mspengine.cpp b/src/burn/engine/mspengine.cpp
index 3d7b5517..a88d0cb2 100644
--- a/src/burn/engine/mspengine.cpp
+++ b/src/burn/engine/mspengine.cpp
@@ -629,16 +629,26 @@ extern "C" HRESULT MspEngineExecutePackage(
629 } 629 }
630 630
631 // set up properties 631 // set up properties
632 hr = MsiEngineConcatProperties(pExecuteAction->mspTarget.pPackage->Msp.rgProperties, pExecuteAction->mspTarget.pPackage->Msp.cProperties, pVariables, fRollback, &sczProperties, FALSE); 632 hr = MsiEngineConcatPackageProperties(pExecuteAction->mspTarget.pPackage->Msp.rgProperties, pExecuteAction->mspTarget.pPackage->Msp.cProperties, pVariables, fRollback, &sczProperties, FALSE);
633 ExitOnFailure(hr, "Failed to add properties to argument string."); 633 ExitOnFailure(hr, "Failed to add properties to argument string.");
634 634
635 hr = MsiEngineConcatProperties(pExecuteAction->mspTarget.pPackage->Msp.rgProperties, pExecuteAction->mspTarget.pPackage->Msp.cProperties, pVariables, fRollback, &sczObfuscatedProperties, TRUE); 635 hr = MsiEngineConcatPackageProperties(pExecuteAction->mspTarget.pPackage->Msp.rgProperties, pExecuteAction->mspTarget.pPackage->Msp.cProperties, pVariables, fRollback, &sczObfuscatedProperties, TRUE);
636 ExitOnFailure(hr, "Failed to add properties to obfuscated argument string."); 636 ExitOnFailure(hr, "Failed to add properties to obfuscated argument string.");
637 637
638 hr = MsiEngineConcatActionProperty(pExecuteAction->mspTarget.actionMsiProperty, &sczProperties); 638 if (BOOTSTRAPPER_ACTION_STATE_UNINSTALL != pExecuteAction->mspTarget.action)
639 {
640 hr = StrAllocConcatFormattedSecure(&sczProperties, L" PATCH=\"%ls\"", sczPatches);
641 ExitOnFailure(hr, "Failed to add PATCH property to argument string.");
642
643 hr = StrAllocConcatFormatted(&sczObfuscatedProperties, L" PATCH=\"%ls\"", sczPatches);
644 ExitOnFailure(hr, "Failed to add PATCH property to obfuscated argument string.");
645 }
646
647 // Always add Burn properties last.
648 hr = MsiEngineConcatBurnProperties(pExecuteAction->mspTarget.action, pExecuteAction->mspTarget.actionMsiProperty, pExecuteAction->mspTarget.fileVersioning, FALSE, FALSE, &sczProperties);
639 ExitOnFailure(hr, "Failed to add action property to argument string."); 649 ExitOnFailure(hr, "Failed to add action property to argument string.");
640 650
641 hr = MsiEngineConcatActionProperty(pExecuteAction->mspTarget.actionMsiProperty, &sczObfuscatedProperties); 651 hr = MsiEngineConcatBurnProperties(pExecuteAction->mspTarget.action, pExecuteAction->mspTarget.actionMsiProperty, pExecuteAction->mspTarget.fileVersioning, FALSE, FALSE, &sczObfuscatedProperties);
642 ExitOnFailure(hr, "Failed to add action property to obfuscated argument string."); 652 ExitOnFailure(hr, "Failed to add action property to obfuscated argument string.");
643 653
644 LogId(REPORT_STANDARD, MSG_APPLYING_PATCH_PACKAGE, pExecuteAction->mspTarget.pPackage->sczId, LoggingActionStateToString(pExecuteAction->mspTarget.action), sczPatches, sczObfuscatedProperties, pExecuteAction->mspTarget.sczTargetProductCode); 654 LogId(REPORT_STANDARD, MSG_APPLYING_PATCH_PACKAGE, pExecuteAction->mspTarget.pPackage->sczId, LoggingActionStateToString(pExecuteAction->mspTarget.action), sczPatches, sczObfuscatedProperties, pExecuteAction->mspTarget.sczTargetProductCode);
@@ -650,27 +660,11 @@ extern "C" HRESULT MspEngineExecutePackage(
650 { 660 {
651 case BOOTSTRAPPER_ACTION_STATE_INSTALL: __fallthrough; 661 case BOOTSTRAPPER_ACTION_STATE_INSTALL: __fallthrough;
652 case BOOTSTRAPPER_ACTION_STATE_REPAIR: 662 case BOOTSTRAPPER_ACTION_STATE_REPAIR:
653 hr = StrAllocConcatSecure(&sczProperties, L" PATCH=\"", 0);
654 ExitOnFailure(hr, "Failed to add PATCH property on install.");
655
656 hr = StrAllocConcatSecure(&sczProperties, sczPatches, 0);
657 ExitOnFailure(hr, "Failed to add patches to PATCH property on install.");
658
659 hr = StrAllocConcatSecure(&sczProperties, L"\" REBOOT=ReallySuppress", 0);
660 ExitOnFailure(hr, "Failed to add reboot suppression property on install.");
661
662 hr = WiuConfigureProductEx(pExecuteAction->mspTarget.sczTargetProductCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, sczProperties, &restart); 663 hr = WiuConfigureProductEx(pExecuteAction->mspTarget.sczTargetProductCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, sczProperties, &restart);
663 ExitOnFailure(hr, "Failed to install MSP package."); 664 ExitOnFailure(hr, "Failed to install MSP package.");
664 break; 665 break;
665 666
666 case BOOTSTRAPPER_ACTION_STATE_UNINSTALL: 667 case BOOTSTRAPPER_ACTION_STATE_UNINSTALL:
667 hr = StrAllocConcatSecure(&sczProperties, L" REBOOT=ReallySuppress", 0);
668 ExitOnFailure(hr, "Failed to add reboot suppression property on uninstall.");
669
670 // Ignore all dependencies, since the Burn engine already performed the check.
671 hr = StrAllocFormattedSecure(&sczProperties, L"%ls %ls=ALL", sczProperties, DEPENDENCY_IGNOREDEPENDENCIES);
672 ExitOnFailure(hr, "Failed to add the list of dependencies to ignore to the properties.");
673
674 hr = WiuRemovePatches(sczPatches, pExecuteAction->mspTarget.sczTargetProductCode, sczProperties, &restart); 668 hr = WiuRemovePatches(sczPatches, pExecuteAction->mspTarget.sczTargetProductCode, sczProperties, &restart);
675 ExitOnFailure(hr, "Failed to uninstall MSP package."); 669 ExitOnFailure(hr, "Failed to uninstall MSP package.");
676 break; 670 break;
@@ -1128,8 +1122,8 @@ static HRESULT PlanTargetProduct(
1128 hr = StrAllocString(&pAction->mspTarget.sczTargetProductCode, pTargetProduct->wzTargetProductCode, 0); 1122 hr = StrAllocString(&pAction->mspTarget.sczTargetProductCode, pTargetProduct->wzTargetProductCode, 0);
1129 ExitOnFailure(hr, "Failed to copy target product code."); 1123 ExitOnFailure(hr, "Failed to copy target product code.");
1130 1124
1131 hr = MsiEngineCalculateInstallUiLevel(display, pUserExperience, pPackage->sczId, !fRollback, pAction->mspTarget.action, 1125 hr = MsiEnginePlanPackageOptions(display, pUserExperience, pPackage->sczId, !fRollback, pAction->mspTarget.action,
1132 &pAction->mspTarget.actionMsiProperty, &pAction->mspTarget.uiLevel, &pAction->mspTarget.fDisableExternalUiHandler); 1126 &pAction->mspTarget.actionMsiProperty, &pAction->mspTarget.uiLevel, &pAction->mspTarget.fDisableExternalUiHandler, &pAction->mspTarget.fileVersioning);
1133 ExitOnFailure(hr, "Failed to get msp ui options."); 1127 ExitOnFailure(hr, "Failed to get msp ui options.");
1134 1128
1135 // If this is a per-machine target product, then the plan needs to be per-machine as well. 1129 // If this is a per-machine target product, then the plan needs to be per-machine as well.