aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/msiengine.cpp
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2026-02-04 20:47:04 -0500
committerBob Arnson <bob@firegiant.com>2026-02-04 20:47:04 -0500
commitedccb203c421d2bd820062024088c6698424d9ee (patch)
tree6b47c3eb5ca53bd9f79f3d032dc1a596d411bf38 /src/burn/engine/msiengine.cpp
parenta3d3963f806117ce123d95e8b77e73e1c1545b25 (diff)
downloadwix-bob/ConfigurableScopeBundles.tar.gz
wix-bob/ConfigurableScopeBundles.tar.bz2
wix-bob/ConfigurableScopeBundles.zip
Support dual-purpose packages in Burn.bob/ConfigurableScopeBundles
Fixes https://github.com/wixtoolset/issues/issues/8958
Diffstat (limited to '')
-rw-r--r--src/burn/engine/msiengine.cpp49
1 files changed, 44 insertions, 5 deletions
diff --git a/src/burn/engine/msiengine.cpp b/src/burn/engine/msiengine.cpp
index a1379054..11bb8a0e 100644
--- a/src/burn/engine/msiengine.cpp
+++ b/src/burn/engine/msiengine.cpp
@@ -454,7 +454,18 @@ extern "C" HRESULT MsiEngineDetectPackage(
454 454
455 // detect self by product code 455 // detect self by product code
456 // TODO: what to do about MSIINSTALLCONTEXT_USERMANAGED? 456 // TODO: what to do about MSIINSTALLCONTEXT_USERMANAGED?
457 hr = WiuGetProductInfoEx(pPackage->Msi.sczProductCode, NULL, pPackage->fPerMachine ? MSIINSTALLCONTEXT_MACHINE : MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONSTRING, &sczInstalledVersion); 457 if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == pPackage->scope || BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == pPackage->scope)
458 {
459 hr = WiuGetProductInfoEx(pPackage->Msi.sczProductCode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONSTRING, &sczInstalledVersion);
460 if (FAILED(hr))
461 {
462 hr = WiuGetProductInfoEx(pPackage->Msi.sczProductCode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONSTRING, &sczInstalledVersion);
463 }
464 }
465 else
466 {
467 hr = WiuGetProductInfoEx(pPackage->Msi.sczProductCode, NULL, pPackage->scope == BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE ? MSIINSTALLCONTEXT_MACHINE : MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONSTRING, &sczInstalledVersion);
468 }
458 if (SUCCEEDED(hr)) 469 if (SUCCEEDED(hr))
459 { 470 {
460 fDetectFeatures = TRUE; 471 fDetectFeatures = TRUE;
@@ -777,7 +788,18 @@ extern "C" HRESULT MsiEngineDetectCompatiblePackage(
777 ExitFunction(); 788 ExitFunction();
778 } 789 }
779 790
780 hr = WiuGetProductInfoEx(wzCompatibleProductCode, NULL, pPackage->fPerMachine ? MSIINSTALLCONTEXT_MACHINE : MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONSTRING, &sczVersion); 791 if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == pPackage->scope || BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == pPackage->scope)
792 {
793 hr = WiuGetProductInfoEx(wzCompatibleProductCode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONSTRING, &sczVersion);
794 if (FAILED(hr))
795 {
796 hr = WiuGetProductInfoEx(wzCompatibleProductCode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONSTRING, &sczVersion);
797 }
798 }
799 else
800 {
801 hr = WiuGetProductInfoEx(wzCompatibleProductCode, NULL, pPackage->scope == BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE ? MSIINSTALLCONTEXT_MACHINE : MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONSTRING, &sczVersion);
802 }
781 if (HRESULT_FROM_WIN32(ERROR_UNKNOWN_PRODUCT) == hr || HRESULT_FROM_WIN32(ERROR_UNKNOWN_PROPERTY) == hr || E_INVALIDARG == hr) 803 if (HRESULT_FROM_WIN32(ERROR_UNKNOWN_PRODUCT) == hr || HRESULT_FROM_WIN32(ERROR_UNKNOWN_PROPERTY) == hr || E_INVALIDARG == hr)
782 { 804 {
783 ExitFunction1(hr = S_OK); 805 ExitFunction1(hr = S_OK);
@@ -1336,10 +1358,10 @@ extern "C" HRESULT MsiEngineExecutePackage(
1336 hr = ConcatPatchProperty(pCache, pPackage, fRollback, &sczObfuscatedProperties); 1358 hr = ConcatPatchProperty(pCache, pPackage, fRollback, &sczObfuscatedProperties);
1337 ExitOnFailure(hr, "Failed to add patch properties to obfuscated argument string."); 1359 ExitOnFailure(hr, "Failed to add patch properties to obfuscated argument string.");
1338 1360
1339 hr = MsiEngineConcatBurnProperties(pExecuteAction->msiPackage.action, pExecuteAction->msiPackage.actionMsiProperty, pExecuteAction->msiPackage.fileVersioning, TRUE, 0 != pPackage->Msi.cFeatures, &sczProperties); 1361 hr = MsiEngineConcatBurnProperties(pExecuteAction->msiPackage.action, pExecuteAction->msiPackage.actionMsiProperty, pExecuteAction->msiPackage.fileVersioning, TRUE, 0 != pPackage->Msi.cFeatures, pExecuteAction->msiPackage.pPackage->scope, pExecuteAction->msiPackage.pPackage->fPerMachine, &sczProperties);
1340 ExitOnFailure(hr, "Failed to add action property to argument string."); 1362 ExitOnFailure(hr, "Failed to add action property to argument string.");
1341 1363
1342 hr = MsiEngineConcatBurnProperties(pExecuteAction->msiPackage.action, pExecuteAction->msiPackage.actionMsiProperty, pExecuteAction->msiPackage.fileVersioning, TRUE, 0 != pPackage->Msi.cFeatures, &sczObfuscatedProperties); 1364 hr = MsiEngineConcatBurnProperties(pExecuteAction->msiPackage.action, pExecuteAction->msiPackage.actionMsiProperty, pExecuteAction->msiPackage.fileVersioning, TRUE, 0 != pPackage->Msi.cFeatures, pPackage->scope, pPackage->fPerMachine, &sczObfuscatedProperties);
1343 ExitOnFailure(hr, "Failed to add action property to obfuscated argument string."); 1365 ExitOnFailure(hr, "Failed to add action property to obfuscated argument string.");
1344 1366
1345 LogId(REPORT_STANDARD, MSG_APPLYING_PACKAGE, LoggingRollbackOrExecute(fRollback), pPackage->sczId, LoggingActionStateToString(pExecuteAction->msiPackage.action), sczMsiPath, sczObfuscatedProperties ? sczObfuscatedProperties : L""); 1367 LogId(REPORT_STANDARD, MSG_APPLYING_PACKAGE, LoggingRollbackOrExecute(fRollback), pPackage->sczId, LoggingActionStateToString(pExecuteAction->msiPackage.action), sczMsiPath, sczObfuscatedProperties ? sczObfuscatedProperties : L"");
@@ -1449,7 +1471,7 @@ extern "C" HRESULT MsiEngineUninstallCompatiblePackage(
1449 ExitOnFailure(hr, "Failed to enable logging for compatible package: %ls to: %ls", pCompatibleEntry->sczId, pExecuteAction->uninstallMsiCompatiblePackage.sczLogPath); 1471 ExitOnFailure(hr, "Failed to enable logging for compatible package: %ls to: %ls", pCompatibleEntry->sczId, pExecuteAction->uninstallMsiCompatiblePackage.sczLogPath);
1450 } 1472 }
1451 1473
1452 hr = MsiEngineConcatBurnProperties(action, burnMsiProperty, fileVersioning, TRUE, FALSE, &sczProperties); 1474 hr = MsiEngineConcatBurnProperties(action, burnMsiProperty, fileVersioning, TRUE, FALSE, pParentPackage->scope, pParentPackage->fPerMachine, &sczProperties);
1453 ExitOnFailure(hr, "Failed to add action property to argument string."); 1475 ExitOnFailure(hr, "Failed to add action property to argument string.");
1454 1476
1455 LogId(REPORT_STANDARD, MSG_APPLYING_ORPHAN_COMPATIBLE_PACKAGE, LoggingRollbackOrExecute(fRollback), pCompatibleEntry->sczId, pParentPackage->sczId, LoggingActionStateToString(action), sczProperties ? sczProperties : L""); 1477 LogId(REPORT_STANDARD, MSG_APPLYING_ORPHAN_COMPATIBLE_PACKAGE, LoggingRollbackOrExecute(fRollback), pCompatibleEntry->sczId, pParentPackage->sczId, LoggingActionStateToString(action), sczProperties ? sczProperties : L"");
@@ -1491,6 +1513,8 @@ extern "C" HRESULT MsiEngineConcatBurnProperties(
1491 __in BOOTSTRAPPER_MSI_FILE_VERSIONING fileVersioning, 1513 __in BOOTSTRAPPER_MSI_FILE_VERSIONING fileVersioning,
1492 __in BOOL fMsiPackage, 1514 __in BOOL fMsiPackage,
1493 __in BOOL fFeatureSelectionEnabled, 1515 __in BOOL fFeatureSelectionEnabled,
1516 __in BOOTSTRAPPER_PACKAGE_SCOPE scope,
1517 __in BOOL fPlannedPerMachineScope,
1494 __deref_out_z LPWSTR* psczProperties 1518 __deref_out_z LPWSTR* psczProperties
1495 ) 1519 )
1496{ 1520{
@@ -1534,6 +1558,7 @@ extern "C" HRESULT MsiEngineConcatBurnProperties(
1534 break; 1558 break;
1535 } 1559 }
1536 1560
1561 // Append properties used by WixUI (and usable otherwise) to adjust internal UI behavior.
1537 switch (actionMsiProperty) 1562 switch (actionMsiProperty)
1538 { 1563 {
1539 case BURN_MSI_PROPERTY_INSTALL: 1564 case BURN_MSI_PROPERTY_INSTALL:
@@ -1581,6 +1606,20 @@ extern "C" HRESULT MsiEngineConcatBurnProperties(
1581 ExitOnFailure(hr, "Failed to add reinstall mode."); 1606 ExitOnFailure(hr, "Failed to add reinstall mode.");
1582 } 1607 }
1583 1608
1609 if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == scope || BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == scope)
1610 {
1611 if (fPlannedPerMachineScope)
1612 {
1613 hr = StrAllocConcatFormattedSecure(psczProperties, L" MSIINSTALLPERUSER=\"\"");
1614 ExitOnFailure(hr, "Failed to add per-machine scope properties.");
1615 }
1616 else
1617 {
1618 hr = StrAllocConcatFormattedSecure(psczProperties, L" MSIINSTALLPERUSER=\"1\"");
1619 ExitOnFailure(hr, "Failed to add per-user scope properties.");
1620 }
1621 }
1622
1584 hr = StrAllocConcatSecure(psczProperties, L" REBOOT=ReallySuppress", 0); 1623 hr = StrAllocConcatSecure(psczProperties, L" REBOOT=ReallySuppress", 0);
1585 ExitOnFailure(hr, "Failed to add reboot suppression property."); 1624 ExitOnFailure(hr, "Failed to add reboot suppression property.");
1586 1625