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