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 | |
| 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')
| -rw-r--r-- | src/burn/engine/apply.cpp | 4 | ||||
| -rw-r--r-- | src/burn/engine/bundlepackageengine.cpp | 24 | ||||
| -rw-r--r-- | src/burn/engine/bundlepackageengine.h | 2 | ||||
| -rw-r--r-- | src/burn/engine/elevation.cpp | 4 |
4 files changed, 27 insertions, 7 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index 68aded71..b7a54246 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
| @@ -2761,7 +2761,7 @@ static HRESULT ExecuteRelatedBundle( | |||
| 2761 | } | 2761 | } |
| 2762 | else | 2762 | else |
| 2763 | { | 2763 | { |
| 2764 | hrExecute = BundlePackageEngineExecuteRelatedBundle(pExecuteAction, pContext->pCache, &pEngineState->variables, fRollback, GenericExecuteMessageHandler, pContext, pRestart); | 2764 | hrExecute = BundlePackageEngineExecuteRelatedBundle(pExecuteAction, pContext->pCache, &pEngineState->variables, fRollback, FALSE/*fPerMachine*/, GenericExecuteMessageHandler, pContext, pRestart); |
| 2765 | ExitOnFailure(hrExecute, "Failed to configure per-user related bundle."); | 2765 | ExitOnFailure(hrExecute, "Failed to configure per-user related bundle."); |
| 2766 | } | 2766 | } |
| 2767 | 2767 | ||
| @@ -2888,7 +2888,7 @@ static HRESULT ExecuteBundlePackage( | |||
| 2888 | } | 2888 | } |
| 2889 | else | 2889 | else |
| 2890 | { | 2890 | { |
| 2891 | hrExecute = BundlePackageEngineExecutePackage(pExecuteAction, pContext->pCache, &pEngineState->variables, fRollback, SUCCEEDED(pExecuteAction->bundlePackage.pPackage->hrCacheResult), GenericExecuteMessageHandler, pContext, pRestart); | 2891 | hrExecute = BundlePackageEngineExecutePackage(pExecuteAction, pContext->pCache, &pEngineState->variables, fRollback, SUCCEEDED(pExecuteAction->bundlePackage.pPackage->hrCacheResult), pEngineState->registration.fPerMachine, GenericExecuteMessageHandler, pContext, pRestart); |
| 2892 | ExitOnFailure(hrExecute, "Failed to configure per-user BUNDLE package."); | 2892 | ExitOnFailure(hrExecute, "Failed to configure per-user BUNDLE package."); |
| 2893 | } | 2893 | } |
| 2894 | 2894 | ||
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 | { |
diff --git a/src/burn/engine/bundlepackageengine.h b/src/burn/engine/bundlepackageengine.h index 60854a07..3912bfce 100644 --- a/src/burn/engine/bundlepackageengine.h +++ b/src/burn/engine/bundlepackageengine.h | |||
| @@ -54,6 +54,7 @@ HRESULT BundlePackageEngineExecutePackage( | |||
| 54 | __in BURN_VARIABLES* pVariables, | 54 | __in BURN_VARIABLES* pVariables, |
| 55 | __in BOOL fRollback, | 55 | __in BOOL fRollback, |
| 56 | __in BOOL fCacheAvailable, | 56 | __in BOOL fCacheAvailable, |
| 57 | __in BOOL fPerMachine, | ||
| 57 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, | 58 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, |
| 58 | __in LPVOID pvContext, | 59 | __in LPVOID pvContext, |
| 59 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | 60 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart |
| @@ -63,6 +64,7 @@ HRESULT BundlePackageEngineExecuteRelatedBundle( | |||
| 63 | __in BURN_CACHE* pCache, | 64 | __in BURN_CACHE* pCache, |
| 64 | __in BURN_VARIABLES* pVariables, | 65 | __in BURN_VARIABLES* pVariables, |
| 65 | __in BOOL fRollback, | 66 | __in BOOL fRollback, |
| 67 | __in BOOL fPerMachine, | ||
| 66 | __in PFN_GENERICMESSAGEHANDLER pfnGenericExecuteProgress, | 68 | __in PFN_GENERICMESSAGEHANDLER pfnGenericExecuteProgress, |
| 67 | __in LPVOID pvContext, | 69 | __in LPVOID pvContext, |
| 68 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | 70 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart |
diff --git a/src/burn/engine/elevation.cpp b/src/burn/engine/elevation.cpp index 711ce4af..b13a5916 100644 --- a/src/burn/engine/elevation.cpp +++ b/src/burn/engine/elevation.cpp | |||
| @@ -2913,7 +2913,7 @@ static HRESULT OnExecuteRelatedBundle( | |||
| 2913 | } | 2913 | } |
| 2914 | 2914 | ||
| 2915 | // Execute related bundle. | 2915 | // Execute related bundle. |
| 2916 | hr = BundlePackageEngineExecuteRelatedBundle(&executeAction, pCache, pVariables, static_cast<BOOL>(dwRollback), GenericExecuteMessageHandler, hPipe, pRestart); | 2916 | hr = BundlePackageEngineExecuteRelatedBundle(&executeAction, pCache, pVariables, static_cast<BOOL>(dwRollback), TRUE/*fPerMachine*/, GenericExecuteMessageHandler, hPipe, pRestart); |
| 2917 | ExitOnFailure(hr, "Failed to execute related bundle."); | 2917 | ExitOnFailure(hr, "Failed to execute related bundle."); |
| 2918 | 2918 | ||
| 2919 | LExit: | 2919 | LExit: |
| @@ -3008,7 +3008,7 @@ static HRESULT OnExecuteBundlePackage( | |||
| 3008 | } | 3008 | } |
| 3009 | 3009 | ||
| 3010 | // Execute BUNDLE package. | 3010 | // Execute BUNDLE package. |
| 3011 | hr = BundlePackageEngineExecutePackage(&executeAction, pCache, pVariables, fRollback, fCacheAvailable, GenericExecuteMessageHandler, hPipe, pRestart); | 3011 | hr = BundlePackageEngineExecutePackage(&executeAction, pCache, pVariables, fRollback, fCacheAvailable, TRUE/*fPerMachine*/, GenericExecuteMessageHandler, hPipe, pRestart); |
| 3012 | ExitOnFailure(hr, "Failed to execute BUNDLE package."); | 3012 | ExitOnFailure(hr, "Failed to execute BUNDLE package."); |
| 3013 | 3013 | ||
| 3014 | LExit: | 3014 | LExit: |
