aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2026-02-20 19:18:23 -0500
committerBob Arnson <bob@firegiant.com>2026-02-20 19:18:23 -0500
commit8f3c366e9671dc5d4931dd3de28a42a1f1be32a5 (patch)
treeb9f270a14fe73dc07667cf37ea0232662e7d858b /src
parent96222b03ccc510027cb4d506fb424961cc351e03 (diff)
downloadwix-bob/WixStdBaConfigurableScope.tar.gz
wix-bob/WixStdBaConfigurableScope.tar.bz2
wix-bob/WixStdBaConfigurableScope.zip
Configurable-scope bundles for WixStdBA.bob/WixStdBaConfigurableScope
Fixes https://github.com/wixtoolset/issues/issues/9234 Fixes https://github.com/wixtoolset/issues/issues/9235
Diffstat (limited to 'src')
-rw-r--r--src/burn/engine/core.cpp4
-rw-r--r--src/burn/engine/package.cpp8
-rw-r--r--src/burn/engine/plan.cpp7
-rw-r--r--src/burn/engine/plan.h1
-rw-r--r--src/burn/engine/registration.cpp3
-rw-r--r--src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml4
-rw-r--r--src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml4
-rw-r--r--src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl2
-rw-r--r--src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml4
-rw-r--r--src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml4
-rw-r--r--src/ext/Bal/stdbas/Resources/RtfTheme.wxl2
-rw-r--r--src/ext/Bal/stdbas/Resources/RtfTheme.xml4
-rw-r--r--src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp46
-rw-r--r--src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.props1
-rw-r--r--src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs16
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(
453 pEngineState->fPlanned = FALSE; 453 pEngineState->fPlanned = FALSE;
454 PlanReset(&pEngineState->plan, &pEngineState->variables, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); 454 PlanReset(&pEngineState->plan, &pEngineState->variables, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads);
455 455
456 hr = PlanSetVariables(action, pEngineState->registration.scope, pEngineState->plan.plannedScope, &pEngineState->variables); 456 hr = PlanSetVariables(action, pEngineState->plan.plannedScope, &pEngineState->variables);
457 ExitOnFailure(hr, "Failed to update plan variables."); 457 ExitOnFailure(hr, "Failed to update plan variables.");
458 458
459 // Remember the overall action state in the plan since it shapes the changes 459 // Remember the overall action state in the plan since it shapes the changes
@@ -569,7 +569,7 @@ extern "C" HRESULT CorePlan(
569 LogPackages(pUpgradeBundlePackage, pForwardCompatibleBundlePackage, &pEngineState->packages, &pEngineState->registration.relatedBundles, action); 569 LogPackages(pUpgradeBundlePackage, pForwardCompatibleBundlePackage, &pEngineState->packages, &pEngineState->registration.relatedBundles, action);
570 } 570 }
571 571
572 hr = PlanSetVariables(action, pEngineState->registration.scope, pEngineState->plan.plannedScope, &pEngineState->variables); 572 hr = PlanSetVariables(action, pEngineState->plan.plannedScope, &pEngineState->variables);
573 ExitOnFailure(hr, "Failed to update plan variables after planning."); 573 ExitOnFailure(hr, "Failed to update plan variables after planning.");
574 574
575 PlanDump(&pEngineState->plan); 575 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(
607 hr = XmlGetAttributeEx(pixn, L"Scope", &scz); 607 hr = XmlGetAttributeEx(pixn, L"Scope", &scz);
608 ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Scope."); 608 ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Scope.");
609 609
610 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, scz, -1, L"perMachine", -1)) 610 if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"perMachine", -1, TRUE))
611 { 611 {
612 *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE; 612 *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE;
613 } 613 }
614 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, scz, -1, L"perUser", -1)) 614 else if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"perUser", -1, TRUE))
615 { 615 {
616 *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER; 616 *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER;
617 } 617 }
618 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, scz, -1, L"perUserOrMachine", -1)) 618 else if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"perUserOrMachine", -1, TRUE))
619 { 619 {
620 *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE; 620 *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE;
621 } 621 }
622 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, scz, -1, L"perMachineOrUser", -1)) 622 else if (CSTR_EQUAL == ::CompareStringOrdinal(scz, -1, L"perMachineOrUser", -1, TRUE))
623 { 623 {
624 *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER; 624 *pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER;
625 } 625 }
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(
284 } 284 }
285 } 285 }
286 286
287 PlanSetVariables(BOOTSTRAPPER_ACTION_UNKNOWN, BOOTSTRAPPER_PACKAGE_SCOPE_INVALID, BOOTSTRAPPER_SCOPE_DEFAULT, pVariables); 287 PlanSetVariables(BOOTSTRAPPER_ACTION_UNKNOWN, BOOTSTRAPPER_SCOPE_DEFAULT, pVariables);
288} 288}
289 289
290extern "C" void PlanUninitializeExecuteAction( 290extern "C" void PlanUninitializeExecuteAction(
@@ -338,7 +338,6 @@ extern "C" void PlanUninitializeExecuteAction(
338 338
339extern "C" HRESULT PlanSetVariables( 339extern "C" HRESULT PlanSetVariables(
340 __in BOOTSTRAPPER_ACTION action, 340 __in BOOTSTRAPPER_ACTION action,
341 __in BOOTSTRAPPER_PACKAGE_SCOPE authoredScope,
342 __in BOOTSTRAPPER_SCOPE plannedScope, 341 __in BOOTSTRAPPER_SCOPE plannedScope,
343 __in BURN_VARIABLES* pVariables 342 __in BURN_VARIABLES* pVariables
344 ) 343 )
@@ -348,9 +347,6 @@ extern "C" HRESULT PlanSetVariables(
348 hr = VariableSetNumeric(pVariables, BURN_BUNDLE_ACTION, action, TRUE); 347 hr = VariableSetNumeric(pVariables, BURN_BUNDLE_ACTION, action, TRUE);
349 ExitOnFailure(hr, "Failed to set the bundle action built-in variable."); 348 ExitOnFailure(hr, "Failed to set the bundle action built-in variable.");
350 349
351 hr = VariableSetNumeric(pVariables, BURN_BUNDLE_AUTHORED_SCOPE, authoredScope, TRUE);
352 ExitOnFailure(hr, "Failed to set the bundle authored scope built-in variable.");
353
354 hr = VariableSetNumeric(pVariables, BURN_BUNDLE_PLANNED_SCOPE, plannedScope, TRUE); 350 hr = VariableSetNumeric(pVariables, BURN_BUNDLE_PLANNED_SCOPE, plannedScope, TRUE);
355 ExitOnFailure(hr, "Failed to set the bundle planned scope built-in variable."); 351 ExitOnFailure(hr, "Failed to set the bundle planned scope built-in variable.");
356 352
@@ -922,7 +918,6 @@ static HRESULT GetUpgradedBundleScope(
922 918
923 // Is the related bundle's upgrade code the same as ours? 919 // Is the related bundle's upgrade code the same as ours?
924 // If so, lock our scope to the "original" bundle's scope. 920 // If so, lock our scope to the "original" bundle's scope.
925 if (CSTR_EQUAL == ::CompareStringOrdinal(wzRelatedUpgradeCode, -1, wzUpgradeCode, -1, FALSE))
926 if (CSTR_EQUAL == ::CompareStringOrdinal(wzRelatedUpgradeCode, -1, wzUpgradeCode, -1, TRUE)) 921 if (CSTR_EQUAL == ::CompareStringOrdinal(wzRelatedUpgradeCode, -1, wzUpgradeCode, -1, TRUE))
927 { 922 {
928 *pScope = pRelatedBundle->detectedScope; 923 *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(
329 ); 329 );
330HRESULT PlanSetVariables( 330HRESULT PlanSetVariables(
331 __in BOOTSTRAPPER_ACTION action, 331 __in BOOTSTRAPPER_ACTION action,
332 __in BOOTSTRAPPER_PACKAGE_SCOPE authoredScope,
333 __in BOOTSTRAPPER_SCOPE plannedScope, 332 __in BOOTSTRAPPER_SCOPE plannedScope,
334 __in BURN_VARIABLES* pVariables 333 __in BURN_VARIABLES* pVariables
335 ); 334 );
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(
441 hr = VariableSetVersion(pVariables, BURN_BUNDLE_VERSION, pRegistration->pVersion, TRUE); 441 hr = VariableSetVersion(pVariables, BURN_BUNDLE_VERSION, pRegistration->pVersion, TRUE);
442 ExitOnFailure(hr, "Failed to overwrite the bundle version built-in variable."); 442 ExitOnFailure(hr, "Failed to overwrite the bundle version built-in variable.");
443 443
444 hr = VariableSetNumeric(pVariables, BURN_BUNDLE_AUTHORED_SCOPE, pRegistration->scope, TRUE);
445 ExitOnFailure(hr, "Failed to set the bundle authored scope built-in variable.");
446
444LExit: 447LExit:
445 ReleaseStr(scz); 448 ReleaseStr(scz);
446 449
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 @@
51 <Text>#(loc.OptionsBrowseButton)</Text> 51 <Text>#(loc.OptionsBrowseButton)</Text>
52 <BrowseDirectoryAction VariableName="InstallFolder" /> 52 <BrowseDirectoryAction VariableName="InstallFolder" />
53 </Button> 53 </Button>
54 <RadioButtons Name="WixStdBAScope">
55 <RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
56 <RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
57 </RadioButtons>
54 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0"> 58 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
55 <Text>#(loc.OptionsOkButton)</Text> 59 <Text>#(loc.OptionsOkButton)</Text>
56 <ChangePageAction Page="Install" /> 60 <ChangePageAction Page="Install" />
diff --git a/src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml b/src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml
index 59a03ad0..11eac2de 100644
--- a/src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml
+++ b/src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml
@@ -54,6 +54,10 @@
54 <Text>#(loc.OptionsBrowseButton)</Text> 54 <Text>#(loc.OptionsBrowseButton)</Text>
55 <BrowseDirectoryAction VariableName="InstallFolder" /> 55 <BrowseDirectoryAction VariableName="InstallFolder" />
56 </Button> 56 </Button>
57 <RadioButtons Name="WixStdBAScope">
58 <RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
59 <RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
60 </RadioButtons>
57 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0"> 61 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
58 <Text>#(loc.OptionsOkButton)</Text> 62 <Text>#(loc.OptionsOkButton)</Text>
59 <ChangePageAction Page="Install" /> 63 <ChangePageAction Page="Install" />
diff --git a/src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl b/src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl
index 24e7b728..0a0664dc 100644
--- a/src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl
+++ b/src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl
@@ -22,6 +22,8 @@
22 <String Id="InstallCancelButton" Value="&amp;Cancel" /> 22 <String Id="InstallCancelButton" Value="&amp;Cancel" />
23 <String Id="OptionsHeader" Value="Setup Options" /> 23 <String Id="OptionsHeader" Value="Setup Options" />
24 <String Id="OptionsLocationLabel" Value="Install location:" /> 24 <String Id="OptionsLocationLabel" Value="Install location:" />
25 <String Id="OptionsPerUserScopeText" Value="Install [WixBundleName] just for &amp;me" />
26 <String Id="OptionsPerMachineScopeText" Value="Install [WixBundleName] for all &amp;users" />
25 <String Id="OptionsBrowseButton" Value="&amp;Browse" /> 27 <String Id="OptionsBrowseButton" Value="&amp;Browse" />
26 <String Id="OptionsOkButton" Value="&amp;OK" /> 28 <String Id="OptionsOkButton" Value="&amp;OK" />
27 <String Id="OptionsCancelButton" Value="&amp;Cancel" /> 29 <String Id="OptionsCancelButton" Value="&amp;Cancel" />
diff --git a/src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml b/src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml
index c82e1b9f..2d33344e 100644
--- a/src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml
+++ b/src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml
@@ -45,6 +45,10 @@
45 <Text>#(loc.OptionsBrowseButton)</Text> 45 <Text>#(loc.OptionsBrowseButton)</Text>
46 <BrowseDirectoryAction VariableName="InstallFolder" /> 46 <BrowseDirectoryAction VariableName="InstallFolder" />
47 </Button> 47 </Button>
48 <RadioButtons Name="WixStdBAScope">
49 <RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
50 <RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
51 </RadioButtons>
48 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0"> 52 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
49 <Text>#(loc.OptionsOkButton)</Text> 53 <Text>#(loc.OptionsOkButton)</Text>
50 <ChangePageAction Page="Install" /> 54 <ChangePageAction Page="Install" />
diff --git a/src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml b/src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml
index b30fe3cd..a41e4457 100644
--- a/src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml
+++ b/src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml
@@ -47,6 +47,10 @@
47 <Text>#(loc.OptionsBrowseButton)</Text> 47 <Text>#(loc.OptionsBrowseButton)</Text>
48 <BrowseDirectoryAction VariableName="InstallFolder" /> 48 <BrowseDirectoryAction VariableName="InstallFolder" />
49 </Button> 49 </Button>
50 <RadioButtons Name="WixStdBAScope">
51 <RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
52 <RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
53 </RadioButtons>
50 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0"> 54 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
51 <Text>#(loc.OptionsOkButton)</Text> 55 <Text>#(loc.OptionsOkButton)</Text>
52 <ChangePageAction Page="Install" /> 56 <ChangePageAction Page="Install" />
diff --git a/src/ext/Bal/stdbas/Resources/RtfTheme.wxl b/src/ext/Bal/stdbas/Resources/RtfTheme.wxl
index a827d1a9..9969f1f2 100644
--- a/src/ext/Bal/stdbas/Resources/RtfTheme.wxl
+++ b/src/ext/Bal/stdbas/Resources/RtfTheme.wxl
@@ -18,6 +18,8 @@
18 <String Id="InstallCancelButton" Value="&amp;Cancel" /> 18 <String Id="InstallCancelButton" Value="&amp;Cancel" />
19 <String Id="OptionsHeader" Value="Setup Options" /> 19 <String Id="OptionsHeader" Value="Setup Options" />
20 <String Id="OptionsLocationLabel" Value="Install location:" /> 20 <String Id="OptionsLocationLabel" Value="Install location:" />
21 <String Id="OptionsPerUserScopeText" Value="Install [WixBundleName] just for &amp;me" />
22 <String Id="OptionsPerMachineScopeText" Value="Install [WixBundleName] for all &amp;users" />
21 <String Id="OptionsBrowseButton" Value="&amp;Browse" /> 23 <String Id="OptionsBrowseButton" Value="&amp;Browse" />
22 <String Id="OptionsOkButton" Value="&amp;OK" /> 24 <String Id="OptionsOkButton" Value="&amp;OK" />
23 <String Id="OptionsCancelButton" Value="&amp;Cancel" /> 25 <String Id="OptionsCancelButton" Value="&amp;Cancel" />
diff --git a/src/ext/Bal/stdbas/Resources/RtfTheme.xml b/src/ext/Bal/stdbas/Resources/RtfTheme.xml
index e1a486c8..1f1c3810 100644
--- a/src/ext/Bal/stdbas/Resources/RtfTheme.xml
+++ b/src/ext/Bal/stdbas/Resources/RtfTheme.xml
@@ -45,6 +45,10 @@
45 <Text>#(loc.OptionsBrowseButton)</Text> 45 <Text>#(loc.OptionsBrowseButton)</Text>
46 <BrowseDirectoryAction VariableName="InstallFolder" /> 46 <BrowseDirectoryAction VariableName="InstallFolder" />
47 </Button> 47 </Button>
48 <RadioButtons Name="WixStdBAScope">
49 <RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
50 <RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
51 </RadioButtons>
48 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0"> 52 <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
49 <Text>#(loc.OptionsOkButton)</Text> 53 <Text>#(loc.OptionsOkButton)</Text>
50 <ChangePageAction Page="Install" /> 54 <ChangePageAction Page="Install" />
diff --git a/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp
index 74c6b4db..e0b03f98 100644
--- a/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp
+++ b/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp
@@ -23,6 +23,9 @@ static const LPCWSTR WIXSTDBA_VARIABLE_SHOW_VERSION = L"WixStdBAShowVersion";
23static const LPCWSTR WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI = L"WixStdBASuppressOptionsUI"; 23static const LPCWSTR WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI = L"WixStdBASuppressOptionsUI";
24static const LPCWSTR WIXSTDBA_VARIABLE_UPDATE_AVAILABLE = L"WixStdBAUpdateAvailable"; 24static const LPCWSTR WIXSTDBA_VARIABLE_UPDATE_AVAILABLE = L"WixStdBAUpdateAvailable";
25 25
26static const LPCWSTR WIXSTDBA_PER_USER_SCOPE = L"PerUser";
27static const LPCWSTR WIXSTDBA_PER_MACHINE_SCOPE = L"PerMachine";;
28
26enum WIXSTDBA_STATE 29enum WIXSTDBA_STATE
27{ 30{
28 WIXSTDBA_STATE_INITIALIZING, 31 WIXSTDBA_STATE_INITIALIZING,
@@ -186,6 +189,7 @@ public: // IBootstrapperApplication
186 ) 189 )
187 { 190 {
188 HRESULT hr = S_OK; 191 HRESULT hr = S_OK;
192 LONGLONG llScope = 0;
189 193
190 hr = __super::OnCreate(pEngine, pCommand); 194 hr = __super::OnCreate(pEngine, pCommand);
191 BalExitOnFailure(hr, "CBootstrapperApplicationBase initialization failed."); 195 BalExitOnFailure(hr, "CBootstrapperApplicationBase initialization failed.");
@@ -197,7 +201,12 @@ public: // IBootstrapperApplication
197 m_hwndSplashScreen = pCommand->hwndSplashScreen; 201 m_hwndSplashScreen = pCommand->hwndSplashScreen;
198 202
199 hr = BalGetStringVariable(L"WixBundleVersion", &m_sczBundleVersion); 203 hr = BalGetStringVariable(L"WixBundleVersion", &m_sczBundleVersion);
200 BalExitOnFailure(hr, "CWixStandardBootstrapperApplication initialization failed."); 204 BalExitOnFailure(hr, "Failed to get WixBundleVersion.");
205
206 hr = BalGetNumericVariable(L"WixBundleAuthoredScope", &llScope);
207 BalExitOnFailure(hr, "Failed to get WixBundleAuthoredScope.");
208
209 m_bundleScope = static_cast<BOOTSTRAPPER_PACKAGE_SCOPE>(llScope);
201 210
202 hr = InitializeData(pCommand); 211 hr = InitializeData(pCommand);
203 BalExitOnFailure(hr, "Failed to initialize data in bootstrapper application."); 212 BalExitOnFailure(hr, "Failed to initialize data in bootstrapper application.");
@@ -2888,6 +2897,18 @@ private:
2888 } 2897 }
2889 } 2898 }
2890 2899
2900 // Set the variable matching the default theme scope-selection radio buttons
2901 // so the default scope is already selected.
2902 if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == m_bundleScope)
2903 {
2904 hr = BalSetStringVariable(L"WixStdBAScope", WIXSTDBA_PER_USER_SCOPE, FALSE);
2905 }
2906 else if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == m_bundleScope)
2907 {
2908 hr = BalSetStringVariable(L"WixStdBAScope", WIXSTDBA_PER_MACHINE_SCOPE, FALSE);
2909 }
2910 BalExitOnFailure(hr, "Failed to set WixStdBAScope.");
2911
2891 LExit: 2912 LExit:
2892 ReleaseObject(pixdManifest); 2913 ReleaseObject(pixdManifest);
2893 2914
@@ -3819,15 +3840,35 @@ private:
3819 ) 3840 )
3820 { 3841 {
3821 HRESULT hr = S_OK; 3842 HRESULT hr = S_OK;
3843 BOOTSTRAPPER_SCOPE scope = BOOTSTRAPPER_SCOPE_DEFAULT;
3844 LPWSTR sczScopeValue = NULL;
3822 3845
3823 m_plannedAction = action; 3846 m_plannedAction = action;
3824 3847
3848 if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == m_bundleScope
3849 || BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == m_bundleScope)
3850 {
3851 hr = BalGetStringVariable(L"WixStdBAScope", &sczScopeValue);
3852 BalExitOnFailure(hr, "Failed to get scope value.");
3853
3854 if (CSTR_EQUAL == ::CompareStringOrdinal(sczScopeValue, -1, L"PerUser", -1, TRUE))
3855 {
3856 scope = BOOTSTRAPPER_SCOPE_PER_USER;
3857 }
3858 else if (CSTR_EQUAL == ::CompareStringOrdinal(sczScopeValue, -1, L"PerMachine", -1, TRUE))
3859 {
3860 scope = BOOTSTRAPPER_SCOPE_PER_MACHINE;
3861 }
3862 }
3863
3825 SetState(WIXSTDBA_STATE_PLANNING, hr); 3864 SetState(WIXSTDBA_STATE_PLANNING, hr);
3826 3865
3827 hr = m_pEngine->Plan(action, BOOTSTRAPPER_SCOPE_DEFAULT/*TODO*/); 3866 hr = m_pEngine->Plan(action, scope);
3828 BalExitOnFailure(hr, "Failed to start planning packages."); 3867 BalExitOnFailure(hr, "Failed to start planning packages.");
3829 3868
3830 LExit: 3869 LExit:
3870 ReleaseStr(sczScopeValue);
3871
3831 if (FAILED(hr)) 3872 if (FAILED(hr))
3832 { 3873 {
3833 SetState(WIXSTDBA_STATE_PLANNING, hr); 3874 SetState(WIXSTDBA_STATE_PLANNING, hr);
@@ -5104,6 +5145,7 @@ private:
5104 HWND m_hwndSplashScreen; 5145 HWND m_hwndSplashScreen;
5105 5146
5106 BOOTSTRAPPER_ACTION m_plannedAction; 5147 BOOTSTRAPPER_ACTION m_plannedAction;
5148 BOOTSTRAPPER_PACKAGE_SCOPE m_bundleScope;
5107 5149
5108 LPWSTR m_sczAfterForcedRestartPackage; 5150 LPWSTR m_sczAfterForcedRestartPackage;
5109 LPWSTR m_sczBundleVersion; 5151 LPWSTR m_sczBundleVersion;
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.props b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.props
index d704544c..aa4945d3 100644
--- a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.props
+++ b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.props
@@ -4,6 +4,7 @@
4 </PropertyGroup> 4 </PropertyGroup>
5 <ItemGroup> 5 <ItemGroup>
6 <PackageReference Include="WixToolset.BootstrapperApplications.wixext" /> 6 <PackageReference Include="WixToolset.BootstrapperApplications.wixext" />
7 <PackageReference Include="WixToolset.Util.wixext" />
7 <PackageReference Include="WixToolset.NetFx.wixext" /> 8 <PackageReference Include="WixToolset.NetFx.wixext" />
8 </ItemGroup> 9 </ItemGroup>
9 <ItemGroup> 10 <ItemGroup>
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs
index 8e1a881a..e47611c5 100644
--- a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs
+++ b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs
@@ -1,4 +1,4 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> 1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
2 <Bundle Id="AllPuomBundle$(BA)" Name="AllPuomBundle$(BA)" Manufacturer="Acme" Version="$(Version)"> 2 <Bundle Id="AllPuomBundle$(BA)" Name="AllPuomBundle$(BA)" Manufacturer="Acme" Version="$(Version)">
3 <?if $(BA) = "WixStdBA"?> 3 <?if $(BA) = "WixStdBA"?>
4 <BootstrapperApplication> 4 <BootstrapperApplication>
@@ -8,6 +8,12 @@
8 8
9 <Variable Name="TestGroupName" Value="ConfigurableScopeTests" /> 9 <Variable Name="TestGroupName" Value="ConfigurableScopeTests" />
10 10
11 <!-- Add some random upgrade codes for the fun of it. -->
12 <RelatedBundle Code="{087861DF-D2EC-4485-9F07-E4CCD67D12D1}" Action="upgrade" />
13 <RelatedBundle Code="{8D6ADB72-EDE7-4D92-B88F-494A2425FE20}" Action="upgrade" />
14
15 <util:ProductSearchRef Id="FooSearch" />
16
11 <Chain> 17 <Chain>
12 <?if $(BA) = "TestBA"?> 18 <?if $(BA) = "TestBA"?>
13 <PackageGroupRef Id="TestBA" /> 19 <PackageGroupRef Id="TestBA" />
@@ -16,4 +22,12 @@
16 <MsiPackage SourceFile="PuomPkg2.msi" /> 22 <MsiPackage SourceFile="PuomPkg2.msi" />
17 </Chain> 23 </Chain>
18 </Bundle> 24 </Bundle>
25
26 <Fragment>
27 <util:ProductSearch Id="FooSearch" ProductCode="{BD22A70A-6191-468B-B6EE-2738916017C1}" Variable="Foo" />
28
29 <!-- Add some more random upgrade codes for even more fun. -->
30 <RelatedBundle Code="{B18397C3-C223-4E5B-9FD7-E22838F9EDCB}" Action="upgrade" />
31 <RelatedBundle Code="{5CC50F34-8EB5-48F9-B0CC-DC54232C487A}" Action="upgrade" />
32 </Fragment>
19</Wix> 33</Wix>