Skip to content

Commit 92714e7

Browse files
committed
Configurable-scope bundles for WixStdBA.
Fixes wixtoolset/issues#9234 Fixes wixtoolset/issues#9235
1 parent 96222b0 commit 92714e7

15 files changed

Lines changed: 94 additions & 16 deletions

File tree

src/burn/engine/core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ extern "C" HRESULT CorePlan(
453453
pEngineState->fPlanned = FALSE;
454454
PlanReset(&pEngineState->plan, &pEngineState->variables, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads);
455455

456-
hr = PlanSetVariables(action, pEngineState->registration.scope, pEngineState->plan.plannedScope, &pEngineState->variables);
456+
hr = PlanSetVariables(action, pEngineState->plan.plannedScope, &pEngineState->variables);
457457
ExitOnFailure(hr, "Failed to update plan variables.");
458458

459459
// Remember the overall action state in the plan since it shapes the changes
@@ -569,7 +569,7 @@ extern "C" HRESULT CorePlan(
569569
LogPackages(pUpgradeBundlePackage, pForwardCompatibleBundlePackage, &pEngineState->packages, &pEngineState->registration.relatedBundles, action);
570570
}
571571

572-
hr = PlanSetVariables(action, pEngineState->registration.scope, pEngineState->plan.plannedScope, &pEngineState->variables);
572+
hr = PlanSetVariables(action, pEngineState->plan.plannedScope, &pEngineState->variables);
573573
ExitOnFailure(hr, "Failed to update plan variables after planning.");
574574

575575
PlanDump(&pEngineState->plan);

src/burn/engine/package.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,19 +607,19 @@ extern "C" HRESULT PackageParseScopeFromXml(
607607
hr = XmlGetAttributeEx(pixn, L"Scope", &scz);
608608
ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Scope.");
609609

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))
611611
{
612612
*pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE;
613613
}
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))
615615
{
616616
*pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER;
617617
}
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))
619619
{
620620
*pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE;
621621
}
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))
623623
{
624624
*pScope = BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER;
625625
}

src/burn/engine/plan.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ extern "C" void PlanReset(
284284
}
285285
}
286286

287-
PlanSetVariables(BOOTSTRAPPER_ACTION_UNKNOWN, BOOTSTRAPPER_PACKAGE_SCOPE_INVALID, BOOTSTRAPPER_SCOPE_DEFAULT, pVariables);
287+
PlanSetVariables(BOOTSTRAPPER_ACTION_UNKNOWN, BOOTSTRAPPER_SCOPE_DEFAULT, pVariables);
288288
}
289289

290290
extern "C" void PlanUninitializeExecuteAction(
@@ -338,7 +338,6 @@ extern "C" void PlanUninitializeExecuteAction(
338338

339339
extern "C" HRESULT PlanSetVariables(
340340
__in BOOTSTRAPPER_ACTION action,
341-
__in BOOTSTRAPPER_PACKAGE_SCOPE authoredScope,
342341
__in BOOTSTRAPPER_SCOPE plannedScope,
343342
__in BURN_VARIABLES* pVariables
344343
)
@@ -348,9 +347,6 @@ extern "C" HRESULT PlanSetVariables(
348347
hr = VariableSetNumeric(pVariables, BURN_BUNDLE_ACTION, action, TRUE);
349348
ExitOnFailure(hr, "Failed to set the bundle action built-in variable.");
350349

351-
hr = VariableSetNumeric(pVariables, BURN_BUNDLE_AUTHORED_SCOPE, authoredScope, TRUE);
352-
ExitOnFailure(hr, "Failed to set the bundle authored scope built-in variable.");
353-
354350
hr = VariableSetNumeric(pVariables, BURN_BUNDLE_PLANNED_SCOPE, plannedScope, TRUE);
355351
ExitOnFailure(hr, "Failed to set the bundle planned scope built-in variable.");
356352

@@ -922,7 +918,6 @@ static HRESULT GetUpgradedBundleScope(
922918

923919
// Is the related bundle's upgrade code the same as ours?
924920
// If so, lock our scope to the "original" bundle's scope.
925-
if (CSTR_EQUAL == ::CompareStringOrdinal(wzRelatedUpgradeCode, -1, wzUpgradeCode, -1, FALSE))
926921
if (CSTR_EQUAL == ::CompareStringOrdinal(wzRelatedUpgradeCode, -1, wzUpgradeCode, -1, TRUE))
927922
{
928923
*pScope = pRelatedBundle->detectedScope;

src/burn/engine/plan.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ void PlanUninitializeExecuteAction(
329329
);
330330
HRESULT PlanSetVariables(
331331
__in BOOTSTRAPPER_ACTION action,
332-
__in BOOTSTRAPPER_PACKAGE_SCOPE authoredScope,
333332
__in BOOTSTRAPPER_SCOPE plannedScope,
334333
__in BURN_VARIABLES* pVariables
335334
);

src/burn/engine/registration.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ extern "C" HRESULT RegistrationSetVariables(
441441
hr = VariableSetVersion(pVariables, BURN_BUNDLE_VERSION, pRegistration->pVersion, TRUE);
442442
ExitOnFailure(hr, "Failed to overwrite the bundle version built-in variable.");
443443

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+
444447
LExit:
445448
ReleaseStr(scz);
446449

src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
<Text>#(loc.OptionsBrowseButton)</Text>
5252
<BrowseDirectoryAction VariableName="InstallFolder" />
5353
</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>
5458
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
5559
<Text>#(loc.OptionsOkButton)</Text>
5660
<ChangePageAction Page="Install" />

src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
<Text>#(loc.OptionsBrowseButton)</Text>
5555
<BrowseDirectoryAction VariableName="InstallFolder" />
5656
</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>
5761
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
5862
<Text>#(loc.OptionsOkButton)</Text>
5963
<ChangePageAction Page="Install" />

src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<String Id="InstallCancelButton" Value="&amp;Cancel" />
2323
<String Id="OptionsHeader" Value="Setup Options" />
2424
<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" />
2527
<String Id="OptionsBrowseButton" Value="&amp;Browse" />
2628
<String Id="OptionsOkButton" Value="&amp;OK" />
2729
<String Id="OptionsCancelButton" Value="&amp;Cancel" />

src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
<Text>#(loc.OptionsBrowseButton)</Text>
4646
<BrowseDirectoryAction VariableName="InstallFolder" />
4747
</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>
4852
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
4953
<Text>#(loc.OptionsOkButton)</Text>
5054
<ChangePageAction Page="Install" />

src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
<Text>#(loc.OptionsBrowseButton)</Text>
4848
<BrowseDirectoryAction VariableName="InstallFolder" />
4949
</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>
5054
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
5155
<Text>#(loc.OptionsOkButton)</Text>
5256
<ChangePageAction Page="Install" />

0 commit comments

Comments
 (0)