aboutsummaryrefslogtreecommitdiff
path: root/src/ext
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-10-27 13:55:16 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-11-01 16:34:09 -0500
commit8fa040da9d0d3826f5ffda6bcbec4f53abd97452 (patch)
treea8a1094f3ac17bd6feed8a6f971c0d6008694345 /src/ext
parent4917383e6f52f0e44f63c60a645f1dd7e8f8d5f9 (diff)
downloadwix-8fa040da9d0d3826f5ffda6bcbec4f53abd97452.tar.gz
wix-8fa040da9d0d3826f5ffda6bcbec4f53abd97452.tar.bz2
wix-8fa040da9d0d3826f5ffda6bcbec4f53abd97452.zip
Allow more customization of control ids in thmutil.
Allow BAFunctions to set control ids. Make sure control ids don't collide.
Diffstat (limited to 'src/ext')
-rw-r--r--src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp65
1 files changed, 62 insertions, 3 deletions
diff --git a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
index 74e0b7d3..8cdd31ce 100644
--- a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
+++ b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
@@ -77,10 +77,15 @@ static LPCWSTR vrgwzPageNames[] = {
77 L"Failure", 77 L"Failure",
78}; 78};
79 79
80// The range [0, 100) is unused to avoid collisions with system ids,
81// the range [100, 0x4000) is unused to avoid collisions with thmutil,
82// the range [0x4000, 0x8000) is unused to avoid collisions with BAFunctions.
83const WORD WIXSTDBA_FIRST_ASSIGN_CONTROL_ID = 0x8000;
84
80enum WIXSTDBA_CONTROL 85enum WIXSTDBA_CONTROL
81{ 86{
82 // Welcome page 87 // Welcome page
83 WIXSTDBA_CONTROL_INSTALL_BUTTON = THEME_FIRST_ASSIGN_CONTROL_ID, 88 WIXSTDBA_CONTROL_INSTALL_BUTTON = WIXSTDBA_FIRST_ASSIGN_CONTROL_ID,
84 WIXSTDBA_CONTROL_EULA_RICHEDIT, 89 WIXSTDBA_CONTROL_EULA_RICHEDIT,
85 WIXSTDBA_CONTROL_EULA_LINK, 90 WIXSTDBA_CONTROL_EULA_LINK,
86 WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX, 91 WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX,
@@ -2833,6 +2838,9 @@ private:
2833 } 2838 }
2834 break; 2839 break;
2835 2840
2841 case WM_THMUTIL_LOADING_CONTROL:
2842 return pBA->OnThemeLoadingControl(reinterpret_cast<THEME_LOADINGCONTROL_ARGS*>(wParam), reinterpret_cast<THEME_LOADINGCONTROL_RESULTS*>(lParam));
2843
2836 case WM_QUERYENDSESSION: 2844 case WM_QUERYENDSESSION:
2837 fCancel = true; 2845 fCancel = true;
2838 pBA->OnSystemShutdown(static_cast<DWORD>(lParam), &fCancel); 2846 pBA->OnSystemShutdown(static_cast<DWORD>(lParam), &fCancel);
@@ -2956,7 +2964,7 @@ private:
2956 BA_FUNCTIONS_ONTHEMELOADED_ARGS themeLoadedArgs = { }; 2964 BA_FUNCTIONS_ONTHEMELOADED_ARGS themeLoadedArgs = { };
2957 BA_FUNCTIONS_ONTHEMELOADED_RESULTS themeLoadedResults = { }; 2965 BA_FUNCTIONS_ONTHEMELOADED_RESULTS themeLoadedResults = { };
2958 2966
2959 hr = ThemeLoadControls(m_pTheme, vrgInitControls, countof(vrgInitControls)); 2967 hr = ThemeLoadControls(m_pTheme);
2960 BalExitOnFailure(hr, "Failed to load theme controls."); 2968 BalExitOnFailure(hr, "Failed to load theme controls.");
2961 2969
2962 C_ASSERT(COUNT_WIXSTDBA_PAGE == countof(vrgwzPageNames)); 2970 C_ASSERT(COUNT_WIXSTDBA_PAGE == countof(vrgwzPageNames));
@@ -3029,6 +3037,57 @@ private:
3029 return SUCCEEDED(hr); 3037 return SUCCEEDED(hr);
3030 } 3038 }
3031 3039
3040 BOOL OnThemeLoadingControl(
3041 __in const THEME_LOADINGCONTROL_ARGS* pArgs,
3042 __in THEME_LOADINGCONTROL_RESULTS* pResults
3043 )
3044 {
3045 HRESULT hr = S_OK;
3046 BOOL fProcessed = FALSE;
3047 BA_FUNCTIONS_ONTHEMECONTROLLOADING_ARGS themeControlLoadingArgs = { };
3048 BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS themeControlLoadingResults = { };
3049
3050 for (DWORD iAssignControl = 0; iAssignControl < countof(vrgInitControls); ++iAssignControl)
3051 {
3052 if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, pArgs->pThemeControl->sczName, -1, vrgInitControls[iAssignControl].wzName, -1))
3053 {
3054 fProcessed = TRUE;
3055 pResults->wId = vrgInitControls[iAssignControl].wId;
3056 ExitFunction();
3057 }
3058 }
3059
3060 if (m_pfnBAFunctionsProc)
3061 {
3062 themeControlLoadingArgs.cbSize = sizeof(themeControlLoadingArgs);
3063 themeControlLoadingArgs.wzName = pArgs->pThemeControl->sczName;
3064
3065 themeControlLoadingResults.cbSize = sizeof(themeControlLoadingResults);
3066 themeControlLoadingResults.wId = pResults->wId;
3067
3068 hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADING, &themeControlLoadingArgs, &themeControlLoadingResults, m_pvBAFunctionsProcContext);
3069
3070 if (E_NOTIMPL == hr)
3071 {
3072 hr = S_OK;
3073 }
3074 else
3075 {
3076 BalExitOnFailure(hr, "BAFunctions OnThemeControlLoading failed.");
3077
3078 if (themeControlLoadingResults.fProcessed)
3079 {
3080 fProcessed = TRUE;
3081 pResults->wId = themeControlLoadingResults.wId;
3082 }
3083 }
3084 }
3085
3086 LExit:
3087 pResults->hr = hr;
3088 return fProcessed || FAILED(hr);
3089 }
3090
3032 3091
3033 // 3092 //
3034 // OnShowFailure - display the failure page. 3093 // OnShowFailure - display the failure page.
@@ -3857,7 +3916,7 @@ private:
3857 BalExitOnNullWithLastError(pfnBAFunctionsCreate, hr, "Failed to get BAFunctionsCreate entry-point from: %ls", sczBafPath); 3916 BalExitOnNullWithLastError(pfnBAFunctionsCreate, hr, "Failed to get BAFunctionsCreate entry-point from: %ls", sczBafPath);
3858 3917
3859 bafCreateArgs.cbSize = sizeof(bafCreateArgs); 3918 bafCreateArgs.cbSize = sizeof(bafCreateArgs);
3860 bafCreateArgs.qwBAFunctionsAPIVersion = MAKEQWORDVERSION(0, 0, 0, 2); // TODO: need to decide whether to keep this, and if so when to update it. 3919 bafCreateArgs.qwBAFunctionsAPIVersion = MAKEQWORDVERSION(2021, 9, 20, 0);
3861 bafCreateArgs.pBootstrapperCreateArgs = &m_createArgs; 3920 bafCreateArgs.pBootstrapperCreateArgs = &m_createArgs;
3862 3921
3863 bafCreateResults.cbSize = sizeof(bafCreateResults); 3922 bafCreateResults.cbSize = sizeof(bafCreateResults);