diff options
| author | Bob Arnson <bob@firegiant.com> | 2026-02-20 19:18:23 -0500 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2026-02-20 19:18:23 -0500 |
| commit | 8f3c366e9671dc5d4931dd3de28a42a1f1be32a5 (patch) | |
| tree | b9f270a14fe73dc07667cf37ea0232662e7d858b /src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp | |
| parent | 96222b03ccc510027cb4d506fb424961cc351e03 (diff) | |
| download | wix-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/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp')
| -rw-r--r-- | src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp | 46 |
1 files changed, 44 insertions, 2 deletions
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"; | |||
| 23 | static const LPCWSTR WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI = L"WixStdBASuppressOptionsUI"; | 23 | static const LPCWSTR WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI = L"WixStdBASuppressOptionsUI"; |
| 24 | static const LPCWSTR WIXSTDBA_VARIABLE_UPDATE_AVAILABLE = L"WixStdBAUpdateAvailable"; | 24 | static const LPCWSTR WIXSTDBA_VARIABLE_UPDATE_AVAILABLE = L"WixStdBAUpdateAvailable"; |
| 25 | 25 | ||
| 26 | static const LPCWSTR WIXSTDBA_PER_USER_SCOPE = L"PerUser"; | ||
| 27 | static const LPCWSTR WIXSTDBA_PER_MACHINE_SCOPE = L"PerMachine";; | ||
| 28 | |||
| 26 | enum WIXSTDBA_STATE | 29 | enum 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; |
