Remove dutil types from BAFunctions.
Sean Hall committed
Oct 27, 2021 at 15:29 UTC
3d73efba15565f5995a492e660dff72286e0b672
8 files changed
+40
-47
src/api/burn/balutil/inc/BAFunctions.h
+3
-4
@@ -178,8 +178,7 @@ struct BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_RESULTS
178
struct BA_FUNCTIONS_ONTHEMELOADED_ARGS
179
{
180
DWORD cbSize;
181
- THEME* pTheme;
182
- WIX_LOCALIZATION* pWixLoc;
181
+ HWND hWnd;
182
};
183
184
struct BA_FUNCTIONS_ONTHEMELOADED_RESULTS
@@ -190,7 +189,6 @@ struct BA_FUNCTIONS_ONTHEMELOADED_RESULTS
189
struct BA_FUNCTIONS_WNDPROC_ARGS
190
{
191
DWORD cbSize;
193
- THEME* pTheme;
192
HWND hWnd;
193
UINT uMsg;
194
WPARAM wParam;
@@ -200,7 +198,8 @@ struct BA_FUNCTIONS_WNDPROC_ARGS
198
struct BA_FUNCTIONS_WNDPROC_RESULTS
199
{
200
DWORD cbSize;
203
- LRESULT lres;
201
+ BOOL fProcessed;
202
+ LRESULT lResult;
203
};
204
205
typedef HRESULT(WINAPI *PFN_BA_FUNCTIONS_CREATE)(
src/api/burn/balutil/inc/BalBaseBAFunctions.h
+10
-20
@@ -5,9 +5,6 @@
5
#include <windows.h>
6
#include <msiquery.h>
7
8
-#include "dutil.h"
9
-#include "locutil.h"
10
-#include "thmutil.h"
8
#include "BAFunctions.h"
9
#include "IBAFunctions.h"
10
#include "BootstrapperEngine.h"
@@ -803,32 +800,26 @@ public: // IBAFunctions
800
}
801
802
virtual STDMETHODIMP OnThemeLoaded(
806
- THEME* pTheme,
807
- WIX_LOCALIZATION* pWixLoc
803
+ __in HWND hWnd
804
)
805
{
806
HRESULT hr = S_OK;
807
812
- m_pTheme = pTheme;
813
- m_pWixLoc = pWixLoc;
808
+ m_hwndParent = hWnd;
809
810
return hr;
811
}
812
813
virtual STDMETHODIMP WndProc(
819
- __in THEME* pTheme,
820
- __in HWND hWnd,
821
- __in UINT uMsg,
822
- __in WPARAM wParam,
823
- __in LPARAM lParam,
824
- __inout LRESULT* plRes
814
+ __in HWND /*hWnd*/,
815
+ __in UINT /*uMsg*/,
816
+ __in WPARAM /*wParam*/,
817
+ __in LPARAM /*lParam*/,
818
+ __inout BOOL* /*pfProcessed*/,
819
+ __inout LRESULT* /*plResult*/
820
)
821
{
827
- HRESULT hr = S_OK;
828
-
829
- *plRes = ThemeDefWindowProc(pTheme, hWnd, uMsg, wParam, lParam);
830
-
831
- return hr;
822
+ return S_OK;
823
}
824
825
virtual STDMETHODIMP BAFunctionsProc(
@@ -917,6 +908,5 @@ protected:
908
BA_FUNCTIONS_CREATE_ARGS m_bafCreateArgs;
909
BOOTSTRAPPER_CREATE_ARGS m_baCreateArgs;
910
BOOTSTRAPPER_COMMAND m_command;
920
- THEME* m_pTheme;
921
- WIX_LOCALIZATION* m_pWixLoc;
911
+ HWND m_hwndParent;
912
};
src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h
+2
-2
@@ -12,7 +12,7 @@ static HRESULT BalBaseBAFunctionsProcOnThemeLoaded(
12
__inout BA_FUNCTIONS_ONTHEMELOADED_RESULTS* /*pResults*/
13
)
14
{
15
- return pBAFunctions->OnThemeLoaded(pArgs->pTheme, pArgs->pWixLoc);
15
+ return pBAFunctions->OnThemeLoaded(pArgs->hWnd);
16
}
17
18
static HRESULT BalBaseBAFunctionsProcWndProc(
@@ -21,7 +21,7 @@ static HRESULT BalBaseBAFunctionsProcWndProc(
21
__inout BA_FUNCTIONS_WNDPROC_RESULTS* pResults
22
)
23
{
24
- return pBAFunctions->WndProc(pArgs->pTheme, pArgs->hWnd, pArgs->uMsg, pArgs->wParam, pArgs->lParam, &pResults->lres);
24
+ return pBAFunctions->WndProc(pArgs->hWnd, pArgs->uMsg, pArgs->wParam, pArgs->lParam, &pResults->fProcessed, &pResults->lResult);
25
}
26
27
static HRESULT BalBaseBAFunctionsProcOnThemeControlLoading(
src/api/burn/balutil/inc/IBAFunctions.h
+3
-5
@@ -7,20 +7,18 @@ DECLARE_INTERFACE_IID_(IBAFunctions, IBootstrapperApplication, "0FB445ED-17BD-49
7
// OnThemeLoaded - Called after the BA finished loading all the controls for the theme.
8
//
9
STDMETHOD(OnThemeLoaded)(
10
- THEME* pTheme,
11
- WIX_LOCALIZATION* pWixLoc
10
+ __in HWND hWnd
11
) = 0;
12
13
// WndProc - Called if the BA hasn't handled the message.
15
- // The implementation must either return E_NOTIMPL or call ThemeDefWindowProc for unhandled messages.
14
//
15
STDMETHOD(WndProc)(
18
- __in THEME* pTheme,
16
__in HWND hWnd,
17
__in UINT uMsg,
18
__in WPARAM wParam,
19
__in LPARAM lParam,
23
- __inout LRESULT* plRes
20
+ __inout BOOL* pfProcessed,
21
+ __inout LRESULT* plResult
22
) = 0;
23
24
// BAFunctionsProc - The PFN_BA_FUNCTIONS_PROC can call this method to give the BAFunctions raw access to the callback from WixStdBA.
src/api/burn/test/BalUtilUnitTest/precomp.h
-2
@@ -14,8 +14,6 @@
14
15
#include <dutil.h>
16
#include <dictutil.h>
17
-#include <locutil.h>
18
-#include <thmutil.h>
17
18
#include <BootstrapperEngine.h>
19
#include <BootstrapperApplication.h>
src/ext/Bal/Samples/bafunctions/precomp.h
+2
-2
@@ -23,13 +23,13 @@
23
#include "dictutil.h"
24
//#include "dirutil.h"
25
#include "fileutil.h"
26
-#include "locutil.h"
26
+//#include "locutil.h"
27
//#include "logutil.h"
28
#include "pathutil.h"
29
//#include "resrutil.h"
30
//#include "shelutil.h"
31
#include "strutil.h"
32
-#include "thmutil.h"
32
+//#include "thmutil.h"
33
//#include "uriutil.h"
34
//#include "xmlutil.h"
35
#include "regutil.h"
src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
+14
-6
@@ -2783,7 +2783,6 @@ private:
2783
if (pBA->m_pfnBAFunctionsProc)
2784
{
2785
wndProcArgs.cbSize = sizeof(wndProcArgs);
2786
- wndProcArgs.pTheme = pTheme;
2786
wndProcArgs.hWnd = hWnd;
2787
wndProcArgs.uMsg = uMsg;
2788
wndProcArgs.wParam = wParam;
@@ -2791,10 +2790,20 @@ private:
2790
wndProcResults.cbSize = sizeof(wndProcResults);
2791
2792
hr = pBA->m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_WNDPROC, &wndProcArgs, &wndProcResults, pBA->m_pvBAFunctionsProcContext);
2794
- if (E_NOTIMPL != hr)
2793
+
2794
+ if (E_NOTIMPL == hr)
2795
{
2796
- lres = wndProcResults.lres;
2797
- ExitFunction();
2796
+ hr = S_OK;
2797
+ }
2798
+ else
2799
+ {
2800
+ BalExitOnFailure(hr, "BAFunctions WndProc failed.");
2801
+
2802
+ if (wndProcResults.fProcessed)
2803
+ {
2804
+ lres = wndProcResults.lResult;
2805
+ ExitFunction();
2806
+ }
2807
}
2808
}
2809
}
@@ -2910,8 +2919,7 @@ private:
2919
if (m_pfnBAFunctionsProc)
2920
{
2921
themeLoadedArgs.cbSize = sizeof(themeLoadedArgs);
2913
- themeLoadedArgs.pTheme = m_pTheme;
2914
- themeLoadedArgs.pWixLoc = m_pWixLoc;
2922
+ themeLoadedArgs.hWnd = m_pTheme->hwndParent;
2923
themeLoadedResults.cbSize = sizeof(themeLoadedResults);
2924
hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMELOADED, &themeLoadedArgs, &themeLoadedResults, m_pvBAFunctionsProcContext);
2925
BalExitOnFailure(hr, "BAFunctions OnThemeLoaded failed.");
src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
+6
-6
@@ -100,7 +100,7 @@ private:
100
hr = CreateTestingWindow();
101
BalExitOnFailure(hr, "Failed to create BafThmUtilTesting window.");
102
103
- ::EnableWindow(m_pTheme->hwndParent, FALSE);
103
+ ::EnableWindow(m_hwndParent, FALSE);
104
105
// message pump
106
while (0 != (fRet = ::GetMessageW(&msg, NULL, 0, 0)))
@@ -118,7 +118,7 @@ private:
118
}
119
120
LExit:
121
- ::EnableWindow(m_pTheme->hwndParent, TRUE);
121
+ ::EnableWindow(m_hwndParent, TRUE);
122
123
DestroyTestingWindow();
124
@@ -130,7 +130,7 @@ private:
130
HRESULT CreateTestingWindow()
131
{
132
HRESULT hr = S_OK;
133
- HICON hIcon = reinterpret_cast<HICON>(m_pTheme->hIcon);
133
+ HICON hIcon = reinterpret_cast<HICON>(m_pBafTheme->hIcon);
134
WNDCLASSW wc = { };
135
int x = CW_USEDEFAULT;
136
int y = CW_USEDEFAULT;
@@ -151,7 +151,7 @@ private:
151
wc.hInstance = m_hModule;
152
wc.hIcon = hIcon;
153
wc.hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
154
- wc.hbrBackground = m_pTheme->rgFonts[m_pBafTheme->dwFontId].hBackground;
154
+ wc.hbrBackground = m_pBafTheme->rgFonts[m_pBafTheme->dwFontId].hBackground;
155
wc.lpszMenuName = NULL;
156
wc.lpszClassName = BAFTHMUTILTESTING_WINDOW_CLASS;
157
if (!::RegisterClassW(&wc))
@@ -168,7 +168,7 @@ private:
168
y = ptCursor.y;
169
}
170
171
- hr = ThemeCreateParentWindow(m_pBafTheme, 0, wc.lpszClassName, m_pBafTheme->sczCaption, m_pBafTheme->dwStyle, x, y, m_pTheme->hwndParent, m_hModule, this, THEME_WINDOW_INITIAL_POSITION_CENTER_MONITOR_FROM_COORDINATES, &m_hWndBaf);
171
+ hr = ThemeCreateParentWindow(m_pBafTheme, 0, wc.lpszClassName, m_pBafTheme->sczCaption, m_pBafTheme->dwStyle, x, y, m_hwndParent, m_hModule, this, THEME_WINDOW_INITIAL_POSITION_CENTER_MONITOR_FROM_COORDINATES, &m_hWndBaf);
172
ExitOnFailure(hr, "Failed to create window.");
173
174
hr = S_OK;
@@ -216,7 +216,7 @@ private:
216
case WM_CLOSE:
217
if (pBaf)
218
{
219
- ::EnableWindow(pBaf->m_pTheme->hwndParent, TRUE);
219
+ ::EnableWindow(pBaf->m_hwndParent, TRUE);
220
}
221
222
break;