Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/burn/engine/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/burn/engine/package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 1 addition & 6 deletions src/burn/engine/plan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
)
Expand All @@ -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.");

Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/burn/engine/plan.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
3 changes: 3 additions & 0 deletions src/burn/engine/registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 4 additions & 0 deletions src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<Text>#(loc.OptionsBrowseButton)</Text>
<BrowseDirectoryAction VariableName="InstallFolder" />
</Button>
<RadioButtons Name="WixStdBAScope">
<RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
<RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
</RadioButtons>
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.OptionsOkButton)</Text>
<ChangePageAction Page="Install" />
Expand Down
4 changes: 4 additions & 0 deletions src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<Text>#(loc.OptionsBrowseButton)</Text>
<BrowseDirectoryAction VariableName="InstallFolder" />
</Button>
<RadioButtons Name="WixStdBAScope">
<RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
<RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
</RadioButtons>
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.OptionsOkButton)</Text>
<ChangePageAction Page="Install" />
Expand Down
2 changes: 2 additions & 0 deletions src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<String Id="InstallCancelButton" Value="&amp;Cancel" />
<String Id="OptionsHeader" Value="Setup Options" />
<String Id="OptionsLocationLabel" Value="Install location:" />
<String Id="OptionsPerUserScopeText" Value="Install [WixBundleName] just for &amp;me" />
<String Id="OptionsPerMachineScopeText" Value="Install [WixBundleName] for all &amp;users" />
<String Id="OptionsBrowseButton" Value="&amp;Browse" />
<String Id="OptionsOkButton" Value="&amp;OK" />
<String Id="OptionsCancelButton" Value="&amp;Cancel" />
Expand Down
4 changes: 4 additions & 0 deletions src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<Text>#(loc.OptionsBrowseButton)</Text>
<BrowseDirectoryAction VariableName="InstallFolder" />
</Button>
<RadioButtons Name="WixStdBAScope">
<RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
<RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
</RadioButtons>
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.OptionsOkButton)</Text>
<ChangePageAction Page="Install" />
Expand Down
4 changes: 4 additions & 0 deletions src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
<Text>#(loc.OptionsBrowseButton)</Text>
<BrowseDirectoryAction VariableName="InstallFolder" />
</Button>
<RadioButtons Name="WixStdBAScope">
<RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
<RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
</RadioButtons>
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.OptionsOkButton)</Text>
<ChangePageAction Page="Install" />
Expand Down
2 changes: 2 additions & 0 deletions src/ext/Bal/stdbas/Resources/RtfTheme.wxl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<String Id="InstallCancelButton" Value="&amp;Cancel" />
<String Id="OptionsHeader" Value="Setup Options" />
<String Id="OptionsLocationLabel" Value="Install location:" />
<String Id="OptionsPerUserScopeText" Value="Install [WixBundleName] just for &amp;me" />
<String Id="OptionsPerMachineScopeText" Value="Install [WixBundleName] for all &amp;users" />
<String Id="OptionsBrowseButton" Value="&amp;Browse" />
<String Id="OptionsOkButton" Value="&amp;OK" />
<String Id="OptionsCancelButton" Value="&amp;Cancel" />
Expand Down
4 changes: 4 additions & 0 deletions src/ext/Bal/stdbas/Resources/RtfTheme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<Text>#(loc.OptionsBrowseButton)</Text>
<BrowseDirectoryAction VariableName="InstallFolder" />
</Button>
<RadioButtons Name="WixStdBAScope">
<RadioButton X="11" Y="180" Height="20" Width="-11" Value="PerUser" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerUserScopeText)</RadioButton>
<RadioButton X="11" Y="200" Height="20" Width="-11" Value="PerMachine" EnableCondition="WixBundleAuthoredScope = 2 OR WixBundleAuthoredScope = 3" HideWhenDisabled="yes" FontId="3">#(loc.OptionsPerMachineScopeText)</RadioButton>
</RadioButtons>
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.OptionsOkButton)</Text>
<ChangePageAction Page="Install" />
Expand Down
46 changes: 44 additions & 2 deletions src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ static const LPCWSTR WIXSTDBA_VARIABLE_SHOW_VERSION = L"WixStdBAShowVersion";
static const LPCWSTR WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI = L"WixStdBASuppressOptionsUI";
static const LPCWSTR WIXSTDBA_VARIABLE_UPDATE_AVAILABLE = L"WixStdBAUpdateAvailable";

static const LPCWSTR WIXSTDBA_PER_USER_SCOPE = L"PerUser";
static const LPCWSTR WIXSTDBA_PER_MACHINE_SCOPE = L"PerMachine";;

enum WIXSTDBA_STATE
{
WIXSTDBA_STATE_INITIALIZING,
Expand Down Expand Up @@ -186,6 +189,7 @@ class CWixStandardBootstrapperApplication : public CBootstrapperApplicationBase
)
{
HRESULT hr = S_OK;
LONGLONG llScope = 0;

hr = __super::OnCreate(pEngine, pCommand);
BalExitOnFailure(hr, "CBootstrapperApplicationBase initialization failed.");
Expand All @@ -197,7 +201,12 @@ class CWixStandardBootstrapperApplication : public CBootstrapperApplicationBase
m_hwndSplashScreen = pCommand->hwndSplashScreen;

hr = BalGetStringVariable(L"WixBundleVersion", &m_sczBundleVersion);
BalExitOnFailure(hr, "CWixStandardBootstrapperApplication initialization failed.");
BalExitOnFailure(hr, "Failed to get WixBundleVersion.");

hr = BalGetNumericVariable(L"WixBundleAuthoredScope", &llScope);
BalExitOnFailure(hr, "Failed to get WixBundleAuthoredScope.");

m_bundleScope = static_cast<BOOTSTRAPPER_PACKAGE_SCOPE>(llScope);

hr = InitializeData(pCommand);
BalExitOnFailure(hr, "Failed to initialize data in bootstrapper application.");
Expand Down Expand Up @@ -2888,6 +2897,18 @@ class CWixStandardBootstrapperApplication : public CBootstrapperApplicationBase
}
}

// Set the variable matching the default theme scope-selection radio buttons
// so the default scope is already selected.
if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == m_bundleScope)
{
hr = BalSetStringVariable(L"WixStdBAScope", WIXSTDBA_PER_USER_SCOPE, FALSE);
}
else if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == m_bundleScope)
{
hr = BalSetStringVariable(L"WixStdBAScope", WIXSTDBA_PER_MACHINE_SCOPE, FALSE);
}
BalExitOnFailure(hr, "Failed to set WixStdBAScope.");

LExit:
ReleaseObject(pixdManifest);

Expand Down Expand Up @@ -3819,15 +3840,35 @@ class CWixStandardBootstrapperApplication : public CBootstrapperApplicationBase
)
{
HRESULT hr = S_OK;
BOOTSTRAPPER_SCOPE scope = BOOTSTRAPPER_SCOPE_DEFAULT;
LPWSTR sczScopeValue = NULL;

m_plannedAction = action;

if (BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER == m_bundleScope
|| BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE == m_bundleScope)
{
hr = BalGetStringVariable(L"WixStdBAScope", &sczScopeValue);
BalExitOnFailure(hr, "Failed to get scope value.");

if (CSTR_EQUAL == ::CompareStringOrdinal(sczScopeValue, -1, L"PerUser", -1, TRUE))
{
scope = BOOTSTRAPPER_SCOPE_PER_USER;
}
else if (CSTR_EQUAL == ::CompareStringOrdinal(sczScopeValue, -1, L"PerMachine", -1, TRUE))
{
scope = BOOTSTRAPPER_SCOPE_PER_MACHINE;
}
}

SetState(WIXSTDBA_STATE_PLANNING, hr);

hr = m_pEngine->Plan(action, BOOTSTRAPPER_SCOPE_DEFAULT/*TODO*/);
hr = m_pEngine->Plan(action, scope);
BalExitOnFailure(hr, "Failed to start planning packages.");

LExit:
ReleaseStr(sczScopeValue);

if (FAILED(hr))
{
SetState(WIXSTDBA_STATE_PLANNING, hr);
Expand Down Expand Up @@ -5104,6 +5145,7 @@ class CWixStandardBootstrapperApplication : public CBootstrapperApplicationBase
HWND m_hwndSplashScreen;

BOOTSTRAPPER_ACTION m_plannedAction;
BOOTSTRAPPER_PACKAGE_SCOPE m_bundleScope;

LPWSTR m_sczAfterForcedRestartPackage;
LPWSTR m_sczBundleVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixToolset.BootstrapperApplications.wixext" />
<PackageReference Include="WixToolset.Util.wixext" />
<PackageReference Include="WixToolset.NetFx.wixext" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<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">
<Bundle Id="AllPuomBundle$(BA)" Name="AllPuomBundle$(BA)" Manufacturer="Acme" Version="$(Version)">
<?if $(BA) = "WixStdBA"?>
<BootstrapperApplication>
Expand All @@ -8,6 +8,12 @@

<Variable Name="TestGroupName" Value="ConfigurableScopeTests" />

<!-- Add some random upgrade codes for the fun of it. -->
<RelatedBundle Code="{087861DF-D2EC-4485-9F07-E4CCD67D12D1}" Action="upgrade" />
<RelatedBundle Code="{8D6ADB72-EDE7-4D92-B88F-494A2425FE20}" Action="upgrade" />

<util:ProductSearchRef Id="FooSearch" />

<Chain>
<?if $(BA) = "TestBA"?>
<PackageGroupRef Id="TestBA" />
Expand All @@ -16,4 +22,12 @@
<MsiPackage SourceFile="PuomPkg2.msi" />
</Chain>
</Bundle>

<Fragment>
<util:ProductSearch Id="FooSearch" ProductCode="{BD22A70A-6191-468B-B6EE-2738916017C1}" Variable="Foo" />

<!-- Add some more random upgrade codes for even more fun. -->
<RelatedBundle Code="{B18397C3-C223-4E5B-9FD7-E22838F9EDCB}" Action="upgrade" />
<RelatedBundle Code="{5CC50F34-8EB5-48F9-B0CC-DC54232C487A}" Action="upgrade" />
</Fragment>
</Wix>