diff options
| author | Bob Arnson <bob@firegiant.com> | 2026-02-25 19:43:09 -0500 |
|---|---|---|
| committer | Bob Arnson <github@bobs.org> | 2026-02-25 20:21:23 -0500 |
| commit | 918332a0e80e8761eca20e801ae7ce3631fdbaea (patch) | |
| tree | c4b9ae147242c1e3830ba2f9443acfe0dcf20958 /src/burn/engine/bundlepackageengine.cpp | |
| parent | 92714e7949c41db4c17e6bd87c919ef4b3dc34f7 (diff) | |
| download | wix-918332a0e80e8761eca20e801ae7ce3631fdbaea.tar.gz wix-918332a0e80e8761eca20e801ae7ce3631fdbaea.tar.bz2 wix-918332a0e80e8761eca20e801ae7ce3631fdbaea.zip | |
Handle scope of configurable-scope BundlePackages.
Fixes https://github.com/wixtoolset/issues/issues/9233
Diffstat (limited to 'src/burn/engine/bundlepackageengine.cpp')
| -rw-r--r-- | src/burn/engine/bundlepackageengine.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/burn/engine/bundlepackageengine.cpp b/src/burn/engine/bundlepackageengine.cpp index 7ada5f6a..ac884830 100644 --- a/src/burn/engine/bundlepackageengine.cpp +++ b/src/burn/engine/bundlepackageengine.cpp | |||
| @@ -25,6 +25,7 @@ static HRESULT ExecuteBundle( | |||
| 25 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 25 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 26 | __in BURN_PACKAGE* pPackage, | 26 | __in BURN_PACKAGE* pPackage, |
| 27 | __in BOOL fPseudoPackage, | 27 | __in BOOL fPseudoPackage, |
| 28 | __in BOOL fPerMachine, | ||
| 28 | __in_z_opt LPCWSTR wzParent, | 29 | __in_z_opt LPCWSTR wzParent, |
| 29 | __in_z_opt LPCWSTR wzIgnoreDependencies, | 30 | __in_z_opt LPCWSTR wzIgnoreDependencies, |
| 30 | __in_z_opt LPCWSTR wzAncestors, | 31 | __in_z_opt LPCWSTR wzAncestors, |
| @@ -51,7 +52,7 @@ extern "C" HRESULT BundlePackageEngineParsePackageFromXml( | |||
| 51 | BOOL fFoundXml = FALSE; | 52 | BOOL fFoundXml = FALSE; |
| 52 | LPWSTR scz = NULL; | 53 | LPWSTR scz = NULL; |
| 53 | 54 | ||
| 54 | // @DetectCondition | 55 | // @BundleCode |
| 55 | hr = XmlGetAttributeEx(pixnBundlePackage, L"BundleCode", &pPackage->Bundle.sczBundleCode); | 56 | hr = XmlGetAttributeEx(pixnBundlePackage, L"BundleCode", &pPackage->Bundle.sczBundleCode); |
| 56 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @BundleCode."); | 57 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @BundleCode."); |
| 57 | 58 | ||
| @@ -91,6 +92,10 @@ extern "C" HRESULT BundlePackageEngineParsePackageFromXml( | |||
| 91 | hr = XmlGetYesNoAttribute(pixnBundlePackage, L"Win64", &pPackage->Bundle.fWin64); | 92 | hr = XmlGetYesNoAttribute(pixnBundlePackage, L"Win64", &pPackage->Bundle.fWin64); |
| 92 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Win64."); | 93 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Win64."); |
| 93 | 94 | ||
| 95 | // @Scope | ||
| 96 | hr = PackageParseScopeFromXml(pixnBundlePackage, &pPackage->scope); | ||
| 97 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Scope."); | ||
| 98 | |||
| 94 | hr = BundlePackageEngineParseRelatedCodes(pixnBundlePackage, &pPackage->Bundle.rgsczDetectCodes, &pPackage->Bundle.cDetectCodes, &pPackage->Bundle.rgsczUpgradeCodes, &pPackage->Bundle.cUpgradeCodes, &pPackage->Bundle.rgsczAddonCodes, &pPackage->Bundle.cAddonCodes, &pPackage->Bundle.rgsczPatchCodes, &pPackage->Bundle.cPatchCodes); | 99 | hr = BundlePackageEngineParseRelatedCodes(pixnBundlePackage, &pPackage->Bundle.rgsczDetectCodes, &pPackage->Bundle.cDetectCodes, &pPackage->Bundle.rgsczUpgradeCodes, &pPackage->Bundle.cUpgradeCodes, &pPackage->Bundle.rgsczAddonCodes, &pPackage->Bundle.cAddonCodes, &pPackage->Bundle.rgsczPatchCodes, &pPackage->Bundle.cPatchCodes); |
| 95 | ExitOnFailure(hr, "Failed to parse related codes."); | 100 | ExitOnFailure(hr, "Failed to parse related codes."); |
| 96 | 101 | ||
| @@ -608,6 +613,7 @@ extern "C" HRESULT BundlePackageEngineExecutePackage( | |||
| 608 | __in BURN_VARIABLES* pVariables, | 613 | __in BURN_VARIABLES* pVariables, |
| 609 | __in BOOL fRollback, | 614 | __in BOOL fRollback, |
| 610 | __in BOOL fCacheAvailable, | 615 | __in BOOL fCacheAvailable, |
| 616 | __in BOOL fPerMachine, | ||
| 611 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, | 617 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, |
| 612 | __in LPVOID pvContext, | 618 | __in LPVOID pvContext, |
| 613 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | 619 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart |
| @@ -621,7 +627,7 @@ extern "C" HRESULT BundlePackageEngineExecutePackage( | |||
| 621 | BOOTSTRAPPER_RELATION_TYPE relationType = BOOTSTRAPPER_RELATION_CHAIN_PACKAGE; | 627 | BOOTSTRAPPER_RELATION_TYPE relationType = BOOTSTRAPPER_RELATION_CHAIN_PACKAGE; |
| 622 | BURN_PACKAGE* pPackage = pExecuteAction->bundlePackage.pPackage; | 628 | BURN_PACKAGE* pPackage = pExecuteAction->bundlePackage.pPackage; |
| 623 | 629 | ||
| 624 | return ExecuteBundle(pCache, pVariables, fRollback, fCacheAvailable, pfnGenericMessageHandler, pvContext, action, relationType, pPackage, FALSE, wzParent, wzIgnoreDependencies, wzAncestors, wzEngineWorkingDirectory, pRestart); | 630 | return ExecuteBundle(pCache, pVariables, fRollback, fCacheAvailable, pfnGenericMessageHandler, pvContext, action, relationType, pPackage, FALSE, fPerMachine, wzParent, wzIgnoreDependencies, wzAncestors, wzEngineWorkingDirectory, pRestart); |
| 625 | } | 631 | } |
| 626 | 632 | ||
| 627 | extern "C" HRESULT BundlePackageEngineExecuteRelatedBundle( | 633 | extern "C" HRESULT BundlePackageEngineExecuteRelatedBundle( |
| @@ -629,6 +635,7 @@ extern "C" HRESULT BundlePackageEngineExecuteRelatedBundle( | |||
| 629 | __in BURN_CACHE* pCache, | 635 | __in BURN_CACHE* pCache, |
| 630 | __in BURN_VARIABLES* pVariables, | 636 | __in BURN_VARIABLES* pVariables, |
| 631 | __in BOOL fRollback, | 637 | __in BOOL fRollback, |
| 638 | __in BOOL fPerMachine, | ||
| 632 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, | 639 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, |
| 633 | __in LPVOID pvContext, | 640 | __in LPVOID pvContext, |
| 634 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | 641 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart |
| @@ -643,7 +650,7 @@ extern "C" HRESULT BundlePackageEngineExecuteRelatedBundle( | |||
| 643 | BOOTSTRAPPER_RELATION_TYPE relationType = ConvertRelationType(pRelatedBundle->planRelationType); | 650 | BOOTSTRAPPER_RELATION_TYPE relationType = ConvertRelationType(pRelatedBundle->planRelationType); |
| 644 | BURN_PACKAGE* pPackage = &pRelatedBundle->package; | 651 | BURN_PACKAGE* pPackage = &pRelatedBundle->package; |
| 645 | 652 | ||
| 646 | return ExecuteBundle(pCache, pVariables, fRollback, TRUE, pfnGenericMessageHandler, pvContext, action, relationType, pPackage, TRUE, wzParent, wzIgnoreDependencies, wzAncestors, wzEngineWorkingDirectory, pRestart); | 653 | return ExecuteBundle(pCache, pVariables, fRollback, TRUE, pfnGenericMessageHandler, pvContext, action, relationType, pPackage, TRUE, fPerMachine, wzParent, wzIgnoreDependencies, wzAncestors, wzEngineWorkingDirectory, pRestart); |
| 647 | } | 654 | } |
| 648 | 655 | ||
| 649 | extern "C" void BundlePackageEngineUpdateInstallRegistrationState( | 656 | extern "C" void BundlePackageEngineUpdateInstallRegistrationState( |
| @@ -742,6 +749,7 @@ static HRESULT ExecuteBundle( | |||
| 742 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 749 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 743 | __in BURN_PACKAGE* pPackage, | 750 | __in BURN_PACKAGE* pPackage, |
| 744 | __in BOOL fPseudoPackage, | 751 | __in BOOL fPseudoPackage, |
| 752 | __in BOOL fPerMachine, | ||
| 745 | __in_z_opt LPCWSTR wzParent, | 753 | __in_z_opt LPCWSTR wzParent, |
| 746 | __in_z_opt LPCWSTR wzIgnoreDependencies, | 754 | __in_z_opt LPCWSTR wzIgnoreDependencies, |
| 747 | __in_z_opt LPCWSTR wzAncestors, | 755 | __in_z_opt LPCWSTR wzAncestors, |
| @@ -987,6 +995,16 @@ static HRESULT ExecuteBundle( | |||
| 987 | hr = CoreAppendFileHandleSelfToCommandLine(sczExecutablePath, &hExecutableFile, &sczBaseCommand, NULL); | 995 | hr = CoreAppendFileHandleSelfToCommandLine(sczExecutablePath, &hExecutableFile, &sczBaseCommand, NULL); |
| 988 | ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF); | 996 | ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF); |
| 989 | 997 | ||
| 998 | // Configurable-scope bundle packages get the scope of the parent bundle. | ||
| 999 | // Note that the command-line switch takes effect only if the BA does a | ||
| 1000 | // default plan. | ||
| 1001 | if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == pPackage->scope | ||
| 1002 | || BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == pPackage->scope) | ||
| 1003 | { | ||
| 1004 | hr = StrAllocConcat(&sczBaseCommand, fPerMachine ? L" -permachine" : L" -peruser", 0); | ||
| 1005 | ExitOnFailure(hr, "Failed to append scope switch to the command line."); | ||
| 1006 | } | ||
| 1007 | |||
| 990 | // build user args | 1008 | // build user args |
| 991 | if (sczUnformattedUserArgs && *sczUnformattedUserArgs) | 1009 | if (sczUnformattedUserArgs && *sczUnformattedUserArgs) |
| 992 | { | 1010 | { |
