aboutsummaryrefslogtreecommitdiff
path: root/src/dutil/inc/wiutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dutil/inc/wiutil.h')
-rw-r--r--src/dutil/inc/wiutil.h373
1 files changed, 373 insertions, 0 deletions
diff --git a/src/dutil/inc/wiutil.h b/src/dutil/inc/wiutil.h
new file mode 100644
index 00000000..4264b815
--- /dev/null
+++ b/src/dutil/inc/wiutil.h
@@ -0,0 +1,373 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9// constants
10
11#define IDNOACTION 0
12#define WIU_MB_OKIGNORECANCELRETRY 0xE
13
14#define MAX_DARWIN_KEY 73
15#define MAX_DARWIN_COLUMN 255
16
17#define WIU_LOG_DEFAULT INSTALLLOGMODE_FATALEXIT | INSTALLLOGMODE_ERROR | INSTALLLOGMODE_WARNING | \
18 INSTALLLOGMODE_USER | INSTALLLOGMODE_INFO | INSTALLLOGMODE_RESOLVESOURCE | \
19 INSTALLLOGMODE_OUTOFDISKSPACE | INSTALLLOGMODE_ACTIONSTART | \
20 INSTALLLOGMODE_ACTIONDATA | INSTALLLOGMODE_COMMONDATA | INSTALLLOGMODE_PROPERTYDUMP
21
22#define ReleaseMsi(h) if (h) { ::MsiCloseHandle(h); }
23#define ReleaseNullMsi(h) if (h) { ::MsiCloseHandle(h); h = NULL; }
24
25
26typedef enum WIU_RESTART
27{
28 WIU_RESTART_NONE,
29 WIU_RESTART_REQUIRED,
30 WIU_RESTART_INITIATED,
31} WIU_RESTART;
32
33typedef enum WIU_MSI_EXECUTE_MESSAGE_TYPE
34{
35 WIU_MSI_EXECUTE_MESSAGE_NONE,
36 WIU_MSI_EXECUTE_MESSAGE_PROGRESS,
37 WIU_MSI_EXECUTE_MESSAGE_ERROR,
38 WIU_MSI_EXECUTE_MESSAGE_MSI_MESSAGE,
39 WIU_MSI_EXECUTE_MESSAGE_MSI_FILES_IN_USE,
40} WIU_MSI_EXECUTE_MESSAGE_TYPE;
41
42
43// structures
44
45typedef struct _WIU_MSI_EXECUTE_MESSAGE
46{
47 WIU_MSI_EXECUTE_MESSAGE_TYPE type;
48 DWORD dwAllowedResults;
49
50 DWORD cData;
51 LPCWSTR* rgwzData;
52
53 INT nResultRecommendation; // recommended return result for this message based on analysis of real world installs.
54
55 union
56 {
57 struct
58 {
59 DWORD dwPercentage;
60 } progress;
61 struct
62 {
63 DWORD dwErrorCode;
64 LPCWSTR wzMessage;
65 } error;
66 struct
67 {
68 INSTALLMESSAGE mt;
69 LPCWSTR wzMessage;
70 } msiMessage;
71 struct
72 {
73 DWORD cFiles;
74 LPCWSTR* rgwzFiles;
75 } msiFilesInUse;
76 };
77} WIU_MSI_EXECUTE_MESSAGE;
78
79typedef struct _WIU_MSI_PROGRESS
80{
81 DWORD dwTotal;
82 DWORD dwCompleted;
83 DWORD dwStep;
84 BOOL fMoveForward;
85 BOOL fEnableActionData;
86 BOOL fScriptInProgress;
87} WIU_MSI_PROGRESS;
88
89
90typedef int (*PFN_MSIEXECUTEMESSAGEHANDLER)(
91 __in WIU_MSI_EXECUTE_MESSAGE* pMessage,
92 __in_opt LPVOID pvContext
93 );
94
95typedef struct _WIU_MSI_EXECUTE_CONTEXT
96{
97 BOOL fRollback;
98 PFN_MSIEXECUTEMESSAGEHANDLER pfnMessageHandler;
99 LPVOID pvContext;
100 WIU_MSI_PROGRESS rgMsiProgress[64];
101 DWORD dwCurrentProgressIndex;
102
103 INSTALLUILEVEL previousInstallUILevel;
104 HWND hwndPreviousParentWindow;
105 INSTALLUI_HANDLERW pfnPreviousExternalUI;
106 INSTALLUI_HANDLER_RECORD pfnPreviousExternalUIRecord;
107
108 BOOL fSetPreviousExternalUIRecord;
109 BOOL fSetPreviousExternalUI;
110} WIU_MSI_EXECUTE_CONTEXT;
111
112
113// typedefs
114typedef UINT (WINAPI *PFN_MSIENABLELOGW)(
115 __in DWORD dwLogMode,
116 __in_z LPCWSTR szLogFile,
117 __in DWORD dwLogAttributes
118 );
119typedef UINT (WINAPI *PFN_MSIGETPRODUCTINFOW)(
120 __in LPCWSTR szProductCode,
121 __in LPCWSTR szProperty,
122 __out_ecount_opt(*pcchValue) LPWSTR szValue,
123 __inout LPDWORD pcchValue
124 );
125typedef INSTALLSTATE (WINAPI *PFN_MSIGETCOMPONENTPATHW)(
126 __in LPCWSTR szProduct,
127 __in LPCWSTR szComponent,
128 __out_ecount_opt(*pcchBuf) LPWSTR lpPathBuf,
129 __inout_opt LPDWORD pcchBuf
130 );
131typedef INSTALLSTATE (WINAPI *PFN_MSILOCATECOMPONENTW)(
132 __in LPCWSTR szComponent,
133 __out_ecount_opt(*pcchBuf) LPWSTR lpPathBuf,
134 __inout_opt LPDWORD pcchBuf
135 );
136typedef UINT (WINAPI *PFN_MSIGETPRODUCTINFOEXW)(
137 __in LPCWSTR szProductCode,
138 __in_opt LPCWSTR szUserSid,
139 __in MSIINSTALLCONTEXT dwContext,
140 __in LPCWSTR szProperty,
141 __out_ecount_opt(*pcchValue) LPWSTR szValue,
142 __inout_opt LPDWORD pcchValue
143 );
144typedef INSTALLSTATE (WINAPI *PFN_MSIQUERYFEATURESTATEW)(
145 __in LPCWSTR szProduct,
146 __in LPCWSTR szFeature
147 );
148typedef UINT (WINAPI *PFN_MSIGETPATCHINFOEXW)(
149 __in_z LPCWSTR wzPatchCode,
150 __in_z LPCWSTR wzProductCode,
151 __in_z_opt LPCWSTR wzUserSid,
152 __in MSIINSTALLCONTEXT dwContext,
153 __in_z LPCWSTR wzProperty,
154 __out_opt LPWSTR wzValue,
155 __inout DWORD* pcchValue
156 );
157typedef UINT (WINAPI *PFN_MSIDETERMINEPATCHSEQUENCEW)(
158 __in_z LPCWSTR wzProductCode,
159 __in_z_opt LPCWSTR wzUserSid,
160 __in MSIINSTALLCONTEXT context,
161 __in DWORD cPatchInfo,
162 __in PMSIPATCHSEQUENCEINFOW pPatchInfo
163 );
164typedef UINT (WINAPI *PFN_MSIDETERMINEAPPLICABLEPATCHESW)(
165 __in_z LPCWSTR wzProductPackagePath,
166 __in DWORD cPatchInfo,
167 __in PMSIPATCHSEQUENCEINFOW pPatchInfo
168 );
169typedef UINT (WINAPI *PFN_MSIINSTALLPRODUCTW)(
170 __in LPCWSTR szPackagePath,
171 __in_opt LPCWSTR szCommandLine
172 );
173typedef UINT (WINAPI *PFN_MSICONFIGUREPRODUCTEXW)(
174 __in LPCWSTR szProduct,
175 __in int iInstallLevel,
176 __in INSTALLSTATE eInstallState,
177 __in_opt LPCWSTR szCommandLine
178 );
179typedef UINT (WINAPI *PFN_MSIREMOVEPATCHESW)(
180 __in_z LPCWSTR wzPatchList,
181 __in_z LPCWSTR wzProductCode,
182 __in INSTALLTYPE eUninstallType,
183 __in_z_opt LPCWSTR szPropertyList
184 );
185typedef INSTALLUILEVEL (WINAPI *PFN_MSISETINTERNALUI)(
186 __in INSTALLUILEVEL dwUILevel,
187 __inout_opt HWND *phWnd
188 );
189typedef UINT (WINAPI *PFN_MSISETEXTERNALUIRECORD)(
190 __in_opt INSTALLUI_HANDLER_RECORD puiHandler,
191 __in DWORD dwMessageFilter,
192 __in_opt LPVOID pvContext,
193 __out_opt PINSTALLUI_HANDLER_RECORD ppuiPrevHandler
194 );
195typedef INSTALLUI_HANDLERW (WINAPI *PFN_MSISETEXTERNALUIW)(
196 __in_opt INSTALLUI_HANDLERW puiHandler,
197 __in DWORD dwMessageFilter,
198 __in_opt LPVOID pvContext
199 );
200typedef UINT (WINAPI *PFN_MSIENUMPRODUCTSW)(
201 __in DWORD iProductIndex,
202 __out_ecount(MAX_GUID_CHARS + 1) LPWSTR lpProductBuf
203 );
204typedef UINT (WINAPI *PFN_MSIENUMPRODUCTSEXW)(
205 __in_z_opt LPCWSTR wzProductCode,
206 __in_z_opt LPCWSTR wzUserSid,
207 __in DWORD dwContext,
208 __in DWORD dwIndex,
209 __out_opt WCHAR wzInstalledProductCode[39],
210 __out_opt MSIINSTALLCONTEXT *pdwInstalledContext,
211 __out_opt LPWSTR wzSid,
212 __inout_opt LPDWORD pcchSid
213 );
214
215typedef UINT (WINAPI *PFN_MSIENUMRELATEDPRODUCTSW)(
216 __in LPCWSTR lpUpgradeCode,
217 __reserved DWORD dwReserved,
218 __in DWORD iProductIndex,
219 __out_ecount(MAX_GUID_CHARS + 1) LPWSTR lpProductBuf
220 );
221typedef UINT (WINAPI *PFN_MSISOURCELISTADDSOURCEEXW)(
222 __in LPCWSTR szProductCodeOrPatchCode,
223 __in_opt LPCWSTR szUserSid,
224 __in MSIINSTALLCONTEXT dwContext,
225 __in DWORD dwOptions,
226 __in LPCWSTR szSource,
227 __in_opt DWORD dwIndex
228 );
229
230
231HRESULT DAPI WiuInitialize(
232 );
233void DAPI WiuUninitialize(
234 );
235void DAPI WiuFunctionOverride(
236 __in_opt PFN_MSIENABLELOGW pfnMsiEnableLogW,
237 __in_opt PFN_MSIGETCOMPONENTPATHW pfnMsiGetComponentPathW,
238 __in_opt PFN_MSILOCATECOMPONENTW pfnMsiLocateComponentW,
239 __in_opt PFN_MSIQUERYFEATURESTATEW pfnMsiQueryFeatureStateW,
240 __in_opt PFN_MSIGETPRODUCTINFOW pfnMsiGetProductInfoW,
241 __in_opt PFN_MSIGETPRODUCTINFOEXW pfnMsiGetProductInfoExW,
242 __in_opt PFN_MSIINSTALLPRODUCTW pfnMsiInstallProductW,
243 __in_opt PFN_MSICONFIGUREPRODUCTEXW pfnMsiConfigureProductExW,
244 __in_opt PFN_MSISETINTERNALUI pfnMsiSetInternalUI,
245 __in_opt PFN_MSISETEXTERNALUIW pfnMsiSetExternalUIW,
246 __in_opt PFN_MSIENUMRELATEDPRODUCTSW pfnMsiEnumRelatedProductsW,
247 __in_opt PFN_MSISETEXTERNALUIRECORD pfnMsiSetExternalUIRecord,
248 __in_opt PFN_MSISOURCELISTADDSOURCEEXW pfnMsiSourceListAddSourceExW
249 );
250HRESULT DAPI WiuGetComponentPath(
251 __in_z LPCWSTR wzProductCode,
252 __in_z LPCWSTR wzComponentId,
253 __out INSTALLSTATE* pInstallState,
254 __out_z LPWSTR* psczValue
255 );
256HRESULT DAPI WiuLocateComponent(
257 __in_z LPCWSTR wzComponentId,
258 __out INSTALLSTATE* pInstallState,
259 __out_z LPWSTR* psczValue
260 );
261HRESULT DAPI WiuQueryFeatureState(
262 __in_z LPCWSTR wzProduct,
263 __in_z LPCWSTR wzFeature,
264 __out INSTALLSTATE* pInstallState
265 );
266HRESULT DAPI WiuGetProductInfo(
267 __in_z LPCWSTR wzProductCode,
268 __in_z LPCWSTR wzProperty,
269 __out LPWSTR* psczValue
270 );
271HRESULT DAPI WiuGetProductInfoEx(
272 __in_z LPCWSTR wzProductCode,
273 __in_z_opt LPCWSTR wzUserSid,
274 __in MSIINSTALLCONTEXT dwContext,
275 __in_z LPCWSTR wzProperty,
276 __out LPWSTR* psczValue
277 );
278HRESULT DAPI WiuGetProductProperty(
279 __in MSIHANDLE hProduct,
280 __in_z LPCWSTR wzProperty,
281 __out LPWSTR* psczValue
282 );
283HRESULT DAPI WiuGetPatchInfoEx(
284 __in_z LPCWSTR wzPatchCode,
285 __in_z LPCWSTR wzProductCode,
286 __in_z_opt LPCWSTR wzUserSid,
287 __in MSIINSTALLCONTEXT dwContext,
288 __in_z LPCWSTR wzProperty,
289 __out LPWSTR* psczValue
290 );
291HRESULT DAPI WiuDeterminePatchSequence(
292 __in_z LPCWSTR wzProductCode,
293 __in_z_opt LPCWSTR wzUserSid,
294 __in MSIINSTALLCONTEXT context,
295 __in PMSIPATCHSEQUENCEINFOW pPatchInfo,
296 __in DWORD cPatchInfo
297 );
298HRESULT DAPI WiuDetermineApplicablePatches(
299 __in_z LPCWSTR wzProductPackagePath,
300 __in PMSIPATCHSEQUENCEINFOW pPatchInfo,
301 __in DWORD cPatchInfo
302 );
303HRESULT DAPI WiuEnumProducts(
304 __in DWORD iProductIndex,
305 __out_ecount(MAX_GUID_CHARS + 1) LPWSTR wzProductCode
306 );
307HRESULT DAPI WiuEnumProductsEx(
308 __in_z_opt LPCWSTR wzProductCode,
309 __in_z_opt LPCWSTR wzUserSid,
310 __in DWORD dwContext,
311 __in DWORD dwIndex,
312 __out_opt WCHAR wzInstalledProductCode[39],
313 __out_opt MSIINSTALLCONTEXT *pdwInstalledContext,
314 __out_opt LPWSTR wzSid,
315 __inout_opt LPDWORD pcchSid
316 );
317HRESULT DAPI WiuEnumRelatedProducts(
318 __in_z LPCWSTR wzUpgradeCode,
319 __in DWORD iProductIndex,
320 __out_ecount(MAX_GUID_CHARS + 1) LPWSTR wzProductCode
321 );
322HRESULT DAPI WiuEnumRelatedProductCodes(
323 __in_z LPCWSTR wzUpgradeCode,
324 __deref_out_ecount_opt(pcRelatedProducts) LPWSTR** prgsczProductCodes,
325 __out DWORD* pcRelatedProducts,
326 __in BOOL fReturnHighestVersionOnly
327 );
328HRESULT DAPI WiuEnableLog(
329 __in DWORD dwLogMode,
330 __in_z LPCWSTR wzLogFile,
331 __in DWORD dwLogAttributes
332 );
333HRESULT DAPI WiuInitializeExternalUI(
334 __in PFN_MSIEXECUTEMESSAGEHANDLER pfnMessageHandler,
335 __in INSTALLUILEVEL internalUILevel,
336 __in HWND hwndParent,
337 __in LPVOID pvContext,
338 __in BOOL fRollback,
339 __in WIU_MSI_EXECUTE_CONTEXT* pExecuteContext
340 );
341void DAPI WiuUninitializeExternalUI(
342 __in WIU_MSI_EXECUTE_CONTEXT* pExecuteContext
343 );
344HRESULT DAPI WiuConfigureProductEx(
345 __in_z LPCWSTR wzProduct,
346 __in int iInstallLevel,
347 __in INSTALLSTATE eInstallState,
348 __in_z LPCWSTR wzCommandLine,
349 __out WIU_RESTART* pRestart
350 );
351HRESULT DAPI WiuInstallProduct(
352 __in_z LPCWSTR wzPackagPath,
353 __in_z LPCWSTR wzCommandLine,
354 __out WIU_RESTART* pRestart
355 );
356HRESULT DAPI WiuRemovePatches(
357 __in_z LPCWSTR wzPatchList,
358 __in_z LPCWSTR wzProductCode,
359 __in_z LPCWSTR wzPropertyList,
360 __out WIU_RESTART* pRestart
361 );
362HRESULT DAPI WiuSourceListAddSourceEx(
363 __in_z LPCWSTR wzProductCodeOrPatchCode,
364 __in_z_opt LPCWSTR wzUserSid,
365 __in MSIINSTALLCONTEXT dwContext,
366 __in DWORD dwCode,
367 __in_z LPCWSTR wzSource,
368 __in_opt DWORD dwIndex
369 );
370
371#ifdef __cplusplus
372}
373#endif