From 8f3c366e9671dc5d4931dd3de28a42a1f1be32a5 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Fri, 20 Feb 2026 19:18:23 -0500 Subject: Configurable-scope bundles for WixStdBA. Fixes https://github.com/wixtoolset/issues/issues/9234 Fixes https://github.com/wixtoolset/issues/issues/9235 --- src/burn/engine/core.cpp | 4 +- src/burn/engine/package.cpp | 8 ++-- src/burn/engine/plan.cpp | 7 +--- src/burn/engine/plan.h | 1 - src/burn/engine/registration.cpp | 3 ++ .../Bal/stdbas/Resources/HyperlinkLargeTheme.xml | 4 ++ .../Bal/stdbas/Resources/HyperlinkSidebarTheme.xml | 4 ++ src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl | 2 + src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml | 4 ++ src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml | 4 ++ src/ext/Bal/stdbas/Resources/RtfTheme.wxl | 2 + src/ext/Bal/stdbas/Resources/RtfTheme.xml | 4 ++ .../stdbas/WixStandardBootstrapperApplication.cpp | 46 +++++++++++++++++++++- .../AllPuomBundle/Bundle.props | 1 + .../AllPuomBundle/Bundle.wxs | 16 +++++++- 15 files changed, 94 insertions(+), 16 deletions(-) diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 5483e46f..da4ea91b 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp @@ -453,7 +453,7 @@ extern "C" HRESULT CorePlan( pEngineState->fPlanned = FALSE; PlanReset(&pEngineState->plan, &pEngineState->variables, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); - hr = PlanSetVariables(action, pEngineState->registration.scope, pEngineState->plan.plannedScope, &pEngineState->variables); + hr = PlanSetVariables(action, pEngineState->plan.plannedScope, &pEngineState->variables); ExitOnFailure(hr, "Failed to update plan variables."); // Remember the overall action state in the plan since it shapes the changes @@ -569,7 +569,7 @@ extern "C" HRESULT CorePlan( LogPackages(pUpgradeBundlePackage, pForwardCompatibleBundlePackage, &pEngineState->packages, &pEngineState->registration.relatedBundles, action); } - hr = PlanSetVariables(action, pEngineState->registration.scope, pEngineState->plan.plannedScope, &pEngineState->variables); + hr = PlanSetVariables(action, pEngineState->plan.plannedScope, &pEngineState->variables); ExitOnFailure(hr, "Failed to update plan variables after planning."); PlanDump(&pEngineState->plan); diff --git a/src/burn/engine/package.cpp b/src/burn/engine/package.cpp index 61b73dc6..c7517a10 100644 --- a/src/burn/engine/package.cpp +++ b/src/burn/engine/package.cpp @@ -607,19 +607,19 @@ extern "C" HRESULT PackageParseScopeFromXml( hr = XmlGetAttributeEx(pixn, L"Scope", &scz); ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Scope."); - if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, scz, -1, L"perMachine", -1)) + if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"perMachine", -1, TRUE)) { *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE; } - else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, scz, -1, L"perUser", -1)) + else if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"perUser", -1, TRUE)) { *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER; } - else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, scz, -1, L"perUserOrMachine", -1)) + else if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"perUserOrMachine", -1, TRUE)) { *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE; } - else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, scz, -1, L"perMachineOrUser", -1)) + else if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"perMachineOrUser", -1, TRUE)) { *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER; } diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index 2257b28c..302c1857 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp @@ -284,7 +284,7 @@ extern "C" void PlanReset( } } - PlanSetVariables(BOOTSTRAPPER_ACTION_UNKNOWN, BOOTSTRAPPER_PACKAGE_SCOPE_INVALID, BOOTSTRAPPER_SCOPE_DEFAULT, pVariables); + PlanSetVariables(BOOTSTRAPPER_ACTION_UNKNOWN, BOOTSTRAPPER_SCOPE_DEFAULT, pVariables); } extern "C" void PlanUninitializeExecuteAction( @@ -338,7 +338,6 @@ extern "C" void PlanUninitializeExecuteAction( extern "C" HRESULT PlanSetVariables( __in BOOTSTRAPPER_ACTION action, - __in BOOTSTRAPPER_PACKAGE_SCOPE authoredScope, __in BOOTSTRAPPER_SCOPE plannedScope, __in BURN_VARIABLES* pVariables ) @@ -348,9 +347,6 @@ extern "C" HRESULT PlanSetVariables( hr = VariableSetNumeric(pVariables, BURN_BUNDLE_ACTION, action, TRUE); ExitOnFailure(hr, "Failed to set the bundle action built-in variable."); - hr = VariableSetNumeric(pVariables, BURN_BUNDLE_AUTHORED_SCOPE, authoredScope, TRUE); - ExitOnFailure(hr, "Failed to set the bundle authored scope built-in variable."); - hr = VariableSetNumeric(pVariables, BURN_BUNDLE_PLANNED_SCOPE, plannedScope, TRUE); ExitOnFailure(hr, "Failed to set the bundle planned scope built-in variable."); @@ -922,7 +918,6 @@ static HRESULT GetUpgradedBundleScope( // Is the related bundle's upgrade code the same as ours? // If so, lock our scope to the "original" bundle's scope. - if (CSTR_EQUAL == ::CompareStringOrdinal(wzRelatedUpgradeCode, -1, wzUpgradeCode, -1, FALSE)) if (CSTR_EQUAL == ::CompareStringOrdinal(wzRelatedUpgradeCode, -1, wzUpgradeCode, -1, TRUE)) { *pScope = pRelatedBundle->detectedScope; diff --git a/src/burn/engine/plan.h b/src/burn/engine/plan.h index 09918440..65baca86 100644 --- a/src/burn/engine/plan.h +++ b/src/burn/engine/plan.h @@ -329,7 +329,6 @@ void PlanUninitializeExecuteAction( ); HRESULT PlanSetVariables( __in BOOTSTRAPPER_ACTION action, - __in BOOTSTRAPPER_PACKAGE_SCOPE authoredScope, __in BOOTSTRAPPER_SCOPE plannedScope, __in BURN_VARIABLES* pVariables ); diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index 7c9ca182..e7a9b95f 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp @@ -441,6 +441,9 @@ extern "C" HRESULT RegistrationSetVariables( hr = VariableSetVersion(pVariables, BURN_BUNDLE_VERSION, pRegistration->pVersion, TRUE); ExitOnFailure(hr, "Failed to overwrite the bundle version built-in variable."); + hr = VariableSetNumeric(pVariables, BURN_BUNDLE_AUTHORED_SCOPE, pRegistration->scope, TRUE); + ExitOnFailure(hr, "Failed to set the bundle authored scope built-in variable."); + LExit: ReleaseStr(scz); diff --git a/src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml b/src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml index 6e7b69ee..dcc1a7c1 100644 --- a/src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml +++ b/src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml @@ -51,6 +51,10 @@ #(loc.OptionsBrowseButton) + + #(loc.OptionsPerUserScopeText) + #(loc.OptionsPerMachineScopeText) + + + #(loc.OptionsPerUserScopeText) + #(loc.OptionsPerMachineScopeText) + + + #(loc.OptionsPerUserScopeText) + #(loc.OptionsPerMachineScopeText) + + + #(loc.OptionsPerUserScopeText) + #(loc.OptionsPerMachineScopeText) + + + #(loc.OptionsPerUserScopeText) + #(loc.OptionsPerMachineScopeText) +