aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/burn/WixToolset.BootstrapperCore.Native/inc/baenginetypes.h (renamed from src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h)146
-rw-r--r--src/api/burn/WixToolset.BootstrapperCore.Native/inc/batypes.h (renamed from src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h)451
-rw-r--r--src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs48
-rw-r--r--src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs149
-rw-r--r--src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs18
-rw-r--r--src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs44
-rw-r--r--src/api/burn/WixToolset.Mba.Core/BundleInfo.cs8
-rw-r--r--src/api/burn/WixToolset.Mba.Core/Engine.cs4
-rw-r--r--src/api/burn/WixToolset.Mba.Core/EventArgs.cs91
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs38
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs54
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs9
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs11
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs20
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IEngine.cs3
-rw-r--r--src/api/burn/WixToolset.Mba.Core/ManagedBootstrapperApplication.cs19
-rw-r--r--src/api/burn/WixToolset.Mba.Core/MbaNative.cs10
-rw-r--r--src/api/burn/WixToolset.Mba.Core/PackageInfo.cs6
-rw-r--r--src/api/burn/balutil/BalBaseBAFunctionsProc.cpp1099
-rw-r--r--src/api/burn/balutil/BalBootstrapperEngine.cpp1148
-rw-r--r--src/api/burn/balutil/BalBootstrapperEngine.h (renamed from src/api/burn/balutil/inc/BalBootstrapperEngine.h)14
-rw-r--r--src/api/burn/balutil/balinfo.cpp11
-rw-r--r--src/api/burn/balutil/balutil.cpp300
-rw-r--r--src/api/burn/balutil/balutil.vcxproj7
-rw-r--r--src/api/burn/balutil/inc/BAFunctions.h12
-rw-r--r--src/api/burn/balutil/inc/BalBaseBAFunctions.h66
-rw-r--r--src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h180
-rw-r--r--src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h90
-rw-r--r--src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h1045
-rw-r--r--src/api/burn/balutil/inc/IBAFunctions.h2
-rw-r--r--src/api/burn/balutil/inc/IBootstrapperApplication.h29
-rw-r--r--src/api/burn/balutil/inc/IBootstrapperApplicationFactory.h13
-rw-r--r--src/api/burn/balutil/inc/IBootstrapperEngine.h11
-rw-r--r--src/api/burn/balutil/inc/balinfo.h1
-rw-r--r--src/api/burn/balutil/inc/balutil.h30
-rw-r--r--src/api/burn/balutil/msg.cpp5263
-rw-r--r--src/api/burn/balutil/msg.h8
-rw-r--r--src/api/burn/balutil/precomp.h12
-rw-r--r--src/api/burn/mbanative/mbanative.cpp29
-rw-r--r--src/api/burn/mbanative/mbanative.def4
-rw-r--r--src/api/burn/mbanative/mbanative.vcxproj1
-rw-r--r--src/api/burn/mbanative/precomp.h4
-rw-r--r--src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp18
-rw-r--r--src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp21
-rw-r--r--src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp26
-rw-r--r--src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h4
-rw-r--r--src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp15
-rw-r--r--src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h3
-rw-r--r--src/api/burn/test/BalUtilUnitTest/precomp.h4
-rw-r--r--src/api/burn/test/WixToolsetTest.Mba.Core/BaseBootstrapperApplicationFactoryFixture.cs141
-rw-r--r--src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs2
-rw-r--r--src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationDllSymbol.cs6
-rw-r--r--src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationSymbol.cs16
-rw-r--r--src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs20
54 files changed, 8492 insertions, 2292 deletions
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/baenginetypes.h
index 96302bd1..7af41d97 100644
--- a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h
+++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/baenginetypes.h
@@ -86,6 +86,7 @@ enum BOOTSTRAPPER_UPDATE_HASH_TYPE
86 86
87enum BOOTSTRAPPER_ENGINE_MESSAGE 87enum BOOTSTRAPPER_ENGINE_MESSAGE
88{ 88{
89 BOOTSTRAPPER_ENGINE_MESSAGE_UNKNOWN,
89 BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT, 90 BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT,
90 BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC, 91 BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC,
91 BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING, 92 BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING,
@@ -112,159 +113,161 @@ enum BOOTSTRAPPER_ENGINE_MESSAGE
112 BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE, 113 BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE,
113 BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS, 114 BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS,
114 BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, 115 BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE,
116
117 BOOTSTRAPPER_APPLICATION_MESSAGE_LAST = 65535
115}; 118};
116 119
117typedef struct _BAENGINE_APPLY_ARGS 120typedef struct _BAENGINE_APPLY_ARGS
118{ 121{
119 DWORD cbSize; 122 DWORD dwApiVersion;
120 HWND hwndParent; 123 DWORD64 hwndParent;
121} BAENGINE_APPLY_ARGS; 124} BAENGINE_APPLY_ARGS;
122 125
123typedef struct _BAENGINE_APPLY_RESULTS 126typedef struct _BAENGINE_APPLY_RESULTS
124{ 127{
125 DWORD cbSize; 128 DWORD dwApiVersion;
126} BAENGINE_APPLY_RESULTS; 129} BAENGINE_APPLY_RESULTS;
127 130
128typedef struct _BAENGINE_CLOSESPLASHSCREEN_ARGS 131typedef struct _BAENGINE_CLOSESPLASHSCREEN_ARGS
129{ 132{
130 DWORD cbSize; 133 DWORD dwApiVersion;
131} BAENGINE_CLOSESPLASHSCREEN_ARGS; 134} BAENGINE_CLOSESPLASHSCREEN_ARGS;
132 135
133typedef struct _BAENGINE_CLOSESPLASHSCREEN_RESULTS 136typedef struct _BAENGINE_CLOSESPLASHSCREEN_RESULTS
134{ 137{
135 DWORD cbSize; 138 DWORD dwApiVersion;
136} BAENGINE_CLOSESPLASHSCREEN_RESULTS; 139} BAENGINE_CLOSESPLASHSCREEN_RESULTS;
137 140
138typedef struct _BAENGINE_COMPAREVERSIONS_ARGS 141typedef struct _BAENGINE_COMPAREVERSIONS_ARGS
139{ 142{
140 DWORD cbSize; 143 DWORD dwApiVersion;
141 LPCWSTR wzVersion1; 144 LPCWSTR wzVersion1;
142 LPCWSTR wzVersion2; 145 LPCWSTR wzVersion2;
143} BAENGINE_COMPAREVERSIONS_ARGS; 146} BAENGINE_COMPAREVERSIONS_ARGS;
144 147
145typedef struct _BAENGINE_COMPAREVERSIONS_RESULTS 148typedef struct _BAENGINE_COMPAREVERSIONS_RESULTS
146{ 149{
147 DWORD cbSize; 150 DWORD dwApiVersion;
148 int nResult; 151 INT32 nResult;
149} BAENGINE_COMPAREVERSIONS_RESULTS; 152} BAENGINE_COMPAREVERSIONS_RESULTS;
150 153
151typedef struct _BAENGINE_DETECT_ARGS 154typedef struct _BAENGINE_DETECT_ARGS
152{ 155{
153 DWORD cbSize; 156 DWORD dwApiVersion;
154 HWND hwndParent; 157 DWORD64 hwndParent;
155} BAENGINE_DETECT_ARGS; 158} BAENGINE_DETECT_ARGS;
156 159
157typedef struct _BAENGINE_DETECT_RESULTS 160typedef struct _BAENGINE_DETECT_RESULTS
158{ 161{
159 DWORD cbSize; 162 DWORD dwApiVersion;
160} BAENGINE_DETECT_RESULTS; 163} BAENGINE_DETECT_RESULTS;
161 164
162typedef struct _BAENGINE_ELEVATE_ARGS 165typedef struct _BAENGINE_ELEVATE_ARGS
163{ 166{
164 DWORD cbSize; 167 DWORD dwApiVersion;
165 HWND hwndParent; 168 DWORD64 hwndParent;
166} BAENGINE_ELEVATE_ARGS; 169} BAENGINE_ELEVATE_ARGS;
167 170
168typedef struct _BAENGINE_ELEVATE_RESULTS 171typedef struct _BAENGINE_ELEVATE_RESULTS
169{ 172{
170 DWORD cbSize; 173 DWORD dwApiVersion;
171} BAENGINE_ELEVATE_RESULTS; 174} BAENGINE_ELEVATE_RESULTS;
172 175
173typedef struct _BAENGINE_ESCAPESTRING_ARGS 176typedef struct _BAENGINE_ESCAPESTRING_ARGS
174{ 177{
175 DWORD cbSize; 178 DWORD dwApiVersion;
176 LPCWSTR wzIn; 179 LPCWSTR wzIn;
177} BAENGINE_ESCAPESTRING_ARGS; 180} BAENGINE_ESCAPESTRING_ARGS;
178 181
179typedef struct _BAENGINE_ESCAPESTRING_RESULTS 182typedef struct _BAENGINE_ESCAPESTRING_RESULTS
180{ 183{
181 DWORD cbSize; 184 DWORD dwApiVersion;
182 LPWSTR wzOut; 185 LPWSTR wzOut;
183 // Should be initialized to the size of wzOut. 186 // Should be initialized to the size of wzOut.
184 SIZE_T cchOut; 187 DWORD cchOut;
185} BAENGINE_ESCAPESTRING_RESULTS; 188} BAENGINE_ESCAPESTRING_RESULTS;
186 189
187typedef struct _BAENGINE_EVALUATECONDITION_ARGS 190typedef struct _BAENGINE_EVALUATECONDITION_ARGS
188{ 191{
189 DWORD cbSize; 192 DWORD dwApiVersion;
190 LPCWSTR wzCondition; 193 LPCWSTR wzCondition;
191} BAENGINE_EVALUATECONDITION_ARGS; 194} BAENGINE_EVALUATECONDITION_ARGS;
192 195
193typedef struct _BAENGINE_EVALUATECONDITION_RESULTS 196typedef struct _BAENGINE_EVALUATECONDITION_RESULTS
194{ 197{
195 DWORD cbSize; 198 DWORD dwApiVersion;
196 BOOL f; 199 BOOL f;
197} BAENGINE_EVALUATECONDITION_RESULTS; 200} BAENGINE_EVALUATECONDITION_RESULTS;
198 201
199typedef struct _BAENGINE_FORMATSTRING_ARGS 202typedef struct _BAENGINE_FORMATSTRING_ARGS
200{ 203{
201 DWORD cbSize; 204 DWORD dwApiVersion;
202 LPCWSTR wzIn; 205 LPCWSTR wzIn;
203} BAENGINE_FORMATSTRING_ARGS; 206} BAENGINE_FORMATSTRING_ARGS;
204 207
205typedef struct _BAENGINE_FORMATSTRING_RESULTS 208typedef struct _BAENGINE_FORMATSTRING_RESULTS
206{ 209{
207 DWORD cbSize; 210 DWORD dwApiVersion;
208 LPWSTR wzOut; 211 LPWSTR wzOut;
209 // Should be initialized to the size of wzOut. 212 // Should be initialized to the size of wzOut.
210 SIZE_T cchOut; 213 DWORD cchOut;
211} BAENGINE_FORMATSTRING_RESULTS; 214} BAENGINE_FORMATSTRING_RESULTS;
212 215
213typedef struct _BAENGINE_GETPACKAGECOUNT_ARGS 216typedef struct _BAENGINE_GETPACKAGECOUNT_ARGS
214{ 217{
215 DWORD cbSize; 218 DWORD dwApiVersion;
216} BAENGINE_GETPACKAGECOUNT_ARGS; 219} BAENGINE_GETPACKAGECOUNT_ARGS;
217 220
218typedef struct _BAENGINE_GETPACKAGECOUNT_RESULTS 221typedef struct _BAENGINE_GETPACKAGECOUNT_RESULTS
219{ 222{
220 DWORD cbSize; 223 DWORD dwApiVersion;
221 DWORD cPackages; 224 DWORD cPackages;
222} BAENGINE_GETPACKAGECOUNT_RESULTS; 225} BAENGINE_GETPACKAGECOUNT_RESULTS;
223 226
224typedef struct _BAENGINE_GETVARIABLENUMERIC_ARGS 227typedef struct _BAENGINE_GETVARIABLENUMERIC_ARGS
225{ 228{
226 DWORD cbSize; 229 DWORD dwApiVersion;
227 LPCWSTR wzVariable; 230 LPCWSTR wzVariable;
228} BAENGINE_GETVARIABLENUMERIC_ARGS; 231} BAENGINE_GETVARIABLENUMERIC_ARGS;
229 232
230typedef struct _BAENGINE_GETVARIABLENUMERIC_RESULTS 233typedef struct _BAENGINE_GETVARIABLENUMERIC_RESULTS
231{ 234{
232 DWORD cbSize; 235 DWORD dwApiVersion;
233 LONGLONG llValue; 236 LONGLONG llValue;
234} BAENGINE_GETVARIABLENUMERIC_RESULTS; 237} BAENGINE_GETVARIABLENUMERIC_RESULTS;
235 238
236typedef struct _BAENGINE_GETVARIABLESTRING_ARGS 239typedef struct _BAENGINE_GETVARIABLESTRING_ARGS
237{ 240{
238 DWORD cbSize; 241 DWORD dwApiVersion;
239 LPCWSTR wzVariable; 242 LPCWSTR wzVariable;
240} BAENGINE_GETVARIABLESTRING_ARGS; 243} BAENGINE_GETVARIABLESTRING_ARGS;
241 244
242typedef struct _BAENGINE_GETVARIABLESTRING_RESULTS 245typedef struct _BAENGINE_GETVARIABLESTRING_RESULTS
243{ 246{
244 DWORD cbSize; 247 DWORD dwApiVersion;
245 LPWSTR wzValue; 248 LPWSTR wzValue;
246 // Should be initialized to the size of wzValue. 249 // Should be initialized to the size of wzValue.
247 SIZE_T cchValue; 250 DWORD cchValue;
248} BAENGINE_GETVARIABLESTRING_RESULTS; 251} BAENGINE_GETVARIABLESTRING_RESULTS;
249 252
250typedef struct _BAENGINE_GETVARIABLEVERSION_ARGS 253typedef struct _BAENGINE_GETVARIABLEVERSION_ARGS
251{ 254{
252 DWORD cbSize; 255 DWORD dwApiVersion;
253 LPCWSTR wzVariable; 256 LPCWSTR wzVariable;
254} BAENGINE_GETVARIABLEVERSION_ARGS; 257} BAENGINE_GETVARIABLEVERSION_ARGS;
255 258
256typedef struct _BAENGINE_GETVARIABLEVERSION_RESULTS 259typedef struct _BAENGINE_GETVARIABLEVERSION_RESULTS
257{ 260{
258 DWORD cbSize; 261 DWORD dwApiVersion;
259 LPWSTR wzValue; 262 LPWSTR wzValue;
260 // Should be initialized to the size of wzValue. 263 // Should be initialized to the size of wzValue.
261 SIZE_T cchValue; 264 DWORD cchValue;
262} BAENGINE_GETVARIABLEVERSION_RESULTS; 265} BAENGINE_GETVARIABLEVERSION_RESULTS;
263 266
264typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_ARGS 267typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_ARGS
265{ 268{
266 DWORD cbSize; 269 DWORD dwApiVersion;
267 HWND hwndParent; 270 DWORD64 hwndParent;
268 LPCWSTR wzApprovedExeForElevationId; 271 LPCWSTR wzApprovedExeForElevationId;
269 LPCWSTR wzArguments; 272 LPCWSTR wzArguments;
270 DWORD dwWaitForInputIdleTimeout; 273 DWORD dwWaitForInputIdleTimeout;
@@ -272,57 +275,58 @@ typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_ARGS
272 275
273typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_RESULTS 276typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_RESULTS
274{ 277{
275 DWORD cbSize; 278 DWORD dwApiVersion;
276} BAENGINE_LAUNCHAPPROVEDEXE_RESULTS; 279} BAENGINE_LAUNCHAPPROVEDEXE_RESULTS;
277 280
278typedef struct _BAENGINE_SETUPDATESOURCE_ARGS 281typedef struct _BAENGINE_SETUPDATESOURCE_ARGS
279{ 282{
280 DWORD cbSize; 283 DWORD dwApiVersion;
281 LPCWSTR wzUrl; 284 LPCWSTR wzUrl;
285 LPCWSTR wzAuthorizationHeader;
282} BAENGINE_SETUPDATESOURCE_ARGS; 286} BAENGINE_SETUPDATESOURCE_ARGS;
283 287
284typedef struct _BAENGINE_SETUPDATESOURCE_RESULTS 288typedef struct _BAENGINE_SETUPDATESOURCE_RESULTS
285{ 289{
286 DWORD cbSize; 290 DWORD dwApiVersion;
287} BAENGINE_SETUPDATESOURCE_RESULTS; 291} BAENGINE_SETUPDATESOURCE_RESULTS;
288 292
289typedef struct _BAENGINE_LOG_ARGS 293typedef struct _BAENGINE_LOG_ARGS
290{ 294{
291 DWORD cbSize; 295 DWORD dwApiVersion;
292 BOOTSTRAPPER_LOG_LEVEL level; 296 BOOTSTRAPPER_LOG_LEVEL level;
293 LPCWSTR wzMessage; 297 LPCWSTR wzMessage;
294} BAENGINE_LOG_ARGS; 298} BAENGINE_LOG_ARGS;
295 299
296typedef struct _BAENGINE_LOG_RESULTS 300typedef struct _BAENGINE_LOG_RESULTS
297{ 301{
298 DWORD cbSize; 302 DWORD dwApiVersion;
299} BAENGINE_LOG_RESULTS; 303} BAENGINE_LOG_RESULTS;
300 304
301typedef struct _BAENGINE_PLAN_ARGS 305typedef struct _BAENGINE_PLAN_ARGS
302{ 306{
303 DWORD cbSize; 307 DWORD dwApiVersion;
304 BOOTSTRAPPER_ACTION action; 308 BOOTSTRAPPER_ACTION action;
305} BAENGINE_PLAN_ARGS; 309} BAENGINE_PLAN_ARGS;
306 310
307typedef struct _BAENGINE_PLAN_RESULTS 311typedef struct _BAENGINE_PLAN_RESULTS
308{ 312{
309 DWORD cbSize; 313 DWORD dwApiVersion;
310} BAENGINE_PLAN_RESULTS; 314} BAENGINE_PLAN_RESULTS;
311 315
312typedef struct _BAENGINE_QUIT_ARGS 316typedef struct _BAENGINE_QUIT_ARGS
313{ 317{
314 DWORD cbSize; 318 DWORD dwApiVersion;
315 DWORD dwExitCode; 319 DWORD dwExitCode;
316} BAENGINE_QUIT_ARGS; 320} BAENGINE_QUIT_ARGS;
317 321
318typedef struct _BAENGINE_QUIT_RESULTS 322typedef struct _BAENGINE_QUIT_RESULTS
319{ 323{
320 DWORD cbSize; 324 DWORD dwApiVersion;
321} BAENGINE_QUIT_RESULTS; 325} BAENGINE_QUIT_RESULTS;
322 326
323typedef struct _BAENGINE_SENDEMBEDDEDERROR_ARGS 327typedef struct _BAENGINE_SENDEMBEDDEDERROR_ARGS
324{ 328{
325 DWORD cbSize; 329 DWORD dwApiVersion;
326 DWORD dwErrorCode; 330 DWORD dwErrorCode;
327 LPCWSTR wzMessage; 331 LPCWSTR wzMessage;
328 DWORD dwUIHint; 332 DWORD dwUIHint;
@@ -330,41 +334,42 @@ typedef struct _BAENGINE_SENDEMBEDDEDERROR_ARGS
330 334
331typedef struct _BAENGINE_SENDEMBEDDEDERROR_RESULTS 335typedef struct _BAENGINE_SENDEMBEDDEDERROR_RESULTS
332{ 336{
333 DWORD cbSize; 337 DWORD dwApiVersion;
334 int nResult; 338 INT32 nResult;
335} BAENGINE_SENDEMBEDDEDERROR_RESULTS; 339} BAENGINE_SENDEMBEDDEDERROR_RESULTS;
336 340
337typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_ARGS 341typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_ARGS
338{ 342{
339 DWORD cbSize; 343 DWORD dwApiVersion;
340 DWORD dwProgressPercentage; 344 DWORD dwProgressPercentage;
341 DWORD dwOverallProgressPercentage; 345 DWORD dwOverallProgressPercentage;
342} BAENGINE_SENDEMBEDDEDPROGRESS_ARGS; 346} BAENGINE_SENDEMBEDDEDPROGRESS_ARGS;
343 347
344typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS 348typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS
345{ 349{
346 DWORD cbSize; 350 DWORD dwApiVersion;
347 int nResult; 351 INT32 nResult;
348} BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS; 352} BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS;
349 353
350typedef struct _BAENGINE_SETDOWNLOADSOURCE_ARGS 354typedef struct _BAENGINE_SETDOWNLOADSOURCE_ARGS
351{ 355{
352 DWORD cbSize; 356 DWORD dwApiVersion;
353 LPCWSTR wzPackageOrContainerId; 357 LPCWSTR wzPackageOrContainerId;
354 LPCWSTR wzPayloadId; 358 LPCWSTR wzPayloadId;
355 LPCWSTR wzUrl; 359 LPCWSTR wzUrl;
356 LPCWSTR wzUser; 360 LPCWSTR wzUser;
357 LPCWSTR wzPassword; 361 LPCWSTR wzPassword;
362 LPCWSTR wzAuthorizationHeader;
358} BAENGINE_SETDOWNLOADSOURCE_ARGS; 363} BAENGINE_SETDOWNLOADSOURCE_ARGS;
359 364
360typedef struct _BAENGINE_SETDOWNLOADSOURCE_RESULTS 365typedef struct _BAENGINE_SETDOWNLOADSOURCE_RESULTS
361{ 366{
362 DWORD cbSize; 367 DWORD dwApiVersion;
363} BAENGINE_SETDOWNLOADSOURCE_RESULTS; 368} BAENGINE_SETDOWNLOADSOURCE_RESULTS;
364 369
365typedef struct _BAENGINE_SETLOCALSOURCE_ARGS 370typedef struct _BAENGINE_SETLOCALSOURCE_ARGS
366{ 371{
367 DWORD cbSize; 372 DWORD dwApiVersion;
368 LPCWSTR wzPackageOrContainerId; 373 LPCWSTR wzPackageOrContainerId;
369 LPCWSTR wzPayloadId; 374 LPCWSTR wzPayloadId;
370 LPCWSTR wzPath; 375 LPCWSTR wzPath;
@@ -372,39 +377,40 @@ typedef struct _BAENGINE_SETLOCALSOURCE_ARGS
372 377
373typedef struct _BAENGINE_SETLOCALSOURCE_RESULTS 378typedef struct _BAENGINE_SETLOCALSOURCE_RESULTS
374{ 379{
375 DWORD cbSize; 380 DWORD dwApiVersion;
376} BAENGINE_SETLOCALSOURCE_RESULTS; 381} BAENGINE_SETLOCALSOURCE_RESULTS;
377 382
378typedef struct _BAENGINE_SETUPDATE_ARGS 383typedef struct _BAENGINE_SETUPDATE_ARGS
379{ 384{
380 DWORD cbSize; 385 DWORD dwApiVersion;
381 LPCWSTR wzLocalSource; 386 LPCWSTR wzLocalSource;
382 LPCWSTR wzDownloadSource; 387 LPCWSTR wzDownloadSource;
383 DWORD64 qwSize; 388 DWORD64 qwSize;
384 BOOTSTRAPPER_UPDATE_HASH_TYPE hashType; 389 BOOTSTRAPPER_UPDATE_HASH_TYPE hashType;
385 LPCWSTR wzHash; 390 LPCWSTR wzHash;
391 LPCWSTR wzUpdatePackageId;
386} BAENGINE_SETUPDATE_ARGS; 392} BAENGINE_SETUPDATE_ARGS;
387 393
388typedef struct _BAENGINE_SETUPDATE_RESULTS 394typedef struct _BAENGINE_SETUPDATE_RESULTS
389{ 395{
390 DWORD cbSize; 396 DWORD dwApiVersion;
391} BAENGINE_SETUPDATE_RESULTS; 397} BAENGINE_SETUPDATE_RESULTS;
392 398
393typedef struct _BAENGINE_SETVARIABLENUMERIC_ARGS 399typedef struct _BAENGINE_SETVARIABLENUMERIC_ARGS
394{ 400{
395 DWORD cbSize; 401 DWORD dwApiVersion;
396 LPCWSTR wzVariable; 402 LPCWSTR wzVariable;
397 LONGLONG llValue; 403 LONGLONG llValue;
398} BAENGINE_SETVARIABLENUMERIC_ARGS; 404} BAENGINE_SETVARIABLENUMERIC_ARGS;
399 405
400typedef struct _BAENGINE_SETVARIABLENUMERIC_RESULTS 406typedef struct _BAENGINE_SETVARIABLENUMERIC_RESULTS
401{ 407{
402 DWORD cbSize; 408 DWORD dwApiVersion;
403} BAENGINE_SETVARIABLENUMERIC_RESULTS; 409} BAENGINE_SETVARIABLENUMERIC_RESULTS;
404 410
405typedef struct _BAENGINE_SETVARIABLESTRING_ARGS 411typedef struct _BAENGINE_SETVARIABLESTRING_ARGS
406{ 412{
407 DWORD cbSize; 413 DWORD dwApiVersion;
408 LPCWSTR wzVariable; 414 LPCWSTR wzVariable;
409 LPCWSTR wzValue; 415 LPCWSTR wzValue;
410 BOOL fFormatted; 416 BOOL fFormatted;
@@ -412,42 +418,42 @@ typedef struct _BAENGINE_SETVARIABLESTRING_ARGS
412 418
413typedef struct _BAENGINE_SETVARIABLESTRING_RESULTS 419typedef struct _BAENGINE_SETVARIABLESTRING_RESULTS
414{ 420{
415 DWORD cbSize; 421 DWORD dwApiVersion;
416} BAENGINE_SETVARIABLESTRING_RESULTS; 422} BAENGINE_SETVARIABLESTRING_RESULTS;
417 423
418typedef struct _BAENGINE_SETVARIABLEVERSION_ARGS 424typedef struct _BAENGINE_SETVARIABLEVERSION_ARGS
419{ 425{
420 DWORD cbSize; 426 DWORD dwApiVersion;
421 LPCWSTR wzVariable; 427 LPCWSTR wzVariable;
422 LPCWSTR wzValue; 428 LPCWSTR wzValue;
423} BAENGINE_SETVARIABLEVERSION_ARGS; 429} BAENGINE_SETVARIABLEVERSION_ARGS;
424 430
425typedef struct _BAENGINE_SETVARIABLEVERSION_RESULTS 431typedef struct _BAENGINE_SETVARIABLEVERSION_RESULTS
426{ 432{
427 DWORD cbSize; 433 DWORD dwApiVersion;
428} BAENGINE_SETVARIABLEVERSION_RESULTS; 434} BAENGINE_SETVARIABLEVERSION_RESULTS;
429 435
430typedef struct _BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS 436typedef struct _BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS
431{ 437{
432 DWORD cbSize; 438 DWORD dwApiVersion;
433 LPCWSTR wzBundleId; 439 LPCWSTR wzBundleId;
434 LPCWSTR wzVariable; 440 LPCWSTR wzVariable;
435} BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS; 441} BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS;
436 442
437typedef struct _BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS 443typedef struct _BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS
438{ 444{
439 DWORD cbSize; 445 DWORD dwApiVersion;
440 LPWSTR wzValue; 446 LPWSTR wzValue;
441 // Should be initialized to the size of wzValue. 447 // Should be initialized to the size of wzValue.
442 SIZE_T cchValue; 448 DWORD cchValue;
443} BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS; 449} BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS;
444 450
445extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_ENGINE_PROC)( 451// extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_ENGINE_PROC)(
446 __in BOOTSTRAPPER_ENGINE_MESSAGE message, 452// __in BOOTSTRAPPER_ENGINE_MESSAGE message,
447 __in const LPVOID pvArgs, 453// __in const LPVOID pvArgs,
448 __inout LPVOID pvResults, 454// __inout LPVOID pvResults,
449 __in_opt LPVOID pvContext 455// __in_opt LPVOID pvContext
450 ); 456// );
451 457
452#if defined(__cplusplus) 458#if defined(__cplusplus)
453} 459}
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/batypes.h
index 2633a9c2..0116364c 100644
--- a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h
+++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/batypes.h
@@ -2,6 +2,10 @@
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. 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 3
4 4
5const LPCWSTR BOOTSTRAPPER_APPLICATION_COMMANDLINE_SWITCH_API_VERSION = L"burn.ba.apiver";
6const LPCWSTR BOOTSTRAPPER_APPLICATION_COMMANDLINE_SWITCH_PIPE_NAME = L"burn.ba.pipe";
7const DWORD WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION = 5;
8
5enum BOOTSTRAPPER_DISPLAY 9enum BOOTSTRAPPER_DISPLAY
6{ 10{
7 BOOTSTRAPPER_DISPLAY_UNKNOWN, 11 BOOTSTRAPPER_DISPLAY_UNKNOWN,
@@ -143,27 +147,30 @@ enum BOOTSTRAPPER_MSI_FILE_VERSIONING
143 147
144enum BOOTSTRAPPER_APPLICATION_MESSAGE 148enum BOOTSTRAPPER_APPLICATION_MESSAGE
145{ 149{
146 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, 150 BOOTSTRAPPER_APPLICATION_MESSAGE_UNKNOWN = 65536,
147 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, 151 BOOTSTRAPPER_APPLICATION_MESSAGE_ONCREATE,
148 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, 152 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDESTROY,
149 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE,
150 BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, 153 BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP,
151 BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, 154 BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN,
155 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN,
156 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE,
152 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, 157 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE,
158 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE,
159 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN,
160 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE,
161 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET,
162 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE,
163 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE,
153 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, 164 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN,
154 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, 165 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE,
155 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, 166 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE,
156 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, 167 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN,
157 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, 168 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE,
158 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE,
159 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET,
160 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE,
161 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE,
162 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE,
163 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN,
164 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET,
165 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, 169 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE,
170 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN,
166 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, 171 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE,
172 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET,
173 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE,
167 BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, 174 BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN,
168 BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, 175 BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN,
169 BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, 176 BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE,
@@ -215,8 +222,6 @@ enum BOOTSTRAPPER_APPLICATION_MESSAGE
215 BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, 222 BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE,
216 BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, 223 BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS,
217 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY, 224 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY,
218 BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATEBEGIN,
219 BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATECOMPLETE,
220 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, 225 BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE,
221 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, 226 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN,
222 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, 227 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE,
@@ -345,7 +350,7 @@ struct BOOTSTRAPPER_COMMAND
345 BOOTSTRAPPER_DISPLAY display; 350 BOOTSTRAPPER_DISPLAY display;
346 351
347 LPWSTR wzCommandLine; 352 LPWSTR wzCommandLine;
348 int nCmdShow; 353 INT32 nCmdShow;
349 354
350 BOOTSTRAPPER_RESUME_TYPE resumeType; 355 BOOTSTRAPPER_RESUME_TYPE resumeType;
351 HWND hwndSplashScreen; 356 HWND hwndSplashScreen;
@@ -361,19 +366,19 @@ struct BOOTSTRAPPER_COMMAND
361 366
362struct BA_ONAPPLYBEGIN_ARGS 367struct BA_ONAPPLYBEGIN_ARGS
363{ 368{
364 DWORD cbSize; 369 DWORD dwApiVersion;
365 DWORD dwPhaseCount; 370 DWORD dwPhaseCount;
366}; 371};
367 372
368struct BA_ONAPPLYBEGIN_RESULTS 373struct BA_ONAPPLYBEGIN_RESULTS
369{ 374{
370 DWORD cbSize; 375 DWORD dwApiVersion;
371 BOOL fCancel; 376 BOOL fCancel;
372}; 377};
373 378
374struct BA_ONAPPLYCOMPLETE_ARGS 379struct BA_ONAPPLYCOMPLETE_ARGS
375{ 380{
376 DWORD cbSize; 381 DWORD dwApiVersion;
377 HRESULT hrStatus; 382 HRESULT hrStatus;
378 // Indicates whether any package required a reboot or initiated the reboot already. 383 // Indicates whether any package required a reboot or initiated the reboot already.
379 BOOTSTRAPPER_APPLY_RESTART restart; 384 BOOTSTRAPPER_APPLY_RESTART restart;
@@ -382,49 +387,49 @@ struct BA_ONAPPLYCOMPLETE_ARGS
382 387
383struct BA_ONAPPLYCOMPLETE_RESULTS 388struct BA_ONAPPLYCOMPLETE_RESULTS
384{ 389{
385 DWORD cbSize; 390 DWORD dwApiVersion;
386 BOOTSTRAPPER_APPLYCOMPLETE_ACTION action; 391 BOOTSTRAPPER_APPLYCOMPLETE_ACTION action;
387}; 392};
388 393
389struct BA_ONAPPLYDOWNGRADE_ARGS 394struct BA_ONAPPLYDOWNGRADE_ARGS
390{ 395{
391 DWORD cbSize; 396 DWORD dwApiVersion;
392 HRESULT hrRecommended; 397 HRESULT hrRecommended;
393}; 398};
394 399
395struct BA_ONAPPLYDOWNGRADE_RESULTS 400struct BA_ONAPPLYDOWNGRADE_RESULTS
396{ 401{
397 DWORD cbSize; 402 DWORD dwApiVersion;
398 HRESULT hrStatus; 403 HRESULT hrStatus;
399}; 404};
400 405
401struct BA_ONBEGINMSITRANSACTIONBEGIN_ARGS 406struct BA_ONBEGINMSITRANSACTIONBEGIN_ARGS
402{ 407{
403 DWORD cbSize; 408 DWORD dwApiVersion;
404 LPCWSTR wzTransactionId; 409 LPCWSTR wzTransactionId;
405}; 410};
406 411
407struct BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS 412struct BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS
408{ 413{
409 DWORD cbSize; 414 DWORD dwApiVersion;
410 BOOL fCancel; 415 BOOL fCancel;
411}; 416};
412 417
413struct BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS 418struct BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS
414{ 419{
415 DWORD cbSize; 420 DWORD dwApiVersion;
416 LPCWSTR wzTransactionId; 421 LPCWSTR wzTransactionId;
417 HRESULT hrStatus; 422 HRESULT hrStatus;
418}; 423};
419 424
420struct BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS 425struct BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS
421{ 426{
422 DWORD cbSize; 427 DWORD dwApiVersion;
423}; 428};
424 429
425struct BA_ONCACHEACQUIREBEGIN_ARGS 430struct BA_ONCACHEACQUIREBEGIN_ARGS
426{ 431{
427 DWORD cbSize; 432 DWORD dwApiVersion;
428 LPCWSTR wzPackageOrContainerId; 433 LPCWSTR wzPackageOrContainerId;
429 LPCWSTR wzPayloadId; 434 LPCWSTR wzPayloadId;
430 LPCWSTR wzSource; 435 LPCWSTR wzSource;
@@ -435,14 +440,14 @@ struct BA_ONCACHEACQUIREBEGIN_ARGS
435 440
436struct BA_ONCACHEACQUIREBEGIN_RESULTS 441struct BA_ONCACHEACQUIREBEGIN_RESULTS
437{ 442{
438 DWORD cbSize; 443 DWORD dwApiVersion;
439 BOOL fCancel; 444 BOOL fCancel;
440 BOOTSTRAPPER_CACHE_OPERATION action; 445 BOOTSTRAPPER_CACHE_OPERATION action;
441}; 446};
442 447
443struct BA_ONCACHEACQUIRECOMPLETE_ARGS 448struct BA_ONCACHEACQUIRECOMPLETE_ARGS
444{ 449{
445 DWORD cbSize; 450 DWORD dwApiVersion;
446 LPCWSTR wzPackageOrContainerId; 451 LPCWSTR wzPackageOrContainerId;
447 LPCWSTR wzPayloadId; 452 LPCWSTR wzPayloadId;
448 HRESULT hrStatus; 453 HRESULT hrStatus;
@@ -451,13 +456,13 @@ struct BA_ONCACHEACQUIRECOMPLETE_ARGS
451 456
452struct BA_ONCACHEACQUIRECOMPLETE_RESULTS 457struct BA_ONCACHEACQUIRECOMPLETE_RESULTS
453{ 458{
454 DWORD cbSize; 459 DWORD dwApiVersion;
455 BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action; 460 BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action;
456}; 461};
457 462
458struct BA_ONCACHEACQUIREPROGRESS_ARGS 463struct BA_ONCACHEACQUIREPROGRESS_ARGS
459{ 464{
460 DWORD cbSize; 465 DWORD dwApiVersion;
461 LPCWSTR wzPackageOrContainerId; 466 LPCWSTR wzPackageOrContainerId;
462 LPCWSTR wzPayloadId; 467 LPCWSTR wzPayloadId;
463 DWORD64 dw64Progress; 468 DWORD64 dw64Progress;
@@ -467,13 +472,13 @@ struct BA_ONCACHEACQUIREPROGRESS_ARGS
467 472
468struct BA_ONCACHEACQUIREPROGRESS_RESULTS 473struct BA_ONCACHEACQUIREPROGRESS_RESULTS
469{ 474{
470 DWORD cbSize; 475 DWORD dwApiVersion;
471 BOOL fCancel; 476 BOOL fCancel;
472}; 477};
473 478
474struct BA_ONCACHEACQUIRERESOLVING_ARGS 479struct BA_ONCACHEACQUIRERESOLVING_ARGS
475{ 480{
476 DWORD cbSize; 481 DWORD dwApiVersion;
477 LPCWSTR wzPackageOrContainerId; 482 LPCWSTR wzPackageOrContainerId;
478 LPCWSTR wzPayloadId; 483 LPCWSTR wzPayloadId;
479 LPCWSTR* rgSearchPaths; 484 LPCWSTR* rgSearchPaths;
@@ -487,7 +492,7 @@ struct BA_ONCACHEACQUIRERESOLVING_ARGS
487 492
488struct BA_ONCACHEACQUIRERESOLVING_RESULTS 493struct BA_ONCACHEACQUIRERESOLVING_RESULTS
489{ 494{
490 DWORD cbSize; 495 DWORD dwApiVersion;
491 DWORD dwChosenSearchPath; 496 DWORD dwChosenSearchPath;
492 BOOTSTRAPPER_CACHE_RESOLVE_OPERATION action; 497 BOOTSTRAPPER_CACHE_RESOLVE_OPERATION action;
493 BOOL fCancel; 498 BOOL fCancel;
@@ -495,42 +500,42 @@ struct BA_ONCACHEACQUIRERESOLVING_RESULTS
495 500
496struct BA_ONCACHEBEGIN_ARGS 501struct BA_ONCACHEBEGIN_ARGS
497{ 502{
498 DWORD cbSize; 503 DWORD dwApiVersion;
499}; 504};
500 505
501struct BA_ONCACHEBEGIN_RESULTS 506struct BA_ONCACHEBEGIN_RESULTS
502{ 507{
503 DWORD cbSize; 508 DWORD dwApiVersion;
504 BOOL fCancel; 509 BOOL fCancel;
505}; 510};
506 511
507struct BA_ONCACHECOMPLETE_ARGS 512struct BA_ONCACHECOMPLETE_ARGS
508{ 513{
509 DWORD cbSize; 514 DWORD dwApiVersion;
510 HRESULT hrStatus; 515 HRESULT hrStatus;
511}; 516};
512 517
513struct BA_ONCACHECOMPLETE_RESULTS 518struct BA_ONCACHECOMPLETE_RESULTS
514{ 519{
515 DWORD cbSize; 520 DWORD dwApiVersion;
516}; 521};
517 522
518struct BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS 523struct BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS
519{ 524{
520 DWORD cbSize; 525 DWORD dwApiVersion;
521 LPCWSTR wzPackageOrContainerId; 526 LPCWSTR wzPackageOrContainerId;
522 LPCWSTR wzPayloadId; 527 LPCWSTR wzPayloadId;
523}; 528};
524 529
525struct BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS 530struct BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS
526{ 531{
527 DWORD cbSize; 532 DWORD dwApiVersion;
528 BOOL fCancel; 533 BOOL fCancel;
529}; 534};
530 535
531struct BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS 536struct BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS
532{ 537{
533 DWORD cbSize; 538 DWORD dwApiVersion;
534 LPCWSTR wzPackageOrContainerId; 539 LPCWSTR wzPackageOrContainerId;
535 LPCWSTR wzPayloadId; 540 LPCWSTR wzPayloadId;
536 HRESULT hrStatus; 541 HRESULT hrStatus;
@@ -538,12 +543,12 @@ struct BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS
538 543
539struct BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS 544struct BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS
540{ 545{
541 DWORD cbSize; 546 DWORD dwApiVersion;
542}; 547};
543 548
544struct BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS 549struct BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS
545{ 550{
546 DWORD cbSize; 551 DWORD dwApiVersion;
547 LPCWSTR wzPackageOrContainerId; 552 LPCWSTR wzPackageOrContainerId;
548 LPCWSTR wzPayloadId; 553 LPCWSTR wzPayloadId;
549 DWORD64 dw64Progress; 554 DWORD64 dw64Progress;
@@ -553,13 +558,13 @@ struct BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS
553 558
554struct BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS 559struct BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS
555{ 560{
556 DWORD cbSize; 561 DWORD dwApiVersion;
557 BOOL fCancel; 562 BOOL fCancel;
558}; 563};
559 564
560struct BA_ONCACHEPACKAGEBEGIN_ARGS 565struct BA_ONCACHEPACKAGEBEGIN_ARGS
561{ 566{
562 DWORD cbSize; 567 DWORD dwApiVersion;
563 LPCWSTR wzPackageId; 568 LPCWSTR wzPackageId;
564 DWORD cCachePayloads; 569 DWORD cCachePayloads;
565 DWORD64 dw64PackageCacheSize; 570 DWORD64 dw64PackageCacheSize;
@@ -569,13 +574,13 @@ struct BA_ONCACHEPACKAGEBEGIN_ARGS
569 574
570struct BA_ONCACHEPACKAGEBEGIN_RESULTS 575struct BA_ONCACHEPACKAGEBEGIN_RESULTS
571{ 576{
572 DWORD cbSize; 577 DWORD dwApiVersion;
573 BOOL fCancel; 578 BOOL fCancel;
574}; 579};
575 580
576struct BA_ONCACHEPACKAGECOMPLETE_ARGS 581struct BA_ONCACHEPACKAGECOMPLETE_ARGS
577{ 582{
578 DWORD cbSize; 583 DWORD dwApiVersion;
579 LPCWSTR wzPackageId; 584 LPCWSTR wzPackageId;
580 HRESULT hrStatus; 585 HRESULT hrStatus;
581 BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation; 586 BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation;
@@ -583,13 +588,13 @@ struct BA_ONCACHEPACKAGECOMPLETE_ARGS
583 588
584struct BA_ONCACHEPACKAGECOMPLETE_RESULTS 589struct BA_ONCACHEPACKAGECOMPLETE_RESULTS
585{ 590{
586 DWORD cbSize; 591 DWORD dwApiVersion;
587 BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action; 592 BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action;
588}; 593};
589 594
590struct BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS 595struct BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS
591{ 596{
592 DWORD cbSize; 597 DWORD dwApiVersion;
593 LPCWSTR wzPackageId; 598 LPCWSTR wzPackageId;
594 HRESULT hrStatus; 599 HRESULT hrStatus;
595 BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION recommendation; 600 BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION recommendation;
@@ -597,26 +602,26 @@ struct BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS
597 602
598struct BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS 603struct BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS
599{ 604{
600 DWORD cbSize; 605 DWORD dwApiVersion;
601 BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION action; 606 BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION action;
602}; 607};
603 608
604struct BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS 609struct BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS
605{ 610{
606 DWORD cbSize; 611 DWORD dwApiVersion;
607 LPCWSTR wzContainerId; 612 LPCWSTR wzContainerId;
608 LPCWSTR wzPayloadId; 613 LPCWSTR wzPayloadId;
609}; 614};
610 615
611struct BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS 616struct BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS
612{ 617{
613 DWORD cbSize; 618 DWORD dwApiVersion;
614 BOOL fCancel; 619 BOOL fCancel;
615}; 620};
616 621
617struct BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS 622struct BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS
618{ 623{
619 DWORD cbSize; 624 DWORD dwApiVersion;
620 LPCWSTR wzContainerId; 625 LPCWSTR wzContainerId;
621 LPCWSTR wzPayloadId; 626 LPCWSTR wzPayloadId;
622 HRESULT hrStatus; 627 HRESULT hrStatus;
@@ -624,12 +629,12 @@ struct BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS
624 629
625struct BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS 630struct BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS
626{ 631{
627 DWORD cbSize; 632 DWORD dwApiVersion;
628}; 633};
629 634
630struct BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS 635struct BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS
631{ 636{
632 DWORD cbSize; 637 DWORD dwApiVersion;
633 LPCWSTR wzContainerId; 638 LPCWSTR wzContainerId;
634 LPCWSTR wzPayloadId; 639 LPCWSTR wzPayloadId;
635 DWORD64 dw64Progress; 640 DWORD64 dw64Progress;
@@ -639,26 +644,26 @@ struct BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS
639 644
640struct BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS 645struct BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS
641{ 646{
642 DWORD cbSize; 647 DWORD dwApiVersion;
643 BOOL fCancel; 648 BOOL fCancel;
644}; 649};
645 650
646struct BA_ONCACHEVERIFYBEGIN_ARGS 651struct BA_ONCACHEVERIFYBEGIN_ARGS
647{ 652{
648 DWORD cbSize; 653 DWORD dwApiVersion;
649 LPCWSTR wzPackageOrContainerId; 654 LPCWSTR wzPackageOrContainerId;
650 LPCWSTR wzPayloadId; 655 LPCWSTR wzPayloadId;
651}; 656};
652 657
653struct BA_ONCACHEVERIFYBEGIN_RESULTS 658struct BA_ONCACHEVERIFYBEGIN_RESULTS
654{ 659{
655 DWORD cbSize; 660 DWORD dwApiVersion;
656 BOOL fCancel; 661 BOOL fCancel;
657}; 662};
658 663
659struct BA_ONCACHEVERIFYCOMPLETE_ARGS 664struct BA_ONCACHEVERIFYCOMPLETE_ARGS
660{ 665{
661 DWORD cbSize; 666 DWORD dwApiVersion;
662 LPCWSTR wzPackageOrContainerId; 667 LPCWSTR wzPackageOrContainerId;
663 LPCWSTR wzPayloadId; 668 LPCWSTR wzPayloadId;
664 HRESULT hrStatus; 669 HRESULT hrStatus;
@@ -667,13 +672,13 @@ struct BA_ONCACHEVERIFYCOMPLETE_ARGS
667 672
668struct BA_ONCACHEVERIFYCOMPLETE_RESULTS 673struct BA_ONCACHEVERIFYCOMPLETE_RESULTS
669{ 674{
670 DWORD cbSize; 675 DWORD dwApiVersion;
671 BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action; 676 BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action;
672}; 677};
673 678
674struct BA_ONCACHEVERIFYPROGRESS_ARGS 679struct BA_ONCACHEVERIFYPROGRESS_ARGS
675{ 680{
676 DWORD cbSize; 681 DWORD dwApiVersion;
677 LPCWSTR wzPackageOrContainerId; 682 LPCWSTR wzPackageOrContainerId;
678 LPCWSTR wzPayloadId; 683 LPCWSTR wzPayloadId;
679 DWORD64 dw64Progress; 684 DWORD64 dw64Progress;
@@ -684,25 +689,25 @@ struct BA_ONCACHEVERIFYPROGRESS_ARGS
684 689
685struct BA_ONCACHEVERIFYPROGRESS_RESULTS 690struct BA_ONCACHEVERIFYPROGRESS_RESULTS
686{ 691{
687 DWORD cbSize; 692 DWORD dwApiVersion;
688 BOOL fCancel; 693 BOOL fCancel;
689}; 694};
690 695
691struct BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS 696struct BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS
692{ 697{
693 DWORD cbSize; 698 DWORD dwApiVersion;
694 LPCWSTR wzTransactionId; 699 LPCWSTR wzTransactionId;
695}; 700};
696 701
697struct BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS 702struct BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS
698{ 703{
699 DWORD cbSize; 704 DWORD dwApiVersion;
700 BOOL fCancel; 705 BOOL fCancel;
701}; 706};
702 707
703struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS 708struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS
704{ 709{
705 DWORD cbSize; 710 DWORD dwApiVersion;
706 LPCWSTR wzTransactionId; 711 LPCWSTR wzTransactionId;
707 HRESULT hrStatus; 712 HRESULT hrStatus;
708 BOOTSTRAPPER_APPLY_RESTART restart; 713 BOOTSTRAPPER_APPLY_RESTART restart;
@@ -711,13 +716,50 @@ struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS
711 716
712struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS 717struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS
713{ 718{
714 DWORD cbSize; 719 DWORD dwApiVersion;
715 BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION action; 720 BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION action;
716}; 721};
717 722
723struct BA_ONCREATE_ARGS
724{
725 DWORD dwApiVersion;
726 BOOTSTRAPPER_COMMAND command;
727 // BOOTSTRAPPER_ACTION action;
728 // BOOTSTRAPPER_DISPLAY display;
729
730 // LPWSTR wzCommandLine;
731 // INT32 nCmdShow;
732
733 // BOOTSTRAPPER_RESUME_TYPE resumeType;
734 // HWND hwndSplashScreen;
735
736 // BOOTSTRAPPER_RELATION_TYPE relationType;
737 // BOOL fPassthrough;
738
739 // LPWSTR wzLayoutDirectory;
740 // LPWSTR wzBootstrapperWorkingFolder;
741 // LPWSTR wzBootstrapperApplicationDataPath;
742};
743
744struct BA_ONCREATE_RESULTS
745{
746 DWORD dwApiVersion;
747};
748
749struct BA_ONDESTROY_ARGS
750{
751 DWORD dwApiVersion;
752 BOOL fReload;
753};
754
755struct BA_ONDESTROY_RESULTS
756{
757 DWORD dwApiVersion;
758};
759
718struct BA_ONDETECTBEGIN_ARGS 760struct BA_ONDETECTBEGIN_ARGS
719{ 761{
720 DWORD cbSize; 762 DWORD dwApiVersion;
721 BOOTSTRAPPER_REGISTRATION_TYPE registrationType; 763 BOOTSTRAPPER_REGISTRATION_TYPE registrationType;
722 DWORD cPackages; 764 DWORD cPackages;
723 BOOL fCached; 765 BOOL fCached;
@@ -725,13 +767,13 @@ struct BA_ONDETECTBEGIN_ARGS
725 767
726struct BA_ONDETECTBEGIN_RESULTS 768struct BA_ONDETECTBEGIN_RESULTS
727{ 769{
728 DWORD cbSize; 770 DWORD dwApiVersion;
729 BOOL fCancel; 771 BOOL fCancel;
730}; 772};
731 773
732struct BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS 774struct BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS
733{ 775{
734 DWORD cbSize; 776 DWORD dwApiVersion;
735 LPCWSTR wzPackageId; 777 LPCWSTR wzPackageId;
736 LPCWSTR wzCompatiblePackageId; 778 LPCWSTR wzCompatiblePackageId;
737 LPCWSTR wzCompatiblePackageVersion; 779 LPCWSTR wzCompatiblePackageVersion;
@@ -739,25 +781,25 @@ struct BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS
739 781
740struct BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS 782struct BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS
741{ 783{
742 DWORD cbSize; 784 DWORD dwApiVersion;
743 BOOL fCancel; 785 BOOL fCancel;
744}; 786};
745 787
746struct BA_ONDETECTCOMPLETE_ARGS 788struct BA_ONDETECTCOMPLETE_ARGS
747{ 789{
748 DWORD cbSize; 790 DWORD dwApiVersion;
749 HRESULT hrStatus; 791 HRESULT hrStatus;
750 BOOL fEligibleForCleanup; 792 BOOL fEligibleForCleanup;
751}; 793};
752 794
753struct BA_ONDETECTCOMPLETE_RESULTS 795struct BA_ONDETECTCOMPLETE_RESULTS
754{ 796{
755 DWORD cbSize; 797 DWORD dwApiVersion;
756}; 798};
757 799
758struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS 800struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS
759{ 801{
760 DWORD cbSize; 802 DWORD dwApiVersion;
761 LPCWSTR wzBundleId; 803 LPCWSTR wzBundleId;
762 BOOTSTRAPPER_RELATION_TYPE relationType; 804 BOOTSTRAPPER_RELATION_TYPE relationType;
763 LPCWSTR wzBundleTag; 805 LPCWSTR wzBundleTag;
@@ -768,13 +810,13 @@ struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS
768 810
769struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS 811struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS
770{ 812{
771 DWORD cbSize; 813 DWORD dwApiVersion;
772 BOOL fCancel; 814 BOOL fCancel;
773}; 815};
774 816
775struct BA_ONDETECTMSIFEATURE_ARGS 817struct BA_ONDETECTMSIFEATURE_ARGS
776{ 818{
777 DWORD cbSize; 819 DWORD dwApiVersion;
778 LPCWSTR wzPackageId; 820 LPCWSTR wzPackageId;
779 LPCWSTR wzFeatureId; 821 LPCWSTR wzFeatureId;
780 BOOTSTRAPPER_FEATURE_STATE state; 822 BOOTSTRAPPER_FEATURE_STATE state;
@@ -782,25 +824,25 @@ struct BA_ONDETECTMSIFEATURE_ARGS
782 824
783struct BA_ONDETECTMSIFEATURE_RESULTS 825struct BA_ONDETECTMSIFEATURE_RESULTS
784{ 826{
785 DWORD cbSize; 827 DWORD dwApiVersion;
786 BOOL fCancel; 828 BOOL fCancel;
787}; 829};
788 830
789struct BA_ONDETECTPACKAGEBEGIN_ARGS 831struct BA_ONDETECTPACKAGEBEGIN_ARGS
790{ 832{
791 DWORD cbSize; 833 DWORD dwApiVersion;
792 LPCWSTR wzPackageId; 834 LPCWSTR wzPackageId;
793}; 835};
794 836
795struct BA_ONDETECTPACKAGEBEGIN_RESULTS 837struct BA_ONDETECTPACKAGEBEGIN_RESULTS
796{ 838{
797 DWORD cbSize; 839 DWORD dwApiVersion;
798 BOOL fCancel; 840 BOOL fCancel;
799}; 841};
800 842
801struct BA_ONDETECTPACKAGECOMPLETE_ARGS 843struct BA_ONDETECTPACKAGECOMPLETE_ARGS
802{ 844{
803 DWORD cbSize; 845 DWORD dwApiVersion;
804 LPCWSTR wzPackageId; 846 LPCWSTR wzPackageId;
805 HRESULT hrStatus; 847 HRESULT hrStatus;
806 BOOTSTRAPPER_PACKAGE_STATE state; 848 BOOTSTRAPPER_PACKAGE_STATE state;
@@ -809,12 +851,12 @@ struct BA_ONDETECTPACKAGECOMPLETE_ARGS
809 851
810struct BA_ONDETECTPACKAGECOMPLETE_RESULTS 852struct BA_ONDETECTPACKAGECOMPLETE_RESULTS
811{ 853{
812 DWORD cbSize; 854 DWORD dwApiVersion;
813}; 855};
814 856
815struct BA_ONDETECTRELATEDBUNDLE_ARGS 857struct BA_ONDETECTRELATEDBUNDLE_ARGS
816{ 858{
817 DWORD cbSize; 859 DWORD dwApiVersion;
818 LPCWSTR wzBundleId; 860 LPCWSTR wzBundleId;
819 BOOTSTRAPPER_RELATION_TYPE relationType; 861 BOOTSTRAPPER_RELATION_TYPE relationType;
820 LPCWSTR wzBundleTag; 862 LPCWSTR wzBundleTag;
@@ -825,13 +867,13 @@ struct BA_ONDETECTRELATEDBUNDLE_ARGS
825 867
826struct BA_ONDETECTRELATEDBUNDLE_RESULTS 868struct BA_ONDETECTRELATEDBUNDLE_RESULTS
827{ 869{
828 DWORD cbSize; 870 DWORD dwApiVersion;
829 BOOL fCancel; 871 BOOL fCancel;
830}; 872};
831 873
832struct BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS 874struct BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS
833{ 875{
834 DWORD cbSize; 876 DWORD dwApiVersion;
835 LPCWSTR wzPackageId; 877 LPCWSTR wzPackageId;
836 LPCWSTR wzBundleId; 878 LPCWSTR wzBundleId;
837 BOOTSTRAPPER_RELATION_TYPE relationType; 879 BOOTSTRAPPER_RELATION_TYPE relationType;
@@ -841,13 +883,13 @@ struct BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS
841 883
842struct BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS 884struct BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS
843{ 885{
844 DWORD cbSize; 886 DWORD dwApiVersion;
845 BOOL fCancel; 887 BOOL fCancel;
846}; 888};
847 889
848struct BA_ONDETECTRELATEDMSIPACKAGE_ARGS 890struct BA_ONDETECTRELATEDMSIPACKAGE_ARGS
849{ 891{
850 DWORD cbSize; 892 DWORD dwApiVersion;
851 LPCWSTR wzPackageId; 893 LPCWSTR wzPackageId;
852 LPCWSTR wzUpgradeCode; 894 LPCWSTR wzUpgradeCode;
853 LPCWSTR wzProductCode; 895 LPCWSTR wzProductCode;
@@ -858,13 +900,13 @@ struct BA_ONDETECTRELATEDMSIPACKAGE_ARGS
858 900
859struct BA_ONDETECTRELATEDMSIPACKAGE_RESULTS 901struct BA_ONDETECTRELATEDMSIPACKAGE_RESULTS
860{ 902{
861 DWORD cbSize; 903 DWORD dwApiVersion;
862 BOOL fCancel; 904 BOOL fCancel;
863}; 905};
864 906
865struct BA_ONDETECTPATCHTARGET_ARGS 907struct BA_ONDETECTPATCHTARGET_ARGS
866{ 908{
867 DWORD cbSize; 909 DWORD dwApiVersion;
868 LPCWSTR wzPackageId; 910 LPCWSTR wzPackageId;
869 LPCWSTR wzProductCode; 911 LPCWSTR wzProductCode;
870 BOOTSTRAPPER_PACKAGE_STATE patchState; 912 BOOTSTRAPPER_PACKAGE_STATE patchState;
@@ -872,13 +914,13 @@ struct BA_ONDETECTPATCHTARGET_ARGS
872 914
873struct BA_ONDETECTPATCHTARGET_RESULTS 915struct BA_ONDETECTPATCHTARGET_RESULTS
874{ 916{
875 DWORD cbSize; 917 DWORD dwApiVersion;
876 BOOL fCancel; 918 BOOL fCancel;
877}; 919};
878 920
879struct BA_ONDETECTUPDATE_ARGS 921struct BA_ONDETECTUPDATE_ARGS
880{ 922{
881 DWORD cbSize; 923 DWORD dwApiVersion;
882 LPCWSTR wzUpdateLocation; 924 LPCWSTR wzUpdateLocation;
883 DWORD64 dw64Size; 925 DWORD64 dw64Size;
884 LPCWSTR wzHash; 926 LPCWSTR wzHash;
@@ -892,61 +934,61 @@ struct BA_ONDETECTUPDATE_ARGS
892 934
893struct BA_ONDETECTUPDATE_RESULTS 935struct BA_ONDETECTUPDATE_RESULTS
894{ 936{
895 DWORD cbSize; 937 DWORD dwApiVersion;
896 BOOL fCancel; 938 BOOL fCancel;
897 BOOL fStopProcessingUpdates; 939 BOOL fStopProcessingUpdates;
898}; 940};
899 941
900struct BA_ONDETECTUPDATEBEGIN_ARGS 942struct BA_ONDETECTUPDATEBEGIN_ARGS
901{ 943{
902 DWORD cbSize; 944 DWORD dwApiVersion;
903 LPCWSTR wzUpdateLocation; 945 LPCWSTR wzUpdateLocation;
904}; 946};
905 947
906struct BA_ONDETECTUPDATEBEGIN_RESULTS 948struct BA_ONDETECTUPDATEBEGIN_RESULTS
907{ 949{
908 DWORD cbSize; 950 DWORD dwApiVersion;
909 BOOL fCancel; 951 BOOL fCancel;
910 BOOL fSkip; 952 BOOL fSkip;
911}; 953};
912 954
913struct BA_ONDETECTUPDATECOMPLETE_ARGS 955struct BA_ONDETECTUPDATECOMPLETE_ARGS
914{ 956{
915 DWORD cbSize; 957 DWORD dwApiVersion;
916 HRESULT hrStatus; 958 HRESULT hrStatus;
917}; 959};
918 960
919struct BA_ONDETECTUPDATECOMPLETE_RESULTS 961struct BA_ONDETECTUPDATECOMPLETE_RESULTS
920{ 962{
921 DWORD cbSize; 963 DWORD dwApiVersion;
922 BOOL fIgnoreError; 964 BOOL fIgnoreError;
923}; 965};
924 966
925struct BA_ONELEVATEBEGIN_ARGS 967struct BA_ONELEVATEBEGIN_ARGS
926{ 968{
927 DWORD cbSize; 969 DWORD dwApiVersion;
928}; 970};
929 971
930struct BA_ONELEVATEBEGIN_RESULTS 972struct BA_ONELEVATEBEGIN_RESULTS
931{ 973{
932 DWORD cbSize; 974 DWORD dwApiVersion;
933 BOOL fCancel; 975 BOOL fCancel;
934}; 976};
935 977
936struct BA_ONELEVATECOMPLETE_ARGS 978struct BA_ONELEVATECOMPLETE_ARGS
937{ 979{
938 DWORD cbSize; 980 DWORD dwApiVersion;
939 HRESULT hrStatus; 981 HRESULT hrStatus;
940}; 982};
941 983
942struct BA_ONELEVATECOMPLETE_RESULTS 984struct BA_ONELEVATECOMPLETE_RESULTS
943{ 985{
944 DWORD cbSize; 986 DWORD dwApiVersion;
945}; 987};
946 988
947struct BA_ONERROR_ARGS 989struct BA_ONERROR_ARGS
948{ 990{
949 DWORD cbSize; 991 DWORD dwApiVersion;
950 BOOTSTRAPPER_ERROR_TYPE errorType; 992 BOOTSTRAPPER_ERROR_TYPE errorType;
951 LPCWSTR wzPackageId; 993 LPCWSTR wzPackageId;
952 DWORD dwCode; 994 DWORD dwCode;
@@ -954,75 +996,75 @@ struct BA_ONERROR_ARGS
954 DWORD dwUIHint; 996 DWORD dwUIHint;
955 DWORD cData; 997 DWORD cData;
956 LPCWSTR* rgwzData; 998 LPCWSTR* rgwzData;
957 int nRecommendation; 999 INT32 nRecommendation;
958}; 1000};
959 1001
960struct BA_ONERROR_RESULTS 1002struct BA_ONERROR_RESULTS
961{ 1003{
962 DWORD cbSize; 1004 DWORD dwApiVersion;
963 int nResult; 1005 INT32 nResult;
964}; 1006};
965 1007
966struct BA_ONEXECUTEBEGIN_ARGS 1008struct BA_ONEXECUTEBEGIN_ARGS
967{ 1009{
968 DWORD cbSize; 1010 DWORD dwApiVersion;
969 DWORD cExecutingPackages; 1011 DWORD cExecutingPackages;
970}; 1012};
971 1013
972struct BA_ONEXECUTEBEGIN_RESULTS 1014struct BA_ONEXECUTEBEGIN_RESULTS
973{ 1015{
974 DWORD cbSize; 1016 DWORD dwApiVersion;
975 BOOL fCancel; 1017 BOOL fCancel;
976}; 1018};
977 1019
978struct BA_ONEXECUTECOMPLETE_ARGS 1020struct BA_ONEXECUTECOMPLETE_ARGS
979{ 1021{
980 DWORD cbSize; 1022 DWORD dwApiVersion;
981 HRESULT hrStatus; 1023 HRESULT hrStatus;
982}; 1024};
983 1025
984struct BA_ONEXECUTECOMPLETE_RESULTS 1026struct BA_ONEXECUTECOMPLETE_RESULTS
985{ 1027{
986 DWORD cbSize; 1028 DWORD dwApiVersion;
987}; 1029};
988 1030
989struct BA_ONEXECUTEFILESINUSE_ARGS 1031struct BA_ONEXECUTEFILESINUSE_ARGS
990{ 1032{
991 DWORD cbSize; 1033 DWORD dwApiVersion;
992 LPCWSTR wzPackageId; 1034 LPCWSTR wzPackageId;
993 DWORD cFiles; 1035 DWORD cFiles;
994 LPCWSTR* rgwzFiles; 1036 LPCWSTR* rgwzFiles;
995 int nRecommendation; 1037 INT32 nRecommendation;
996 BOOTSTRAPPER_FILES_IN_USE_TYPE source; 1038 BOOTSTRAPPER_FILES_IN_USE_TYPE source;
997}; 1039};
998 1040
999struct BA_ONEXECUTEFILESINUSE_RESULTS 1041struct BA_ONEXECUTEFILESINUSE_RESULTS
1000{ 1042{
1001 DWORD cbSize; 1043 DWORD dwApiVersion;
1002 int nResult; 1044 INT32 nResult;
1003}; 1045};
1004 1046
1005struct BA_ONEXECUTEMSIMESSAGE_ARGS 1047struct BA_ONEXECUTEMSIMESSAGE_ARGS
1006{ 1048{
1007 DWORD cbSize; 1049 DWORD dwApiVersion;
1008 LPCWSTR wzPackageId; 1050 LPCWSTR wzPackageId;
1009 INSTALLMESSAGE messageType; 1051 INSTALLMESSAGE messageType;
1010 DWORD dwUIHint; 1052 DWORD dwUIHint;
1011 LPCWSTR wzMessage; 1053 LPCWSTR wzMessage;
1012 DWORD cData; 1054 DWORD cData;
1013 LPCWSTR* rgwzData; 1055 LPCWSTR* rgwzData;
1014 int nRecommendation; 1056 INT32 nRecommendation;
1015}; 1057};
1016 1058
1017struct BA_ONEXECUTEMSIMESSAGE_RESULTS 1059struct BA_ONEXECUTEMSIMESSAGE_RESULTS
1018{ 1060{
1019 DWORD cbSize; 1061 DWORD dwApiVersion;
1020 int nResult; 1062 INT32 nResult;
1021}; 1063};
1022 1064
1023struct BA_ONEXECUTEPACKAGEBEGIN_ARGS 1065struct BA_ONEXECUTEPACKAGEBEGIN_ARGS
1024{ 1066{
1025 DWORD cbSize; 1067 DWORD dwApiVersion;
1026 LPCWSTR wzPackageId; 1068 LPCWSTR wzPackageId;
1027 BOOL fExecute; // false means rollback. 1069 BOOL fExecute; // false means rollback.
1028 BOOTSTRAPPER_ACTION_STATE action; 1070 BOOTSTRAPPER_ACTION_STATE action;
@@ -1032,13 +1074,13 @@ struct BA_ONEXECUTEPACKAGEBEGIN_ARGS
1032 1074
1033struct BA_ONEXECUTEPACKAGEBEGIN_RESULTS 1075struct BA_ONEXECUTEPACKAGEBEGIN_RESULTS
1034{ 1076{
1035 DWORD cbSize; 1077 DWORD dwApiVersion;
1036 BOOL fCancel; 1078 BOOL fCancel;
1037}; 1079};
1038 1080
1039struct BA_ONEXECUTEPACKAGECOMPLETE_ARGS 1081struct BA_ONEXECUTEPACKAGECOMPLETE_ARGS
1040{ 1082{
1041 DWORD cbSize; 1083 DWORD dwApiVersion;
1042 LPCWSTR wzPackageId; 1084 LPCWSTR wzPackageId;
1043 HRESULT hrStatus; 1085 HRESULT hrStatus;
1044 // Indicates whether this package requires a reboot or initiated the reboot already. 1086 // Indicates whether this package requires a reboot or initiated the reboot already.
@@ -1048,26 +1090,26 @@ struct BA_ONEXECUTEPACKAGECOMPLETE_ARGS
1048 1090
1049struct BA_ONEXECUTEPACKAGECOMPLETE_RESULTS 1091struct BA_ONEXECUTEPACKAGECOMPLETE_RESULTS
1050{ 1092{
1051 DWORD cbSize; 1093 DWORD dwApiVersion;
1052 BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION action; 1094 BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION action;
1053}; 1095};
1054 1096
1055struct BA_ONEXECUTEPATCHTARGET_ARGS 1097struct BA_ONEXECUTEPATCHTARGET_ARGS
1056{ 1098{
1057 DWORD cbSize; 1099 DWORD dwApiVersion;
1058 LPCWSTR wzPackageId; 1100 LPCWSTR wzPackageId;
1059 LPCWSTR wzTargetProductCode; 1101 LPCWSTR wzTargetProductCode;
1060}; 1102};
1061 1103
1062struct BA_ONEXECUTEPATCHTARGET_RESULTS 1104struct BA_ONEXECUTEPATCHTARGET_RESULTS
1063{ 1105{
1064 DWORD cbSize; 1106 DWORD dwApiVersion;
1065 BOOL fCancel; 1107 BOOL fCancel;
1066}; 1108};
1067 1109
1068struct BA_ONEXECUTEPROCESSCANCEL_ARGS 1110struct BA_ONEXECUTEPROCESSCANCEL_ARGS
1069{ 1111{
1070 DWORD cbSize; 1112 DWORD dwApiVersion;
1071 LPCWSTR wzPackageId; 1113 LPCWSTR wzPackageId;
1072 DWORD dwProcessId; 1114 DWORD dwProcessId;
1073 BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION recommendation; 1115 BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION recommendation;
@@ -1075,13 +1117,13 @@ struct BA_ONEXECUTEPROCESSCANCEL_ARGS
1075 1117
1076struct BA_ONEXECUTEPROCESSCANCEL_RESULTS 1118struct BA_ONEXECUTEPROCESSCANCEL_RESULTS
1077{ 1119{
1078 DWORD cbSize; 1120 DWORD dwApiVersion;
1079 BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION action; 1121 BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION action;
1080}; 1122};
1081 1123
1082struct BA_ONEXECUTEPROGRESS_ARGS 1124struct BA_ONEXECUTEPROGRESS_ARGS
1083{ 1125{
1084 DWORD cbSize; 1126 DWORD dwApiVersion;
1085 LPCWSTR wzPackageId; 1127 LPCWSTR wzPackageId;
1086 DWORD dwProgressPercentage; 1128 DWORD dwProgressPercentage;
1087 DWORD dwOverallPercentage; 1129 DWORD dwOverallPercentage;
@@ -1089,24 +1131,24 @@ struct BA_ONEXECUTEPROGRESS_ARGS
1089 1131
1090struct BA_ONEXECUTEPROGRESS_RESULTS 1132struct BA_ONEXECUTEPROGRESS_RESULTS
1091{ 1133{
1092 DWORD cbSize; 1134 DWORD dwApiVersion;
1093 BOOL fCancel; 1135 BOOL fCancel;
1094}; 1136};
1095 1137
1096struct BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS 1138struct BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS
1097{ 1139{
1098 DWORD cbSize; 1140 DWORD dwApiVersion;
1099}; 1141};
1100 1142
1101struct BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS 1143struct BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS
1102{ 1144{
1103 DWORD cbSize; 1145 DWORD dwApiVersion;
1104 BOOL fCancel; 1146 BOOL fCancel;
1105}; 1147};
1106 1148
1107struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS 1149struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS
1108{ 1150{
1109 DWORD cbSize; 1151 DWORD dwApiVersion;
1110 HRESULT hrStatus; 1152 HRESULT hrStatus;
1111 // Only valid if the operation succeeded. 1153 // Only valid if the operation succeeded.
1112 DWORD dwProcessId; 1154 DWORD dwProcessId;
@@ -1114,45 +1156,45 @@ struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS
1114 1156
1115struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS 1157struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS
1116{ 1158{
1117 DWORD cbSize; 1159 DWORD dwApiVersion;
1118}; 1160};
1119 1161
1120struct BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS 1162struct BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS
1121{ 1163{
1122 DWORD cbSize; 1164 DWORD dwApiVersion;
1123}; 1165};
1124 1166
1125struct BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS 1167struct BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS
1126{ 1168{
1127 DWORD cbSize; 1169 DWORD dwApiVersion;
1128}; 1170};
1129 1171
1130struct BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS 1172struct BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS
1131{ 1173{
1132 DWORD cbSize; 1174 DWORD dwApiVersion;
1133 HRESULT hrStatus; 1175 HRESULT hrStatus;
1134}; 1176};
1135 1177
1136struct BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS 1178struct BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS
1137{ 1179{
1138 DWORD cbSize; 1180 DWORD dwApiVersion;
1139}; 1181};
1140 1182
1141struct BA_ONPLANBEGIN_ARGS 1183struct BA_ONPLANBEGIN_ARGS
1142{ 1184{
1143 DWORD cbSize; 1185 DWORD dwApiVersion;
1144 DWORD cPackages; 1186 DWORD cPackages;
1145}; 1187};
1146 1188
1147struct BA_ONPLANBEGIN_RESULTS 1189struct BA_ONPLANBEGIN_RESULTS
1148{ 1190{
1149 DWORD cbSize; 1191 DWORD dwApiVersion;
1150 BOOL fCancel; 1192 BOOL fCancel;
1151}; 1193};
1152 1194
1153struct BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS 1195struct BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS
1154{ 1196{
1155 DWORD cbSize; 1197 DWORD dwApiVersion;
1156 LPCWSTR wzPackageId; 1198 LPCWSTR wzPackageId;
1157 LPCWSTR wzCompatiblePackageId; 1199 LPCWSTR wzCompatiblePackageId;
1158 LPCWSTR wzCompatiblePackageVersion; 1200 LPCWSTR wzCompatiblePackageVersion;
@@ -1161,14 +1203,14 @@ struct BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS
1161 1203
1162struct BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS 1204struct BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS
1163{ 1205{
1164 DWORD cbSize; 1206 DWORD dwApiVersion;
1165 BOOL fCancel; 1207 BOOL fCancel;
1166 BOOL fRequestRemove; 1208 BOOL fRequestRemove;
1167}; 1209};
1168 1210
1169struct BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS 1211struct BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS
1170{ 1212{
1171 DWORD cbSize; 1213 DWORD dwApiVersion;
1172 LPCWSTR wzPackageId; 1214 LPCWSTR wzPackageId;
1173 LPCWSTR wzCompatiblePackageId; 1215 LPCWSTR wzCompatiblePackageId;
1174 HRESULT hrStatus; 1216 HRESULT hrStatus;
@@ -1177,23 +1219,23 @@ struct BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS
1177 1219
1178struct BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS 1220struct BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS
1179{ 1221{
1180 DWORD cbSize; 1222 DWORD dwApiVersion;
1181}; 1223};
1182 1224
1183struct BA_ONPLANCOMPLETE_ARGS 1225struct BA_ONPLANCOMPLETE_ARGS
1184{ 1226{
1185 DWORD cbSize; 1227 DWORD dwApiVersion;
1186 HRESULT hrStatus; 1228 HRESULT hrStatus;
1187}; 1229};
1188 1230
1189struct BA_ONPLANCOMPLETE_RESULTS 1231struct BA_ONPLANCOMPLETE_RESULTS
1190{ 1232{
1191 DWORD cbSize; 1233 DWORD dwApiVersion;
1192}; 1234};
1193 1235
1194struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS 1236struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS
1195{ 1237{
1196 DWORD cbSize; 1238 DWORD dwApiVersion;
1197 LPCWSTR wzBundleId; 1239 LPCWSTR wzBundleId;
1198 BOOTSTRAPPER_RELATION_TYPE relationType; 1240 BOOTSTRAPPER_RELATION_TYPE relationType;
1199 LPCWSTR wzBundleTag; 1241 LPCWSTR wzBundleTag;
@@ -1204,14 +1246,14 @@ struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS
1204 1246
1205struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS 1247struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS
1206{ 1248{
1207 DWORD cbSize; 1249 DWORD dwApiVersion;
1208 BOOL fCancel; 1250 BOOL fCancel;
1209 BOOL fIgnoreBundle; 1251 BOOL fIgnoreBundle;
1210}; 1252};
1211 1253
1212struct BA_ONPLANMSIFEATURE_ARGS 1254struct BA_ONPLANMSIFEATURE_ARGS
1213{ 1255{
1214 DWORD cbSize; 1256 DWORD dwApiVersion;
1215 LPCWSTR wzPackageId; 1257 LPCWSTR wzPackageId;
1216 LPCWSTR wzFeatureId; 1258 LPCWSTR wzFeatureId;
1217 BOOTSTRAPPER_FEATURE_STATE recommendedState; 1259 BOOTSTRAPPER_FEATURE_STATE recommendedState;
@@ -1219,14 +1261,14 @@ struct BA_ONPLANMSIFEATURE_ARGS
1219 1261
1220struct BA_ONPLANMSIFEATURE_RESULTS 1262struct BA_ONPLANMSIFEATURE_RESULTS
1221{ 1263{
1222 DWORD cbSize; 1264 DWORD dwApiVersion;
1223 BOOTSTRAPPER_FEATURE_STATE requestedState; 1265 BOOTSTRAPPER_FEATURE_STATE requestedState;
1224 BOOL fCancel; 1266 BOOL fCancel;
1225}; 1267};
1226 1268
1227struct BA_ONPLANMSIPACKAGE_ARGS 1269struct BA_ONPLANMSIPACKAGE_ARGS
1228{ 1270{
1229 DWORD cbSize; 1271 DWORD dwApiVersion;
1230 LPCWSTR wzPackageId; 1272 LPCWSTR wzPackageId;
1231 BOOL fExecute; // false means rollback. 1273 BOOL fExecute; // false means rollback.
1232 BOOTSTRAPPER_ACTION_STATE action; 1274 BOOTSTRAPPER_ACTION_STATE action;
@@ -1235,7 +1277,7 @@ struct BA_ONPLANMSIPACKAGE_ARGS
1235 1277
1236struct BA_ONPLANMSIPACKAGE_RESULTS 1278struct BA_ONPLANMSIPACKAGE_RESULTS
1237{ 1279{
1238 DWORD cbSize; 1280 DWORD dwApiVersion;
1239 BOOL fCancel; 1281 BOOL fCancel;
1240 BURN_MSI_PROPERTY actionMsiProperty; 1282 BURN_MSI_PROPERTY actionMsiProperty;
1241 INSTALLUILEVEL uiLevel; 1283 INSTALLUILEVEL uiLevel;
@@ -1245,7 +1287,7 @@ struct BA_ONPLANMSIPACKAGE_RESULTS
1245 1287
1246struct BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS 1288struct BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS
1247{ 1289{
1248 DWORD cbSize; 1290 DWORD dwApiVersion;
1249 LPCWSTR wzPackageId; 1291 LPCWSTR wzPackageId;
1250 LPCWSTR wzCompatiblePackageId; 1292 LPCWSTR wzCompatiblePackageId;
1251 BOOL fRemove; 1293 BOOL fRemove;
@@ -1253,12 +1295,12 @@ struct BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS
1253 1295
1254struct BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS 1296struct BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS
1255{ 1297{
1256 DWORD cbSize; 1298 DWORD dwApiVersion;
1257}; 1299};
1258 1300
1259struct BA_ONPLANNEDPACKAGE_ARGS 1301struct BA_ONPLANNEDPACKAGE_ARGS
1260{ 1302{
1261 DWORD cbSize; 1303 DWORD dwApiVersion;
1262 LPCWSTR wzPackageId; 1304 LPCWSTR wzPackageId;
1263 BOOTSTRAPPER_ACTION_STATE execute; 1305 BOOTSTRAPPER_ACTION_STATE execute;
1264 BOOTSTRAPPER_ACTION_STATE rollback; 1306 BOOTSTRAPPER_ACTION_STATE rollback;
@@ -1268,12 +1310,12 @@ struct BA_ONPLANNEDPACKAGE_ARGS
1268 1310
1269struct BA_ONPLANNEDPACKAGE_RESULTS 1311struct BA_ONPLANNEDPACKAGE_RESULTS
1270{ 1312{
1271 DWORD cbSize; 1313 DWORD dwApiVersion;
1272}; 1314};
1273 1315
1274struct BA_ONPLANPACKAGEBEGIN_ARGS 1316struct BA_ONPLANPACKAGEBEGIN_ARGS
1275{ 1317{
1276 DWORD cbSize; 1318 DWORD dwApiVersion;
1277 LPCWSTR wzPackageId; 1319 LPCWSTR wzPackageId;
1278 BOOTSTRAPPER_PACKAGE_STATE state; 1320 BOOTSTRAPPER_PACKAGE_STATE state;
1279 BOOL fCached; 1321 BOOL fCached;
@@ -1285,7 +1327,7 @@ struct BA_ONPLANPACKAGEBEGIN_ARGS
1285 1327
1286struct BA_ONPLANPACKAGEBEGIN_RESULTS 1328struct BA_ONPLANPACKAGEBEGIN_RESULTS
1287{ 1329{
1288 DWORD cbSize; 1330 DWORD dwApiVersion;
1289 BOOL fCancel; 1331 BOOL fCancel;
1290 BOOTSTRAPPER_REQUEST_STATE requestedState; 1332 BOOTSTRAPPER_REQUEST_STATE requestedState;
1291 BOOTSTRAPPER_CACHE_TYPE requestedCacheType; 1333 BOOTSTRAPPER_CACHE_TYPE requestedCacheType;
@@ -1293,7 +1335,7 @@ struct BA_ONPLANPACKAGEBEGIN_RESULTS
1293 1335
1294struct BA_ONPLANPACKAGECOMPLETE_ARGS 1336struct BA_ONPLANPACKAGECOMPLETE_ARGS
1295{ 1337{
1296 DWORD cbSize; 1338 DWORD dwApiVersion;
1297 LPCWSTR wzPackageId; 1339 LPCWSTR wzPackageId;
1298 HRESULT hrStatus; 1340 HRESULT hrStatus;
1299 BOOTSTRAPPER_REQUEST_STATE requested; 1341 BOOTSTRAPPER_REQUEST_STATE requested;
@@ -1301,68 +1343,68 @@ struct BA_ONPLANPACKAGECOMPLETE_ARGS
1301 1343
1302struct BA_ONPLANPACKAGECOMPLETE_RESULTS 1344struct BA_ONPLANPACKAGECOMPLETE_RESULTS
1303{ 1345{
1304 DWORD cbSize; 1346 DWORD dwApiVersion;
1305}; 1347};
1306 1348
1307struct BA_ONPLANRELATEDBUNDLE_ARGS 1349struct BA_ONPLANRELATEDBUNDLE_ARGS
1308{ 1350{
1309 DWORD cbSize; 1351 DWORD dwApiVersion;
1310 LPCWSTR wzBundleId; 1352 LPCWSTR wzBundleId;
1311 BOOTSTRAPPER_REQUEST_STATE recommendedState; 1353 BOOTSTRAPPER_REQUEST_STATE recommendedState;
1312}; 1354};
1313 1355
1314struct BA_ONPLANRELATEDBUNDLE_RESULTS 1356struct BA_ONPLANRELATEDBUNDLE_RESULTS
1315{ 1357{
1316 DWORD cbSize; 1358 DWORD dwApiVersion;
1317 BOOL fCancel; 1359 BOOL fCancel;
1318 BOOTSTRAPPER_REQUEST_STATE requestedState; 1360 BOOTSTRAPPER_REQUEST_STATE requestedState;
1319}; 1361};
1320 1362
1321struct BA_ONPLANRELATEDBUNDLETYPE_ARGS 1363struct BA_ONPLANRELATEDBUNDLETYPE_ARGS
1322{ 1364{
1323 DWORD cbSize; 1365 DWORD dwApiVersion;
1324 LPCWSTR wzBundleId; 1366 LPCWSTR wzBundleId;
1325 BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE recommendedType; 1367 BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE recommendedType;
1326}; 1368};
1327 1369
1328struct BA_ONPLANRELATEDBUNDLETYPE_RESULTS 1370struct BA_ONPLANRELATEDBUNDLETYPE_RESULTS
1329{ 1371{
1330 DWORD cbSize; 1372 DWORD dwApiVersion;
1331 BOOL fCancel; 1373 BOOL fCancel;
1332 BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE requestedType; 1374 BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE requestedType;
1333}; 1375};
1334 1376
1335struct BA_ONPLANRESTORERELATEDBUNDLE_ARGS 1377struct BA_ONPLANRESTORERELATEDBUNDLE_ARGS
1336{ 1378{
1337 DWORD cbSize; 1379 DWORD dwApiVersion;
1338 LPCWSTR wzBundleId; 1380 LPCWSTR wzBundleId;
1339 BOOTSTRAPPER_REQUEST_STATE recommendedState; 1381 BOOTSTRAPPER_REQUEST_STATE recommendedState;
1340}; 1382};
1341 1383
1342struct BA_ONPLANRESTORERELATEDBUNDLE_RESULTS 1384struct BA_ONPLANRESTORERELATEDBUNDLE_RESULTS
1343{ 1385{
1344 DWORD cbSize; 1386 DWORD dwApiVersion;
1345 BOOL fCancel; 1387 BOOL fCancel;
1346 BOOTSTRAPPER_REQUEST_STATE requestedState; 1388 BOOTSTRAPPER_REQUEST_STATE requestedState;
1347}; 1389};
1348 1390
1349struct BA_ONPLANROLLBACKBOUNDARY_ARGS 1391struct BA_ONPLANROLLBACKBOUNDARY_ARGS
1350{ 1392{
1351 DWORD cbSize; 1393 DWORD dwApiVersion;
1352 LPCWSTR wzRollbackBoundaryId; 1394 LPCWSTR wzRollbackBoundaryId;
1353 BOOL fRecommendedTransaction; 1395 BOOL fRecommendedTransaction;
1354}; 1396};
1355 1397
1356struct BA_ONPLANROLLBACKBOUNDARY_RESULTS 1398struct BA_ONPLANROLLBACKBOUNDARY_RESULTS
1357{ 1399{
1358 DWORD cbSize; 1400 DWORD dwApiVersion;
1359 BOOL fTransaction; 1401 BOOL fTransaction;
1360 BOOL fCancel; 1402 BOOL fCancel;
1361}; 1403};
1362 1404
1363struct BA_ONPLANPATCHTARGET_ARGS 1405struct BA_ONPLANPATCHTARGET_ARGS
1364{ 1406{
1365 DWORD cbSize; 1407 DWORD dwApiVersion;
1366 LPCWSTR wzPackageId; 1408 LPCWSTR wzPackageId;
1367 LPCWSTR wzProductCode; 1409 LPCWSTR wzProductCode;
1368 BOOTSTRAPPER_REQUEST_STATE recommendedState; 1410 BOOTSTRAPPER_REQUEST_STATE recommendedState;
@@ -1370,62 +1412,62 @@ struct BA_ONPLANPATCHTARGET_ARGS
1370 1412
1371struct BA_ONPLANPATCHTARGET_RESULTS 1413struct BA_ONPLANPATCHTARGET_RESULTS
1372{ 1414{
1373 DWORD cbSize; 1415 DWORD dwApiVersion;
1374 BOOTSTRAPPER_REQUEST_STATE requestedState;
1375 BOOL fCancel; 1416 BOOL fCancel;
1417 BOOTSTRAPPER_REQUEST_STATE requestedState;
1376}; 1418};
1377 1419
1378struct BA_ONPROGRESS_ARGS 1420struct BA_ONPROGRESS_ARGS
1379{ 1421{
1380 DWORD cbSize; 1422 DWORD dwApiVersion;
1381 DWORD dwProgressPercentage; 1423 DWORD dwProgressPercentage;
1382 DWORD dwOverallPercentage; 1424 DWORD dwOverallPercentage;
1383}; 1425};
1384 1426
1385struct BA_ONPROGRESS_RESULTS 1427struct BA_ONPROGRESS_RESULTS
1386{ 1428{
1387 DWORD cbSize; 1429 DWORD dwApiVersion;
1388 BOOL fCancel; 1430 BOOL fCancel;
1389}; 1431};
1390 1432
1391struct BA_ONREGISTERBEGIN_ARGS 1433struct BA_ONREGISTERBEGIN_ARGS
1392{ 1434{
1393 DWORD cbSize; 1435 DWORD dwApiVersion;
1394 BOOTSTRAPPER_REGISTRATION_TYPE recommendedRegistrationType; 1436 BOOTSTRAPPER_REGISTRATION_TYPE recommendedRegistrationType;
1395}; 1437};
1396 1438
1397struct BA_ONREGISTERBEGIN_RESULTS 1439struct BA_ONREGISTERBEGIN_RESULTS
1398{ 1440{
1399 DWORD cbSize; 1441 DWORD dwApiVersion;
1400 BOOL fCancel; 1442 BOOL fCancel;
1401 BOOTSTRAPPER_REGISTRATION_TYPE registrationType; 1443 BOOTSTRAPPER_REGISTRATION_TYPE registrationType;
1402}; 1444};
1403 1445
1404struct BA_ONREGISTERCOMPLETE_ARGS 1446struct BA_ONREGISTERCOMPLETE_ARGS
1405{ 1447{
1406 DWORD cbSize; 1448 DWORD dwApiVersion;
1407 HRESULT hrStatus; 1449 HRESULT hrStatus;
1408}; 1450};
1409 1451
1410struct BA_ONREGISTERCOMPLETE_RESULTS 1452struct BA_ONREGISTERCOMPLETE_RESULTS
1411{ 1453{
1412 DWORD cbSize; 1454 DWORD dwApiVersion;
1413}; 1455};
1414 1456
1415struct BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS 1457struct BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS
1416{ 1458{
1417 DWORD cbSize; 1459 DWORD dwApiVersion;
1418 LPCWSTR wzTransactionId; 1460 LPCWSTR wzTransactionId;
1419}; 1461};
1420 1462
1421struct BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS 1463struct BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS
1422{ 1464{
1423 DWORD cbSize; 1465 DWORD dwApiVersion;
1424}; 1466};
1425 1467
1426struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS 1468struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS
1427{ 1469{
1428 DWORD cbSize; 1470 DWORD dwApiVersion;
1429 LPCWSTR wzTransactionId; 1471 LPCWSTR wzTransactionId;
1430 HRESULT hrStatus; 1472 HRESULT hrStatus;
1431 BOOTSTRAPPER_APPLY_RESTART restart; 1473 BOOTSTRAPPER_APPLY_RESTART restart;
@@ -1434,99 +1476,76 @@ struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS
1434 1476
1435struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS 1477struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS
1436{ 1478{
1437 DWORD cbSize; 1479 DWORD dwApiVersion;
1438 BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION action; 1480 BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION action;
1439}; 1481};
1440 1482
1441struct BA_ONSETUPDATEBEGIN_ARGS
1442{
1443 DWORD cbSize;
1444};
1445
1446struct BA_ONSETUPDATEBEGIN_RESULTS
1447{
1448 DWORD cbSize;
1449};
1450
1451struct BA_ONSETUPDATECOMPLETE_ARGS
1452{
1453 DWORD cbSize;
1454 HRESULT hrStatus;
1455 LPCWSTR wzPreviousPackageId;
1456 LPCWSTR wzNewPackageId;
1457};
1458
1459struct BA_ONSETUPDATECOMPLETE_RESULTS
1460{
1461 DWORD cbSize;
1462};
1463
1464struct BA_ONSHUTDOWN_ARGS 1483struct BA_ONSHUTDOWN_ARGS
1465{ 1484{
1466 DWORD cbSize; 1485 DWORD dwApiVersion;
1467}; 1486};
1468 1487
1469struct BA_ONSHUTDOWN_RESULTS 1488struct BA_ONSHUTDOWN_RESULTS
1470{ 1489{
1471 DWORD cbSize; 1490 DWORD dwApiVersion;
1472 BOOTSTRAPPER_SHUTDOWN_ACTION action; 1491 BOOTSTRAPPER_SHUTDOWN_ACTION action;
1473}; 1492};
1474 1493
1475struct BA_ONSTARTUP_ARGS 1494struct BA_ONSTARTUP_ARGS
1476{ 1495{
1477 DWORD cbSize; 1496 DWORD dwApiVersion;
1478}; 1497};
1479 1498
1480struct BA_ONSTARTUP_RESULTS 1499struct BA_ONSTARTUP_RESULTS
1481{ 1500{
1482 DWORD cbSize; 1501 DWORD dwApiVersion;
1483}; 1502};
1484 1503
1485struct BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS 1504struct BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS
1486{ 1505{
1487 DWORD cbSize; 1506 DWORD dwApiVersion;
1488}; 1507};
1489 1508
1490struct BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS 1509struct BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS
1491{ 1510{
1492 DWORD cbSize; 1511 DWORD dwApiVersion;
1493}; 1512};
1494 1513
1495struct BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS 1514struct BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS
1496{ 1515{
1497 DWORD cbSize; 1516 DWORD dwApiVersion;
1498 HRESULT hrStatus; 1517 HRESULT hrStatus;
1499}; 1518};
1500 1519
1501struct BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS 1520struct BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS
1502{ 1521{
1503 DWORD cbSize; 1522 DWORD dwApiVersion;
1504}; 1523};
1505 1524
1506struct BA_ONUNREGISTERBEGIN_ARGS 1525struct BA_ONUNREGISTERBEGIN_ARGS
1507{ 1526{
1508 DWORD cbSize; 1527 DWORD dwApiVersion;
1509 BOOTSTRAPPER_REGISTRATION_TYPE recommendedRegistrationType; 1528 BOOTSTRAPPER_REGISTRATION_TYPE recommendedRegistrationType;
1510}; 1529};
1511 1530
1512struct BA_ONUNREGISTERBEGIN_RESULTS 1531struct BA_ONUNREGISTERBEGIN_RESULTS
1513{ 1532{
1514 DWORD cbSize; 1533 DWORD dwApiVersion;
1515 BOOTSTRAPPER_REGISTRATION_TYPE registrationType; 1534 BOOTSTRAPPER_REGISTRATION_TYPE registrationType;
1516}; 1535};
1517 1536
1518struct BA_ONUNREGISTERCOMPLETE_ARGS 1537struct BA_ONUNREGISTERCOMPLETE_ARGS
1519{ 1538{
1520 DWORD cbSize; 1539 DWORD dwApiVersion;
1521 HRESULT hrStatus; 1540 HRESULT hrStatus;
1522}; 1541};
1523 1542
1524struct BA_ONUNREGISTERCOMPLETE_RESULTS 1543struct BA_ONUNREGISTERCOMPLETE_RESULTS
1525{ 1544{
1526 DWORD cbSize; 1545 DWORD dwApiVersion;
1527}; 1546};
1528 1547
1529 1548#ifdef TODO_DELETE
1530 1549
1531extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_APPLICATION_PROC)( 1550extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_APPLICATION_PROC)(
1532 __in BOOTSTRAPPER_APPLICATION_MESSAGE message, 1551 __in BOOTSTRAPPER_APPLICATION_MESSAGE message,
@@ -1537,13 +1556,13 @@ extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_APPLICATION_PROC)(
1537 1556
1538struct BOOTSTRAPPER_DESTROY_ARGS 1557struct BOOTSTRAPPER_DESTROY_ARGS
1539{ 1558{
1540 DWORD cbSize; 1559 DWORD dwApiVersion;
1541 BOOL fReload; 1560 BOOL fReload;
1542}; 1561};
1543 1562
1544struct BOOTSTRAPPER_DESTROY_RESULTS 1563struct BOOTSTRAPPER_DESTROY_RESULTS
1545{ 1564{
1546 DWORD cbSize; 1565 DWORD dwApiVersion;
1547 BOOL fDisableUnloading; // indicates the BA dll must not be unloaded after BootstrapperApplicationDestroy. 1566 BOOL fDisableUnloading; // indicates the BA dll must not be unloaded after BootstrapperApplicationDestroy.
1548}; 1567};
1549 1568
@@ -1556,7 +1575,7 @@ extern "C" typedef void (WINAPI *PFN_BOOTSTRAPPER_APPLICATION_DESTROY)(
1556 1575
1557struct BOOTSTRAPPER_CREATE_ARGS 1576struct BOOTSTRAPPER_CREATE_ARGS
1558{ 1577{
1559 DWORD cbSize; 1578 DWORD dwApiVersion;
1560 DWORD64 qwEngineAPIVersion; 1579 DWORD64 qwEngineAPIVersion;
1561 PFN_BOOTSTRAPPER_ENGINE_PROC pfnBootstrapperEngineProc; 1580 PFN_BOOTSTRAPPER_ENGINE_PROC pfnBootstrapperEngineProc;
1562 LPVOID pvBootstrapperEngineProcContext; 1581 LPVOID pvBootstrapperEngineProcContext;
@@ -1565,7 +1584,7 @@ struct BOOTSTRAPPER_CREATE_ARGS
1565 1584
1566struct BOOTSTRAPPER_CREATE_RESULTS 1585struct BOOTSTRAPPER_CREATE_RESULTS
1567{ 1586{
1568 DWORD cbSize; 1587 DWORD dwApiVersion;
1569 PFN_BOOTSTRAPPER_APPLICATION_PROC pfnBootstrapperApplicationProc; 1588 PFN_BOOTSTRAPPER_APPLICATION_PROC pfnBootstrapperApplicationProc;
1570 LPVOID pvBootstrapperApplicationProcContext; 1589 LPVOID pvBootstrapperApplicationProcContext;
1571}; 1590};
@@ -1574,3 +1593,5 @@ extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_APPLICATION_CREATE)(
1574 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, 1593 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
1575 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults 1594 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults
1576 ); 1595 );
1596
1597#endif
diff --git a/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs
index 339bfd8f..25995e27 100644
--- a/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs
+++ b/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs
@@ -6,58 +6,48 @@ namespace WixToolset.Mba.Core
6 using System.Runtime.InteropServices; 6 using System.Runtime.InteropServices;
7 7
8 /// <summary> 8 /// <summary>
9 /// Default implementation of <see cref="IBootstrapperApplicationFactory"/>. 9 /// This is no longer used.
10 /// </summary> 10 /// </summary>
11 [Obsolete("Bootstrapper applications now run out of proc and do not use a BootstrapperApplicationFactory. Remove your BootstrapperApplicationFactory class. See https://wixtoolset.org/docs/fiveforfour/ for more details.")]
11 public abstract class BaseBootstrapperApplicationFactory : IBootstrapperApplicationFactory 12 public abstract class BaseBootstrapperApplicationFactory : IBootstrapperApplicationFactory
12 { 13 {
13 /// <summary> 14 /// <summary>
14 /// Default implementation of <see cref="IBootstrapperApplicationFactory.Create(IntPtr, IntPtr)"/> 15 /// This is no longer used.
15 /// </summary> 16 /// </summary>
16 /// <param name="pArgs">The args struct given by the engine when initially creating the BA.</param> 17 /// <param name="pArgs">This is no longer used.</param>
17 /// <param name="pResults">The results struct given by the engine when initially creating the BA</param> 18 /// <param name="pResults">This is no longer used.</param>
18 public void Create(IntPtr pArgs, IntPtr pResults) 19 public void Create(IntPtr pArgs, IntPtr pResults)
19 { 20 {
20 InitializeFromCreateArgs(pArgs, out var engine, out var bootstrapperCommand); 21 throw new NotImplementedException();
21
22 var ba = this.Create(engine, bootstrapperCommand);
23 StoreBAInCreateResults(pResults, ba);
24 } 22 }
25 23
26 /// <summary> 24 /// <summary>
27 /// Called by <see cref="BaseBootstrapperApplicationFactory.Create(IntPtr, IntPtr)"/> to get the <see cref="IBootstrapperApplication"/>. 25 /// This is no longer used.
28 /// </summary> 26 /// </summary>
29 /// <param name="engine">The bundle engine.</param> 27 /// <param name="engine">This is no longer used.</param>
30 /// <param name="bootstrapperCommand">Command information passed from the engine for the BA to perform.</param> 28 /// <param name="bootstrapperCommand">This is no longer used.</param>
31 /// <returns>The <see cref="IBootstrapperApplication"/> for the bundle.</returns> 29 /// <returns>This is no longer used.</returns>
32 protected abstract IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand); 30 protected abstract IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand);
33 31
34 /// <summary> 32 /// <summary>
35 /// Initializes the native part of <see cref="WixToolset.Mba.Core"/>. 33 /// This is no longer used.
36 /// Most users should inherit from <see cref="BaseBootstrapperApplicationFactory"/> instead of calling this method.
37 /// </summary> 34 /// </summary>
38 /// <param name="pArgs">The args struct given by the engine when initially creating the BA.</param> 35 /// <param name="pArgs">This is no longer used.</param>
39 /// <param name="engine">The bundle engine interface.</param> 36 /// <param name="engine">This is no longer used.</param>
40 /// <param name="bootstrapperCommand">The context of the current run of the bundle.</param> 37 /// <param name="bootstrapperCommand">This is no longer used.</param>
41 public static void InitializeFromCreateArgs(IntPtr pArgs, out IEngine engine, out IBootstrapperCommand bootstrapperCommand) 38 public static void InitializeFromCreateArgs(IntPtr pArgs, out IEngine engine, out IBootstrapperCommand bootstrapperCommand)
42 { 39 {
43 Command pCommand = new Command 40 throw new NotImplementedException();
44 {
45 cbSize = Marshal.SizeOf(typeof(Command))
46 };
47 var pEngine = MbaNative.InitializeFromCreateArgs(pArgs, ref pCommand);
48 engine = new Engine(pEngine);
49 bootstrapperCommand = pCommand.GetBootstrapperCommand();
50 } 41 }
51 42
52 /// <summary> 43 /// <summary>
53 /// Registers the BA with the engine using the default mapping between the message based interface and the COM interface. 44 /// This is no longer used.
54 /// Most users should inherit from <see cref="BaseBootstrapperApplicationFactory"/> instead of calling this method.
55 /// </summary> 45 /// </summary>
56 /// <param name="pResults">The results struct given by the engine when initially creating the BA</param> 46 /// <param name="pResults">This is no longer used.</param>
57 /// <param name="ba">The <see cref="IBootstrapperApplication"/>.</param> 47 /// <param name="ba">This is no longer used.</param>
58 public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba) 48 public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba)
59 { 49 {
60 MbaNative.StoreBAInCreateResults(pResults, ba); 50 throw new NotImplementedException();
61 } 51 }
62 } 52 }
63} 53}
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs
index a0ec6ab9..98b34217 100644
--- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs
+++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs
@@ -13,23 +13,15 @@ namespace WixToolset.Mba.Core
13 public abstract class BootstrapperApplication : MarshalByRefObject, IDefaultBootstrapperApplication 13 public abstract class BootstrapperApplication : MarshalByRefObject, IDefaultBootstrapperApplication
14 { 14 {
15 /// <summary> 15 /// <summary>
16 /// Specifies whether this bootstrapper should run asynchronously. The default is true.
17 /// </summary>
18 protected readonly bool asyncExecution;
19
20 /// <summary>
21 /// Gets the <see cref="IEngine"/> for interaction with the engine. 16 /// Gets the <see cref="IEngine"/> for interaction with the engine.
22 /// </summary> 17 /// </summary>
23 protected readonly IEngine engine; 18 protected IEngine engine;
24 19
25 /// <summary> 20 /// <inheritdoc/>
26 /// Creates a new instance of the <see cref="BootstrapperApplication"/> class. 21 public event EventHandler<CreateEventArgs> Create;
27 /// </summary> 22
28 protected BootstrapperApplication(IEngine engine) 23 /// <inheritdoc/>
29 { 24 public event EventHandler<DestroyEventArgs> Destroy;
30 this.engine = engine;
31 this.asyncExecution = true;
32 }
33 25
34 /// <inheritdoc/> 26 /// <inheritdoc/>
35 public event EventHandler<StartupEventArgs> Startup; 27 public event EventHandler<StartupEventArgs> Startup;
@@ -266,12 +258,6 @@ namespace WixToolset.Mba.Core
266 public event EventHandler<CachePayloadExtractCompleteEventArgs> CachePayloadExtractComplete; 258 public event EventHandler<CachePayloadExtractCompleteEventArgs> CachePayloadExtractComplete;
267 259
268 /// <inheritdoc/> 260 /// <inheritdoc/>
269 public event EventHandler<SetUpdateBeginEventArgs> SetUpdateBegin;
270
271 /// <inheritdoc/>
272 public event EventHandler<SetUpdateCompleteEventArgs> SetUpdateComplete;
273
274 /// <inheritdoc/>
275 public event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle; 261 public event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle;
276 262
277 /// <inheritdoc/> 263 /// <inheritdoc/>
@@ -284,35 +270,73 @@ namespace WixToolset.Mba.Core
284 public event EventHandler<CachePackageNonVitalValidationFailureEventArgs> CachePackageNonVitalValidationFailure; 270 public event EventHandler<CachePackageNonVitalValidationFailureEventArgs> CachePackageNonVitalValidationFailure;
285 271
286 /// <summary> 272 /// <summary>
273 /// The default constructor.
274 /// </summary>
275 /// <remarks>
276 /// The engine object will be valid after handling the OnCreate() event.
277 /// </remarks>
278 protected BootstrapperApplication()
279 {
280 }
281
282 /// <summary>
283 /// This constructor is no longer used.
284 /// </summary>
285 [Obsolete("This constructor is no longer used. Use the default constructor. The engine object will be valid after handling the OnCreate() event.")]
286 protected BootstrapperApplication(IEngine engine)
287 {
288 throw new NotImplementedException("This constructor is no longer used. Use the default constructor. The engine object will be valid after handling the OnCreate() event.");
289 }
290
291 /// <summary>
287 /// Entry point that is called when the bootstrapper application is ready to run. 292 /// Entry point that is called when the bootstrapper application is ready to run.
288 /// </summary> 293 /// </summary>
289 protected abstract void Run(); 294 protected abstract void Run();
290 295
291 /// <summary> 296 /// <summary>
292 /// Called by the engine, raises the <see cref="Startup"/> event. 297 /// Called by the engine, raises the <see cref="Create"/> event.
293 /// </summary> 298 /// </summary>
294 /// <param name="args">Additional arguments for this event.</param> 299 /// <param name="args">Additional arguments for this event.</param>
295 protected virtual void OnStartup(StartupEventArgs args) 300 protected virtual void OnCreate(CreateEventArgs args)
296 { 301 {
297 EventHandler<StartupEventArgs> handler = this.Startup; 302 this.engine = args.Engine;
303
304 EventHandler<CreateEventArgs> handler = this.Create;
298 if (null != handler) 305 if (null != handler)
299 { 306 {
300 handler(this, args); 307 handler(this, args);
301 } 308 }
309 }
302 310
303 if (this.asyncExecution) 311 /// <summary>
312 /// Called by the engine, raises the <see cref="Destroy"/> event.
313 /// </summary>
314 /// <param name="args">Additional arguments for this event.</param>
315 protected virtual void OnDestroy(DestroyEventArgs args)
316 {
317 EventHandler<DestroyEventArgs> handler = this.Destroy;
318 if (null != handler)
304 { 319 {
305 this.engine.Log(LogLevel.Verbose, "Creating BA thread to run asynchronously."); 320 handler(this, args);
306 Thread uiThread = new Thread(this.Run);
307 uiThread.Name = "UIThread";
308 uiThread.SetApartmentState(ApartmentState.STA);
309 uiThread.Start();
310 } 321 }
311 else 322 }
323
324 /// <summary>
325 /// Called by the engine, raises the <see cref="Startup"/> event.
326 /// </summary>
327 /// <param name="args">Additional arguments for this event.</param>
328 protected virtual void OnStartup(StartupEventArgs args)
329 {
330 EventHandler<StartupEventArgs> handler = this.Startup;
331 if (null != handler)
312 { 332 {
313 this.engine.Log(LogLevel.Verbose, "Creating BA thread to run synchronously."); 333 handler(this, args);
314 this.Run();
315 } 334 }
335
336 Thread uiThread = new Thread(this.Run);
337 uiThread.Name = "UIThread";
338 uiThread.SetApartmentState(ApartmentState.STA);
339 uiThread.Start();
316 } 340 }
317 341
318 /// <summary> 342 /// <summary>
@@ -1315,31 +1339,6 @@ namespace WixToolset.Mba.Core
1315 } 1339 }
1316 } 1340 }
1317 1341
1318 /// <summary>
1319 /// Called by the engine, raises the <see cref="SetUpdateBegin"/> event.
1320 /// </summary>
1321 /// <param name="args">Additional arguments for this event.</param>
1322 protected virtual void OnSetUpdateBegin(SetUpdateBeginEventArgs args)
1323 {
1324 EventHandler<SetUpdateBeginEventArgs> handler = this.SetUpdateBegin;
1325 if (null != handler)
1326 {
1327 handler(this, args);
1328 }
1329 }
1330
1331 /// <summary>
1332 /// Called by the engine, raises the <see cref="SetUpdateComplete"/> event.
1333 /// </summary>
1334 /// <param name="args">Additional arguments for this event.</param>
1335 protected virtual void OnSetUpdateComplete(SetUpdateCompleteEventArgs args)
1336 {
1337 EventHandler<SetUpdateCompleteEventArgs> handler = this.SetUpdateComplete;
1338 if (null != handler)
1339 {
1340 handler(this, args);
1341 }
1342 }
1343 1342
1344 /// <summary> 1343 /// <summary>
1345 /// Called by the engine, raises the <see cref="PlanRestoreRelatedBundle"/> event. 1344 /// Called by the engine, raises the <see cref="PlanRestoreRelatedBundle"/> event.
@@ -1395,7 +1394,7 @@ namespace WixToolset.Mba.Core
1395 1394
1396 #region IBootstrapperApplication Members 1395 #region IBootstrapperApplication Members
1397 1396
1398 int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) 1397 int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults)
1399 { 1398 {
1400 switch (message) 1399 switch (message)
1401 { 1400 {
@@ -1404,8 +1403,24 @@ namespace WixToolset.Mba.Core
1404 } 1403 }
1405 } 1404 }
1406 1405
1407 void IBootstrapperApplication.BAProcFallback(int message, IntPtr pvArgs, IntPtr pvResults, ref int phr, IntPtr pvContext) 1406 void IBootstrapperApplication.BAProcFallback(int message, IntPtr pvArgs, IntPtr pvResults, ref int phr)
1407 {
1408 }
1409
1410 int IBootstrapperApplication.OnCreate(IBootstrapperEngine engine, ref Command command)
1408 { 1411 {
1412 CreateEventArgs args = new CreateEventArgs(new Engine(engine), command.GetBootstrapperCommand());
1413 this.OnCreate(args);
1414
1415 return args.HResult;
1416 }
1417
1418 int IBootstrapperApplication.OnDestroy(bool reload)
1419 {
1420 DestroyEventArgs args = new DestroyEventArgs(reload);
1421 this.OnDestroy(args);
1422
1423 return args.HResult;
1409 } 1424 }
1410 1425
1411 int IBootstrapperApplication.OnStartup() 1426 int IBootstrapperApplication.OnStartup()
@@ -2107,22 +2122,6 @@ namespace WixToolset.Mba.Core
2107 return args.HResult; 2122 return args.HResult;
2108 } 2123 }
2109 2124
2110 int IBootstrapperApplication.OnSetUpdateBegin()
2111 {
2112 SetUpdateBeginEventArgs args = new SetUpdateBeginEventArgs();
2113 this.OnSetUpdateBegin(args);
2114
2115 return args.HResult;
2116 }
2117
2118 int IBootstrapperApplication.OnSetUpdateComplete(int hrStatus, string wzPreviousPackageId, string wzNewPackageId)
2119 {
2120 SetUpdateCompleteEventArgs args = new SetUpdateCompleteEventArgs(hrStatus, wzPreviousPackageId, wzNewPackageId);
2121 this.OnSetUpdateComplete(args);
2122
2123 return args.HResult;
2124 }
2125
2126 int IBootstrapperApplication.OnPlanRestoreRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) 2125 int IBootstrapperApplication.OnPlanRestoreRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
2127 { 2126 {
2128 PlanRestoreRelatedBundleEventArgs args = new PlanRestoreRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel); 2127 PlanRestoreRelatedBundleEventArgs args = new PlanRestoreRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel);
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs
index 95252cf3..6b465408 100644
--- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs
+++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs
@@ -5,31 +5,27 @@ namespace WixToolset.Mba.Core
5 using System; 5 using System;
6 6
7 /// <summary> 7 /// <summary>
8 /// Identifies the bootstrapper application factory class. 8 /// This is no longer used.
9 /// </summary> 9 /// </summary>
10 /// <remarks> 10 [Obsolete("Bootstrapper applications now run out of proc and do not use a BootstrapperApplicationFactory. Remove your BootstrapperApplicationFactory class. See https://wixtoolset.org/docs/fiveforfour/ for more details.")]
11 /// This required assembly attribute identifies the bootstrapper application factory class.
12 /// </remarks>
13 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] 11 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
14 public sealed class BootstrapperApplicationFactoryAttribute : Attribute 12 public sealed class BootstrapperApplicationFactoryAttribute : Attribute
15 { 13 {
16 private Type bootstrapperApplicationFactoryType;
17
18 /// <summary> 14 /// <summary>
19 /// Creates a new instance of the <see cref="BootstrapperApplicationFactoryAttribute"/> class. 15 /// This is no longer used.
20 /// </summary> 16 /// </summary>
21 /// <param name="bootstrapperApplicationFactoryType">The <see cref="Type"/> of the BA factory.</param> 17 /// <param name="bootstrapperApplicationFactoryType">This is no longer used</param>
22 public BootstrapperApplicationFactoryAttribute(Type bootstrapperApplicationFactoryType) 18 public BootstrapperApplicationFactoryAttribute(Type bootstrapperApplicationFactoryType)
23 { 19 {
24 this.bootstrapperApplicationFactoryType = bootstrapperApplicationFactoryType; 20 throw new NotImplementedException();
25 } 21 }
26 22
27 /// <summary> 23 /// <summary>
28 /// Gets the type of the bootstrapper application factory class to create. 24 /// This is no longer used.
29 /// </summary> 25 /// </summary>
30 public Type BootstrapperApplicationFactoryType 26 public Type BootstrapperApplicationFactoryType
31 { 27 {
32 get { return this.bootstrapperApplicationFactoryType; } 28 get { throw new NotImplementedException(); }
33 } 29 }
34 } 30 }
35} 31}
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs
index ed1dc191..b96a8f95 100644
--- a/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs
+++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs
@@ -3,11 +3,55 @@
3namespace WixToolset.Mba.Core 3namespace WixToolset.Mba.Core
4{ 4{
5 using System; 5 using System;
6 using System.CodeDom.Compiler;
6 using System.Collections.Generic; 7 using System.Collections.Generic;
7 using System.ComponentModel; 8 using System.ComponentModel;
8 using System.Runtime.InteropServices; 9 using System.Runtime.InteropServices;
9 10
10 /// <summary> 11 /// <summary>
12 /// Command-line provided to the bootstrapper application.
13 /// </summary>
14 [Serializable]
15 [StructLayout(LayoutKind.Sequential)]
16 [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")]
17 public struct Command
18 {
19 // Strings must be declared as pointers so that Marshaling doesn't free them.
20 [MarshalAs(UnmanagedType.I4)] internal int cbSize;
21 [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action;
22 [MarshalAs(UnmanagedType.U4)] private readonly Display display;
23 private readonly IntPtr wzCommandLine;
24 [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow;
25 [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume;
26 private readonly IntPtr hwndSplashScreen;
27 [MarshalAs(UnmanagedType.I4)] private readonly RelationType relation;
28 [MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough;
29 private readonly IntPtr wzLayoutDirectory;
30 private readonly IntPtr wzBootstrapperWorkingFolder;
31 private readonly IntPtr wzBootstrapperApplicationDataPath;
32
33 /// <summary>
34 /// Gets the IBootstrapperCommand for this Command.
35 /// </summary>
36 /// <returns>IBootstrapperCommand</returns>
37 public IBootstrapperCommand GetBootstrapperCommand()
38 {
39 return new BootstrapperCommand(
40 this.action,
41 this.display,
42 Marshal.PtrToStringUni(this.wzCommandLine),
43 this.nCmdShow,
44 this.resume,
45 this.hwndSplashScreen,
46 this.relation,
47 this.passthrough,
48 Marshal.PtrToStringUni(this.wzLayoutDirectory),
49 Marshal.PtrToStringUni(this.wzBootstrapperWorkingFolder),
50 Marshal.PtrToStringUni(this.wzBootstrapperApplicationDataPath));
51 }
52 }
53
54 /// <summary>
11 /// Default implementation of <see cref="IBootstrapperCommand"/>. 55 /// Default implementation of <see cref="IBootstrapperCommand"/>.
12 /// </summary> 56 /// </summary>
13 public sealed class BootstrapperCommand : IBootstrapperCommand 57 public sealed class BootstrapperCommand : IBootstrapperCommand
diff --git a/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs b/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs
index ee751ebf..0039f375 100644
--- a/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs
+++ b/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs
@@ -34,17 +34,17 @@ namespace WixToolset.Mba.Core
34 } 34 }
35 35
36 /// <inheritdoc/> 36 /// <inheritdoc/>
37 public IPackageInfo AddRelatedBundleAsPackage(DetectRelatedBundleEventArgs e) 37 public IPackageInfo AddRelatedBundleAsPackage(string productCode, RelationType relationType, bool perMachine, string version)
38 { 38 {
39 var package = PackageInfo.GetRelatedBundleAsPackage(e.ProductCode, e.RelationType, e.PerMachine, e.Version); 39 var package = PackageInfo.GetRelatedBundleAsPackage(productCode, relationType, perMachine, version);
40 this.Packages.Add(package.Id, package); 40 this.Packages.Add(package.Id, package);
41 return package; 41 return package;
42 } 42 }
43 43
44 /// <inheritdoc/> 44 /// <inheritdoc/>
45 public IPackageInfo AddUpdateBundleAsPackage(SetUpdateCompleteEventArgs e) 45 public IPackageInfo AddUpdateBundleAsPackage(string packageId)
46 { 46 {
47 var package = PackageInfo.GetUpdateBundleAsPackage(e.NewPackageId); 47 var package = PackageInfo.GetUpdateBundleAsPackage(packageId);
48 this.Packages.Add(package.Id, package); 48 this.Packages.Add(package.Id, package);
49 return package; 49 return package;
50 } 50 }
diff --git a/src/api/burn/WixToolset.Mba.Core/Engine.cs b/src/api/burn/WixToolset.Mba.Core/Engine.cs
index 1120fb1c..df412e8c 100644
--- a/src/api/burn/WixToolset.Mba.Core/Engine.cs
+++ b/src/api/burn/WixToolset.Mba.Core/Engine.cs
@@ -253,9 +253,9 @@ namespace WixToolset.Mba.Core
253 } 253 }
254 254
255 /// <inheritdoc/> 255 /// <inheritdoc/>
256 public void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash) 256 public void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash, string updatePackageId)
257 { 257 {
258 this.engine.SetUpdate(localSource, downloadSource, size, hashType, hash); 258 this.engine.SetUpdate(localSource, downloadSource, size, hashType, hash, updatePackageId);
259 } 259 }
260 260
261 /// <inheritdoc/> 261 /// <inheritdoc/>
diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs
index 4b7f2245..6506c840 100644
--- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs
+++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs
@@ -198,6 +198,54 @@ namespace WixToolset.Mba.Core
198 } 198 }
199 199
200 /// <summary> 200 /// <summary>
201 /// Event arguments for <see cref="IDefaultBootstrapperApplication.Create"/>.
202 /// </summary>
203 [Serializable]
204 public class CreateEventArgs : HResultEventArgs
205 {
206 /// <summary>
207 /// This class is for events raised by the engine.
208 /// It is not intended to be instantiated by user code.
209 /// </summary>
210 public CreateEventArgs(IEngine engine, IBootstrapperCommand command)
211 {
212 this.Engine = engine;
213 this.Command = command;
214 }
215
216 /// <summary>
217 /// Engine running the application.
218 /// </summary>
219 public IEngine Engine { get; }
220
221 /// <summary>
222 /// Command line arguments.
223 /// </summary>
224 public IBootstrapperCommand Command { get; }
225 }
226
227 /// <summary>
228 /// Event arguments for <see cref="IDefaultBootstrapperApplication.Destroy"/>.
229 /// </summary>
230 [Serializable]
231 public class DestroyEventArgs : HResultEventArgs
232 {
233 /// <summary>
234 /// This class is for events raised by the engine.
235 /// It is not intended to be instantiated by user code.
236 /// </summary>
237 public DestroyEventArgs(bool reload)
238 {
239 this.Reload = reload;
240 }
241
242 /// <summary>
243 /// Bootstrapper application is being reloaded.
244 /// </summary>
245 public bool Reload { get; }
246 }
247
248 /// <summary>
201 /// Event arguments for <see cref="IDefaultBootstrapperApplication.Startup"/>. 249 /// Event arguments for <see cref="IDefaultBootstrapperApplication.Startup"/>.
202 /// </summary> 250 /// </summary>
203 [Serializable] 251 [Serializable]
@@ -2567,49 +2615,6 @@ namespace WixToolset.Mba.Core
2567 } 2615 }
2568 2616
2569 /// <summary> 2617 /// <summary>
2570 /// EventArgs for <see cref="IDefaultBootstrapperApplication.SetUpdateBegin"/>.
2571 /// </summary>
2572 [Serializable]
2573 public class SetUpdateBeginEventArgs : HResultEventArgs
2574 {
2575 /// <summary>
2576 /// This class is for events raised by the engine.
2577 /// It is not intended to be instantiated by user code.
2578 /// </summary>
2579 public SetUpdateBeginEventArgs()
2580 {
2581 }
2582 }
2583
2584 /// <summary>
2585 /// Event arguments for <see cref="IDefaultBootstrapperApplication.SetUpdateComplete"/>
2586 /// </summary>
2587 [Serializable]
2588 public class SetUpdateCompleteEventArgs : StatusEventArgs
2589 {
2590 /// <summary>
2591 /// This class is for events raised by the engine.
2592 /// It is not intended to be instantiated by user code.
2593 /// </summary>
2594 public SetUpdateCompleteEventArgs(int hrStatus, string previousPackageId, string newPackageId)
2595 : base(hrStatus)
2596 {
2597 this.PreviousPackageId = previousPackageId;
2598 this.NewPackageId = newPackageId;
2599 }
2600
2601 /// <summary>
2602 /// Gets the identifier of the update package that was removed.
2603 /// </summary>
2604 public string PreviousPackageId { get; private set; }
2605
2606 /// <summary>
2607 /// Gets the identifier of the update package that was added.
2608 /// </summary>
2609 public string NewPackageId { get; private set; }
2610 }
2611
2612 /// <summary>
2613 /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/> 2618 /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/>
2614 /// </summary> 2619 /// </summary>
2615 [Serializable] 2620 [Serializable]
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs
index 36c7fd33..8a255c44 100644
--- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs
+++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs
@@ -21,8 +21,7 @@ namespace WixToolset.Mba.Core
21 int BAProc( 21 int BAProc(
22 int message, 22 int message,
23 IntPtr pvArgs, 23 IntPtr pvArgs,
24 IntPtr pvResults, 24 IntPtr pvResults
25 IntPtr pvContext
26 ); 25 );
27 26
28 /// <summary> 27 /// <summary>
@@ -32,11 +31,24 @@ namespace WixToolset.Mba.Core
32 int message, 31 int message,
33 IntPtr pvArgs, 32 IntPtr pvArgs,
34 IntPtr pvResults, 33 IntPtr pvResults,
35 ref int phr, 34 ref int phr
36 IntPtr pvContext
37 ); 35 );
38 36
39 /// <summary> 37 /// <summary>
38 /// See <see cref="IDefaultBootstrapperApplication.Create"/>.
39 /// </summary>
40 [PreserveSig]
41 [return: MarshalAs(UnmanagedType.I4)]
42 int OnCreate(IBootstrapperEngine engine, ref Command command);
43
44 /// <summary>
45 /// See <see cref="IDefaultBootstrapperApplication.Destroy"/>.
46 /// </summary>
47 [PreserveSig]
48 [return: MarshalAs(UnmanagedType.I4)]
49 int OnDestroy(bool reload);
50
51 /// <summary>
40 /// See <see cref="IDefaultBootstrapperApplication.Startup"/>. 52 /// See <see cref="IDefaultBootstrapperApplication.Startup"/>.
41 /// </summary> 53 /// </summary>
42 [PreserveSig] 54 [PreserveSig]
@@ -940,24 +952,6 @@ namespace WixToolset.Mba.Core
940 ); 952 );
941 953
942 /// <summary> 954 /// <summary>
943 /// See <see cref="IDefaultBootstrapperApplication.SetUpdateBegin"/>.
944 /// </summary>
945 [PreserveSig]
946 [return: MarshalAs(UnmanagedType.I4)]
947 int OnSetUpdateBegin();
948
949 /// <summary>
950 /// See <see cref="IDefaultBootstrapperApplication.SetUpdateComplete"/>.
951 /// </summary>
952 [PreserveSig]
953 [return: MarshalAs(UnmanagedType.I4)]
954 int OnSetUpdateComplete(
955 int hrStatus,
956 [MarshalAs(UnmanagedType.LPWStr)] string wzPreviousPackageId,
957 [MarshalAs(UnmanagedType.LPWStr)] string wzNewPackageId
958 );
959
960 /// <summary>
961 /// See <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/>. 955 /// See <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/>.
962 /// </summary> 956 /// </summary>
963 [PreserveSig] 957 [PreserveSig]
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs
index 2e84de67..393c7e31 100644
--- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs
+++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs
@@ -7,58 +7,16 @@ namespace WixToolset.Mba.Core
7 using System.Runtime.InteropServices; 7 using System.Runtime.InteropServices;
8 8
9 /// <summary> 9 /// <summary>
10 /// Interface used by the native host to dynamically load the BA. 10 /// This is no longer used.
11 /// </summary> 11 /// </summary>
12 [ComVisible(true)] 12 [Obsolete("Bootstrapper applications now run out of proc and do not use a BootstrapperApplicationFactory. Remove your BootstrapperApplicationFactory class. See https://wixtoolset.org/docs/fiveforfour/ for more details.")]
13 [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
14 [Guid("2965A12F-AC7B-43A0-85DF-E4B2168478A4")]
15 [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")]
16 public interface IBootstrapperApplicationFactory 13 public interface IBootstrapperApplicationFactory
17 { 14 {
18 /// <summary> 15 /// <summary>
19 /// Low level method called by the native host. 16 /// This is no longer used.
20 /// </summary> 17 /// </summary>
21 /// <param name="pArgs"></param> 18 /// <param name="pArgs">This is no longer used.</param>
22 /// <param name="pResults"></param> 19 /// <param name="pResults">This is no longer used.</param>
23 void Create( 20 void Create(IntPtr pArgs, IntPtr pResults);
24 IntPtr pArgs,
25 IntPtr pResults
26 );
27 }
28
29 [Serializable]
30 [StructLayout(LayoutKind.Sequential)]
31 [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")]
32 internal struct Command
33 {
34 // Strings must be declared as pointers so that Marshaling doesn't free them.
35 [MarshalAs(UnmanagedType.I4)] internal int cbSize;
36 [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action;
37 [MarshalAs(UnmanagedType.U4)] private readonly Display display;
38 private readonly IntPtr wzCommandLine;
39 [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow;
40 [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume;
41 private readonly IntPtr hwndSplashScreen;
42 [MarshalAs(UnmanagedType.I4)] private readonly RelationType relation;
43 [MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough;
44 private readonly IntPtr wzLayoutDirectory;
45 private readonly IntPtr wzBootstrapperWorkingFolder;
46 private readonly IntPtr wzBootstrapperApplicationDataPath;
47
48 public IBootstrapperCommand GetBootstrapperCommand()
49 {
50 return new BootstrapperCommand(
51 this.action,
52 this.display,
53 Marshal.PtrToStringUni(this.wzCommandLine),
54 this.nCmdShow,
55 this.resume,
56 this.hwndSplashScreen,
57 this.relation,
58 this.passthrough,
59 Marshal.PtrToStringUni(this.wzLayoutDirectory),
60 Marshal.PtrToStringUni(this.wzBootstrapperWorkingFolder),
61 Marshal.PtrToStringUni(this.wzBootstrapperApplicationDataPath));
62 }
63 } 21 }
64} 22}
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs
index 3f90639f..a175bead 100644
--- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs
+++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs
@@ -108,14 +108,15 @@ namespace WixToolset.Mba.Core
108 ); 108 );
109 109
110 /// <summary> 110 /// <summary>
111 /// See <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string)"/>. 111 /// See <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string, string)"/>.
112 /// </summary> 112 /// </summary>
113 void SetUpdate( 113 void SetUpdate(
114 [MarshalAs(UnmanagedType.LPWStr)] string wzLocalSource, 114 [MarshalAs(UnmanagedType.LPWStr)] string wzLocalSource,
115 [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadSource, 115 [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadSource,
116 [MarshalAs(UnmanagedType.U8)] long qwValue, 116 [MarshalAs(UnmanagedType.U8)] long qwValue,
117 [MarshalAs(UnmanagedType.U4)] UpdateHashType hashType, 117 [MarshalAs(UnmanagedType.U4)] UpdateHashType hashType,
118 [MarshalAs(UnmanagedType.LPWStr)] string wzHash 118 [MarshalAs(UnmanagedType.LPWStr)] string wzHash,
119 [MarshalAs(UnmanagedType.LPWStr)] string wzUpdatePackageId
119 ); 120 );
120 121
121 /// <summary> 122 /// <summary>
@@ -330,12 +331,12 @@ namespace WixToolset.Mba.Core
330 Repair, 331 Repair,
331 332
332 /// <summary> 333 /// <summary>
333 /// Launch the update registered with <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string)"/> and then exit without waiting for it to complete. 334 /// Launch the update registered with <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string, string)"/> and then exit without waiting for it to complete.
334 /// </summary> 335 /// </summary>
335 UpdateReplace, 336 UpdateReplace,
336 337
337 /// <summary> 338 /// <summary>
338 /// Launch the update registered with <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string)"/> as an embedded bundle. 339 /// Launch the update registered with <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string, string)"/> as an embedded bundle.
339 /// </summary> 340 /// </summary>
340 UpdateReplaceEmbedded, 341 UpdateReplaceEmbedded,
341 } 342 }
diff --git a/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs b/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs
index 951f511a..3c52fc02 100644
--- a/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs
+++ b/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs
@@ -37,15 +37,18 @@ namespace WixToolset.Mba.Core
37 /// <summary> 37 /// <summary>
38 /// Adds a related bundle as a package. 38 /// Adds a related bundle as a package.
39 /// </summary> 39 /// </summary>
40 /// <param name="e"></param> 40 /// <param name="productCode"></param>
41 /// <param name="relationType"></param>
42 /// <param name="perMachine"></param>
43 /// <param name="version"></param>
41 /// <returns>The created <see cref="IPackageInfo"/>.</returns> 44 /// <returns>The created <see cref="IPackageInfo"/>.</returns>
42 IPackageInfo AddRelatedBundleAsPackage(DetectRelatedBundleEventArgs e); 45 IPackageInfo AddRelatedBundleAsPackage(string productCode, RelationType relationType, bool perMachine, string version);
43 46
44 /// <summary> 47 /// <summary>
45 /// Adds an update bundle as a package. 48 /// Adds an update bundle as a package.
46 /// </summary> 49 /// </summary>
47 /// <param name="e"></param> 50 /// <param name="packageId">Package id added as update bundle.</param>
48 /// <returns>The created <see cref="IPackageInfo"/>.</returns> 51 /// <returns>The created <see cref="IPackageInfo"/>.</returns>
49 IPackageInfo AddUpdateBundleAsPackage(SetUpdateCompleteEventArgs e); 52 IPackageInfo AddUpdateBundleAsPackage(string packageId);
50 } 53 }
51} 54}
diff --git a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs
index 2fa88bdb..51ea4e4d 100644
--- a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs
+++ b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs
@@ -139,6 +139,16 @@ namespace WixToolset.Mba.Core
139 event EventHandler<CommitMsiTransactionCompleteEventArgs> CommitMsiTransactionComplete; 139 event EventHandler<CommitMsiTransactionCompleteEventArgs> CommitMsiTransactionComplete;
140 140
141 /// <summary> 141 /// <summary>
142 /// Fired when the application is being created.
143 /// </summary>
144 event EventHandler<CreateEventArgs> Create;
145
146 /// <summary>
147 /// Fired when the application is being destroyed.
148 /// </summary>
149 event EventHandler<DestroyEventArgs> Destroy;
150
151 /// <summary>
142 /// Fired when the overall detection phase has begun. 152 /// Fired when the overall detection phase has begun.
143 /// </summary> 153 /// </summary>
144 event EventHandler<DetectBeginEventArgs> DetectBegin; 154 event EventHandler<DetectBeginEventArgs> DetectBegin;
@@ -394,16 +404,6 @@ namespace WixToolset.Mba.Core
394 event EventHandler<RollbackMsiTransactionCompleteEventArgs> RollbackMsiTransactionComplete; 404 event EventHandler<RollbackMsiTransactionCompleteEventArgs> RollbackMsiTransactionComplete;
395 405
396 /// <summary> 406 /// <summary>
397 /// Fired when the engine has begun to setup the update package.
398 /// </summary>
399 event EventHandler<SetUpdateBeginEventArgs> SetUpdateBegin;
400
401 /// <summary>
402 /// Fired when the engine has completed setting up the update package.
403 /// </summary>
404 event EventHandler<SetUpdateCompleteEventArgs> SetUpdateComplete;
405
406 /// <summary>
407 /// Fired when the engine is shutting down the bootstrapper application. 407 /// Fired when the engine is shutting down the bootstrapper application.
408 /// </summary> 408 /// </summary>
409 event EventHandler<ShutdownEventArgs> Shutdown; 409 event EventHandler<ShutdownEventArgs> Shutdown;
diff --git a/src/api/burn/WixToolset.Mba.Core/IEngine.cs b/src/api/burn/WixToolset.Mba.Core/IEngine.cs
index 7ffa80d7..dde97a70 100644
--- a/src/api/burn/WixToolset.Mba.Core/IEngine.cs
+++ b/src/api/burn/WixToolset.Mba.Core/IEngine.cs
@@ -149,7 +149,8 @@ namespace WixToolset.Mba.Core
149 /// <param name="size">Size of the expected update.</param> 149 /// <param name="size">Size of the expected update.</param>
150 /// <param name="hashType">Type of the hash expected on the update.</param> 150 /// <param name="hashType">Type of the hash expected on the update.</param>
151 /// <param name="hash">Optional hash expected for the update.</param> 151 /// <param name="hash">Optional hash expected for the update.</param>
152 void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash); 152 /// <param name="updatePackageId">Optional package id for the update.</param>
153 void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash, string updatePackageId);
153 154
154 /// <summary> 155 /// <summary>
155 /// Sets the URL to the update feed. 156 /// Sets the URL to the update feed.
diff --git a/src/api/burn/WixToolset.Mba.Core/ManagedBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/ManagedBootstrapperApplication.cs
new file mode 100644
index 00000000..74bfbd73
--- /dev/null
+++ b/src/api/burn/WixToolset.Mba.Core/ManagedBootstrapperApplication.cs
@@ -0,0 +1,19 @@
1// 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.
2
3namespace WixToolset.Mba.Core
4{
5 /// <summary>
6 /// Managed bootstrapper application entry point.
7 /// </summary>
8 public static class ManagedBootstrapperApplication
9 {
10 /// <summary>
11 /// Run the managed bootstrapper application.
12 /// </summary>
13 /// <param name="application">Bootstrapper applciation to run.</param>
14 public static void Run(IBootstrapperApplication application)
15 {
16 MbaNative.BootstrapperApplicationRun(application);
17 }
18 }
19}
diff --git a/src/api/burn/WixToolset.Mba.Core/MbaNative.cs b/src/api/burn/WixToolset.Mba.Core/MbaNative.cs
index a68a3907..e8e9d576 100644
--- a/src/api/burn/WixToolset.Mba.Core/MbaNative.cs
+++ b/src/api/burn/WixToolset.Mba.Core/MbaNative.cs
@@ -8,14 +8,10 @@ namespace WixToolset.Mba.Core
8 internal static class MbaNative 8 internal static class MbaNative
9 { 9 {
10 [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] 10 [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)]
11 internal static extern IBootstrapperEngine InitializeFromCreateArgs( 11 internal static extern void BootstrapperApplicationDebuggerCheck();
12 IntPtr pArgs,
13 ref Command pCommand
14 );
15 12
16 [DllImport("mbanative.dll", ExactSpelling = true)] 13 [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)]
17 internal static extern void StoreBAInCreateResults( 14 internal static extern void BootstrapperApplicationRun(
18 IntPtr pResults,
19 [MarshalAs(UnmanagedType.Interface)] IBootstrapperApplication pBA 15 [MarshalAs(UnmanagedType.Interface)] IBootstrapperApplication pBA
20 ); 16 );
21 } 17 }
diff --git a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs
index c6373647..b91c52c9 100644
--- a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs
+++ b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs
@@ -365,19 +365,19 @@ namespace WixToolset.Mba.Core
365 package.DisplayInternalUICondition = BootstrapperApplicationData.GetAttribute(node, "DisplayInternalUICondition"); 365 package.DisplayInternalUICondition = BootstrapperApplicationData.GetAttribute(node, "DisplayInternalUICondition");
366 } 366 }
367 367
368 nodes = root.Select("/p:BootstrapperApplicationData/p:WixMbaPrereqInformation", namespaceManager); 368 nodes = root.Select("/p:BootstrapperApplicationData/p:WixPrereqInformation", namespaceManager);
369 369
370 foreach (XPathNavigator node in nodes) 370 foreach (XPathNavigator node in nodes)
371 { 371 {
372 string id = BootstrapperApplicationData.GetAttribute(node, "PackageId"); 372 string id = BootstrapperApplicationData.GetAttribute(node, "PackageId");
373 if (id == null) 373 if (id == null)
374 { 374 {
375 throw new Exception("Failed to get package identifier for WixMbaPrereqInformation."); 375 throw new Exception("Failed to get package identifier for WixPrereqInformation.");
376 } 376 }
377 377
378 if (!packagesById.TryGetValue(id, out var ipackage)) 378 if (!packagesById.TryGetValue(id, out var ipackage))
379 { 379 {
380 throw new Exception(String.Format("Failed to find package specified in WixMbaPrereqInformation: {0}", id)); 380 throw new Exception(String.Format("Failed to find package specified in WixPrereqInformation: {0}", id));
381 } 381 }
382 382
383 var package = (PackageInfo)ipackage; 383 var package = (PackageInfo)ipackage;
diff --git a/src/api/burn/balutil/BalBaseBAFunctionsProc.cpp b/src/api/burn/balutil/BalBaseBAFunctionsProc.cpp
new file mode 100644
index 00000000..38ebf65c
--- /dev/null
+++ b/src/api/burn/balutil/BalBaseBAFunctionsProc.cpp
@@ -0,0 +1,1099 @@
1// 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.
2
3#include "precomp.h"
4
5static HRESULT BalBaseBAFunctionsProcOnDestroy(
6 __in IBAFunctions* pBAFunctions,
7 __in BA_ONDESTROY_ARGS* pArgs,
8 __inout BA_ONDESTROY_RESULTS* /*pResults*/
9 )
10{
11 return pBAFunctions->OnDestroy(pArgs->fReload);
12}
13
14static HRESULT BalBaseBAFunctionsProcOnDetectBegin(
15 __in IBAFunctions* pBAFunctions,
16 __in BA_ONDETECTBEGIN_ARGS* pArgs,
17 __inout BA_ONDETECTBEGIN_RESULTS* pResults
18 )
19{
20 return pBAFunctions->OnDetectBegin(pArgs->fCached, pArgs->registrationType, pArgs->cPackages, &pResults->fCancel);
21}
22
23static HRESULT BalBaseBAFunctionsProcOnDetectComplete(
24 __in IBAFunctions* pBAFunctions,
25 __in BA_ONDETECTCOMPLETE_ARGS* pArgs,
26 __inout BA_ONDETECTCOMPLETE_RESULTS* /*pResults*/
27 )
28{
29 return pBAFunctions->OnDetectComplete(pArgs->hrStatus, pArgs->fEligibleForCleanup);
30}
31
32static HRESULT BalBaseBAFunctionsProcOnPlanBegin(
33 __in IBAFunctions* pBAFunctions,
34 __in BA_ONPLANBEGIN_ARGS* pArgs,
35 __inout BA_ONPLANBEGIN_RESULTS* pResults
36 )
37{
38 return pBAFunctions->OnPlanBegin(pArgs->cPackages, &pResults->fCancel);
39}
40
41static HRESULT BalBaseBAFunctionsProcOnPlanComplete(
42 __in IBAFunctions* pBAFunctions,
43 __in BA_ONPLANCOMPLETE_ARGS* pArgs,
44 __inout BA_ONPLANCOMPLETE_RESULTS* /*pResults*/
45 )
46{
47 return pBAFunctions->OnPlanComplete(pArgs->hrStatus);
48}
49
50static HRESULT BalBaseBAFunctionsProcOnStartup(
51 __in IBAFunctions* pBAFunctions,
52 __in BA_ONSTARTUP_ARGS* /*pArgs*/,
53 __inout BA_ONSTARTUP_RESULTS* /*pResults*/
54 )
55{
56 return pBAFunctions->OnStartup();
57}
58
59static HRESULT BalBaseBAFunctionsProcOnShutdown(
60 __in IBAFunctions* pBAFunctions,
61 __in BA_ONSHUTDOWN_ARGS* /*pArgs*/,
62 __inout BA_ONSHUTDOWN_RESULTS* pResults
63 )
64{
65 return pBAFunctions->OnShutdown(&pResults->action);
66}
67
68static HRESULT BalBaseBAFunctionsProcOnDetectForwardCompatibleBundle(
69 __in IBAFunctions* pBAFunctions,
70 __in BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS* pArgs,
71 __inout BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS* pResults
72 )
73{
74 return pBAFunctions->OnDetectForwardCompatibleBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fMissingFromCache, &pResults->fCancel);
75}
76
77static HRESULT BalBaseBAFunctionsProcOnDetectUpdateBegin(
78 __in IBAFunctions* pBAFunctions,
79 __in BA_ONDETECTUPDATEBEGIN_ARGS* pArgs,
80 __inout BA_ONDETECTUPDATEBEGIN_RESULTS* pResults
81 )
82{
83 return pBAFunctions->OnDetectUpdateBegin(pArgs->wzUpdateLocation, &pResults->fCancel, &pResults->fSkip);
84}
85
86static HRESULT BalBaseBAFunctionsProcOnDetectUpdate(
87 __in IBAFunctions* pBAFunctions,
88 __in BA_ONDETECTUPDATE_ARGS* pArgs,
89 __inout BA_ONDETECTUPDATE_RESULTS* pResults
90 )
91{
92 return pBAFunctions->OnDetectUpdate(pArgs->wzUpdateLocation, pArgs->dw64Size, pArgs->wzHash, pArgs->hashAlgorithm, pArgs->wzVersion, pArgs->wzTitle, pArgs->wzSummary, pArgs->wzContentType, pArgs->wzContent, &pResults->fCancel, &pResults->fStopProcessingUpdates);
93}
94
95static HRESULT BalBaseBAFunctionsProcOnDetectUpdateComplete(
96 __in IBAFunctions* pBAFunctions,
97 __in BA_ONDETECTUPDATECOMPLETE_ARGS* pArgs,
98 __inout BA_ONDETECTUPDATECOMPLETE_RESULTS* pResults
99 )
100{
101 return pBAFunctions->OnDetectUpdateComplete(pArgs->hrStatus, &pResults->fIgnoreError);
102}
103
104static HRESULT BalBaseBAFunctionsProcOnDetectRelatedBundle(
105 __in IBAFunctions* pBAFunctions,
106 __in BA_ONDETECTRELATEDBUNDLE_ARGS* pArgs,
107 __inout BA_ONDETECTRELATEDBUNDLE_RESULTS* pResults
108 )
109{
110 return pBAFunctions->OnDetectRelatedBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fMissingFromCache, &pResults->fCancel);
111}
112
113static HRESULT BalBaseBAFunctionsProcOnDetectPackageBegin(
114 __in IBAFunctions* pBAFunctions,
115 __in BA_ONDETECTPACKAGEBEGIN_ARGS* pArgs,
116 __inout BA_ONDETECTPACKAGEBEGIN_RESULTS* pResults
117 )
118{
119 return pBAFunctions->OnDetectPackageBegin(pArgs->wzPackageId, &pResults->fCancel);
120}
121
122static HRESULT BalBaseBAFunctionsProcOnDetectCompatiblePackage(
123 __in IBAFunctions* pBAFunctions,
124 __in BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS* pArgs,
125 __inout BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS* pResults
126 )
127{
128 return pBAFunctions->OnDetectCompatibleMsiPackage(pArgs->wzPackageId, pArgs->wzCompatiblePackageId, pArgs->wzCompatiblePackageVersion, &pResults->fCancel);
129}
130
131static HRESULT BalBaseBAFunctionsProcOnDetectRelatedMsiPackage(
132 __in IBAFunctions* pBAFunctions,
133 __in BA_ONDETECTRELATEDMSIPACKAGE_ARGS* pArgs,
134 __inout BA_ONDETECTRELATEDMSIPACKAGE_RESULTS* pResults
135 )
136{
137 return pBAFunctions->OnDetectRelatedMsiPackage(pArgs->wzPackageId, pArgs->wzUpgradeCode, pArgs->wzProductCode, pArgs->fPerMachine, pArgs->wzVersion, pArgs->operation, &pResults->fCancel);
138}
139
140static HRESULT BalBaseBAFunctionsProcOnDetectPatchTarget(
141 __in IBAFunctions* pBAFunctions,
142 __in BA_ONDETECTPATCHTARGET_ARGS* pArgs,
143 __inout BA_ONDETECTPATCHTARGET_RESULTS* pResults
144 )
145{
146 return pBAFunctions->OnDetectPatchTarget(pArgs->wzPackageId, pArgs->wzProductCode, pArgs->patchState, &pResults->fCancel);
147}
148
149static HRESULT BalBaseBAFunctionsProcOnDetectMsiFeature(
150 __in IBAFunctions* pBAFunctions,
151 __in BA_ONDETECTMSIFEATURE_ARGS* pArgs,
152 __inout BA_ONDETECTMSIFEATURE_RESULTS* pResults
153 )
154{
155 return pBAFunctions->OnDetectMsiFeature(pArgs->wzPackageId, pArgs->wzFeatureId, pArgs->state, &pResults->fCancel);
156}
157
158static HRESULT BalBaseBAFunctionsProcOnDetectPackageComplete(
159 __in IBAFunctions* pBAFunctions,
160 __in BA_ONDETECTPACKAGECOMPLETE_ARGS* pArgs,
161 __inout BA_ONDETECTPACKAGECOMPLETE_RESULTS* /*pResults*/
162 )
163{
164 return pBAFunctions->OnDetectPackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->state, pArgs->fCached);
165}
166
167static HRESULT BalBaseBAFunctionsProcOnPlanRelatedBundle(
168 __in IBAFunctions* pBAFunctions,
169 __in BA_ONPLANRELATEDBUNDLE_ARGS* pArgs,
170 __inout BA_ONPLANRELATEDBUNDLE_RESULTS* pResults
171 )
172{
173 return pBAFunctions->OnPlanRelatedBundle(pArgs->wzBundleId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
174}
175
176static HRESULT BalBaseBAFunctionsProcOnPlanRollbackBoundary(
177 __in IBAFunctions* pBAFunctions,
178 __in BA_ONPLANROLLBACKBOUNDARY_ARGS* pArgs,
179 __inout BA_ONPLANROLLBACKBOUNDARY_RESULTS* pResults
180 )
181{
182 return pBAFunctions->OnPlanRollbackBoundary(pArgs->wzRollbackBoundaryId, pArgs->fRecommendedTransaction, &pResults->fTransaction, &pResults->fCancel);
183}
184
185static HRESULT BalBaseBAFunctionsProcOnPlanPackageBegin(
186 __in IBAFunctions* pBAFunctions,
187 __in BA_ONPLANPACKAGEBEGIN_ARGS* pArgs,
188 __inout BA_ONPLANPACKAGEBEGIN_RESULTS* pResults
189 )
190{
191 return pBAFunctions->OnPlanPackageBegin(pArgs->wzPackageId, pArgs->state, pArgs->fCached, pArgs->installCondition, pArgs->repairCondition, pArgs->recommendedState, pArgs->recommendedCacheType, &pResults->requestedState, &pResults->requestedCacheType, &pResults->fCancel);
192}
193
194static HRESULT BalBaseBAFunctionsProcOnPlanCompatibleMsiPackageBegin(
195 __in IBAFunctions* pBAFunctions,
196 __in BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS* pArgs,
197 __inout BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS* pResults
198 )
199{
200 return pBAFunctions->OnPlanCompatibleMsiPackageBegin(pArgs->wzPackageId, pArgs->wzCompatiblePackageId, pArgs->wzCompatiblePackageVersion, pArgs->fRecommendedRemove, &pResults->fRequestRemove, &pResults->fCancel);
201}
202
203static HRESULT BalBaseBAFunctionsProcOnPlanCompatibleMsiPackageComplete(
204 __in IBAFunctions* pBAFunctions,
205 __in BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS* pArgs,
206 __inout BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS* /*pResults*/
207 )
208{
209 return pBAFunctions->OnPlanCompatibleMsiPackageComplete(pArgs->wzPackageId, pArgs->wzCompatiblePackageId, pArgs->hrStatus, pArgs->fRequestedRemove);
210}
211
212static HRESULT BalBaseBAFunctionsProcOnPlanPatchTarget(
213 __in IBAFunctions* pBAFunctions,
214 __in BA_ONPLANPATCHTARGET_ARGS* pArgs,
215 __inout BA_ONPLANPATCHTARGET_RESULTS* pResults
216 )
217{
218 return pBAFunctions->OnPlanPatchTarget(pArgs->wzPackageId, pArgs->wzProductCode, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
219}
220
221static HRESULT BalBaseBAFunctionsProcOnPlanMsiFeature(
222 __in IBAFunctions* pBAFunctions,
223 __in BA_ONPLANMSIFEATURE_ARGS* pArgs,
224 __inout BA_ONPLANMSIFEATURE_RESULTS* pResults
225 )
226{
227 return pBAFunctions->OnPlanMsiFeature(pArgs->wzPackageId, pArgs->wzFeatureId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
228}
229
230static HRESULT BalBaseBAFunctionsProcOnPlanPackageComplete(
231 __in IBAFunctions* pBAFunctions,
232 __in BA_ONPLANPACKAGECOMPLETE_ARGS* pArgs,
233 __inout BA_ONPLANPACKAGECOMPLETE_RESULTS* /*pResults*/
234 )
235{
236 return pBAFunctions->OnPlanPackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->requested);
237}
238
239static HRESULT BalBaseBAFunctionsProcOnPlannedCompatiblePackage(
240 __in IBAFunctions* pBAFunctions,
241 __in BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS* pArgs,
242 __inout BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS* /*pResults*/
243 )
244{
245 return pBAFunctions->OnPlannedCompatiblePackage(pArgs->wzPackageId, pArgs->wzCompatiblePackageId, pArgs->fRemove);
246}
247
248static HRESULT BalBaseBAFunctionsProcOnPlannedPackage(
249 __in IBAFunctions* pBAFunctions,
250 __in BA_ONPLANNEDPACKAGE_ARGS* pArgs,
251 __inout BA_ONPLANNEDPACKAGE_RESULTS* /*pResults*/
252 )
253{
254 return pBAFunctions->OnPlannedPackage(pArgs->wzPackageId, pArgs->execute, pArgs->rollback, pArgs->fPlannedCache, pArgs->fPlannedUncache);
255}
256
257static HRESULT BalBaseBAFunctionsProcOnApplyBegin(
258 __in IBAFunctions* pBAFunctions,
259 __in BA_ONAPPLYBEGIN_ARGS* pArgs,
260 __inout BA_ONAPPLYBEGIN_RESULTS* pResults
261 )
262{
263 return pBAFunctions->OnApplyBegin(pArgs->dwPhaseCount, &pResults->fCancel);
264}
265
266static HRESULT BalBaseBAFunctionsProcOnElevateBegin(
267 __in IBAFunctions* pBAFunctions,
268 __in BA_ONELEVATEBEGIN_ARGS* /*pArgs*/,
269 __inout BA_ONELEVATEBEGIN_RESULTS* pResults
270 )
271{
272 return pBAFunctions->OnElevateBegin(&pResults->fCancel);
273}
274
275static HRESULT BalBaseBAFunctionsProcOnElevateComplete(
276 __in IBAFunctions* pBAFunctions,
277 __in BA_ONELEVATECOMPLETE_ARGS* pArgs,
278 __inout BA_ONELEVATECOMPLETE_RESULTS* /*pResults*/
279 )
280{
281 return pBAFunctions->OnElevateComplete(pArgs->hrStatus);
282}
283
284static HRESULT BalBaseBAFunctionsProcOnProgress(
285 __in IBAFunctions* pBAFunctions,
286 __in BA_ONPROGRESS_ARGS* pArgs,
287 __inout BA_ONPROGRESS_RESULTS* pResults
288 )
289{
290 return pBAFunctions->OnProgress(pArgs->dwProgressPercentage, pArgs->dwOverallPercentage, &pResults->fCancel);
291}
292
293static HRESULT BalBaseBAFunctionsProcOnError(
294 __in IBAFunctions* pBAFunctions,
295 __in BA_ONERROR_ARGS* pArgs,
296 __inout BA_ONERROR_RESULTS* pResults
297 )
298{
299 return pBAFunctions->OnError(pArgs->errorType, pArgs->wzPackageId, pArgs->dwCode, pArgs->wzError, pArgs->dwUIHint, pArgs->cData, pArgs->rgwzData, pArgs->nRecommendation, &pResults->nResult);
300}
301
302static HRESULT BalBaseBAFunctionsProcOnRegisterBegin(
303 __in IBAFunctions* pBAFunctions,
304 __in BA_ONREGISTERBEGIN_ARGS* pArgs,
305 __inout BA_ONREGISTERBEGIN_RESULTS* pResults
306 )
307{
308 return pBAFunctions->OnRegisterBegin(pArgs->recommendedRegistrationType, &pResults->fCancel, &pResults->registrationType);
309}
310
311static HRESULT BalBaseBAFunctionsProcOnRegisterComplete(
312 __in IBAFunctions* pBAFunctions,
313 __in BA_ONREGISTERCOMPLETE_ARGS* pArgs,
314 __inout BA_ONREGISTERCOMPLETE_RESULTS* /*pResults*/
315 )
316{
317 return pBAFunctions->OnRegisterComplete(pArgs->hrStatus);
318}
319
320static HRESULT BalBaseBAFunctionsProcOnCacheBegin(
321 __in IBAFunctions* pBAFunctions,
322 __in BA_ONCACHEBEGIN_ARGS* /*pArgs*/,
323 __inout BA_ONCACHEBEGIN_RESULTS* pResults
324 )
325{
326 return pBAFunctions->OnCacheBegin(&pResults->fCancel);
327}
328
329static HRESULT BalBaseBAFunctionsProcOnCachePackageBegin(
330 __in IBAFunctions* pBAFunctions,
331 __in BA_ONCACHEPACKAGEBEGIN_ARGS* pArgs,
332 __inout BA_ONCACHEPACKAGEBEGIN_RESULTS* pResults
333 )
334{
335 return pBAFunctions->OnCachePackageBegin(pArgs->wzPackageId, pArgs->cCachePayloads, pArgs->dw64PackageCacheSize, pArgs->fVital, &pResults->fCancel);
336}
337
338static HRESULT BalBaseBAFunctionsProcOnCacheAcquireBegin(
339 __in IBAFunctions* pBAFunctions,
340 __in BA_ONCACHEACQUIREBEGIN_ARGS* pArgs,
341 __inout BA_ONCACHEACQUIREBEGIN_RESULTS* pResults
342 )
343{
344 return pBAFunctions->OnCacheAcquireBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->wzSource, pArgs->wzDownloadUrl, pArgs->wzPayloadContainerId, pArgs->recommendation, &pResults->action, &pResults->fCancel);
345}
346
347static HRESULT BalBaseBAFunctionsProcOnCacheAcquireProgress(
348 __in IBAFunctions* pBAFunctions,
349 __in BA_ONCACHEACQUIREPROGRESS_ARGS* pArgs,
350 __inout BA_ONCACHEACQUIREPROGRESS_RESULTS* pResults
351 )
352{
353 return pBAFunctions->OnCacheAcquireProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel);
354}
355
356static HRESULT BalBaseBAFunctionsProcOnCacheAcquireResolving(
357 __in IBAFunctions* pBAFunctions,
358 __in BA_ONCACHEACQUIRERESOLVING_ARGS* pArgs,
359 __inout BA_ONCACHEACQUIRERESOLVING_RESULTS* pResults
360 )
361{
362 return pBAFunctions->OnCacheAcquireResolving(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->rgSearchPaths, pArgs->cSearchPaths, pArgs->fFoundLocal, pArgs->dwRecommendedSearchPath, pArgs->wzDownloadUrl, pArgs->wzPayloadContainerId, pArgs->recommendation, &pResults->dwChosenSearchPath, &pResults->action, &pResults->fCancel);
363}
364
365static HRESULT BalBaseBAFunctionsProcOnCacheAcquireComplete(
366 __in IBAFunctions* pBAFunctions,
367 __in BA_ONCACHEACQUIRECOMPLETE_ARGS* pArgs,
368 __inout BA_ONCACHEACQUIRECOMPLETE_RESULTS* pResults
369 )
370{
371 return pBAFunctions->OnCacheAcquireComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus, pArgs->recommendation, &pResults->action);
372}
373
374static HRESULT BalBaseBAFunctionsProcOnCacheVerifyBegin(
375 __in IBAFunctions* pBAFunctions,
376 __in BA_ONCACHEVERIFYBEGIN_ARGS* pArgs,
377 __inout BA_ONCACHEVERIFYBEGIN_RESULTS* pResults
378 )
379{
380 return pBAFunctions->OnCacheVerifyBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, &pResults->fCancel);
381}
382
383static HRESULT BalBaseBAFunctionsProcOnCacheVerifyProgress(
384 __in IBAFunctions* pBAFunctions,
385 __in BA_ONCACHEVERIFYPROGRESS_ARGS* pArgs,
386 __inout BA_ONCACHEVERIFYPROGRESS_RESULTS* pResults
387 )
388{
389 return pBAFunctions->OnCacheVerifyProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, pArgs->verifyStep, &pResults->fCancel);
390}
391
392static HRESULT BalBaseBAFunctionsProcOnCacheVerifyComplete(
393 __in IBAFunctions* pBAFunctions,
394 __in BA_ONCACHEVERIFYCOMPLETE_ARGS* pArgs,
395 __inout BA_ONCACHEVERIFYCOMPLETE_RESULTS* pResults
396 )
397{
398 return pBAFunctions->OnCacheVerifyComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus, pArgs->recommendation, &pResults->action);
399}
400
401static HRESULT BalBaseBAFunctionsProcOnCachePackageComplete(
402 __in IBAFunctions* pBAFunctions,
403 __in BA_ONCACHEPACKAGECOMPLETE_ARGS* pArgs,
404 __inout BA_ONCACHEPACKAGECOMPLETE_RESULTS* pResults
405 )
406{
407 return pBAFunctions->OnCachePackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->recommendation, &pResults->action);
408}
409
410static HRESULT BalBaseBAFunctionsProcOnCacheComplete(
411 __in IBAFunctions* pBAFunctions,
412 __in BA_ONCACHECOMPLETE_ARGS* pArgs,
413 __inout BA_ONCACHECOMPLETE_RESULTS* /*pResults*/
414 )
415{
416 return pBAFunctions->OnCacheComplete(pArgs->hrStatus);
417}
418
419static HRESULT BalBaseBAFunctionsProcOnExecuteBegin(
420 __in IBAFunctions* pBAFunctions,
421 __in BA_ONEXECUTEBEGIN_ARGS* pArgs,
422 __inout BA_ONEXECUTEBEGIN_RESULTS* pResults
423 )
424{
425 return pBAFunctions->OnExecuteBegin(pArgs->cExecutingPackages, &pResults->fCancel);
426}
427
428static HRESULT BalBaseBAFunctionsProcOnExecutePackageBegin(
429 __in IBAFunctions* pBAFunctions,
430 __in BA_ONEXECUTEPACKAGEBEGIN_ARGS* pArgs,
431 __inout BA_ONEXECUTEPACKAGEBEGIN_RESULTS* pResults
432 )
433{
434 return pBAFunctions->OnExecutePackageBegin(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, pArgs->uiLevel, pArgs->fDisableExternalUiHandler, &pResults->fCancel);
435}
436
437static HRESULT BalBaseBAFunctionsProcOnExecutePatchTarget(
438 __in IBAFunctions* pBAFunctions,
439 __in BA_ONEXECUTEPATCHTARGET_ARGS* pArgs,
440 __inout BA_ONEXECUTEPATCHTARGET_RESULTS* pResults
441 )
442{
443 return pBAFunctions->OnExecutePatchTarget(pArgs->wzPackageId, pArgs->wzTargetProductCode, &pResults->fCancel);
444}
445
446static HRESULT BalBaseBAFunctionsProcOnExecuteProgress(
447 __in IBAFunctions* pBAFunctions,
448 __in BA_ONEXECUTEPROGRESS_ARGS* pArgs,
449 __inout BA_ONEXECUTEPROGRESS_RESULTS* pResults
450 )
451{
452 return pBAFunctions->OnExecuteProgress(pArgs->wzPackageId, pArgs->dwProgressPercentage, pArgs->dwOverallPercentage, &pResults->fCancel);
453}
454
455static HRESULT BalBaseBAFunctionsProcOnExecuteMsiMessage(
456 __in IBAFunctions* pBAFunctions,
457 __in BA_ONEXECUTEMSIMESSAGE_ARGS* pArgs,
458 __inout BA_ONEXECUTEMSIMESSAGE_RESULTS* pResults
459 )
460{
461 return pBAFunctions->OnExecuteMsiMessage(pArgs->wzPackageId, pArgs->messageType, pArgs->dwUIHint, pArgs->wzMessage, pArgs->cData, pArgs->rgwzData, pArgs->nRecommendation, &pResults->nResult);
462}
463
464static HRESULT BalBaseBAFunctionsProcOnExecuteFilesInUse(
465 __in IBAFunctions* pBAFunctions,
466 __in BA_ONEXECUTEFILESINUSE_ARGS* pArgs,
467 __inout BA_ONEXECUTEFILESINUSE_RESULTS* pResults
468 )
469{
470 return pBAFunctions->OnExecuteFilesInUse(pArgs->wzPackageId, pArgs->cFiles, pArgs->rgwzFiles, pArgs->nRecommendation, pArgs->source, &pResults->nResult);
471}
472
473static HRESULT BalBaseBAFunctionsProcOnExecutePackageComplete(
474 __in IBAFunctions* pBAFunctions,
475 __in BA_ONEXECUTEPACKAGECOMPLETE_ARGS* pArgs,
476 __inout BA_ONEXECUTEPACKAGECOMPLETE_RESULTS* pResults
477 )
478{
479 return pBAFunctions->OnExecutePackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action);
480}
481
482static HRESULT BalBaseBAFunctionsProcOnExecuteProcessCancel(
483 __in IBAFunctions* pBAFunctions,
484 __in BA_ONEXECUTEPROCESSCANCEL_ARGS* pArgs,
485 __inout BA_ONEXECUTEPROCESSCANCEL_RESULTS* pResults
486 )
487{
488 return pBAFunctions->OnExecuteProcessCancel(pArgs->wzPackageId, pArgs->dwProcessId, pArgs->recommendation, &pResults->action);
489}
490
491static HRESULT BalBaseBAFunctionsProcOnExecuteComplete(
492 __in IBAFunctions* pBAFunctions,
493 __in BA_ONEXECUTECOMPLETE_ARGS* pArgs,
494 __inout BA_ONEXECUTECOMPLETE_RESULTS* /*pResults*/
495 )
496{
497 return pBAFunctions->OnExecuteComplete(pArgs->hrStatus);
498}
499
500static HRESULT BalBaseBAFunctionsProcOnUnregisterBegin(
501 __in IBAFunctions* pBAFunctions,
502 __in BA_ONUNREGISTERBEGIN_ARGS* pArgs,
503 __inout BA_ONUNREGISTERBEGIN_RESULTS* pResults
504 )
505{
506 return pBAFunctions->OnUnregisterBegin(pArgs->recommendedRegistrationType, &pResults->registrationType);
507}
508
509static HRESULT BalBaseBAFunctionsProcOnUnregisterComplete(
510 __in IBAFunctions* pBAFunctions,
511 __in BA_ONUNREGISTERCOMPLETE_ARGS* pArgs,
512 __inout BA_ONUNREGISTERCOMPLETE_RESULTS* /*pResults*/
513 )
514{
515 return pBAFunctions->OnUnregisterComplete(pArgs->hrStatus);
516}
517
518static HRESULT BalBaseBAFunctionsProcOnApplyComplete(
519 __in IBAFunctions* pBAFunctions,
520 __in BA_ONAPPLYCOMPLETE_ARGS* pArgs,
521 __inout BA_ONAPPLYCOMPLETE_RESULTS* pResults
522 )
523{
524 return pBAFunctions->OnApplyComplete(pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action);
525}
526
527static HRESULT BalBaseBAFunctionsProcOnLaunchApprovedExeBegin(
528 __in IBAFunctions* pBAFunctions,
529 __in BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS* /*pArgs*/,
530 __inout BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS* pResults
531 )
532{
533 return pBAFunctions->OnLaunchApprovedExeBegin(&pResults->fCancel);
534}
535
536static HRESULT BalBaseBAFunctionsProcOnLaunchApprovedExeComplete(
537 __in IBAFunctions* pBAFunctions,
538 __in BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS* pArgs,
539 __inout BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS* /*pResults*/
540 )
541{
542 return pBAFunctions->OnLaunchApprovedExeComplete(pArgs->hrStatus, pArgs->dwProcessId);
543}
544
545static HRESULT BalBaseBAFunctionsProcOnPlanMsiPackage(
546 __in IBAFunctions* pBAFunctions,
547 __in BA_ONPLANMSIPACKAGE_ARGS* pArgs,
548 __inout BA_ONPLANMSIPACKAGE_RESULTS* pResults
549 )
550{
551 return pBAFunctions->OnPlanMsiPackage(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, pArgs->recommendedFileVersioning, &pResults->fCancel, &pResults->actionMsiProperty, &pResults->uiLevel, &pResults->fDisableExternalUiHandler, &pResults->fileVersioning);
552}
553
554static HRESULT BalBaseBAFunctionsProcOnBeginMsiTransactionBegin(
555 __in IBAFunctions* pBAFunctions,
556 __in BA_ONBEGINMSITRANSACTIONBEGIN_ARGS* pArgs,
557 __inout BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS* pResults
558 )
559{
560 return pBAFunctions->OnBeginMsiTransactionBegin(pArgs->wzTransactionId, &pResults->fCancel);
561}
562
563static HRESULT BalBaseBAFunctionsProcOnBeginMsiTransactionComplete(
564 __in IBAFunctions* pBAFunctions,
565 __in BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS* pArgs,
566 __inout BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS* /*pResults*/
567 )
568{
569 return pBAFunctions->OnBeginMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus);
570}
571
572static HRESULT BalBaseBAFunctionsProcOnCommitMsiTransactionBegin(
573 __in IBAFunctions* pBAFunctions,
574 __in BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS* pArgs,
575 __inout BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS* pResults
576 )
577{
578 return pBAFunctions->OnCommitMsiTransactionBegin(pArgs->wzTransactionId, &pResults->fCancel);
579}
580
581static HRESULT BalBaseBAFunctionsProcOnCommitMsiTransactionComplete(
582 __in IBAFunctions* pBAFunctions,
583 __in BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS* pArgs,
584 __inout BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS* pResults
585 )
586{
587 return pBAFunctions->OnCommitMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action);
588}
589
590static HRESULT BalBaseBAFunctionsProcOnRollbackMsiTransactionBegin(
591 __in IBAFunctions* pBAFunctions,
592 __in BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS* pArgs,
593 __inout BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS* /*pResults*/
594 )
595{
596 return pBAFunctions->OnRollbackMsiTransactionBegin(pArgs->wzTransactionId);
597}
598
599static HRESULT BalBaseBAFunctionsProcOnRollbackMsiTransactionComplete(
600 __in IBAFunctions* pBAFunctions,
601 __in BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS* pArgs,
602 __inout BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS* pResults
603 )
604{
605 return pBAFunctions->OnRollbackMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action);
606}
607
608static HRESULT BalBaseBAFunctionsProcOnPauseAutomaticUpdatesBegin(
609 __in IBAFunctions* pBAFunctions,
610 __in BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS* /*pArgs*/,
611 __inout BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS* /*pResults*/
612 )
613{
614 return pBAFunctions->OnPauseAutomaticUpdatesBegin();
615}
616
617static HRESULT BalBaseBAFunctionsProcOnPauseAutomaticUpdatesComplete(
618 __in IBAFunctions* pBAFunctions,
619 __in BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS* pArgs,
620 __inout BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS* /*pResults*/
621 )
622{
623 return pBAFunctions->OnPauseAutomaticUpdatesComplete(pArgs->hrStatus);
624}
625
626static HRESULT BalBaseBAFunctionsProcOnSystemRestorePointBegin(
627 __in IBAFunctions* pBAFunctions,
628 __in BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS* /*pArgs*/,
629 __inout BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS* /*pResults*/
630 )
631{
632 return pBAFunctions->OnSystemRestorePointBegin();
633}
634
635static HRESULT BalBaseBAFunctionsProcOnSystemRestorePointComplete(
636 __in IBAFunctions* pBAFunctions,
637 __in BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS* pArgs,
638 __inout BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS* /*pResults*/
639 )
640{
641 return pBAFunctions->OnSystemRestorePointComplete(pArgs->hrStatus);
642}
643
644static HRESULT BalBaseBAFunctionsProcOnPlanForwardCompatibleBundle(
645 __in IBAFunctions* pBAFunctions,
646 __in BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS* pArgs,
647 __inout BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS* pResults
648 )
649{
650 return pBAFunctions->OnPlanForwardCompatibleBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fRecommendedIgnoreBundle, &pResults->fCancel, &pResults->fIgnoreBundle);
651}
652
653static HRESULT BalBaseBAFunctionsProcOnCacheContainerOrPayloadVerifyBegin(
654 __in IBAFunctions* pBAFunctions,
655 __in BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS* pArgs,
656 __inout BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS* pResults
657 )
658{
659 return pBAFunctions->OnCacheContainerOrPayloadVerifyBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, &pResults->fCancel);
660}
661
662static HRESULT BalBaseBAFunctionsProcOnCacheContainerOrPayloadVerifyProgress(
663 __in IBAFunctions* pBAFunctions,
664 __in BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS* pArgs,
665 __inout BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS* pResults
666 )
667{
668 return pBAFunctions->OnCacheContainerOrPayloadVerifyProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel);
669}
670
671static HRESULT BalBaseBAFunctionsProcOnCacheContainerOrPayloadVerifyComplete(
672 __in IBAFunctions* pBAFunctions,
673 __in BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS* pArgs,
674 __inout BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS* /*pResults*/
675 )
676{
677 return pBAFunctions->OnCacheContainerOrPayloadVerifyComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus);
678}
679
680static HRESULT BalBaseBAFunctionsProcOnCachePayloadExtractBegin(
681 __in IBAFunctions* pBAFunctions,
682 __in BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS* pArgs,
683 __inout BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS* pResults
684 )
685{
686 return pBAFunctions->OnCachePayloadExtractBegin(pArgs->wzContainerId, pArgs->wzPayloadId, &pResults->fCancel);
687}
688
689static HRESULT BalBaseBAFunctionsProcOnCachePayloadExtractProgress(
690 __in IBAFunctions* pBAFunctions,
691 __in BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS* pArgs,
692 __inout BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS* pResults
693 )
694{
695 return pBAFunctions->OnCachePayloadExtractProgress(pArgs->wzContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel);
696}
697
698static HRESULT BalBaseBAFunctionsProcOnCachePayloadExtractComplete(
699 __in IBAFunctions* pBAFunctions,
700 __in BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS* pArgs,
701 __inout BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS* /*pResults*/
702 )
703{
704 return pBAFunctions->OnCachePayloadExtractComplete(pArgs->wzContainerId, pArgs->wzPayloadId, pArgs->hrStatus);
705}
706
707static HRESULT BalBaseBAFunctionsProcOnPlanRestoreRelatedBundle(
708 __in IBAFunctions* pBAFunctions,
709 __in BA_ONPLANRESTORERELATEDBUNDLE_ARGS* pArgs,
710 __inout BA_ONPLANRESTORERELATEDBUNDLE_RESULTS* pResults
711 )
712{
713 return pBAFunctions->OnPlanRestoreRelatedBundle(pArgs->wzBundleId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
714}
715
716static HRESULT BalBaseBAFunctionsProcOnPlanRelatedBundleType(
717 __in IBAFunctions* pBAFunctions,
718 __in BA_ONPLANRELATEDBUNDLETYPE_ARGS* pArgs,
719 __inout BA_ONPLANRELATEDBUNDLETYPE_RESULTS* pResults
720 )
721{
722 return pBAFunctions->OnPlanRelatedBundleType(pArgs->wzBundleId, pArgs->recommendedType, &pResults->requestedType, &pResults->fCancel);
723}
724
725static HRESULT BalBaseBAFunctionsProcOnApplyDowngrade(
726 __in IBAFunctions* pBAFunctions,
727 __in BA_ONAPPLYDOWNGRADE_ARGS* pArgs,
728 __inout BA_ONAPPLYDOWNGRADE_RESULTS* pResults
729 )
730{
731 return pBAFunctions->OnApplyDowngrade(pArgs->hrRecommended, &pResults->hrStatus);
732}
733
734static HRESULT BalBaseBAFunctionsProcOnDetectRelatedBundlePackage(
735 __in IBAFunctions* pBAFunctions,
736 __in BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS* pArgs,
737 __inout BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS* pResults
738 )
739{
740 return pBAFunctions->OnDetectRelatedBundlePackage(pArgs->wzPackageId, pArgs->wzBundleId, pArgs->relationType, pArgs->fPerMachine, pArgs->wzVersion, &pResults->fCancel);
741}
742
743static HRESULT BalBaseBAFunctionsProcOnCachePackageNonVitalValidationFailure(
744 __in IBAFunctions* pBAFunctions,
745 __in BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS* pArgs,
746 __inout BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS* pResults
747 )
748{
749 return pBAFunctions->OnCachePackageNonVitalValidationFailure(pArgs->wzPackageId, pArgs->hrStatus, pArgs->recommendation, &pResults->action);
750}
751
752static HRESULT BalBaseBAFunctionsProcOnThemeLoaded(
753 __in IBAFunctions* pBAFunctions,
754 __in BA_FUNCTIONS_ONTHEMELOADED_ARGS* pArgs,
755 __inout BA_FUNCTIONS_ONTHEMELOADED_RESULTS* /*pResults*/
756 )
757{
758 return pBAFunctions->OnThemeLoaded(pArgs->hWnd);
759}
760
761static HRESULT BalBaseBAFunctionsProcWndProc(
762 __in IBAFunctions* pBAFunctions,
763 __in BA_FUNCTIONS_WNDPROC_ARGS* pArgs,
764 __inout BA_FUNCTIONS_WNDPROC_RESULTS* pResults
765 )
766{
767 return pBAFunctions->WndProc(pArgs->hWnd, pArgs->uMsg, pArgs->wParam, pArgs->lParam, &pResults->fProcessed, &pResults->lResult);
768}
769
770static HRESULT BalBaseBAFunctionsProcOnThemeControlLoading(
771 __in IBAFunctions* pBAFunctions,
772 __in BA_FUNCTIONS_ONTHEMECONTROLLOADING_ARGS* pArgs,
773 __inout BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS* pResults
774 )
775{
776 return pBAFunctions->OnThemeControlLoading(pArgs->wzName, &pResults->fProcessed, &pResults->wId, &pResults->dwAutomaticBehaviorType);
777}
778
779static HRESULT BalBaseBAFunctionsProcOnThemeControlWmCommand(
780 __in IBAFunctions* pBAFunctions,
781 __in BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_ARGS* pArgs,
782 __inout BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_RESULTS* pResults
783 )
784{
785 return pBAFunctions->OnThemeControlWmCommand(pArgs->wParam, pArgs->wzName, pArgs->wId, pArgs->hWnd, &pResults->fProcessed, &pResults->lResult);
786}
787
788static HRESULT BalBaseBAFunctionsProcOnThemeControlWmNotify(
789 __in IBAFunctions* pBAFunctions,
790 __in BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_ARGS* pArgs,
791 __inout BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_RESULTS* pResults
792 )
793{
794 return pBAFunctions->OnThemeControlWmNotify(pArgs->lParam, pArgs->wzName, pArgs->wId, pArgs->hWnd, &pResults->fProcessed, &pResults->lResult);
795}
796
797static HRESULT BalBaseBAFunctionsProcOnThemeControlLoaded(
798 __in IBAFunctions* pBAFunctions,
799 __in BA_FUNCTIONS_ONTHEMECONTROLLOADED_ARGS* pArgs,
800 __inout BA_FUNCTIONS_ONTHEMECONTROLLOADED_RESULTS* pResults
801 )
802{
803 return pBAFunctions->OnThemeControlLoaded(pArgs->wzName, pArgs->wId, pArgs->hWnd, &pResults->fProcessed);
804}
805
806/*******************************************************************
807BalBaseBAFunctionsProc - requires pvContext to be of type IBAFunctions.
808Provides a default mapping between the message based BAFunctions interface and
809the COM-based BAFunctions interface.
810
811*******************************************************************/
812HRESULT WINAPI BalBaseBAFunctionsProc(
813 __in BA_FUNCTIONS_MESSAGE message,
814 __in const LPVOID pvArgs,
815 __inout LPVOID pvResults,
816 __in_opt LPVOID pvContext
817 )
818{
819 IBAFunctions* pBAFunctions = reinterpret_cast<IBAFunctions*>(pvContext);
820 HRESULT hr = pBAFunctions->BAFunctionsProc(message, pvArgs, pvResults, pvContext);
821
822 if (E_NOTIMPL == hr)
823 {
824 switch (message)
825 {
826 case BA_FUNCTIONS_MESSAGE_ONCREATE:
827 // ONCREATE is handled when the function is created, not via callback.
828 break;
829 case BA_FUNCTIONS_MESSAGE_ONDESTROY:
830 hr = BalBaseBAFunctionsProcOnDestroy(pBAFunctions, reinterpret_cast<BA_ONDESTROY_ARGS*>(pvArgs), reinterpret_cast<BA_ONDESTROY_RESULTS*>(pvResults));
831 break;
832 case BA_FUNCTIONS_MESSAGE_ONSTARTUP:
833 hr = BalBaseBAFunctionsProcOnStartup(pBAFunctions, reinterpret_cast<BA_ONSTARTUP_ARGS*>(pvArgs), reinterpret_cast<BA_ONSTARTUP_RESULTS*>(pvResults));
834 break;
835 case BA_FUNCTIONS_MESSAGE_ONSHUTDOWN:
836 hr = BalBaseBAFunctionsProcOnShutdown(pBAFunctions, reinterpret_cast<BA_ONSHUTDOWN_ARGS*>(pvArgs), reinterpret_cast<BA_ONSHUTDOWN_RESULTS*>(pvResults));
837 break;
838 case BA_FUNCTIONS_MESSAGE_ONDETECTBEGIN:
839 hr = BalBaseBAFunctionsProcOnDetectBegin(pBAFunctions, reinterpret_cast<BA_ONDETECTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTBEGIN_RESULTS*>(pvResults));
840 break;
841 case BA_FUNCTIONS_MESSAGE_ONDETECTCOMPLETE:
842 hr = BalBaseBAFunctionsProcOnDetectComplete(pBAFunctions, reinterpret_cast<BA_ONDETECTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTCOMPLETE_RESULTS*>(pvResults));
843 break;
844 case BA_FUNCTIONS_MESSAGE_ONPLANBEGIN:
845 hr = BalBaseBAFunctionsProcOnPlanBegin(pBAFunctions, reinterpret_cast<BA_ONPLANBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANBEGIN_RESULTS*>(pvResults));
846 break;
847 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPLETE:
848 hr = BalBaseBAFunctionsProcOnPlanComplete(pBAFunctions, reinterpret_cast<BA_ONPLANCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANCOMPLETE_RESULTS*>(pvResults));
849 break;
850 case BA_FUNCTIONS_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE:
851 hr = BalBaseBAFunctionsProcOnDetectForwardCompatibleBundle(pBAFunctions, reinterpret_cast<BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS*>(pvResults));
852 break;
853 case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATEBEGIN:
854 hr = BalBaseBAFunctionsProcOnDetectUpdateBegin(pBAFunctions, reinterpret_cast<BA_ONDETECTUPDATEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATEBEGIN_RESULTS*>(pvResults));
855 break;
856 case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATE:
857 hr = BalBaseBAFunctionsProcOnDetectUpdate(pBAFunctions, reinterpret_cast<BA_ONDETECTUPDATE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATE_RESULTS*>(pvResults));
858 break;
859 case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATECOMPLETE:
860 hr = BalBaseBAFunctionsProcOnDetectUpdateComplete(pBAFunctions, reinterpret_cast<BA_ONDETECTUPDATECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATECOMPLETE_RESULTS*>(pvResults));
861 break;
862 case BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLE:
863 hr = BalBaseBAFunctionsProcOnDetectRelatedBundle(pBAFunctions, reinterpret_cast<BA_ONDETECTRELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTRELATEDBUNDLE_RESULTS*>(pvResults));
864 break;
865 case BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGEBEGIN:
866 hr = BalBaseBAFunctionsProcOnDetectPackageBegin(pBAFunctions, reinterpret_cast<BA_ONDETECTPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPACKAGEBEGIN_RESULTS*>(pvResults));
867 break;
868 case BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDMSIPACKAGE:
869 hr = BalBaseBAFunctionsProcOnDetectRelatedMsiPackage(pBAFunctions, reinterpret_cast<BA_ONDETECTRELATEDMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTRELATEDMSIPACKAGE_RESULTS*>(pvResults));
870 break;
871 case BA_FUNCTIONS_MESSAGE_ONDETECTPATCHTARGET:
872 hr = BalBaseBAFunctionsProcOnDetectPatchTarget(pBAFunctions, reinterpret_cast<BA_ONDETECTPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPATCHTARGET_RESULTS*>(pvResults));
873 break;
874 case BA_FUNCTIONS_MESSAGE_ONDETECTMSIFEATURE:
875 hr = BalBaseBAFunctionsProcOnDetectMsiFeature(pBAFunctions, reinterpret_cast<BA_ONDETECTMSIFEATURE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTMSIFEATURE_RESULTS*>(pvResults));
876 break;
877 case BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGECOMPLETE:
878 hr = BalBaseBAFunctionsProcOnDetectPackageComplete(pBAFunctions, reinterpret_cast<BA_ONDETECTPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPACKAGECOMPLETE_RESULTS*>(pvResults));
879 break;
880 case BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLE:
881 hr = BalBaseBAFunctionsProcOnPlanRelatedBundle(pBAFunctions, reinterpret_cast<BA_ONPLANRELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRELATEDBUNDLE_RESULTS*>(pvResults));
882 break;
883 case BA_FUNCTIONS_MESSAGE_ONPLANPACKAGEBEGIN:
884 hr = BalBaseBAFunctionsProcOnPlanPackageBegin(pBAFunctions, reinterpret_cast<BA_ONPLANPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPACKAGEBEGIN_RESULTS*>(pvResults));
885 break;
886 case BA_FUNCTIONS_MESSAGE_ONPLANPATCHTARGET:
887 hr = BalBaseBAFunctionsProcOnPlanPatchTarget(pBAFunctions, reinterpret_cast<BA_ONPLANPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPATCHTARGET_RESULTS*>(pvResults));
888 break;
889 case BA_FUNCTIONS_MESSAGE_ONPLANMSIFEATURE:
890 hr = BalBaseBAFunctionsProcOnPlanMsiFeature(pBAFunctions, reinterpret_cast<BA_ONPLANMSIFEATURE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANMSIFEATURE_RESULTS*>(pvResults));
891 break;
892 case BA_FUNCTIONS_MESSAGE_ONPLANPACKAGECOMPLETE:
893 hr = BalBaseBAFunctionsProcOnPlanPackageComplete(pBAFunctions, reinterpret_cast<BA_ONPLANPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPACKAGECOMPLETE_RESULTS*>(pvResults));
894 break;
895 case BA_FUNCTIONS_MESSAGE_ONAPPLYBEGIN:
896 hr = BalBaseBAFunctionsProcOnApplyBegin(pBAFunctions, reinterpret_cast<BA_ONAPPLYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYBEGIN_RESULTS*>(pvResults));
897 break;
898 case BA_FUNCTIONS_MESSAGE_ONELEVATEBEGIN:
899 hr = BalBaseBAFunctionsProcOnElevateBegin(pBAFunctions, reinterpret_cast<BA_ONELEVATEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONELEVATEBEGIN_RESULTS*>(pvResults));
900 break;
901 case BA_FUNCTIONS_MESSAGE_ONELEVATECOMPLETE:
902 hr = BalBaseBAFunctionsProcOnElevateComplete(pBAFunctions, reinterpret_cast<BA_ONELEVATECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONELEVATECOMPLETE_RESULTS*>(pvResults));
903 break;
904 case BA_FUNCTIONS_MESSAGE_ONPROGRESS:
905 hr = BalBaseBAFunctionsProcOnProgress(pBAFunctions, reinterpret_cast<BA_ONPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONPROGRESS_RESULTS*>(pvResults));
906 break;
907 case BA_FUNCTIONS_MESSAGE_ONERROR:
908 hr = BalBaseBAFunctionsProcOnError(pBAFunctions, reinterpret_cast<BA_ONERROR_ARGS*>(pvArgs), reinterpret_cast<BA_ONERROR_RESULTS*>(pvResults));
909 break;
910 case BA_FUNCTIONS_MESSAGE_ONREGISTERBEGIN:
911 hr = BalBaseBAFunctionsProcOnRegisterBegin(pBAFunctions, reinterpret_cast<BA_ONREGISTERBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONREGISTERBEGIN_RESULTS*>(pvResults));
912 break;
913 case BA_FUNCTIONS_MESSAGE_ONREGISTERCOMPLETE:
914 hr = BalBaseBAFunctionsProcOnRegisterComplete(pBAFunctions, reinterpret_cast<BA_ONREGISTERCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONREGISTERCOMPLETE_RESULTS*>(pvResults));
915 break;
916 case BA_FUNCTIONS_MESSAGE_ONCACHEBEGIN:
917 hr = BalBaseBAFunctionsProcOnCacheBegin(pBAFunctions, reinterpret_cast<BA_ONCACHEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEBEGIN_RESULTS*>(pvResults));
918 break;
919 case BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGEBEGIN:
920 hr = BalBaseBAFunctionsProcOnCachePackageBegin(pBAFunctions, reinterpret_cast<BA_ONCACHEPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPACKAGEBEGIN_RESULTS*>(pvResults));
921 break;
922 case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREBEGIN:
923 hr = BalBaseBAFunctionsProcOnCacheAcquireBegin(pBAFunctions, reinterpret_cast<BA_ONCACHEACQUIREBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIREBEGIN_RESULTS*>(pvResults));
924 break;
925 case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREPROGRESS:
926 hr = BalBaseBAFunctionsProcOnCacheAcquireProgress(pBAFunctions, reinterpret_cast<BA_ONCACHEACQUIREPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIREPROGRESS_RESULTS*>(pvResults));
927 break;
928 case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRERESOLVING:
929 hr = BalBaseBAFunctionsProcOnCacheAcquireResolving(pBAFunctions, reinterpret_cast<BA_ONCACHEACQUIRERESOLVING_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIRERESOLVING_RESULTS*>(pvResults));
930 break;
931 case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRECOMPLETE:
932 hr = BalBaseBAFunctionsProcOnCacheAcquireComplete(pBAFunctions, reinterpret_cast<BA_ONCACHEACQUIRECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIRECOMPLETE_RESULTS*>(pvResults));
933 break;
934 case BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYBEGIN:
935 hr = BalBaseBAFunctionsProcOnCacheVerifyBegin(pBAFunctions, reinterpret_cast<BA_ONCACHEVERIFYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYBEGIN_RESULTS*>(pvResults));
936 break;
937 case BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYPROGRESS:
938 hr = BalBaseBAFunctionsProcOnCacheVerifyProgress(pBAFunctions, reinterpret_cast<BA_ONCACHEVERIFYPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYPROGRESS_RESULTS*>(pvResults));
939 break;
940 case BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYCOMPLETE:
941 hr = BalBaseBAFunctionsProcOnCacheVerifyComplete(pBAFunctions, reinterpret_cast<BA_ONCACHEVERIFYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYCOMPLETE_RESULTS*>(pvResults));
942 break;
943 case BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGECOMPLETE:
944 hr = BalBaseBAFunctionsProcOnCachePackageComplete(pBAFunctions, reinterpret_cast<BA_ONCACHEPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPACKAGECOMPLETE_RESULTS*>(pvResults));
945 break;
946 case BA_FUNCTIONS_MESSAGE_ONCACHECOMPLETE:
947 hr = BalBaseBAFunctionsProcOnCacheComplete(pBAFunctions, reinterpret_cast<BA_ONCACHECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECOMPLETE_RESULTS*>(pvResults));
948 break;
949 case BA_FUNCTIONS_MESSAGE_ONEXECUTEBEGIN:
950 hr = BalBaseBAFunctionsProcOnExecuteBegin(pBAFunctions, reinterpret_cast<BA_ONEXECUTEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEBEGIN_RESULTS*>(pvResults));
951 break;
952 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGEBEGIN:
953 hr = BalBaseBAFunctionsProcOnExecutePackageBegin(pBAFunctions, reinterpret_cast<BA_ONEXECUTEPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPACKAGEBEGIN_RESULTS*>(pvResults));
954 break;
955 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPATCHTARGET:
956 hr = BalBaseBAFunctionsProcOnExecutePatchTarget(pBAFunctions, reinterpret_cast<BA_ONEXECUTEPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPATCHTARGET_RESULTS*>(pvResults));
957 break;
958 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPROGRESS:
959 hr = BalBaseBAFunctionsProcOnExecuteProgress(pBAFunctions, reinterpret_cast<BA_ONEXECUTEPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPROGRESS_RESULTS*>(pvResults));
960 break;
961 case BA_FUNCTIONS_MESSAGE_ONEXECUTEMSIMESSAGE:
962 hr = BalBaseBAFunctionsProcOnExecuteMsiMessage(pBAFunctions, reinterpret_cast<BA_ONEXECUTEMSIMESSAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEMSIMESSAGE_RESULTS*>(pvResults));
963 break;
964 case BA_FUNCTIONS_MESSAGE_ONEXECUTEFILESINUSE:
965 hr = BalBaseBAFunctionsProcOnExecuteFilesInUse(pBAFunctions, reinterpret_cast<BA_ONEXECUTEFILESINUSE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEFILESINUSE_RESULTS*>(pvResults));
966 break;
967 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGECOMPLETE:
968 hr = BalBaseBAFunctionsProcOnExecutePackageComplete(pBAFunctions, reinterpret_cast<BA_ONEXECUTEPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPACKAGECOMPLETE_RESULTS*>(pvResults));
969 break;
970 case BA_FUNCTIONS_MESSAGE_ONEXECUTECOMPLETE:
971 hr = BalBaseBAFunctionsProcOnExecuteComplete(pBAFunctions, reinterpret_cast<BA_ONEXECUTECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTECOMPLETE_RESULTS*>(pvResults));
972 break;
973 case BA_FUNCTIONS_MESSAGE_ONUNREGISTERBEGIN:
974 hr = BalBaseBAFunctionsProcOnUnregisterBegin(pBAFunctions, reinterpret_cast<BA_ONUNREGISTERBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONUNREGISTERBEGIN_RESULTS*>(pvResults));
975 break;
976 case BA_FUNCTIONS_MESSAGE_ONUNREGISTERCOMPLETE:
977 hr = BalBaseBAFunctionsProcOnUnregisterComplete(pBAFunctions, reinterpret_cast<BA_ONUNREGISTERCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONUNREGISTERCOMPLETE_RESULTS*>(pvResults));
978 break;
979 case BA_FUNCTIONS_MESSAGE_ONAPPLYCOMPLETE:
980 hr = BalBaseBAFunctionsProcOnApplyComplete(pBAFunctions, reinterpret_cast<BA_ONAPPLYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYCOMPLETE_RESULTS*>(pvResults));
981 break;
982 case BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN:
983 hr = BalBaseBAFunctionsProcOnLaunchApprovedExeBegin(pBAFunctions, reinterpret_cast<BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS*>(pvResults));
984 break;
985 case BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE:
986 hr = BalBaseBAFunctionsProcOnLaunchApprovedExeComplete(pBAFunctions, reinterpret_cast<BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS*>(pvResults));
987 break;
988 case BA_FUNCTIONS_MESSAGE_ONPLANMSIPACKAGE:
989 hr = BalBaseBAFunctionsProcOnPlanMsiPackage(pBAFunctions, reinterpret_cast<BA_ONPLANMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANMSIPACKAGE_RESULTS*>(pvResults));
990 break;
991 case BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONBEGIN:
992 hr = BalBaseBAFunctionsProcOnBeginMsiTransactionBegin(pBAFunctions, reinterpret_cast<BA_ONBEGINMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS*>(pvResults));
993 break;
994 case BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE:
995 hr = BalBaseBAFunctionsProcOnBeginMsiTransactionComplete(pBAFunctions, reinterpret_cast<BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults));
996 break;
997 case BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN:
998 hr = BalBaseBAFunctionsProcOnCommitMsiTransactionBegin(pBAFunctions, reinterpret_cast<BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS*>(pvResults));
999 break;
1000 case BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE:
1001 hr = BalBaseBAFunctionsProcOnCommitMsiTransactionComplete(pBAFunctions, reinterpret_cast<BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults));
1002 break;
1003 case BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN:
1004 hr = BalBaseBAFunctionsProcOnRollbackMsiTransactionBegin(pBAFunctions, reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS*>(pvResults));
1005 break;
1006 case BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE:
1007 hr = BalBaseBAFunctionsProcOnRollbackMsiTransactionComplete(pBAFunctions, reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults));
1008 case BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN:
1009 hr = BalBaseBAFunctionsProcOnPauseAutomaticUpdatesBegin(pBAFunctions, reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS*>(pvResults));
1010 break;
1011 case BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE:
1012 hr = BalBaseBAFunctionsProcOnPauseAutomaticUpdatesComplete(pBAFunctions, reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS*>(pvResults));
1013 break;
1014 case BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN:
1015 hr = BalBaseBAFunctionsProcOnSystemRestorePointBegin(pBAFunctions, reinterpret_cast<BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS*>(pvResults));
1016 break;
1017 case BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE:
1018 hr = BalBaseBAFunctionsProcOnSystemRestorePointComplete(pBAFunctions, reinterpret_cast<BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS*>(pvResults));
1019 break;
1020 case BA_FUNCTIONS_MESSAGE_ONPLANNEDPACKAGE:
1021 hr = BalBaseBAFunctionsProcOnPlannedPackage(pBAFunctions, reinterpret_cast<BA_ONPLANNEDPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANNEDPACKAGE_RESULTS*>(pvResults));
1022 break;
1023 case BA_FUNCTIONS_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE:
1024 hr = BalBaseBAFunctionsProcOnPlanForwardCompatibleBundle(pBAFunctions, reinterpret_cast<BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS*>(pvResults));
1025 break;
1026 case BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN:
1027 hr = BalBaseBAFunctionsProcOnCacheContainerOrPayloadVerifyBegin(pBAFunctions, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS*>(pvResults));
1028 break;
1029 case BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS:
1030 hr = BalBaseBAFunctionsProcOnCacheContainerOrPayloadVerifyProgress(pBAFunctions, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS*>(pvResults));
1031 break;
1032 case BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE:
1033 hr = BalBaseBAFunctionsProcOnCacheContainerOrPayloadVerifyComplete(pBAFunctions, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS*>(pvResults));
1034 break;
1035 case BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN:
1036 hr = BalBaseBAFunctionsProcOnCachePayloadExtractBegin(pBAFunctions, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS*>(pvResults));
1037 break;
1038 case BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS:
1039 hr = BalBaseBAFunctionsProcOnCachePayloadExtractProgress(pBAFunctions, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS*>(pvResults));
1040 break;
1041 case BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE:
1042 hr = BalBaseBAFunctionsProcOnCachePayloadExtractComplete(pBAFunctions, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS*>(pvResults));
1043 break;
1044 case BA_FUNCTIONS_MESSAGE_ONPLANROLLBACKBOUNDARY:
1045 hr = BalBaseBAFunctionsProcOnPlanRollbackBoundary(pBAFunctions, reinterpret_cast<BA_ONPLANROLLBACKBOUNDARY_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANROLLBACKBOUNDARY_RESULTS*>(pvResults));
1046 break;
1047 case BA_FUNCTIONS_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE:
1048 hr = BalBaseBAFunctionsProcOnDetectCompatiblePackage(pBAFunctions, reinterpret_cast<BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS*>(pvResults));
1049 break;
1050 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN:
1051 hr = BalBaseBAFunctionsProcOnPlanCompatibleMsiPackageBegin(pBAFunctions, reinterpret_cast<BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS*>(pvResults));
1052 break;
1053 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE:
1054 hr = BalBaseBAFunctionsProcOnPlanCompatibleMsiPackageComplete(pBAFunctions, reinterpret_cast<BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS*>(pvResults));
1055 break;
1056 case BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE:
1057 hr = BalBaseBAFunctionsProcOnPlannedCompatiblePackage(pBAFunctions, reinterpret_cast<BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS*>(pvResults));
1058 break;
1059 case BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE:
1060 hr = BalBaseBAFunctionsProcOnPlanRestoreRelatedBundle(pBAFunctions, reinterpret_cast<BA_ONPLANRESTORERELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRESTORERELATEDBUNDLE_RESULTS*>(pvResults));
1061 break;
1062 case BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE:
1063 hr = BalBaseBAFunctionsProcOnPlanRelatedBundleType(pBAFunctions, reinterpret_cast<BA_ONPLANRELATEDBUNDLETYPE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRELATEDBUNDLETYPE_RESULTS*>(pvResults));
1064 break;
1065 case BA_FUNCTIONS_MESSAGE_ONAPPLYDOWNGRADE:
1066 hr = BalBaseBAFunctionsProcOnApplyDowngrade(pBAFunctions, reinterpret_cast<BA_ONAPPLYDOWNGRADE_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYDOWNGRADE_RESULTS*>(pvResults));
1067 break;
1068 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPROCESSCANCEL:
1069 hr = BalBaseBAFunctionsProcOnExecuteProcessCancel(pBAFunctions, reinterpret_cast<BA_ONEXECUTEPROCESSCANCEL_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPROCESSCANCEL_RESULTS*>(pvResults));
1070 break;
1071 case BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE:
1072 hr = BalBaseBAFunctionsProcOnDetectRelatedBundlePackage(pBAFunctions, reinterpret_cast<BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS*>(pvResults));
1073 break;
1074 case BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE:
1075 hr = BalBaseBAFunctionsProcOnCachePackageNonVitalValidationFailure(pBAFunctions, reinterpret_cast<BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS*>(pvResults));
1076 break;
1077 case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED:
1078 hr = BalBaseBAFunctionsProcOnThemeLoaded(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMELOADED_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMELOADED_RESULTS*>(pvResults));
1079 break;
1080 case BA_FUNCTIONS_MESSAGE_WNDPROC:
1081 hr = BalBaseBAFunctionsProcWndProc(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_WNDPROC_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_WNDPROC_RESULTS*>(pvResults));
1082 break;
1083 case BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADING:
1084 hr = BalBaseBAFunctionsProcOnThemeControlLoading(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLLOADING_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS*>(pvResults));
1085 break;
1086 case BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLWMCOMMAND:
1087 hr = BalBaseBAFunctionsProcOnThemeControlWmCommand(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_RESULTS*>(pvResults));
1088 break;
1089 case BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLWMNOTIFY:
1090 hr = BalBaseBAFunctionsProcOnThemeControlWmNotify(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_RESULTS*>(pvResults));
1091 break;
1092 case BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADED:
1093 hr = BalBaseBAFunctionsProcOnThemeControlLoaded(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLLOADED_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLLOADED_RESULTS*>(pvResults));
1094 break;
1095 }
1096 }
1097
1098 return hr;
1099}
diff --git a/src/api/burn/balutil/BalBootstrapperEngine.cpp b/src/api/burn/balutil/BalBootstrapperEngine.cpp
index be53c6b9..b924906e 100644
--- a/src/api/burn/balutil/BalBootstrapperEngine.cpp
+++ b/src/api/burn/balutil/BalBootstrapperEngine.cpp
@@ -2,7 +2,6 @@
2 2
3#include "precomp.h" 3#include "precomp.h"
4 4
5
6class CBalBootstrapperEngine : public IBootstrapperEngine 5class CBalBootstrapperEngine : public IBootstrapperEngine
7{ 6{
8public: // IUnknown 7public: // IUnknown
@@ -64,18 +63,44 @@ public: // IBootstrapperEngine
64 HRESULT hr = S_OK; 63 HRESULT hr = S_OK;
65 BAENGINE_GETPACKAGECOUNT_ARGS args = { }; 64 BAENGINE_GETPACKAGECOUNT_ARGS args = { };
66 BAENGINE_GETPACKAGECOUNT_RESULTS results = { }; 65 BAENGINE_GETPACKAGECOUNT_RESULTS results = { };
66 BUFF_BUFFER bufferArgs = { };
67 BUFF_BUFFER bufferResults = { };
68 PIPE_RPC_RESULT rpc = { };
69 SIZE_T iBuffer = 0;
67 70
68 ExitOnNull(pcPackages, hr, E_INVALIDARG, "pcPackages is required"); 71 ExitOnNull(pcPackages, hr, E_INVALIDARG, "pcPackages is required");
69 72
70 args.cbSize = sizeof(args); 73 // Init send structs.
74 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
75
76 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
77
78 // Send args.
79 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
80 ExitOnFailure(hr, "Failed to write API version of GetPackageCount args.");
81
82 // Send results.
83 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
84 ExitOnFailure(hr, "Failed to write API version of GetPackageCount results.");
85
86 // Get results.
87 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT, &bufferArgs, &bufferResults, &rpc);
88 ExitOnFailure(hr, "BA GetPackageCount failed.");
71 89
72 results.cbSize = sizeof(results); 90 // Read results.
91 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
92 ExitOnFailure(hr, "Failed to read value length from GetPackageCount results.");
73 93
74 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT, &args, &results, m_pvBAEngineProcContext); 94 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, (DWORD*)&results.cPackages);
95 ExitOnFailure(hr, "Failed to read value length from GetPackageCount results.");
75 96
76 *pcPackages = results.cPackages; 97 *pcPackages = results.cPackages;
77 98
78 LExit: 99 LExit:
100 PipeFreeRpcResult(&rpc);
101 ReleaseBuffer(bufferResults);
102 ReleaseBuffer(bufferArgs);
103
79 return hr; 104 return hr;
80 } 105 }
81 106
@@ -87,20 +112,50 @@ public: // IBootstrapperEngine
87 HRESULT hr = S_OK; 112 HRESULT hr = S_OK;
88 BAENGINE_GETVARIABLENUMERIC_ARGS args = { }; 113 BAENGINE_GETVARIABLENUMERIC_ARGS args = { };
89 BAENGINE_GETVARIABLENUMERIC_RESULTS results = { }; 114 BAENGINE_GETVARIABLENUMERIC_RESULTS results = { };
115 BUFF_BUFFER bufferArgs = { };
116 BUFF_BUFFER bufferResults = { };
117 PIPE_RPC_RESULT rpc = { };
118 SIZE_T iBuffer = 0;
119 LPWSTR sczValue = NULL;
90 120
91 ExitOnNull(pllValue, hr, E_INVALIDARG, "pllValue is required"); 121 ExitOnNull(pllValue, hr, E_INVALIDARG, "pllValue is required");
92 122
93 args.cbSize = sizeof(args); 123 // Init send structs.
124 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
94 args.wzVariable = wzVariable; 125 args.wzVariable = wzVariable;
95 126
96 results.cbSize = sizeof(results); 127 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
128
129 // Send args.
130 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
131 ExitOnFailure(hr, "Failed to write API version of GetVariableNumeric args.");
132
133 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVariable);
134 ExitOnFailure(hr, "Failed to write variable name of GetVariableNumeric args.");
135
136 // Send results.
137 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
138 ExitOnFailure(hr, "Failed to write API version of GetVariableNumeric results.");
97 139
98 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC, &args, &results, m_pvBAEngineProcContext); 140 // Get results.
141 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC, &bufferArgs, &bufferResults, &rpc);
142 ExitOnFailure(hr, "BA GetVariableNumeric failed.");
143
144 // Read results.
145 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
146 ExitOnFailure(hr, "Failed to read value length from GetVariableNumeric results.");
147
148 hr = BuffReadNumber64(rpc.pbData, rpc.cbData, &iBuffer, (DWORD64*)&results.llValue);
149 ExitOnFailure(hr, "Failed to read value length from GetVariableNumeric results.");
99 150
100 *pllValue = results.llValue; 151 *pllValue = results.llValue;
101 152
102 LExit: 153 LExit:
103 SecureZeroMemory(&results, sizeof(results)); 154 ReleaseStr(sczValue);
155 PipeFreeRpcResult(&rpc);
156 ReleaseBuffer(bufferResults);
157 ReleaseBuffer(bufferArgs);
158
104 return hr; 159 return hr;
105 } 160 }
106 161
@@ -113,21 +168,69 @@ public: // IBootstrapperEngine
113 HRESULT hr = S_OK; 168 HRESULT hr = S_OK;
114 BAENGINE_GETVARIABLESTRING_ARGS args = { }; 169 BAENGINE_GETVARIABLESTRING_ARGS args = { };
115 BAENGINE_GETVARIABLESTRING_RESULTS results = { }; 170 BAENGINE_GETVARIABLESTRING_RESULTS results = { };
171 BUFF_BUFFER bufferArgs = { };
172 BUFF_BUFFER bufferResults = { };
173 PIPE_RPC_RESULT rpc = { };
174 SIZE_T iBuffer = 0;
175 LPWSTR sczValue = NULL;
116 176
117 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); 177 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required");
118 178
119 args.cbSize = sizeof(args); 179 // Init send structs.
180 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
120 args.wzVariable = wzVariable; 181 args.wzVariable = wzVariable;
121 182
122 results.cbSize = sizeof(results); 183 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
123 results.wzValue = wzValue; 184 results.cchValue = static_cast<DWORD>(*pcchValue);
124 results.cchValue = *pcchValue; 185
186 // Send args.
187 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
188 ExitOnFailure(hr, "Failed to write API version of GetVariableString args.");
189
190 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVariable);
191 ExitOnFailure(hr, "Failed to write variable name of GetVariableString args.");
192
193 // Send results.
194 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
195 ExitOnFailure(hr, "Failed to write API version of GetVariableString results.");
196
197 hr = BuffWriteNumberToBuffer(&bufferResults, results.cchValue);
198 ExitOnFailure(hr, "Failed to write API version of GetVariableString results value.");
199
200 // Get results.
201 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING, &bufferArgs, &bufferResults, &rpc);
202 ExitOnFailure(hr, "BA GetVariableString failed.");
203
204 // Read results.
205 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
206 ExitOnFailure(hr, "Failed to read value length from GetVariableString results.");
125 207
126 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING, &args, &results, m_pvBAEngineProcContext); 208 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.cchValue);
209 ExitOnFailure(hr, "Failed to read value length from GetVariableString results.");
210
211 hr = BuffReadString(rpc.pbData, rpc.cbData, &iBuffer, &sczValue);
212 ExitOnFailure(hr, "Failed to read value from GetVariableString results.");
213
214 results.wzValue = sczValue;
215
216 if (wzValue)
217 {
218 hr = ::StringCchCopyW(wzValue, *pcchValue, results.wzValue);
219 }
220 else if (results.cchValue)
221 {
222 hr = E_MOREDATA;
223 }
127 224
128 *pcchValue = results.cchValue; 225 *pcchValue = results.cchValue;
226 ExitOnFailure(hr, "Failed to copy value from GetVariableString results.");
129 227
130 LExit: 228 LExit:
229 ReleaseStr(sczValue);
230 PipeFreeRpcResult(&rpc);
231 ReleaseBuffer(bufferResults);
232 ReleaseBuffer(bufferArgs);
233
131 return hr; 234 return hr;
132 } 235 }
133 236
@@ -140,21 +243,70 @@ public: // IBootstrapperEngine
140 HRESULT hr = S_OK; 243 HRESULT hr = S_OK;
141 BAENGINE_GETVARIABLEVERSION_ARGS args = { }; 244 BAENGINE_GETVARIABLEVERSION_ARGS args = { };
142 BAENGINE_GETVARIABLEVERSION_RESULTS results = { }; 245 BAENGINE_GETVARIABLEVERSION_RESULTS results = { };
246 BUFF_BUFFER bufferArgs = { };
247 BUFF_BUFFER bufferResults = { };
248 PIPE_RPC_RESULT rpc = { };
249 SIZE_T iBuffer = 0;
250 LPWSTR sczValue = NULL;
143 251
144 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); 252 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required");
145 253
146 args.cbSize = sizeof(args); 254 // Init send structs.
255 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
147 args.wzVariable = wzVariable; 256 args.wzVariable = wzVariable;
148 257
149 results.cbSize = sizeof(results); 258 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
150 results.wzValue = wzValue; 259 hr = DutilSizetToDword(*pcchValue, &results.cchValue);
151 results.cchValue = *pcchValue; 260 ExitOnFailure(hr, "Failed to convert pcchValue to DWORD.");
261
262 // Send args.
263 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
264 ExitOnFailure(hr, "Failed to write API version of GetVariableVersion args.");
152 265
153 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLEVERSION, &args, &results, m_pvBAEngineProcContext); 266 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVariable);
267 ExitOnFailure(hr, "Failed to write variable name of GetVariableVersion args.");
268
269 // Send results.
270 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
271 ExitOnFailure(hr, "Failed to write API version of GetVariableVersion results.");
272
273 hr = BuffWriteNumberToBuffer(&bufferResults, results.cchValue);
274 ExitOnFailure(hr, "Failed to write API version of GetVariableVersion results value.");
275
276 // Get results.
277 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLEVERSION, &bufferArgs, &bufferResults, &rpc);
278 ExitOnFailure(hr, "BA GetVariableVersion failed.");
279
280 // Read results.
281 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
282 ExitOnFailure(hr, "Failed to read value length from GetVariableVersion results.");
283
284 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.cchValue);
285 ExitOnFailure(hr, "Failed to read value length from GetVariableVersion results.");
286
287 hr = BuffReadString(rpc.pbData, rpc.cbData, &iBuffer, &sczValue);
288 ExitOnFailure(hr, "Failed to read value from GetVariableVersion results.");
289
290 results.wzValue = sczValue;
291
292 if (wzValue)
293 {
294 hr = ::StringCchCopyW(wzValue, *pcchValue, results.wzValue);
295 }
296 else if (results.cchValue)
297 {
298 hr = E_MOREDATA;
299 }
154 300
155 *pcchValue = results.cchValue; 301 *pcchValue = results.cchValue;
302 ExitOnFailure(hr, "Failed to copy value from GetVariableVersion results.");
156 303
157 LExit: 304 LExit:
305 ReleaseStr(sczValue);
306 PipeFreeRpcResult(&rpc);
307 ReleaseBuffer(bufferResults);
308 ReleaseBuffer(bufferArgs);
309
158 return hr; 310 return hr;
159 } 311 }
160 312
@@ -168,21 +320,74 @@ public: // IBootstrapperEngine
168 HRESULT hr = S_OK; 320 HRESULT hr = S_OK;
169 BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS args = { }; 321 BAENGINE_GETRELATEDBUNDLEVARIABLE_ARGS args = { };
170 BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS results = { }; 322 BAENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS results = { };
323 BUFF_BUFFER bufferArgs = { };
324 BUFF_BUFFER bufferResults = { };
325 PIPE_RPC_RESULT rpc = { };
326 SIZE_T iBuffer = 0;
327 LPWSTR sczValue = NULL;
171 328
172 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); 329 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required");
173 330
174 args.cbSize = sizeof(args); 331 // Init send structs.
332 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
175 args.wzBundleId = wzBundleId; 333 args.wzBundleId = wzBundleId;
176 args.wzVariable = wzVariable; 334 args.wzVariable = wzVariable;
177 335
178 results.cbSize = sizeof(results); 336 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
179 results.wzValue = wzValue; 337 hr = DutilSizetToDword(*pcchValue, &results.cchValue);
180 results.cchValue = *pcchValue; 338 ExitOnFailure(hr, "Failed to convert pcchValue to DWORD.");
339
340 // Send args.
341 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
342 ExitOnFailure(hr, "Failed to write API version of GetRelatedBundleVariable args.");
343
344 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId);
345 ExitOnFailure(hr, "Failed to write bundle id of GetRelatedBundleVariable args.");
346
347 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVariable);
348 ExitOnFailure(hr, "Failed to write variable name of GetRelatedBundleVariable args.");
349
350 // Send results.
351 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
352 ExitOnFailure(hr, "Failed to write API version of GetRelatedBundleVariable results.");
353
354 hr = BuffWriteNumberToBuffer(&bufferResults, results.cchValue);
355 ExitOnFailure(hr, "Failed to write API version of GetRelatedBundleVariable results value.");
181 356
182 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, &args, &results, m_pvBAEngineProcContext); 357 // Get results.
358 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, &bufferArgs, &bufferResults, &rpc);
359 ExitOnFailure(hr, "BA GetRelatedBundleVariable failed.");
360
361 // Read results.
362 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
363 ExitOnFailure(hr, "Failed to read value length from GetRelatedBundleVariable results.");
364
365 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.cchValue);
366 ExitOnFailure(hr, "Failed to read value length from GetRelatedBundleVariable results.");
367
368 hr = BuffReadString(rpc.pbData, rpc.cbData, &iBuffer, &sczValue);
369 ExitOnFailure(hr, "Failed to read value from GetRelatedBundleVariable results.");
370
371 results.wzValue = sczValue;
372
373 if (wzValue)
374 {
375 hr = ::StringCchCopyW(wzValue, *pcchValue, results.wzValue);
376 }
377 else if (results.cchValue)
378 {
379 hr = E_MOREDATA;
380 }
183 381
184 *pcchValue = results.cchValue; 382 *pcchValue = results.cchValue;
383 ExitOnFailure(hr, "Failed to copy value from GetRelatedBundleVariable results.");
384
185 LExit: 385 LExit:
386 ReleaseStr(sczValue);
387 PipeFreeRpcResult(&rpc);
388 ReleaseBuffer(bufferResults);
389 ReleaseBuffer(bufferArgs);
390
186 return hr; 391 return hr;
187 } 392 }
188 393
@@ -195,21 +400,70 @@ public: // IBootstrapperEngine
195 HRESULT hr = S_OK; 400 HRESULT hr = S_OK;
196 BAENGINE_FORMATSTRING_ARGS args = { }; 401 BAENGINE_FORMATSTRING_ARGS args = { };
197 BAENGINE_FORMATSTRING_RESULTS results = { }; 402 BAENGINE_FORMATSTRING_RESULTS results = { };
403 BUFF_BUFFER bufferArgs = { };
404 BUFF_BUFFER bufferResults = { };
405 PIPE_RPC_RESULT rpc = { };
406 SIZE_T iBuffer = 0;
407 LPWSTR sczOut = NULL;
198 408
199 ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); 409 ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required");
200 410
201 args.cbSize = sizeof(args); 411 // Init send structs.
412 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
202 args.wzIn = wzIn; 413 args.wzIn = wzIn;
203 414
204 results.cbSize = sizeof(results); 415 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
205 results.wzOut = wzOut; 416 hr = DutilSizetToDword(*pcchOut, &results.cchOut);
206 results.cchOut = *pcchOut; 417 ExitOnFailure(hr, "Failed to convert pcchOut to DWORD.");
418
419 // Send args.
420 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
421 ExitOnFailure(hr, "Failed to write API version of FormatString args.");
422
423 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzIn);
424 ExitOnFailure(hr, "Failed to write string to format of FormatString args.");
425
426 // Send results.
427 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
428 ExitOnFailure(hr, "Failed to write API version of FormatString results.");
429
430 hr = BuffWriteNumberToBuffer(&bufferResults, results.cchOut);
431 ExitOnFailure(hr, "Failed to write format string maximum size of FormatString results value.");
432
433 // Get results.
434 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_FORMATSTRING, &bufferArgs, &bufferResults, &rpc);
435 ExitOnFailure(hr, "BA FormatString failed.");
436
437 // Read results.
438 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
439 ExitOnFailure(hr, "Failed to read size from FormatString results.");
440
441 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.cchOut);
442 ExitOnFailure(hr, "Failed to read formatted string length from FormatString results.");
207 443
208 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_FORMATSTRING, &args, &results, m_pvBAEngineProcContext); 444 hr = BuffReadString(rpc.pbData, rpc.cbData, &iBuffer, &sczOut);
445 ExitOnFailure(hr, "Failed to read formatted string from FormatString results.");
446
447 results.wzOut = sczOut;
448
449 if (wzOut)
450 {
451 hr = ::StringCchCopyW(wzOut, *pcchOut, results.wzOut);
452 }
453 else if (results.cchOut)
454 {
455 hr = E_MOREDATA;
456 }
209 457
210 *pcchOut = results.cchOut; 458 *pcchOut = results.cchOut;
459 ExitOnFailure(hr, "Failed to copy formatted string from FormatString results.");
211 460
212 LExit: 461 LExit:
462 ReleaseStr(sczOut);
463 PipeFreeRpcResult(&rpc);
464 ReleaseBuffer(bufferResults);
465 ReleaseBuffer(bufferArgs);
466
213 return hr; 467 return hr;
214 } 468 }
215 469
@@ -222,21 +476,70 @@ public: // IBootstrapperEngine
222 HRESULT hr = S_OK; 476 HRESULT hr = S_OK;
223 BAENGINE_ESCAPESTRING_ARGS args = { }; 477 BAENGINE_ESCAPESTRING_ARGS args = { };
224 BAENGINE_ESCAPESTRING_RESULTS results = { }; 478 BAENGINE_ESCAPESTRING_RESULTS results = { };
479 BUFF_BUFFER bufferArgs = { };
480 BUFF_BUFFER bufferResults = { };
481 PIPE_RPC_RESULT rpc = { };
482 SIZE_T iBuffer = 0;
483 LPWSTR sczOut = NULL;
225 484
226 ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); 485 ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required");
227 486
228 args.cbSize = sizeof(args); 487 // Init send structs.
488 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
229 args.wzIn = wzIn; 489 args.wzIn = wzIn;
230 490
231 results.cbSize = sizeof(results); 491 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
232 results.wzOut = wzOut; 492 hr = DutilSizetToDword(*pcchOut, &results.cchOut);
233 results.cchOut = *pcchOut; 493 ExitOnFailure(hr, "Failed to convert pcchOut to DWORD.");
494
495 // Send args.
496 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
497 ExitOnFailure(hr, "Failed to write API version of EscapeString args.");
234 498
235 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_ESCAPESTRING, &args, &results, m_pvBAEngineProcContext); 499 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzIn);
500 ExitOnFailure(hr, "Failed to write string to escape of EscapeString args.");
501
502 // Send results.
503 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
504 ExitOnFailure(hr, "Failed to write API version of EscapeString results.");
505
506 hr = BuffWriteNumberToBuffer(&bufferResults, results.cchOut);
507 ExitOnFailure(hr, "Failed to write escape string maximum size of EscapeString results value.");
508
509 // Get results.
510 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_ESCAPESTRING, &bufferArgs, &bufferResults, &rpc);
511 ExitOnFailure(hr, "BA EscapeString failed.");
512
513 // Read results.
514 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
515 ExitOnFailure(hr, "Failed to read size from EscapeString results.");
516
517 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.cchOut);
518 ExitOnFailure(hr, "Failed to read escaped string length from EscapeString results.");
519
520 hr = BuffReadString(rpc.pbData, rpc.cbData, &iBuffer, &sczOut);
521 ExitOnFailure(hr, "Failed to read escaped string from EscapeString results.");
522
523 results.wzOut = sczOut;
524
525 if (wzOut)
526 {
527 hr = ::StringCchCopyW(wzOut, *pcchOut, results.wzOut);
528 }
529 else if (results.cchOut)
530 {
531 hr = E_MOREDATA;
532 }
236 533
237 *pcchOut = results.cchOut; 534 *pcchOut = results.cchOut;
535 ExitOnFailure(hr, "Failed to copy escaped string from EscapeString results.");
238 536
239 LExit: 537 LExit:
538 ReleaseStr(sczOut);
539 PipeFreeRpcResult(&rpc);
540 ReleaseBuffer(bufferResults);
541 ReleaseBuffer(bufferArgs);
542
240 return hr; 543 return hr;
241 } 544 }
242 545
@@ -248,19 +551,56 @@ public: // IBootstrapperEngine
248 HRESULT hr = S_OK; 551 HRESULT hr = S_OK;
249 BAENGINE_EVALUATECONDITION_ARGS args = { }; 552 BAENGINE_EVALUATECONDITION_ARGS args = { };
250 BAENGINE_EVALUATECONDITION_RESULTS results = { }; 553 BAENGINE_EVALUATECONDITION_RESULTS results = { };
554 BUFF_BUFFER bufferArgs = { };
555 BUFF_BUFFER bufferResults = { };
556 PIPE_RPC_RESULT rpc = { };
557 SIZE_T iBuffer = 0;
251 558
559 ExitOnNull(wzCondition, hr, E_INVALIDARG, "wzCondition is required");
252 ExitOnNull(pf, hr, E_INVALIDARG, "pf is required"); 560 ExitOnNull(pf, hr, E_INVALIDARG, "pf is required");
253 561
254 args.cbSize = sizeof(args); 562 // Empty condition evaluates to true.
563 if (!*wzCondition)
564 {
565 *pf = TRUE;
566 ExitFunction();
567 }
568
569 // Init send structs.
570 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
255 args.wzCondition = wzCondition; 571 args.wzCondition = wzCondition;
256 572
257 results.cbSize = sizeof(results); 573 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
574
575 // Send args.
576 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
577 ExitOnFailure(hr, "Failed to write API version of EvaluateCondition args.");
578
579 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzCondition);
580 ExitOnFailure(hr, "Failed to write condition of EvaluateCondition args.");
258 581
259 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_EVALUATECONDITION, &args, &results, m_pvBAEngineProcContext); 582 // Send results.
583 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
584 ExitOnFailure(hr, "Failed to write API version of EvaluateCondition results.");
585
586 // Get results.
587 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_EVALUATECONDITION, &bufferArgs, &bufferResults, &rpc);
588 ExitOnFailure(hr, "BA EvaluateCondition failed.");
589
590 // Read results.
591 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
592 ExitOnFailure(hr, "Failed to read size from EvaluateCondition results.");
593
594 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.f));
595 ExitOnFailure(hr, "Failed to read result from EvaluateCondition results.");
260 596
261 *pf = results.f; 597 *pf = results.f;
262 598
263 LExit: 599 LExit:
600 PipeFreeRpcResult(&rpc);
601 ReleaseBuffer(bufferResults);
602 ReleaseBuffer(bufferArgs);
603
264 return hr; 604 return hr;
265 } 605 }
266 606
@@ -269,16 +609,44 @@ public: // IBootstrapperEngine
269 __in_z LPCWSTR wzMessage 609 __in_z LPCWSTR wzMessage
270 ) 610 )
271 { 611 {
612 HRESULT hr = S_OK;
272 BAENGINE_LOG_ARGS args = { }; 613 BAENGINE_LOG_ARGS args = { };
273 BAENGINE_LOG_RESULTS results = { }; 614 BAENGINE_LOG_RESULTS results = { };
615 BUFF_BUFFER bufferArgs = { };
616 BUFF_BUFFER bufferResults = { };
617 PIPE_RPC_RESULT rpc = { };
274 618
275 args.cbSize = sizeof(args); 619 // Init send structs.
620 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
276 args.level = level; 621 args.level = level;
277 args.wzMessage = wzMessage; 622 args.wzMessage = wzMessage;
278 623
279 results.cbSize = sizeof(results); 624 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
625
626 // Send args.
627 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
628 ExitOnFailure(hr, "Failed to write API version of Log args.");
629
630 hr = BuffWriteNumberToBuffer(&bufferArgs, args.level);
631 ExitOnFailure(hr, "Failed to write level of Log args.");
632
633 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzMessage);
634 ExitOnFailure(hr, "Failed to write message of Log args.");
635
636 // Send results.
637 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
638 ExitOnFailure(hr, "Failed to write API version of Log results.");
280 639
281 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_LOG, &args, &results, m_pvBAEngineProcContext); 640 // Get results.
641 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_LOG, &bufferArgs, &bufferResults, &rpc);
642 ExitOnFailure(hr, "BA Log failed.");
643
644 LExit:
645 PipeFreeRpcResult(&rpc);
646 ReleaseBuffer(bufferResults);
647 ReleaseBuffer(bufferArgs);
648
649 return hr;
282 } 650 }
283 651
284 virtual STDMETHODIMP SendEmbeddedError( 652 virtual STDMETHODIMP SendEmbeddedError(
@@ -291,21 +659,56 @@ public: // IBootstrapperEngine
291 HRESULT hr = S_OK; 659 HRESULT hr = S_OK;
292 BAENGINE_SENDEMBEDDEDERROR_ARGS args = { }; 660 BAENGINE_SENDEMBEDDEDERROR_ARGS args = { };
293 BAENGINE_SENDEMBEDDEDERROR_RESULTS results = { }; 661 BAENGINE_SENDEMBEDDEDERROR_RESULTS results = { };
662 BUFF_BUFFER bufferArgs = { };
663 BUFF_BUFFER bufferResults = { };
664 PIPE_RPC_RESULT rpc = { };
665 SIZE_T iBuffer = 0;
294 666
295 ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); 667 ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required");
296 668
297 args.cbSize = sizeof(args); 669 // Init send structs.
670 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
298 args.dwErrorCode = dwErrorCode; 671 args.dwErrorCode = dwErrorCode;
299 args.wzMessage = wzMessage; 672 args.wzMessage = wzMessage;
300 args.dwUIHint = dwUIHint; 673 args.dwUIHint = dwUIHint;
301 674
302 results.cbSize = sizeof(results); 675 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
676
677 // Send args.
678 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
679 ExitOnFailure(hr, "Failed to write API version of SendEmbeddedError args.");
680
681 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwErrorCode);
682 ExitOnFailure(hr, "Failed to write error code of SendEmbeddedError args.");
683
684 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzMessage);
685 ExitOnFailure(hr, "Failed to write message of SendEmbeddedError args.");
686
687 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwUIHint);
688 ExitOnFailure(hr, "Failed to write UI hint of SendEmbeddedError args.");
689
690 // Send results.
691 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
692 ExitOnFailure(hr, "Failed to write API version of SendEmbeddedError results.");
303 693
304 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDERROR, &args, &results, m_pvBAEngineProcContext); 694 // Get results.
695 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDERROR, &bufferArgs, &bufferResults, &rpc);
696 ExitOnFailure(hr, "BA SendEmbeddedError failed.");
697
698 // Read results.
699 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
700 ExitOnFailure(hr, "Failed to read size from SendEmbeddedError results.");
701
702 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.nResult));
703 ExitOnFailure(hr, "Failed to read result from SendEmbeddedError results.");
305 704
306 *pnResult = results.nResult; 705 *pnResult = results.nResult;
307 706
308 LExit: 707 LExit:
708 PipeFreeRpcResult(&rpc);
709 ReleaseBuffer(bufferResults);
710 ReleaseBuffer(bufferArgs);
711
309 return hr; 712 return hr;
310 } 713 }
311 714
@@ -318,20 +721,52 @@ public: // IBootstrapperEngine
318 HRESULT hr = S_OK; 721 HRESULT hr = S_OK;
319 BAENGINE_SENDEMBEDDEDPROGRESS_ARGS args = { }; 722 BAENGINE_SENDEMBEDDEDPROGRESS_ARGS args = { };
320 BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS results = { }; 723 BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS results = { };
724 BUFF_BUFFER bufferArgs = { };
725 BUFF_BUFFER bufferResults = { };
726 PIPE_RPC_RESULT rpc = { };
727 SIZE_T iBuffer = 0;
321 728
322 ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); 729 ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required");
323 730
324 args.cbSize = sizeof(args); 731 // Init send structs.
732 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
325 args.dwProgressPercentage = dwProgressPercentage; 733 args.dwProgressPercentage = dwProgressPercentage;
326 args.dwOverallProgressPercentage = dwOverallProgressPercentage; 734 args.dwOverallProgressPercentage = dwOverallProgressPercentage;
327 735
328 results.cbSize = sizeof(results); 736 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
737
738 // Send args.
739 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
740 ExitOnFailure(hr, "Failed to write API version of SendEmbeddedProgress args.");
741
742 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwProgressPercentage);
743 ExitOnFailure(hr, "Failed to write progress of SendEmbeddedProgress args.");
744
745 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwOverallProgressPercentage);
746 ExitOnFailure(hr, "Failed to write overall progress of SendEmbeddedProgress args.");
747
748 // Send results.
749 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
750 ExitOnFailure(hr, "Failed to write API version of SendEmbeddedProgress results.");
751
752 // Get results.
753 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDPROGRESS, &bufferArgs, &bufferResults, &rpc);
754 ExitOnFailure(hr, "BA SendEmbeddedProgress failed.");
755
756 // Read results.
757 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
758 ExitOnFailure(hr, "Failed to read size from SendEmbeddedProgress results.");
329 759
330 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDPROGRESS, &args, &results, m_pvBAEngineProcContext); 760 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.nResult));
761 ExitOnFailure(hr, "Failed to read result from SendEmbeddedProgress results.");
331 762
332 *pnResult = results.nResult; 763 *pnResult = results.nResult;
333 764
334 LExit: 765 LExit:
766 PipeFreeRpcResult(&rpc);
767 ReleaseBuffer(bufferResults);
768 ReleaseBuffer(bufferArgs);
769
335 return hr; 770 return hr;
336 } 771 }
337 772
@@ -340,22 +775,67 @@ public: // IBootstrapperEngine
340 __in_z_opt LPCWSTR wzDownloadSource, 775 __in_z_opt LPCWSTR wzDownloadSource,
341 __in DWORD64 qwSize, 776 __in DWORD64 qwSize,
342 __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashType, 777 __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashType,
343 __in_z_opt LPCWSTR wzHash 778 __in_z_opt LPCWSTR wzHash,
779 __in_z_opt LPCWSTR wzUpdatePackageId
344 ) 780 )
345 { 781 {
782 HRESULT hr = S_OK;
346 BAENGINE_SETUPDATE_ARGS args = { }; 783 BAENGINE_SETUPDATE_ARGS args = { };
347 BAENGINE_SETUPDATE_RESULTS results = { }; 784 BAENGINE_SETUPDATE_RESULTS results = { };
785 BUFF_BUFFER bufferArgs = { };
786 BUFF_BUFFER bufferResults = { };
787 PIPE_RPC_RESULT rpc = { };
348 788
349 args.cbSize = sizeof(args); 789 // Init send structs.
790 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
350 args.wzLocalSource = wzLocalSource; 791 args.wzLocalSource = wzLocalSource;
351 args.wzDownloadSource = wzDownloadSource; 792 args.wzDownloadSource = wzDownloadSource;
352 args.qwSize = qwSize; 793 args.qwSize = qwSize;
353 args.hashType = hashType; 794 args.hashType = hashType;
354 args.wzHash = wzHash; 795 args.wzHash = wzHash;
796 args.wzUpdatePackageId = wzUpdatePackageId;
797
798 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
799
800 // Send args.
801 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
802 ExitOnFailure(hr, "Failed to write API version of SetUpdate args.");
803
804 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzLocalSource);
805 ExitOnFailure(hr, "Failed to write local source of SetUpdate args.");
806
807 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzDownloadSource);
808 ExitOnFailure(hr, "Failed to write download source of SetUpdate args.");
809
810 hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.qwSize);
811 ExitOnFailure(hr, "Failed to write udpate size of SetUpdate args.");
812
813 hr = BuffWriteNumberToBuffer(&bufferArgs, static_cast<DWORD>(args.hashType));
814 ExitOnFailure(hr, "Failed to write hash type of SetUpdate args.");
815
816 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzHash);
817 ExitOnFailure(hr, "Failed to write hash of SetUpdate args.");
355 818
356 results.cbSize = sizeof(results); 819 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzHash);
820 ExitOnFailure(hr, "Failed to write hash of SetUpdate args.");
357 821
358 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATE, &args, &results, m_pvBAEngineProcContext); 822 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzUpdatePackageId);
823 ExitOnFailure(hr, "Failed to write update package id to SetUpdate args.");
824
825 // Send results.
826 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
827 ExitOnFailure(hr, "Failed to write API version of SetUpdate results.");
828
829 // Get results.
830 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATE, &bufferArgs, &bufferResults, &rpc);
831 ExitOnFailure(hr, "BA SetUpdate failed.");
832
833 LExit:
834 PipeFreeRpcResult(&rpc);
835 ReleaseBuffer(bufferResults);
836 ReleaseBuffer(bufferArgs);
837
838 return hr;
359 } 839 }
360 840
361 virtual STDMETHODIMP SetLocalSource( 841 virtual STDMETHODIMP SetLocalSource(
@@ -364,17 +844,48 @@ public: // IBootstrapperEngine
364 __in_z LPCWSTR wzPath 844 __in_z LPCWSTR wzPath
365 ) 845 )
366 { 846 {
847 HRESULT hr = S_OK;
367 BAENGINE_SETLOCALSOURCE_ARGS args = { }; 848 BAENGINE_SETLOCALSOURCE_ARGS args = { };
368 BAENGINE_SETLOCALSOURCE_RESULTS results = { }; 849 BAENGINE_SETLOCALSOURCE_RESULTS results = { };
850 BUFF_BUFFER bufferArgs = { };
851 BUFF_BUFFER bufferResults = { };
852 PIPE_RPC_RESULT rpc = { };
369 853
370 args.cbSize = sizeof(args); 854 // Init send structs.
855 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
371 args.wzPackageOrContainerId = wzPackageOrContainerId; 856 args.wzPackageOrContainerId = wzPackageOrContainerId;
372 args.wzPayloadId = wzPayloadId; 857 args.wzPayloadId = wzPayloadId;
373 args.wzPath = wzPath; 858 args.wzPath = wzPath;
374 859
375 results.cbSize = sizeof(results); 860 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
861
862 // Send args.
863 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
864 ExitOnFailure(hr, "Failed to write API version of SetLocalSource args.");
865
866 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId);
867 ExitOnFailure(hr, "Failed to write package or container id of SetLocalSource args.");
376 868
377 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETLOCALSOURCE, &args, &results, m_pvBAEngineProcContext); 869 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId);
870 ExitOnFailure(hr, "Failed to write payload id of SetLocalSource args.");
871
872 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPath);
873 ExitOnFailure(hr, "Failed to write path of SetLocalSource args.");
874
875 // Send results.
876 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
877 ExitOnFailure(hr, "Failed to write API version of SetLocalSource results.");
878
879 // Get results.
880 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SETLOCALSOURCE, &bufferArgs, &bufferResults, &rpc);
881 ExitOnFailure(hr, "BA SetLocalSource failed.");
882
883 LExit:
884 PipeFreeRpcResult(&rpc);
885 ReleaseBuffer(bufferResults);
886 ReleaseBuffer(bufferArgs);
887
888 return hr;
378 } 889 }
379 890
380 virtual STDMETHODIMP SetDownloadSource( 891 virtual STDMETHODIMP SetDownloadSource(
@@ -382,22 +893,64 @@ public: // IBootstrapperEngine
382 __in_z_opt LPCWSTR wzPayloadId, 893 __in_z_opt LPCWSTR wzPayloadId,
383 __in_z LPCWSTR wzUrl, 894 __in_z LPCWSTR wzUrl,
384 __in_z_opt LPCWSTR wzUser, 895 __in_z_opt LPCWSTR wzUser,
385 __in_z_opt LPCWSTR wzPassword 896 __in_z_opt LPCWSTR wzPassword,
897 __in_z_opt LPCWSTR wzAuthorizationHeader
386 ) 898 )
387 { 899 {
900 HRESULT hr = S_OK;
388 BAENGINE_SETDOWNLOADSOURCE_ARGS args = { }; 901 BAENGINE_SETDOWNLOADSOURCE_ARGS args = { };
389 BAENGINE_SETDOWNLOADSOURCE_RESULTS results = { }; 902 BAENGINE_SETDOWNLOADSOURCE_RESULTS results = { };
903 BUFF_BUFFER bufferArgs = { };
904 BUFF_BUFFER bufferResults = { };
905 PIPE_RPC_RESULT rpc = { };
390 906
391 args.cbSize = sizeof(args); 907 // Init send structs.
908 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
392 args.wzPackageOrContainerId = wzPackageOrContainerId; 909 args.wzPackageOrContainerId = wzPackageOrContainerId;
393 args.wzPayloadId = wzPayloadId; 910 args.wzPayloadId = wzPayloadId;
394 args.wzUrl = wzUrl; 911 args.wzUrl = wzUrl;
395 args.wzUser = wzUser; 912 args.wzUser = wzUser;
396 args.wzPassword = wzPassword; 913 args.wzPassword = wzPassword;
914 args.wzAuthorizationHeader = wzAuthorizationHeader;
397 915
398 results.cbSize = sizeof(results); 916 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
399 917
400 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETDOWNLOADSOURCE, &args, &results, m_pvBAEngineProcContext); 918 // Send args.
919 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
920 ExitOnFailure(hr, "Failed to write API version of SetDownloadSource args.");
921
922 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPackageOrContainerId);
923 ExitOnFailure(hr, "Failed to write package or container id of SetDownloadSource args.");
924
925 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPayloadId);
926 ExitOnFailure(hr, "Failed to write payload id of SetDownloadSource args.");
927
928 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzUrl);
929 ExitOnFailure(hr, "Failed to write url of SetDownloadSource args.");
930
931 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzUser);
932 ExitOnFailure(hr, "Failed to write user of SetDownloadSource args.");
933
934 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzPassword);
935 ExitOnFailure(hr, "Failed to write password of SetDownloadSource args.");
936
937 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzAuthorizationHeader);
938 ExitOnFailure(hr, "Failed to write authorization header of SetDownloadSource args.");
939
940 // Send results.
941 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
942 ExitOnFailure(hr, "Failed to write API version of SetDownloadSource results.");
943
944 // Get results.
945 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SETDOWNLOADSOURCE, &bufferArgs, &bufferResults, &rpc);
946 ExitOnFailure(hr, "BA SetDownloadSource failed.");
947
948 LExit:
949 PipeFreeRpcResult(&rpc);
950 ReleaseBuffer(bufferResults);
951 ReleaseBuffer(bufferArgs);
952
953 return hr;
401 } 954 }
402 955
403 virtual STDMETHODIMP SetVariableNumeric( 956 virtual STDMETHODIMP SetVariableNumeric(
@@ -405,16 +958,44 @@ public: // IBootstrapperEngine
405 __in LONGLONG llValue 958 __in LONGLONG llValue
406 ) 959 )
407 { 960 {
961 HRESULT hr = S_OK;
408 BAENGINE_SETVARIABLENUMERIC_ARGS args = { }; 962 BAENGINE_SETVARIABLENUMERIC_ARGS args = { };
409 BAENGINE_SETVARIABLENUMERIC_RESULTS results = { }; 963 BAENGINE_SETVARIABLENUMERIC_RESULTS results = { };
964 BUFF_BUFFER bufferArgs = { };
965 BUFF_BUFFER bufferResults = { };
966 PIPE_RPC_RESULT rpc = { };
410 967
411 args.cbSize = sizeof(args); 968 // Init send structs.
969 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
412 args.wzVariable = wzVariable; 970 args.wzVariable = wzVariable;
413 args.llValue = llValue; 971 args.llValue = llValue;
414 972
415 results.cbSize = sizeof(results); 973 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
974
975 // Send args.
976 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
977 ExitOnFailure(hr, "Failed to write API version of SetVariableNumeric args.");
978
979 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVariable);
980 ExitOnFailure(hr, "Failed to write variable of SetVariableNumeric args.");
981
982 hr = BuffWriteNumber64ToBuffer(&bufferArgs, static_cast<DWORD64>(args.llValue));
983 ExitOnFailure(hr, "Failed to write value of SetVariableNumeric args.");
984
985 // Send results.
986 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
987 ExitOnFailure(hr, "Failed to write API version of SetVariableNumeric results.");
988
989 // Get results.
990 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLENUMERIC, &bufferArgs, &bufferResults, &rpc);
991 ExitOnFailure(hr, "BA SetVariableNumeric failed.");
416 992
417 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLENUMERIC, &args, &results, m_pvBAEngineProcContext); 993 LExit:
994 PipeFreeRpcResult(&rpc);
995 ReleaseBuffer(bufferResults);
996 ReleaseBuffer(bufferArgs);
997
998 return hr;
418 } 999 }
419 1000
420 virtual STDMETHODIMP SetVariableString( 1001 virtual STDMETHODIMP SetVariableString(
@@ -423,17 +1004,48 @@ public: // IBootstrapperEngine
423 __in BOOL fFormatted 1004 __in BOOL fFormatted
424 ) 1005 )
425 { 1006 {
1007 HRESULT hr = S_OK;
426 BAENGINE_SETVARIABLESTRING_ARGS args = { }; 1008 BAENGINE_SETVARIABLESTRING_ARGS args = { };
427 BAENGINE_SETVARIABLESTRING_RESULTS results = { }; 1009 BAENGINE_SETVARIABLESTRING_RESULTS results = { };
1010 BUFF_BUFFER bufferArgs = { };
1011 BUFF_BUFFER bufferResults = { };
1012 PIPE_RPC_RESULT rpc = { };
428 1013
429 args.cbSize = sizeof(args); 1014 // Init send structs.
1015 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
430 args.wzVariable = wzVariable; 1016 args.wzVariable = wzVariable;
431 args.wzValue = wzValue; 1017 args.wzValue = wzValue;
432 args.fFormatted = fFormatted; 1018 args.fFormatted = fFormatted;
433 1019
434 results.cbSize = sizeof(results); 1020 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1021
1022 // Send args.
1023 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1024 ExitOnFailure(hr, "Failed to write API version of SetVariableString args.");
1025
1026 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVariable);
1027 ExitOnFailure(hr, "Failed to write variable of SetVariableString args.");
1028
1029 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzValue);
1030 ExitOnFailure(hr, "Failed to write value of SetVariableString args.");
1031
1032 hr = BuffWriteNumberToBuffer(&bufferArgs, args.fFormatted);
1033 ExitOnFailure(hr, "Failed to write formatted flag of SetVariableString args.");
1034
1035 // Send results.
1036 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1037 ExitOnFailure(hr, "Failed to write API version of SetVariableString results.");
435 1038
436 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLESTRING, &args, &results, m_pvBAEngineProcContext); 1039 // Get results.
1040 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLESTRING, &bufferArgs, &bufferResults, &rpc);
1041 ExitOnFailure(hr, "BA SetVariableString failed.");
1042
1043 LExit:
1044 PipeFreeRpcResult(&rpc);
1045 ReleaseBuffer(bufferResults);
1046 ReleaseBuffer(bufferArgs);
1047
1048 return hr;
437 } 1049 }
438 1050
439 virtual STDMETHODIMP SetVariableVersion( 1051 virtual STDMETHODIMP SetVariableVersion(
@@ -441,103 +1053,278 @@ public: // IBootstrapperEngine
441 __in_z_opt LPCWSTR wzValue 1053 __in_z_opt LPCWSTR wzValue
442 ) 1054 )
443 { 1055 {
1056 HRESULT hr = S_OK;
444 BAENGINE_SETVARIABLEVERSION_ARGS args = { }; 1057 BAENGINE_SETVARIABLEVERSION_ARGS args = { };
445 BAENGINE_SETVARIABLEVERSION_RESULTS results = { }; 1058 BAENGINE_SETVARIABLEVERSION_RESULTS results = { };
1059 BUFF_BUFFER bufferArgs = { };
1060 BUFF_BUFFER bufferResults = { };
1061 PIPE_RPC_RESULT rpc = { };
446 1062
447 args.cbSize = sizeof(args); 1063 // Init send structs.
1064 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
448 args.wzVariable = wzVariable; 1065 args.wzVariable = wzVariable;
449 args.wzValue = wzValue; 1066 args.wzValue = wzValue;
450 1067
451 results.cbSize = sizeof(results); 1068 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1069
1070 // Send args.
1071 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1072 ExitOnFailure(hr, "Failed to write API version of SetVariableVersion args.");
1073
1074 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVariable);
1075 ExitOnFailure(hr, "Failed to write variable of SetVariableVersion args.");
1076
1077 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzValue);
1078 ExitOnFailure(hr, "Failed to write value of SetVariableVersion args.");
1079
1080 // Send results.
1081 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1082 ExitOnFailure(hr, "Failed to write API version of SetVariableVersion results.");
452 1083
453 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLEVERSION, &args, &results, m_pvBAEngineProcContext); 1084 // Get results.
1085 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLEVERSION, &bufferArgs, &bufferResults, &rpc);
1086 ExitOnFailure(hr, "BA SetVariableVersion failed.");
1087
1088 LExit:
1089 PipeFreeRpcResult(&rpc);
1090 ReleaseBuffer(bufferResults);
1091 ReleaseBuffer(bufferArgs);
1092
1093 return hr;
454 } 1094 }
455 1095
456 virtual STDMETHODIMP CloseSplashScreen() 1096 virtual STDMETHODIMP CloseSplashScreen()
457 { 1097 {
1098 HRESULT hr = S_OK;
458 BAENGINE_CLOSESPLASHSCREEN_ARGS args = { }; 1099 BAENGINE_CLOSESPLASHSCREEN_ARGS args = { };
459 BAENGINE_CLOSESPLASHSCREEN_RESULTS results = { }; 1100 BAENGINE_CLOSESPLASHSCREEN_RESULTS results = { };
1101 BUFF_BUFFER bufferArgs = { };
1102 BUFF_BUFFER bufferResults = { };
1103 PIPE_RPC_RESULT rpc = { };
1104
1105 // Init send structs.
1106 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1107
1108 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1109
1110 // Send args.
1111 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1112 ExitOnFailure(hr, "Failed to write API version of CloseSplashScreen args.");
1113
1114 // Send results.
1115 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1116 ExitOnFailure(hr, "Failed to write API version of CloseSplashScreen results.");
460 1117
461 args.cbSize = sizeof(args); 1118 // Get results.
1119 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_CLOSESPLASHSCREEN, &bufferArgs, &bufferResults, &rpc);
1120 ExitOnFailure(hr, "BA CloseSplashScreen failed.");
462 1121
463 results.cbSize = sizeof(results); 1122 LExit:
1123 PipeFreeRpcResult(&rpc);
1124 ReleaseBuffer(bufferResults);
1125 ReleaseBuffer(bufferArgs);
464 1126
465 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_CLOSESPLASHSCREEN, &args, &results, m_pvBAEngineProcContext); 1127 return hr;
466 } 1128 }
467 1129
468 virtual STDMETHODIMP Detect( 1130 virtual STDMETHODIMP Detect(
469 __in_opt HWND hwndParent 1131 __in_opt HWND hwndParent
470 ) 1132 )
471 { 1133 {
1134 HRESULT hr = S_OK;
472 BAENGINE_DETECT_ARGS args = { }; 1135 BAENGINE_DETECT_ARGS args = { };
473 BAENGINE_DETECT_RESULTS results = { }; 1136 BAENGINE_DETECT_RESULTS results = { };
1137 BUFF_BUFFER bufferArgs = { };
1138 BUFF_BUFFER bufferResults = { };
1139 PIPE_RPC_RESULT rpc = { };
1140
1141 // Init send structs.
1142 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1143 args.hwndParent = reinterpret_cast<DWORD64>(hwndParent);
1144
1145 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
474 1146
475 args.cbSize = sizeof(args); 1147 // Send args.
476 args.hwndParent = hwndParent; 1148 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1149 ExitOnFailure(hr, "Failed to write API version of Detect args.");
477 1150
478 results.cbSize = sizeof(results); 1151 hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.hwndParent);
1152 ExitOnFailure(hr, "Failed to write parent window of Detect args.");
1153
1154 // Send results.
1155 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1156 ExitOnFailure(hr, "Failed to write API version of Detect results.");
1157
1158 // Get results.
1159 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_DETECT, &bufferArgs, &bufferResults, &rpc);
1160 ExitOnFailure(hr, "BA Detect failed.");
1161
1162 LExit:
1163 PipeFreeRpcResult(&rpc);
1164 ReleaseBuffer(bufferResults);
1165 ReleaseBuffer(bufferArgs);
479 1166
480 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_DETECT, &args, &results, m_pvBAEngineProcContext); 1167 return hr;
481 } 1168 }
482 1169
483 virtual STDMETHODIMP Plan( 1170 virtual STDMETHODIMP Plan(
484 __in BOOTSTRAPPER_ACTION action 1171 __in BOOTSTRAPPER_ACTION action
485 ) 1172 )
486 { 1173 {
1174 HRESULT hr = S_OK;
487 BAENGINE_PLAN_ARGS args = { }; 1175 BAENGINE_PLAN_ARGS args = { };
488 BAENGINE_PLAN_RESULTS results = { }; 1176 BAENGINE_PLAN_RESULTS results = { };
1177 BUFF_BUFFER bufferArgs = { };
1178 BUFF_BUFFER bufferResults = { };
1179 PIPE_RPC_RESULT rpc = { };
489 1180
490 args.cbSize = sizeof(args); 1181 // Init send structs.
1182 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
491 args.action = action; 1183 args.action = action;
492 1184
493 results.cbSize = sizeof(results); 1185 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1186
1187 // Send args.
1188 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1189 ExitOnFailure(hr, "Failed to write API version of Plan args.");
1190
1191 hr = BuffWriteNumberToBuffer(&bufferArgs, static_cast<DWORD>(args.action));
1192 ExitOnFailure(hr, "Failed to write parent window of Plan args.");
1193
1194 // Send results.
1195 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1196 ExitOnFailure(hr, "Failed to write API version of Plan results.");
494 1197
495 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_PLAN, &args, &results, m_pvBAEngineProcContext); 1198 // Get results.
1199 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_PLAN, &bufferArgs, &bufferResults, &rpc);
1200 ExitOnFailure(hr, "BA Plan failed.");
1201
1202 LExit:
1203 PipeFreeRpcResult(&rpc);
1204 ReleaseBuffer(bufferResults);
1205 ReleaseBuffer(bufferArgs);
1206
1207 return hr;
496 } 1208 }
497 1209
498 virtual STDMETHODIMP Elevate( 1210 virtual STDMETHODIMP Elevate(
499 __in_opt HWND hwndParent 1211 __in_opt HWND hwndParent
500 ) 1212 )
501 { 1213 {
1214 HRESULT hr = S_OK;
502 BAENGINE_ELEVATE_ARGS args = { }; 1215 BAENGINE_ELEVATE_ARGS args = { };
503 BAENGINE_ELEVATE_RESULTS results = { }; 1216 BAENGINE_ELEVATE_RESULTS results = { };
1217 BUFF_BUFFER bufferArgs = { };
1218 BUFF_BUFFER bufferResults = { };
1219 PIPE_RPC_RESULT rpc = { };
1220
1221 // Init send structs.
1222 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1223 args.hwndParent = reinterpret_cast<DWORD64>(hwndParent);
1224
1225 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1226
1227 // Send args.
1228 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1229 ExitOnFailure(hr, "Failed to write API version of Elevate args.");
504 1230
505 args.cbSize = sizeof(args); 1231 hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.hwndParent);
506 args.hwndParent = hwndParent; 1232 ExitOnFailure(hr, "Failed to write parent window of Elevate args.");
507 1233
508 results.cbSize = sizeof(results); 1234 // Send results.
1235 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1236 ExitOnFailure(hr, "Failed to write API version of Elevate results.");
509 1237
510 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_ELEVATE, &args, &results, m_pvBAEngineProcContext); 1238 // Get results.
1239 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_ELEVATE, &bufferArgs, &bufferResults, &rpc);
1240 ExitOnFailure(hr, "BA Elevate failed.");
1241
1242 LExit:
1243 PipeFreeRpcResult(&rpc);
1244 ReleaseBuffer(bufferResults);
1245 ReleaseBuffer(bufferArgs);
1246
1247 return hr;
511 } 1248 }
512 1249
513 virtual STDMETHODIMP Apply( 1250 virtual STDMETHODIMP Apply(
514 __in HWND hwndParent 1251 __in HWND hwndParent
515 ) 1252 )
516 { 1253 {
1254 HRESULT hr = S_OK;
517 BAENGINE_APPLY_ARGS args = { }; 1255 BAENGINE_APPLY_ARGS args = { };
518 BAENGINE_APPLY_RESULTS results = { }; 1256 BAENGINE_APPLY_RESULTS results = { };
1257 BUFF_BUFFER bufferArgs = { };
1258 BUFF_BUFFER bufferResults = { };
1259 PIPE_RPC_RESULT rpc = { };
1260
1261 // Init send structs.
1262 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1263 args.hwndParent = reinterpret_cast<DWORD64>(hwndParent);
1264
1265 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1266
1267 // Send args.
1268 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1269 ExitOnFailure(hr, "Failed to write API version of Apply args.");
1270
1271 hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.hwndParent);
1272 ExitOnFailure(hr, "Failed to write parent window of Apply args.");
519 1273
520 args.cbSize = sizeof(args); 1274 // Send results.
521 args.hwndParent = hwndParent; 1275 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1276 ExitOnFailure(hr, "Failed to write API version of Apply results.");
522 1277
523 results.cbSize = sizeof(results); 1278 // Get results.
1279 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_APPLY, &bufferArgs, &bufferResults, &rpc);
1280 ExitOnFailure(hr, "BA Apply failed.");
524 1281
525 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_APPLY, &args, &results, m_pvBAEngineProcContext); 1282 LExit:
1283 PipeFreeRpcResult(&rpc);
1284 ReleaseBuffer(bufferResults);
1285 ReleaseBuffer(bufferArgs);
1286
1287 return hr;
526 } 1288 }
527 1289
528 virtual STDMETHODIMP Quit( 1290 virtual STDMETHODIMP Quit(
529 __in DWORD dwExitCode 1291 __in DWORD dwExitCode
530 ) 1292 )
531 { 1293 {
1294 HRESULT hr = S_OK;
532 BAENGINE_QUIT_ARGS args = { }; 1295 BAENGINE_QUIT_ARGS args = { };
533 BAENGINE_QUIT_RESULTS results = { }; 1296 BAENGINE_QUIT_RESULTS results = { };
1297 BUFF_BUFFER bufferArgs = { };
1298 BUFF_BUFFER bufferResults = { };
1299 PIPE_RPC_RESULT rpc = { };
534 1300
535 args.cbSize = sizeof(args); 1301 // Init send structs.
1302 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
536 args.dwExitCode = dwExitCode; 1303 args.dwExitCode = dwExitCode;
537 1304
538 results.cbSize = sizeof(results); 1305 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
539 1306
540 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_QUIT, &args, &results, m_pvBAEngineProcContext); 1307 // Send args.
1308 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1309 ExitOnFailure(hr, "Failed to write API version of Quit args.");
1310
1311 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwExitCode);
1312 ExitOnFailure(hr, "Failed to write exit code of Quit args.");
1313
1314 // Send results.
1315 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1316 ExitOnFailure(hr, "Failed to write API version of Quit results.");
1317
1318 // Get results.
1319 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_QUIT, &bufferArgs, &bufferResults, &rpc);
1320 ExitOnFailure(hr, "BA Quit failed.");
1321
1322 LExit:
1323 PipeFreeRpcResult(&rpc);
1324 ReleaseBuffer(bufferResults);
1325 ReleaseBuffer(bufferArgs);
1326
1327 return hr;
541 } 1328 }
542 1329
543 virtual STDMETHODIMP LaunchApprovedExe( 1330 virtual STDMETHODIMP LaunchApprovedExe(
@@ -547,33 +1334,101 @@ public: // IBootstrapperEngine
547 __in DWORD dwWaitForInputIdleTimeout 1334 __in DWORD dwWaitForInputIdleTimeout
548 ) 1335 )
549 { 1336 {
1337 HRESULT hr = S_OK;
550 BAENGINE_LAUNCHAPPROVEDEXE_ARGS args = { }; 1338 BAENGINE_LAUNCHAPPROVEDEXE_ARGS args = { };
551 BAENGINE_LAUNCHAPPROVEDEXE_RESULTS results = { }; 1339 BAENGINE_LAUNCHAPPROVEDEXE_RESULTS results = { };
1340 BUFF_BUFFER bufferArgs = { };
1341 BUFF_BUFFER bufferResults = { };
1342 PIPE_RPC_RESULT rpc = { };
1343
1344 ExitOnNull(wzApprovedExeForElevationId, hr, E_INVALIDARG, "wzApprovedExeForElevationId is required");
552 1345
553 args.cbSize = sizeof(args); 1346 // Init send structs.
554 args.hwndParent = hwndParent; 1347 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1348 args.hwndParent = reinterpret_cast<DWORD64>(hwndParent);
555 args.wzApprovedExeForElevationId = wzApprovedExeForElevationId; 1349 args.wzApprovedExeForElevationId = wzApprovedExeForElevationId;
556 args.wzArguments = wzArguments; 1350 args.wzArguments = wzArguments;
557 args.dwWaitForInputIdleTimeout = dwWaitForInputIdleTimeout; 1351 args.dwWaitForInputIdleTimeout = dwWaitForInputIdleTimeout;
558 1352
559 results.cbSize = sizeof(results); 1353 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
560 1354
561 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE, &args, &results, m_pvBAEngineProcContext); 1355 // Send args.
1356 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1357 ExitOnFailure(hr, "Failed to write API version of LaunchApprovedExe args.");
1358
1359 hr = BuffWriteNumber64ToBuffer(&bufferArgs, args.hwndParent);
1360 ExitOnFailure(hr, "Failed to write parent window of LaunchApprovedExe args.");
1361
1362 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzApprovedExeForElevationId);
1363 ExitOnFailure(hr, "Failed to write approved exe elevation id of LaunchApprovedExe args.");
1364
1365 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzArguments);
1366 ExitOnFailure(hr, "Failed to write arguments of LaunchApprovedExe args.");
1367
1368 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwWaitForInputIdleTimeout);
1369 ExitOnFailure(hr, "Failed to write wait for idle input timeout of LaunchApprovedExe args.");
1370
1371 // Send results.
1372 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1373 ExitOnFailure(hr, "Failed to write API version of LaunchApprovedExe results.");
1374
1375 // Get results.
1376 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE, &bufferArgs, &bufferResults, &rpc);
1377 ExitOnFailure(hr, "BA LaunchApprovedExe failed.");
1378
1379 LExit:
1380 PipeFreeRpcResult(&rpc);
1381 ReleaseBuffer(bufferResults);
1382 ReleaseBuffer(bufferArgs);
1383
1384 return hr;
562 } 1385 }
563 1386
564 virtual STDMETHODIMP SetUpdateSource( 1387 virtual STDMETHODIMP SetUpdateSource(
565 __in_z LPCWSTR wzUrl 1388 __in_z LPCWSTR wzUrl,
1389 __in_z_opt LPCWSTR wzAuthorizationHeader
566 ) 1390 )
567 { 1391 {
1392 HRESULT hr = S_OK;
568 BAENGINE_SETUPDATESOURCE_ARGS args = { }; 1393 BAENGINE_SETUPDATESOURCE_ARGS args = { };
569 BAENGINE_SETUPDATESOURCE_RESULTS results = { }; 1394 BAENGINE_SETUPDATESOURCE_RESULTS results = { };
1395 BUFF_BUFFER bufferArgs = { };
1396 BUFF_BUFFER bufferResults = { };
1397 PIPE_RPC_RESULT rpc = { };
1398
1399 ExitOnNull(wzUrl, hr, E_INVALIDARG, "wzUrl is required");
570 1400
571 args.cbSize = sizeof(args); 1401 // Init send structs.
1402 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
572 args.wzUrl = wzUrl; 1403 args.wzUrl = wzUrl;
1404 args.wzAuthorizationHeader = wzAuthorizationHeader;
1405
1406 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1407
1408 // Send args.
1409 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1410 ExitOnFailure(hr, "Failed to write API version of SetUpdateSource args.");
1411
1412 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzUrl);
1413 ExitOnFailure(hr, "Failed to write url of SetUpdateSource args.");
1414
1415 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzAuthorizationHeader);
1416 ExitOnFailure(hr, "Failed to write authorization header of SetUpdateSource args.");
573 1417
574 results.cbSize = sizeof(results); 1418 // Send results.
1419 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1420 ExitOnFailure(hr, "Failed to write API version of SetUpdateSource results.");
575 1421
576 return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE, &args, &results, m_pvBAEngineProcContext); 1422 // Get results.
1423 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE, &bufferArgs, &bufferResults, &rpc);
1424 ExitOnFailure(hr, "BA SetUpdateSource failed.");
1425
1426 LExit:
1427 PipeFreeRpcResult(&rpc);
1428 ReleaseBuffer(bufferResults);
1429 ReleaseBuffer(bufferArgs);
1430
1431 return hr;
577 } 1432 }
578 1433
579 virtual STDMETHODIMP CompareVersions( 1434 virtual STDMETHODIMP CompareVersions(
@@ -585,66 +1440,133 @@ public: // IBootstrapperEngine
585 HRESULT hr = S_OK; 1440 HRESULT hr = S_OK;
586 BAENGINE_COMPAREVERSIONS_ARGS args = { }; 1441 BAENGINE_COMPAREVERSIONS_ARGS args = { };
587 BAENGINE_COMPAREVERSIONS_RESULTS results = { }; 1442 BAENGINE_COMPAREVERSIONS_RESULTS results = { };
1443 BUFF_BUFFER bufferArgs = { };
1444 BUFF_BUFFER bufferResults = { };
1445 PIPE_RPC_RESULT rpc = { };
1446 SIZE_T iBuffer = 0;
588 1447
589 ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); 1448 ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required");
590 1449
591 args.cbSize = sizeof(args); 1450 // Init send structs.
1451 args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
592 args.wzVersion1 = wzVersion1; 1452 args.wzVersion1 = wzVersion1;
593 args.wzVersion2 = wzVersion2; 1453 args.wzVersion2 = wzVersion2;
594 1454
595 results.cbSize = sizeof(results); 1455 results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1456
1457 // Send args.
1458 hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
1459 ExitOnFailure(hr, "Failed to write API version of CompareVersions args.");
1460
1461 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVersion1);
1462 ExitOnFailure(hr, "Failed to write first input of CompareVersions args.");
1463
1464 hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVersion2);
1465 ExitOnFailure(hr, "Failed to write second input of CompareVersions args.");
1466
1467 // Send results.
1468 hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);
1469 ExitOnFailure(hr, "Failed to write API version of CompareVersions results.");
1470
1471 // Get results.
1472 hr = SendRequest(BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS, &bufferArgs, &bufferResults, &rpc);
1473 ExitOnFailure(hr, "BA CompareVersions failed.");
596 1474
597 hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS, &args, &results, m_pvBAEngineProcContext); 1475 // Read results.
1476 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, &results.dwApiVersion);
1477 ExitOnFailure(hr, "Failed to read size from CompareVersions results.");
1478
1479 hr = BuffReadNumber(rpc.pbData, rpc.cbData, &iBuffer, reinterpret_cast<DWORD*>(&results.nResult));
1480 ExitOnFailure(hr, "Failed to read result from CompareVersions results.");
598 1481
599 *pnResult = results.nResult; 1482 *pnResult = results.nResult;
600 1483
601 LExit: 1484 LExit:
1485 PipeFreeRpcResult(&rpc);
1486 ReleaseBuffer(bufferResults);
1487 ReleaseBuffer(bufferArgs);
1488
602 return hr; 1489 return hr;
603 } 1490 }
604 1491
605public: 1492private:
606 HRESULT Init() 1493 HRESULT SendRequest(
1494 __in DWORD dwMessageType,
1495 __in BUFF_BUFFER* pBufferArgs,
1496 __in BUFF_BUFFER* pBufferResults,
1497 __in PIPE_RPC_RESULT* pRpc
1498 )
607 { 1499 {
608 return ::CoCreateFreeThreadedMarshaler(this, &m_pFreeThreadedMarshaler); 1500 HRESULT hr = S_OK;
1501 BUFF_BUFFER buffer = { };
1502
1503 hr = CombineArgsAndResults(pBufferArgs, pBufferResults, &buffer);
1504 if (SUCCEEDED(hr))
1505 {
1506 hr = PipeRpcRequest(&m_hRpcPipe, dwMessageType, buffer.pbData, buffer.cbData, pRpc);
1507 }
1508
1509 ReleaseBuffer(buffer);
1510 return hr;
609 } 1511 }
610 1512
1513 HRESULT CombineArgsAndResults(
1514 __in BUFF_BUFFER* pBufferArgs,
1515 __in BUFF_BUFFER* pBufferResults,
1516 __in BUFF_BUFFER* pBufferCombined
1517 )
1518 {
1519 HRESULT hr = S_OK;
1520
1521 // Write args to buffer.
1522 hr = BuffWriteStreamToBuffer(pBufferCombined, pBufferArgs->pbData, pBufferArgs->cbData);
1523 ExitOnFailure(hr, "Failed to write args buffer.");
1524
1525 // Write results to buffer.
1526 hr = BuffWriteStreamToBuffer(pBufferCombined, pBufferResults->pbData, pBufferResults->cbData);
1527 ExitOnFailure(hr, "Failed to write results buffer.");
1528
1529 LExit:
1530 return hr;
1531 }
1532
1533public:
611 CBalBootstrapperEngine( 1534 CBalBootstrapperEngine(
612 __in PFN_BOOTSTRAPPER_ENGINE_PROC pfnBAEngineProc, 1535 __in HANDLE hPipe,
613 __in_opt LPVOID pvBAEngineProcContext 1536 __out HRESULT* phr
614 ) 1537 )
615 { 1538 {
616 m_cReferences = 1; 1539 m_cReferences = 1;
617 m_pfnBAEngineProc = pfnBAEngineProc; 1540
618 m_pvBAEngineProcContext = pvBAEngineProcContext; 1541 PipeRpcInitialize(&m_hRpcPipe, hPipe, FALSE);
619 m_pFreeThreadedMarshaler = NULL; 1542
1543 *phr = ::CoCreateFreeThreadedMarshaler(this, &m_pFreeThreadedMarshaler);
620 } 1544 }
621 1545
622 ~CBalBootstrapperEngine() 1546 ~CBalBootstrapperEngine()
623 { 1547 {
1548 PipeRpcUninitiailize(&m_hRpcPipe);
624 ReleaseObject(m_pFreeThreadedMarshaler); 1549 ReleaseObject(m_pFreeThreadedMarshaler);
625 } 1550 }
626 1551
627private: 1552private:
628 long m_cReferences; 1553 long m_cReferences;
629 PFN_BOOTSTRAPPER_ENGINE_PROC m_pfnBAEngineProc; 1554 PIPE_RPC_HANDLE m_hRpcPipe;
630 LPVOID m_pvBAEngineProcContext;
631 IUnknown* m_pFreeThreadedMarshaler; 1555 IUnknown* m_pFreeThreadedMarshaler;
632}; 1556};
633 1557
1558
634HRESULT BalBootstrapperEngineCreate( 1559HRESULT BalBootstrapperEngineCreate(
635 __in PFN_BOOTSTRAPPER_ENGINE_PROC pfnBAEngineProc, 1560 __in HANDLE hPipe,
636 __in_opt LPVOID pvBAEngineProcContext,
637 __out IBootstrapperEngine** ppBootstrapperEngine 1561 __out IBootstrapperEngine** ppBootstrapperEngine
638 ) 1562 )
639{ 1563{
640 HRESULT hr = S_OK; 1564 HRESULT hr = S_OK;
641 CBalBootstrapperEngine* pBootstrapperEngine = NULL; 1565 CBalBootstrapperEngine* pBootstrapperEngine = NULL;
642 1566
643 pBootstrapperEngine = new CBalBootstrapperEngine(pfnBAEngineProc, pvBAEngineProcContext); 1567 pBootstrapperEngine = new CBalBootstrapperEngine(hPipe, &hr);
644 ExitOnNull(pBootstrapperEngine, hr, E_OUTOFMEMORY, "Failed to allocate new BalBootstrapperEngine object."); 1568 ExitOnNull(pBootstrapperEngine, hr, E_OUTOFMEMORY, "Failed to allocate new BalBootstrapperEngine object.");
645 1569 ExitOnFailure(hr, "Failed to initialize BalBootstrapperEngine.");
646 hr = pBootstrapperEngine->Init();
647 ExitOnFailure(hr, "Failed to initialize CBalBootstrapperEngine.");
648 1570
649 hr = pBootstrapperEngine->QueryInterface(IID_PPV_ARGS(ppBootstrapperEngine)); 1571 hr = pBootstrapperEngine->QueryInterface(IID_PPV_ARGS(ppBootstrapperEngine));
650 ExitOnFailure(hr, "Failed to QI for IBootstrapperEngine from BalBootstrapperEngine object."); 1572 ExitOnFailure(hr, "Failed to QI for IBootstrapperEngine from BalBootstrapperEngine object.");
diff --git a/src/api/burn/balutil/inc/BalBootstrapperEngine.h b/src/api/burn/balutil/BalBootstrapperEngine.h
index 45131d98..b3bd4ca7 100644
--- a/src/api/burn/balutil/inc/BalBootstrapperEngine.h
+++ b/src/api/burn/balutil/BalBootstrapperEngine.h
@@ -1,17 +1,7 @@
1#pragma once
1// 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. 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.
2 3
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7// function declarations
8
9HRESULT BalBootstrapperEngineCreate( 4HRESULT BalBootstrapperEngineCreate(
10 __in PFN_BOOTSTRAPPER_ENGINE_PROC pfnBAEngineProc, 5 __in HANDLE hEnginePipe,
11 __in_opt LPVOID pvBAEngineProcContext,
12 __out IBootstrapperEngine** ppEngineForApplication 6 __out IBootstrapperEngine** ppEngineForApplication
13 ); 7 );
14
15#ifdef __cplusplus
16}
17#endif
diff --git a/src/api/burn/balutil/balinfo.cpp b/src/api/burn/balutil/balinfo.cpp
index 751ba4f1..6f609a40 100644
--- a/src/api/burn/balutil/balinfo.cpp
+++ b/src/api/burn/balutil/balinfo.cpp
@@ -223,7 +223,6 @@ LExit:
223DAPI_(HRESULT) BalInfoAddUpdateBundleAsPackage( 223DAPI_(HRESULT) BalInfoAddUpdateBundleAsPackage(
224 __in BAL_INFO_PACKAGES* pPackages, 224 __in BAL_INFO_PACKAGES* pPackages,
225 __in_z LPCWSTR wzId, 225 __in_z LPCWSTR wzId,
226 __in_z LPCWSTR /*wzPreviousId*/,
227 __out_opt BAL_INFO_PACKAGE** ppPackage 226 __out_opt BAL_INFO_PACKAGE** ppPackage
228 ) 227 )
229{ 228{
@@ -356,7 +355,7 @@ DAPI_(HRESULT) BalSetOverridableVariablesFromEngine(
356 LPCWSTR wzVariableValue = pCommand->rgVariableValues[i]; 355 LPCWSTR wzVariableValue = pCommand->rgVariableValues[i];
357 356
358 hr = DictGetValue(pOverridableVariables->sdVariables, wzVariableName, reinterpret_cast<void**>(&pOverridableVariable)); 357 hr = DictGetValue(pOverridableVariables->sdVariables, wzVariableName, reinterpret_cast<void**>(&pOverridableVariable));
359 if (E_NOTFOUND == hr) 358 if (E_NOTFOUND == hr || E_INVALIDARG == hr)
360 { 359 {
361 BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Ignoring attempt to set non-overridable variable: '%ls'.", wzVariableName); 360 BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Ignoring attempt to set non-overridable variable: '%ls'.", wzVariableName);
362 hr = S_OK; 361 hr = S_OK;
@@ -549,16 +548,16 @@ static HRESULT ParseBalPackageInfoFromXml(
549 } 548 }
550 ExitOnFailure(hr, "Failed to parse all WixBalPackageInfo elements."); 549 ExitOnFailure(hr, "Failed to parse all WixBalPackageInfo elements.");
551 550
552 hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixMbaPrereqInformation", &pNodeList); 551 hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixPrereqInformation", &pNodeList);
553 ExitOnFailure(hr, "Failed to select all packages."); 552 ExitOnFailure(hr, "Failed to select all packages.");
554 553
555 while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) 554 while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL)))
556 { 555 {
557 hr = XmlGetAttributeEx(pNode, L"PackageId", &scz); 556 hr = XmlGetAttributeEx(pNode, L"PackageId", &scz);
558 ExitOnRequiredXmlQueryFailure(hr, "Failed to get package identifier for WixMbaPrereqInformation."); 557 ExitOnRequiredXmlQueryFailure(hr, "Failed to get package identifier for WixPrereqInformation.");
559 558
560 hr = BalInfoFindPackageById(pPackages, scz, &pPackage); 559 hr = BalInfoFindPackageById(pPackages, scz, &pPackage);
561 ExitOnFailure(hr, "Failed to find package specified in WixMbaPrereqInformation: %ls", scz); 560 ExitOnFailure(hr, "Failed to find package specified in WixPrereqInformation: %ls", scz);
562 561
563 pPackage->fPrereqPackage = TRUE; 562 pPackage->fPrereqPackage = TRUE;
564 563
@@ -570,7 +569,7 @@ static HRESULT ParseBalPackageInfoFromXml(
570 569
571 ReleaseNullObject(pNode); 570 ReleaseNullObject(pNode);
572 } 571 }
573 ExitOnFailure(hr, "Failed to parse all WixMbaPrereqInformation elements."); 572 ExitOnFailure(hr, "Failed to parse all WixPrereqInformation elements.");
574 573
575 if (S_FALSE == hr) 574 if (S_FALSE == hr)
576 { 575 {
diff --git a/src/api/burn/balutil/balutil.cpp b/src/api/burn/balutil/balutil.cpp
index 2d80878c..a77ff7d0 100644
--- a/src/api/burn/balutil/balutil.cpp
+++ b/src/api/burn/balutil/balutil.cpp
@@ -3,8 +3,39 @@
3#include "precomp.h" 3#include "precomp.h"
4 4
5const DWORD VARIABLE_GROW_FACTOR = 80; 5const DWORD VARIABLE_GROW_FACTOR = 80;
6static DWORD vdwDebuggerCheck = 0;
6static IBootstrapperEngine* vpEngine = NULL; 7static IBootstrapperEngine* vpEngine = NULL;
7 8
9static HRESULT ParseCommandLine(
10 __inout_z LPWSTR *psczPipeBaseName,
11 __inout_z LPWSTR *psczPipeSecret,
12 __out DWORD64 *pqwEngineAPIVersion
13 );
14static HRESULT ConnectToEngine(
15 __in_z LPCWSTR wzPipeBaseName,
16 __in_z LPCWSTR wzPipeSecret,
17 __out HANDLE *phBAPipe,
18 __out HANDLE *phEnginePipe
19 );
20static HRESULT ConnectAndVerify(
21 __in_z LPCWSTR wzPipeName,
22 __in_z LPCWSTR wzPipeSecret,
23 __in DWORD cbPipeSecret,
24 __out HANDLE *phPipe
25 );
26static HRESULT PumpMessages(
27 __in HANDLE hPipe,
28 __in IBootstrapperApplication* pApplication,
29 __in IBootstrapperEngine* pEngine
30 );
31static void MsgProc(
32 __in BOOTSTRAPPER_APPLICATION_MESSAGE messageType,
33 __in_bcount(cbData) LPVOID pvData,
34 __in DWORD cbData,
35 __in IBootstrapperApplication* pApplication,
36 __in IBootstrapperEngine* pEngine
37 );
38
8// prototypes 39// prototypes
9 40
10DAPI_(void) BalInitialize( 41DAPI_(void) BalInitialize(
@@ -17,38 +48,136 @@ DAPI_(void) BalInitialize(
17 vpEngine = pEngine; 48 vpEngine = pEngine;
18} 49}
19 50
20DAPI_(HRESULT) BalInitializeFromCreateArgs( 51DAPI_(void) BalUninitialize()
21 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, 52{
22 __out_opt IBootstrapperEngine** ppEngine 53 ReleaseNullObject(vpEngine);
54}
55
56DAPI_(HRESULT) BootstrapperApplicationRun(
57 __in IBootstrapperApplication* pApplication
23 ) 58 )
24{ 59{
25 HRESULT hr = S_OK; 60 HRESULT hr = S_OK;
61 BOOL fComInitialized = FALSE;
62 DWORD64 qwEngineAPIVersion = 0;
63 LPWSTR sczPipeBaseName = NULL;
64 LPWSTR sczPipeSecret = NULL;
65 HANDLE hBAPipe = INVALID_HANDLE_VALUE;
66 HANDLE hEnginePipe = INVALID_HANDLE_VALUE;
26 IBootstrapperEngine* pEngine = NULL; 67 IBootstrapperEngine* pEngine = NULL;
68 BOOL fInitializedBal = FALSE;
69
70 // initialize COM
71 hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
72 ExitOnFailure(hr, "Failed to initialize COM.");
73 fComInitialized = TRUE;
74
75 hr = ParseCommandLine(&sczPipeBaseName, &sczPipeSecret, &qwEngineAPIVersion);
76 BalExitOnFailure(hr, "Failed to parse command line.");
27 77
28 hr = BalBootstrapperEngineCreate(pArgs->pfnBootstrapperEngineProc, pArgs->pvBootstrapperEngineProcContext, &pEngine); 78 // TODO: Validate the engine API version.
29 ExitOnFailure(hr, "Failed to create BalBootstrapperEngine."); 79
80 hr = ConnectToEngine(sczPipeBaseName, sczPipeSecret, &hBAPipe, &hEnginePipe);
81 BalExitOnFailure(hr, "Failed to connect to engine.");
82
83 hr = BalBootstrapperEngineCreate(hEnginePipe, &pEngine);
84 BalExitOnFailure(hr, "Failed to create bootstrapper engine.");
30 85
31 BalInitialize(pEngine); 86 BalInitialize(pEngine);
87 fInitializedBal = TRUE;
88
89 BootstrapperApplicationDebuggerCheck();
32 90
33 if (ppEngine) 91 hr = MsgPump(hBAPipe, pApplication, pEngine);
92 BalExitOnFailure(hr, "Failed while pumping messages.");
93
94LExit:
95 if (fInitializedBal)
34 { 96 {
35 *ppEngine = pEngine; 97 BalUninitialize();
36 } 98 }
37 pEngine = NULL;
38 99
39LExit: 100 ReleaseNullObject(pEngine);
40 ReleaseObject(pEngine); 101 ReleasePipeHandle(hEnginePipe);
102 ReleasePipeHandle(hBAPipe);
103 ReleaseStr(sczPipeSecret);
104 ReleaseStr(sczPipeBaseName);
105
106 if (fComInitialized)
107 {
108 ::CoUninitialize();
109 }
41 110
42 return hr; 111 return hr;
43} 112}
44 113
45 114DAPI_(VOID) BootstrapperApplicationDebuggerCheck()
46DAPI_(void) BalUninitialize()
47{ 115{
48 ReleaseNullObject(vpEngine); 116 HRESULT hr = S_OK;
117 HKEY hk = NULL;
118 BOOL fDebug = FALSE;
119 LPWSTR sczDebugBootstrapperApplications = NULL;
120 LPWSTR sczDebugBootstrapperApplication = NULL;
121 LPWSTR sczModulePath = NULL;
122 LPCWSTR wzModuleFilename = NULL;
123 WCHAR wzMessage[1024] = { };
124
125 if (0 == vdwDebuggerCheck)
126 {
127 ++vdwDebuggerCheck;
128
129 hr = RegOpen(HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\Session Manager\\Environment", KEY_QUERY_VALUE, &hk);
130 if (SUCCEEDED(hr))
131 {
132 hr = RegReadString(hk, L"WixDebugBootstrapperApplications", &sczDebugBootstrapperApplications);
133 if (SUCCEEDED(hr) && sczDebugBootstrapperApplications && *sczDebugBootstrapperApplications &&
134 sczDebugBootstrapperApplications[0] != L'0' && !sczDebugBootstrapperApplications[1])
135 {
136 hr = PathForCurrentProcess(&sczModulePath, NULL);
137 if (SUCCEEDED(hr) && sczModulePath && *sczModulePath)
138 {
139 wzModuleFilename = PathFile(sczModulePath);
140 if (wzModuleFilename)
141 {
142 fDebug = TRUE;
143 }
144 }
145 }
146 else
147 {
148 hr = RegReadString(hk, L"WixDebugBootstrapperApplication", &sczDebugBootstrapperApplication);
149 if (SUCCEEDED(hr) && sczDebugBootstrapperApplication && *sczDebugBootstrapperApplication)
150 {
151 hr = PathForCurrentProcess(&sczModulePath, NULL);
152 if (SUCCEEDED(hr) && sczModulePath && *sczModulePath)
153 {
154 wzModuleFilename = PathFile(sczModulePath);
155 if (wzModuleFilename && CSTR_EQUAL == ::CompareStringOrdinal(sczDebugBootstrapperApplication, -1, wzModuleFilename, -1, TRUE))
156 {
157 fDebug = TRUE;
158 }
159 }
160 }
161 }
162
163 if (fDebug)
164 {
165 hr = ::StringCchPrintfW(wzMessage, countof(wzMessage), L"To debug the boostrapper application process %ls\n\nSet breakpoints and attach a debugger to process id: %d (0x%x)", wzModuleFilename, ::GetCurrentProcessId(), ::GetCurrentProcessId());
166
167 if (SUCCEEDED(hr))
168 {
169 ::MessageBoxW(NULL, wzMessage, L"WiX Bootstrapper Application", MB_SERVICE_NOTIFICATION | MB_TOPMOST | MB_ICONQUESTION | MB_OK | MB_SYSTEMMODAL);
170 }
171 }
172 }
173 }
174
175 ReleaseRegKey(hk);
176 ReleaseStr(sczModulePath);
177 ReleaseStr(sczDebugBootstrapperApplication);
178 ReleaseStr(sczDebugBootstrapperApplications);
49} 179}
50 180
51
52DAPI_(HRESULT) BalManifestLoad( 181DAPI_(HRESULT) BalManifestLoad(
53 __in HMODULE hBootstrapperApplicationModule, 182 __in HMODULE hBootstrapperApplicationModule,
54 __out IXMLDOMDocument** ppixdManifest 183 __out IXMLDOMDocument** ppixdManifest
@@ -671,3 +800,146 @@ LExit:
671 800
672 return hr; 801 return hr;
673} 802}
803
804
805static HRESULT ParseCommandLine(
806 __inout_z LPWSTR *psczPipeBaseName,
807 __inout_z LPWSTR *psczPipeSecret,
808 __out DWORD64 *pqwEngineAPIVersion
809 )
810{
811 HRESULT hr = S_OK;
812 LPWSTR wzCommandLine = ::GetCommandLineW();
813 int argc = 0;
814 LPWSTR* argv = NULL;
815
816 *pqwEngineAPIVersion = 0;
817
818 hr = AppParseCommandLine(wzCommandLine, &argc, &argv);
819 ExitOnFailure(hr, "Failed to parse command line.");
820
821 // Skip the executable full path in argv[0].
822 for (int i = 1; i < argc; ++i)
823 {
824 if (argv[i][0] == L'-')
825 {
826 if (CSTR_EQUAL == ::CompareStringOrdinal(&argv[i][1], -1, BOOTSTRAPPER_APPLICATION_COMMANDLINE_SWITCH_API_VERSION, -1, TRUE))
827 {
828 if (i + 1 >= argc)
829 {
830 BalExitOnRootFailure(hr = E_INVALIDARG, "Must specify an api version.");
831 }
832
833 ++i;
834
835 hr = StrStringToUInt64(argv[i], 0, pqwEngineAPIVersion);
836 BalExitOnFailure(hr, "Failed to parse api version: %ls", argv[i]);
837 }
838 else if (CSTR_EQUAL == ::CompareStringOrdinal(&argv[i][1], -1, BOOTSTRAPPER_APPLICATION_COMMANDLINE_SWITCH_PIPE_NAME, -1, TRUE))
839 {
840 if (i + 2 >= argc)
841 {
842 BalExitOnRootFailure(hr = E_INVALIDARG, "Must specify a pipe name and pipe secret.");
843 }
844
845 ++i;
846
847 hr = StrAllocString(psczPipeBaseName, argv[i], 0);
848 BalExitOnFailure(hr, "Failed to copy pipe name.");
849
850 ++i;
851
852 hr = StrAllocString(psczPipeSecret, argv[i], 0);
853 BalExitOnFailure(hr, "Failed to copy pipe secret.");
854 }
855 }
856 else
857 {
858 BalExitWithRootFailure(hr, E_INVALIDARG, "Invalid argument: %ls", argv[i]);
859 }
860 }
861
862LExit:
863 if (argv)
864 {
865 AppFreeCommandLineArgs(argv);
866 }
867
868 return hr;
869}
870
871static HRESULT ConnectToEngine(
872 __in_z LPCWSTR wzPipeBaseName,
873 __in_z LPCWSTR wzPipeSecret,
874 __out HANDLE *phBAPipe,
875 __out HANDLE *phEnginePipe
876 )
877{
878 HRESULT hr = S_OK;
879 LPWSTR sczBAPipeName = NULL;
880 LPWSTR sczEnginePipeName = NULL;
881 HANDLE hBAPipe = INVALID_HANDLE_VALUE;
882 HANDLE hEnginePipe = INVALID_HANDLE_VALUE;
883
884 DWORD cbPipeSecret = lstrlenW(wzPipeSecret) * sizeof(WCHAR);
885
886 hr = StrAllocFormatted(&sczBAPipeName, L"%ls%ls", wzPipeBaseName, L".BA");
887 ExitOnFailure(hr, "Failed to allocate BA pipe name.");
888
889 hr = StrAllocFormatted(&sczEnginePipeName, L"%ls%ls", wzPipeBaseName, L".BAEngine");
890 ExitOnFailure(hr, "Failed to allocate BA engine pipe name.");
891
892 hr = ConnectAndVerify(sczBAPipeName, wzPipeSecret, cbPipeSecret, &hBAPipe);
893 BalExitOnFailure(hr, "Failed to connect to bootstrapper application pipe.");
894
895 hr = ConnectAndVerify(sczEnginePipeName, wzPipeSecret, cbPipeSecret, &hEnginePipe);
896 BalExitOnFailure(hr, "Failed to connect to engine pipe.");
897
898 *phBAPipe = hBAPipe;
899 hBAPipe = INVALID_HANDLE_VALUE;
900
901 *phEnginePipe = hEnginePipe;
902 hEnginePipe = INVALID_HANDLE_VALUE;
903
904LExit:
905 ReleasePipeHandle(hEnginePipe);
906 ReleasePipeHandle(hBAPipe);
907 ReleaseStr(sczEnginePipeName);
908 ReleaseStr(sczBAPipeName);
909
910 return hr;
911}
912
913static HRESULT ConnectAndVerify(
914 __in_z LPCWSTR wzPipeName,
915 __in_z LPCWSTR wzPipeSecret,
916 __in DWORD cbPipeSecret,
917 __out HANDLE *phPipe
918 )
919{
920 HRESULT hr = S_OK;
921 HRESULT hrConnect = S_OK;
922 HANDLE hPipe = INVALID_HANDLE_VALUE;
923
924 hr = PipeClientConnect(wzPipeName, &hPipe);
925 BalExitOnFailure(hr, "Failed to connect to pipe.");
926
927 hr = FileWriteHandle(hPipe, reinterpret_cast<LPCBYTE>(&cbPipeSecret), sizeof(cbPipeSecret));
928 BalExitOnFailure(hr, "Failed to write secret size to pipe.");
929
930 hr = FileWriteHandle(hPipe, reinterpret_cast<LPCBYTE>(wzPipeSecret), cbPipeSecret);
931 BalExitOnFailure(hr, "Failed to write secret size to pipe.");
932
933 FileReadHandle(hPipe, reinterpret_cast<LPBYTE>(&hrConnect), sizeof(hrConnect));
934 BalExitOnFailure(hr, "Failed to read connect result from pipe.");
935
936 BalExitOnFailure(hrConnect, "Failed connect result from pipe.");
937
938 *phPipe = hPipe;
939 hPipe = INVALID_HANDLE_VALUE;
940
941LExit:
942 ReleasePipeHandle(hPipe);
943
944 return hr;
945}
diff --git a/src/api/burn/balutil/balutil.vcxproj b/src/api/burn/balutil/balutil.vcxproj
index d5cd146b..8f93d636 100644
--- a/src/api/burn/balutil/balutil.vcxproj
+++ b/src/api/burn/balutil/balutil.vcxproj
@@ -53,6 +53,7 @@
53 </PropertyGroup> 53 </PropertyGroup>
54 54
55 <ItemGroup> 55 <ItemGroup>
56 <ClCompile Include="BalBaseBAFunctionsProc.cpp" />
56 <ClCompile Include="BalBootstrapperEngine.cpp" /> 57 <ClCompile Include="BalBootstrapperEngine.cpp" />
57 <ClCompile Include="balcondition.cpp" /> 58 <ClCompile Include="balcondition.cpp" />
58 <ClCompile Include="balinfo.cpp" /> 59 <ClCompile Include="balinfo.cpp" />
@@ -61,23 +62,23 @@
61 <ClCompile Include="precomp.cpp"> 62 <ClCompile Include="precomp.cpp">
62 <PrecompiledHeader>Create</PrecompiledHeader> 63 <PrecompiledHeader>Create</PrecompiledHeader>
63 </ClCompile> 64 </ClCompile>
65 <ClCompile Include="msg.cpp" />
64 </ItemGroup> 66 </ItemGroup>
65 <ItemGroup> 67 <ItemGroup>
66 <ClInclude Include="inc\BAFunctions.h" /> 68 <ClInclude Include="inc\BAFunctions.h" />
67 <ClInclude Include="inc\BalBaseBAFunctions.h" /> 69 <ClInclude Include="inc\BalBaseBAFunctions.h" />
68 <ClInclude Include="inc\BalBaseBAFunctionsProc.h" /> 70 <ClInclude Include="inc\BalBaseBAFunctionsProc.h" />
69 <ClInclude Include="inc\BalBaseBootstrapperApplication.h" /> 71 <ClInclude Include="inc\BalBaseBootstrapperApplication.h" />
70 <ClInclude Include="inc\BalBaseBootstrapperApplicationProc.h" />
71 <ClInclude Include="inc\BalBootstrapperEngine.h" />
72 <ClInclude Include="inc\balcondition.h" /> 72 <ClInclude Include="inc\balcondition.h" />
73 <ClInclude Include="inc\balinfo.h" /> 73 <ClInclude Include="inc\balinfo.h" />
74 <ClInclude Include="inc\balretry.h" /> 74 <ClInclude Include="inc\balretry.h" />
75 <ClInclude Include="inc\balutil.h" /> 75 <ClInclude Include="inc\balutil.h" />
76 <ClInclude Include="inc\IBAFunctions.h" /> 76 <ClInclude Include="inc\IBAFunctions.h" />
77 <ClInclude Include="inc\IBootstrapperApplication.h" /> 77 <ClInclude Include="inc\IBootstrapperApplication.h" />
78 <ClInclude Include="inc\IBootstrapperApplicationFactory.h" />
79 <ClInclude Include="inc\IBootstrapperEngine.h" /> 78 <ClInclude Include="inc\IBootstrapperEngine.h" />
79 <ClInclude Include="BalBootstrapperEngine.h" />
80 <ClInclude Include="precomp.h" /> 80 <ClInclude Include="precomp.h" />
81 <ClInclude Include="msg.h" />
81 </ItemGroup> 82 </ItemGroup>
82 83
83 <ItemGroup> 84 <ItemGroup>
diff --git a/src/api/burn/balutil/inc/BAFunctions.h b/src/api/burn/balutil/inc/BAFunctions.h
index 4a0b8599..7908a74c 100644
--- a/src/api/burn/balutil/inc/BAFunctions.h
+++ b/src/api/burn/balutil/inc/BAFunctions.h
@@ -1,6 +1,7 @@
1#pragma once 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. 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 3
4#include "IBootstrapperEngine.h"
4 5
5#ifdef __cplusplus 6#ifdef __cplusplus
6extern "C" { 7extern "C" {
@@ -9,12 +10,14 @@ extern "C" {
9// The first 1024 messages are reserved so that the BA messages have the same value here. 10// The first 1024 messages are reserved so that the BA messages have the same value here.
10enum BA_FUNCTIONS_MESSAGE 11enum BA_FUNCTIONS_MESSAGE
11{ 12{
13 BA_FUNCTIONS_MESSAGE_ONCREATE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCREATE,
14 BA_FUNCTIONS_MESSAGE_ONDESTROY = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDESTROY,
15 BA_FUNCTIONS_MESSAGE_ONSTARTUP = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP,
16 BA_FUNCTIONS_MESSAGE_ONSHUTDOWN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN,
12 BA_FUNCTIONS_MESSAGE_ONDETECTBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, 17 BA_FUNCTIONS_MESSAGE_ONDETECTBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN,
13 BA_FUNCTIONS_MESSAGE_ONDETECTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, 18 BA_FUNCTIONS_MESSAGE_ONDETECTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE,
14 BA_FUNCTIONS_MESSAGE_ONPLANBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, 19 BA_FUNCTIONS_MESSAGE_ONPLANBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN,
15 BA_FUNCTIONS_MESSAGE_ONPLANCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, 20 BA_FUNCTIONS_MESSAGE_ONPLANCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE,
16 BA_FUNCTIONS_MESSAGE_ONSTARTUP = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP,
17 BA_FUNCTIONS_MESSAGE_ONSHUTDOWN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN,
18 BA_FUNCTIONS_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, 21 BA_FUNCTIONS_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE,
19 BA_FUNCTIONS_MESSAGE_ONDETECTUPDATEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, 22 BA_FUNCTIONS_MESSAGE_ONDETECTUPDATEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN,
20 BA_FUNCTIONS_MESSAGE_ONDETECTUPDATE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, 23 BA_FUNCTIONS_MESSAGE_ONDETECTUPDATE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE,
@@ -81,8 +84,6 @@ enum BA_FUNCTIONS_MESSAGE
81 BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, 84 BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE,
82 BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, 85 BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS,
83 BA_FUNCTIONS_MESSAGE_ONPLANROLLBACKBOUNDARY = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY, 86 BA_FUNCTIONS_MESSAGE_ONPLANROLLBACKBOUNDARY = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY,
84 BA_FUNCTIONS_MESSAGE_ONSETUPDATEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATEBEGIN,
85 BA_FUNCTIONS_MESSAGE_ONSETUPDATECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATECOMPLETE,
86 BA_FUNCTIONS_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, 87 BA_FUNCTIONS_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE,
87 BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, 88 BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN,
88 BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, 89 BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE,
@@ -117,7 +118,8 @@ struct BA_FUNCTIONS_CREATE_ARGS
117{ 118{
118 DWORD cbSize; 119 DWORD cbSize;
119 DWORD64 qwBAFunctionsAPIVersion; 120 DWORD64 qwBAFunctionsAPIVersion;
120 BOOTSTRAPPER_CREATE_ARGS* pBootstrapperCreateArgs; 121 IBootstrapperEngine* pEngine;
122 BOOTSTRAPPER_COMMAND* pCommand;
121}; 123};
122 124
123struct BA_FUNCTIONS_CREATE_RESULTS 125struct BA_FUNCTIONS_CREATE_RESULTS
diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctions.h b/src/api/burn/balutil/inc/BalBaseBAFunctions.h
index 6ad109c3..33b71324 100644
--- a/src/api/burn/balutil/inc/BalBaseBAFunctions.h
+++ b/src/api/burn/balutil/inc/BalBaseBAFunctions.h
@@ -1,16 +1,12 @@
1#pragma once 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. 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 3
4
5#include <windows.h> 4#include <windows.h>
6#include <msiquery.h> 5#include <msiquery.h>
7 6
8#include "BAFunctions.h" 7#include <batypes.h>
8
9#include "IBAFunctions.h" 9#include "IBAFunctions.h"
10#include "BootstrapperEngine.h"
11#include "BootstrapperApplication.h"
12#include "IBootstrapperEngine.h"
13#include "IBootstrapperApplication.h"
14 10
15class CBalBaseBAFunctions : public IBAFunctions 11class CBalBaseBAFunctions : public IBAFunctions
16{ 12{
@@ -69,8 +65,7 @@ public: // IBootstrapperApplication
69 virtual STDMETHODIMP_(HRESULT) BAProc( 65 virtual STDMETHODIMP_(HRESULT) BAProc(
70 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, 66 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/,
71 __in const LPVOID /*pvArgs*/, 67 __in const LPVOID /*pvArgs*/,
72 __inout LPVOID /*pvResults*/, 68 __inout LPVOID /*pvResults*/
73 __in_opt LPVOID /*pvContext*/
74 ) 69 )
75 { 70 {
76 return E_NOTIMPL; 71 return E_NOTIMPL;
@@ -80,12 +75,31 @@ public: // IBootstrapperApplication
80 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, 75 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/,
81 __in const LPVOID /*pvArgs*/, 76 __in const LPVOID /*pvArgs*/,
82 __inout LPVOID /*pvResults*/, 77 __inout LPVOID /*pvResults*/,
83 __inout HRESULT* /*phr*/, 78 __inout HRESULT* /*phr*/
84 __in_opt LPVOID /*pvContext*/
85 ) 79 )
86 { 80 {
87 } 81 }
88 82
83 virtual STDMETHODIMP OnCreate(
84 __in IBootstrapperEngine* pEngine,
85 __in BOOTSTRAPPER_COMMAND* /*pCommand*/
86 )
87 {
88 HRESULT hr = S_OK;
89
90 pEngine->AddRef();
91 m_pEngine = pEngine;
92
93 return hr;
94 }
95
96 virtual STDMETHODIMP OnDestroy(
97 __in BOOL /*fReload*/
98 )
99 {
100 return S_OK;
101 }
102
89 virtual STDMETHODIMP OnStartup() 103 virtual STDMETHODIMP OnStartup()
90 { 104 {
91 return S_OK; 105 return S_OK;
@@ -837,20 +851,6 @@ public: // IBootstrapperApplication
837 return S_OK; 851 return S_OK;
838 } 852 }
839 853
840 virtual STDMETHODIMP OnSetUpdateBegin()
841 {
842 return S_OK;
843 }
844
845 virtual STDMETHODIMP OnSetUpdateComplete(
846 __in HRESULT /*hrStatus*/,
847 __in_z_opt LPCWSTR /*wzPreviousPackageId*/,
848 __in_z_opt LPCWSTR /*wzNewPackageId*/
849 )
850 {
851 return S_OK;
852 }
853
854 virtual STDMETHODIMP OnPlanRestoreRelatedBundle( 854 virtual STDMETHODIMP OnPlanRestoreRelatedBundle(
855 __in_z LPCWSTR /*wzBundleId*/, 855 __in_z LPCWSTR /*wzBundleId*/,
856 __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, 856 __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/,
@@ -996,22 +996,13 @@ public: // IBAFunctions
996 } 996 }
997 997
998protected: 998protected:
999 CBalBaseBAFunctions( 999 CBalBaseBAFunctions(HMODULE hModule)
1000 __in HMODULE hModule,
1001 __in IBootstrapperEngine* pEngine,
1002 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs
1003 )
1004 { 1000 {
1005 m_cReferences = 1; 1001 m_cReferences = 1;
1006 m_hModule = hModule; 1002 m_hModule = hModule;
1007 pEngine->AddRef();
1008 m_pEngine = pEngine;
1009 1003
1010 memcpy_s(&m_command, sizeof(m_command), pArgs->pBootstrapperCreateArgs->pCommand, sizeof(BOOTSTRAPPER_COMMAND)); 1004 m_hwndParent = NULL;
1011 memcpy_s(&m_baCreateArgs, sizeof(m_baCreateArgs), pArgs->pBootstrapperCreateArgs, sizeof(BOOTSTRAPPER_CREATE_ARGS)); 1005 m_pEngine = NULL;
1012 memcpy_s(&m_bafCreateArgs, sizeof(m_bafCreateArgs), pArgs, sizeof(BA_FUNCTIONS_CREATE_ARGS));
1013 m_baCreateArgs.pCommand = &m_command;
1014 m_bafCreateArgs.pBootstrapperCreateArgs = &m_baCreateArgs;
1015 } 1006 }
1016 1007
1017 virtual ~CBalBaseBAFunctions() 1008 virtual ~CBalBaseBAFunctions()
@@ -1025,8 +1016,5 @@ private:
1025protected: 1016protected:
1026 IBootstrapperEngine* m_pEngine; 1017 IBootstrapperEngine* m_pEngine;
1027 HMODULE m_hModule; 1018 HMODULE m_hModule;
1028 BA_FUNCTIONS_CREATE_ARGS m_bafCreateArgs;
1029 BOOTSTRAPPER_CREATE_ARGS m_baCreateArgs;
1030 BOOTSTRAPPER_COMMAND m_command;
1031 HWND m_hwndParent; 1019 HWND m_hwndParent;
1032}; 1020};
diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h
index 728bd2b5..65eeb0b4 100644
--- a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h
+++ b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h
@@ -1,191 +1,15 @@
1#pragma once 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. 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 3
4
5#include "BalBaseBootstrapperApplicationProc.h"
6#include "BAFunctions.h"
7#include "IBAFunctions.h"
8
9static HRESULT BalBaseBAFunctionsProcOnThemeLoaded(
10 __in IBAFunctions* pBAFunctions,
11 __in BA_FUNCTIONS_ONTHEMELOADED_ARGS* pArgs,
12 __inout BA_FUNCTIONS_ONTHEMELOADED_RESULTS* /*pResults*/
13 )
14{
15 return pBAFunctions->OnThemeLoaded(pArgs->hWnd);
16}
17
18static HRESULT BalBaseBAFunctionsProcWndProc(
19 __in IBAFunctions* pBAFunctions,
20 __in BA_FUNCTIONS_WNDPROC_ARGS* pArgs,
21 __inout BA_FUNCTIONS_WNDPROC_RESULTS* pResults
22 )
23{
24 return pBAFunctions->WndProc(pArgs->hWnd, pArgs->uMsg, pArgs->wParam, pArgs->lParam, &pResults->fProcessed, &pResults->lResult);
25}
26
27static HRESULT BalBaseBAFunctionsProcOnThemeControlLoading(
28 __in IBAFunctions* pBAFunctions,
29 __in BA_FUNCTIONS_ONTHEMECONTROLLOADING_ARGS* pArgs,
30 __inout BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS* pResults
31 )
32{
33 return pBAFunctions->OnThemeControlLoading(pArgs->wzName, &pResults->fProcessed, &pResults->wId, &pResults->dwAutomaticBehaviorType);
34}
35
36static HRESULT BalBaseBAFunctionsProcOnThemeControlWmCommand(
37 __in IBAFunctions* pBAFunctions,
38 __in BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_ARGS* pArgs,
39 __inout BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_RESULTS* pResults
40 )
41{
42 return pBAFunctions->OnThemeControlWmCommand(pArgs->wParam, pArgs->wzName, pArgs->wId, pArgs->hWnd, &pResults->fProcessed, &pResults->lResult);
43}
44
45static HRESULT BalBaseBAFunctionsProcOnThemeControlWmNotify(
46 __in IBAFunctions* pBAFunctions,
47 __in BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_ARGS* pArgs,
48 __inout BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_RESULTS* pResults
49 )
50{
51 return pBAFunctions->OnThemeControlWmNotify(pArgs->lParam, pArgs->wzName, pArgs->wId, pArgs->hWnd, &pResults->fProcessed, &pResults->lResult);
52}
53
54static HRESULT BalBaseBAFunctionsProcOnThemeControlLoaded(
55 __in IBAFunctions* pBAFunctions,
56 __in BA_FUNCTIONS_ONTHEMECONTROLLOADED_ARGS* pArgs,
57 __inout BA_FUNCTIONS_ONTHEMECONTROLLOADED_RESULTS* pResults
58 )
59{
60 return pBAFunctions->OnThemeControlLoaded(pArgs->wzName, pArgs->wId, pArgs->hWnd, &pResults->fProcessed);
61}
62
63/******************************************************************* 4/*******************************************************************
64BalBaseBAFunctionsProc - requires pvContext to be of type IBAFunctions. 5BalBaseBAFunctionsProc - requires pvContext to be of type IBAFunctions.
65Provides a default mapping between the message based BAFunctions interface and 6Provides a default mapping between the message based BAFunctions interface and
66the COM-based BAFunctions interface. 7the COM-based BAFunctions interface.
67 8
68*******************************************************************/ 9*******************************************************************/
69static HRESULT WINAPI BalBaseBAFunctionsProc( 10HRESULT WINAPI BalBaseBAFunctionsProc(
70 __in BA_FUNCTIONS_MESSAGE message, 11 __in BA_FUNCTIONS_MESSAGE message,
71 __in const LPVOID pvArgs, 12 __in const LPVOID pvArgs,
72 __inout LPVOID pvResults, 13 __inout LPVOID pvResults,
73 __in_opt LPVOID pvContext 14 __in_opt LPVOID pvContext
74 ) 15 );
75{
76 IBAFunctions* pBAFunctions = reinterpret_cast<IBAFunctions*>(pvContext);
77 HRESULT hr = pBAFunctions->BAFunctionsProc(message, pvArgs, pvResults, pvContext);
78
79 if (E_NOTIMPL == hr)
80 {
81 switch (message)
82 {
83 case BA_FUNCTIONS_MESSAGE_ONDETECTBEGIN:
84 case BA_FUNCTIONS_MESSAGE_ONDETECTCOMPLETE:
85 case BA_FUNCTIONS_MESSAGE_ONPLANBEGIN:
86 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPLETE:
87 case BA_FUNCTIONS_MESSAGE_ONSTARTUP:
88 case BA_FUNCTIONS_MESSAGE_ONSHUTDOWN:
89 case BA_FUNCTIONS_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE:
90 case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATEBEGIN:
91 case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATE:
92 case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATECOMPLETE:
93 case BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLE:
94 case BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGEBEGIN:
95 case BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDMSIPACKAGE:
96 case BA_FUNCTIONS_MESSAGE_ONDETECTPATCHTARGET:
97 case BA_FUNCTIONS_MESSAGE_ONDETECTMSIFEATURE:
98 case BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGECOMPLETE:
99 case BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLE:
100 case BA_FUNCTIONS_MESSAGE_ONPLANPACKAGEBEGIN:
101 case BA_FUNCTIONS_MESSAGE_ONPLANPATCHTARGET:
102 case BA_FUNCTIONS_MESSAGE_ONPLANMSIFEATURE:
103 case BA_FUNCTIONS_MESSAGE_ONPLANPACKAGECOMPLETE:
104 case BA_FUNCTIONS_MESSAGE_ONAPPLYBEGIN:
105 case BA_FUNCTIONS_MESSAGE_ONELEVATEBEGIN:
106 case BA_FUNCTIONS_MESSAGE_ONELEVATECOMPLETE:
107 case BA_FUNCTIONS_MESSAGE_ONPROGRESS:
108 case BA_FUNCTIONS_MESSAGE_ONERROR:
109 case BA_FUNCTIONS_MESSAGE_ONREGISTERBEGIN:
110 case BA_FUNCTIONS_MESSAGE_ONREGISTERCOMPLETE:
111 case BA_FUNCTIONS_MESSAGE_ONCACHEBEGIN:
112 case BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGEBEGIN:
113 case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREBEGIN:
114 case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREPROGRESS:
115 case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRERESOLVING:
116 case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRECOMPLETE:
117 case BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYBEGIN:
118 case BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYCOMPLETE:
119 case BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGECOMPLETE:
120 case BA_FUNCTIONS_MESSAGE_ONCACHECOMPLETE:
121 case BA_FUNCTIONS_MESSAGE_ONEXECUTEBEGIN:
122 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGEBEGIN:
123 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPATCHTARGET:
124 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPROGRESS:
125 case BA_FUNCTIONS_MESSAGE_ONEXECUTEMSIMESSAGE:
126 case BA_FUNCTIONS_MESSAGE_ONEXECUTEFILESINUSE:
127 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGECOMPLETE:
128 case BA_FUNCTIONS_MESSAGE_ONEXECUTECOMPLETE:
129 case BA_FUNCTIONS_MESSAGE_ONUNREGISTERBEGIN:
130 case BA_FUNCTIONS_MESSAGE_ONUNREGISTERCOMPLETE:
131 case BA_FUNCTIONS_MESSAGE_ONAPPLYCOMPLETE:
132 case BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN:
133 case BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE:
134 case BA_FUNCTIONS_MESSAGE_ONPLANMSIPACKAGE:
135 case BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONBEGIN:
136 case BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE:
137 case BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN:
138 case BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE:
139 case BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN:
140 case BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE:
141 case BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN:
142 case BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE:
143 case BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN:
144 case BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE:
145 case BA_FUNCTIONS_MESSAGE_ONPLANNEDPACKAGE:
146 case BA_FUNCTIONS_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE:
147 case BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYPROGRESS:
148 case BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN:
149 case BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE:
150 case BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS:
151 case BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN:
152 case BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE:
153 case BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS:
154 case BA_FUNCTIONS_MESSAGE_ONPLANROLLBACKBOUNDARY:
155 case BA_FUNCTIONS_MESSAGE_ONSETUPDATEBEGIN:
156 case BA_FUNCTIONS_MESSAGE_ONSETUPDATECOMPLETE:
157 case BA_FUNCTIONS_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE:
158 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN:
159 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE:
160 case BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE:
161 case BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE:
162 case BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE:
163 case BA_FUNCTIONS_MESSAGE_ONAPPLYDOWNGRADE:
164 case BA_FUNCTIONS_MESSAGE_ONEXECUTEPROCESSCANCEL:
165 case BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE:
166 case BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE:
167 hr = BalBaseBootstrapperApplicationProc((BOOTSTRAPPER_APPLICATION_MESSAGE)message, pvArgs, pvResults, pvContext);
168 break;
169 case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED:
170 hr = BalBaseBAFunctionsProcOnThemeLoaded(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMELOADED_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMELOADED_RESULTS*>(pvResults));
171 break;
172 case BA_FUNCTIONS_MESSAGE_WNDPROC:
173 hr = BalBaseBAFunctionsProcWndProc(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_WNDPROC_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_WNDPROC_RESULTS*>(pvResults));
174 break;
175 case BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADING:
176 hr = BalBaseBAFunctionsProcOnThemeControlLoading(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLLOADING_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS*>(pvResults));
177 break;
178 case BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLWMCOMMAND:
179 hr = BalBaseBAFunctionsProcOnThemeControlWmCommand(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_RESULTS*>(pvResults));
180 break;
181 case BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLWMNOTIFY:
182 hr = BalBaseBAFunctionsProcOnThemeControlWmNotify(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_RESULTS*>(pvResults));
183 break;
184 case BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADED:
185 hr = BalBaseBAFunctionsProcOnThemeControlLoaded(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLLOADED_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMECONTROLLOADED_RESULTS*>(pvResults));
186 break;
187 }
188 }
189
190 return hr;
191}
diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
index ae7b2a93..30c75fb6 100644
--- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
+++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
@@ -3,8 +3,6 @@
3#include <windows.h> 3#include <windows.h>
4#include <msiquery.h> 4#include <msiquery.h>
5 5
6#include "BootstrapperEngine.h"
7#include "BootstrapperApplication.h"
8#include "IBootstrapperEngine.h" 6#include "IBootstrapperEngine.h"
9#include "IBootstrapperApplication.h" 7#include "IBootstrapperApplication.h"
10 8
@@ -12,7 +10,9 @@
12#include "balinfo.h" 10#include "balinfo.h"
13#include "balretry.h" 11#include "balretry.h"
14 12
15class CBalBaseBootstrapperApplication : public IBootstrapperApplication 13#define CBalBaseBootstrapperApplication CBootstrapperApplication
14
15class CBootstrapperApplication : public IBootstrapperApplication
16{ 16{
17public: // IUnknown 17public: // IUnknown
18 virtual STDMETHODIMP QueryInterface( 18 virtual STDMETHODIMP QueryInterface(
@@ -65,8 +65,7 @@ public: // IBootstrapperApplication
65 virtual STDMETHODIMP_(HRESULT) BAProc( 65 virtual STDMETHODIMP_(HRESULT) BAProc(
66 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, 66 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/,
67 __in const LPVOID /*pvArgs*/, 67 __in const LPVOID /*pvArgs*/,
68 __inout LPVOID /*pvResults*/, 68 __inout LPVOID /*pvResults*/
69 __in_opt LPVOID /*pvContext*/
70 ) 69 )
71 { 70 {
72 return E_NOTIMPL; 71 return E_NOTIMPL;
@@ -76,10 +75,35 @@ public: // IBootstrapperApplication
76 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, 75 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/,
77 __in const LPVOID /*pvArgs*/, 76 __in const LPVOID /*pvArgs*/,
78 __inout LPVOID /*pvResults*/, 77 __inout LPVOID /*pvResults*/,
79 __inout HRESULT* /*phr*/, 78 __inout HRESULT* /*phr*/
80 __in_opt LPVOID /*pvContext*/ 79 )
80 {
81 }
82
83 virtual STDMETHODIMP OnCreate(
84 __in IBootstrapperEngine* pEngine,
85 __in BOOTSTRAPPER_COMMAND* pCommand
86 )
87 {
88 HRESULT hr = S_OK;
89
90 m_commandDisplay = pCommand->display;
91
92 hr = BalInfoParseCommandLine(&m_BalInfoCommand, pCommand);
93 BalExitOnFailure(hr, "Failed to parse command line with balutil.");
94
95 pEngine->AddRef();
96 m_pEngine = pEngine;
97
98 LExit:
99 return hr;
100 }
101
102 virtual STDMETHODIMP OnDestroy(
103 __in BOOL /*fReload*/
81 ) 104 )
82 { 105 {
106 return S_OK;
83 } 107 }
84 108
85 virtual STDMETHODIMP OnStartup() 109 virtual STDMETHODIMP OnStartup()
@@ -429,7 +453,7 @@ public: // IBootstrapperApplication
429 m_dwProgressPercentage = dwProgressPercentage; 453 m_dwProgressPercentage = dwProgressPercentage;
430 m_dwOverallProgressPercentage = dwOverallProgressPercentage; 454 m_dwOverallProgressPercentage = dwOverallProgressPercentage;
431 455
432 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) 456 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
433 { 457 {
434 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); 458 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult);
435 BalExitOnFailure(hr, "Failed to send embedded overall progress."); 459 BalExitOnFailure(hr, "Failed to send embedded overall progress.");
@@ -463,7 +487,7 @@ public: // IBootstrapperApplication
463 { 487 {
464 BalRetryErrorOccurred(wzPackageId, dwCode); 488 BalRetryErrorOccurred(wzPackageId, dwCode);
465 489
466 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) 490 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
467 { 491 {
468 HRESULT hr = m_pEngine->SendEmbeddedError(dwCode, wzError, dwUIHint, pResult); 492 HRESULT hr = m_pEngine->SendEmbeddedError(dwCode, wzError, dwUIHint, pResult);
469 if (FAILED(hr)) 493 if (FAILED(hr))
@@ -475,7 +499,7 @@ public: // IBootstrapperApplication
475 { 499 {
476 *pResult = IDCANCEL; 500 *pResult = IDCANCEL;
477 } 501 }
478 else if (BOOTSTRAPPER_DISPLAY_FULL == m_display) 502 else if (BOOTSTRAPPER_DISPLAY_FULL == m_commandDisplay)
479 { 503 {
480 if (BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_SERVER == errorType || BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_PROXY == errorType) 504 if (BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_SERVER == errorType || BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_PROXY == errorType)
481 { 505 {
@@ -553,7 +577,7 @@ public: // IBootstrapperApplication
553 577
554 // Send progress even though we don't update the numbers to at least give the caller an opportunity 578 // Send progress even though we don't update the numbers to at least give the caller an opportunity
555 // to cancel. 579 // to cancel.
556 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) 580 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
557 { 581 {
558 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); 582 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult);
559 BalExitOnFailure(hr, "Failed to send embedded cache progress."); 583 BalExitOnFailure(hr, "Failed to send embedded cache progress.");
@@ -733,7 +757,7 @@ public: // IBootstrapperApplication
733 757
734 // Send progress even though we don't update the numbers to at least give the caller an opportunity 758 // Send progress even though we don't update the numbers to at least give the caller an opportunity
735 // to cancel. 759 // to cancel.
736 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) 760 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
737 { 761 {
738 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); 762 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult);
739 BalExitOnFailure(hr, "Failed to send embedded execute progress."); 763 BalExitOnFailure(hr, "Failed to send embedded execute progress.");
@@ -848,7 +872,7 @@ public: // IBootstrapperApplication
848 { 872 {
849 HRESULT hr = S_OK; 873 HRESULT hr = S_OK;
850 BOOL fRestartRequired = BOOTSTRAPPER_APPLY_RESTART_REQUIRED == restart; 874 BOOL fRestartRequired = BOOTSTRAPPER_APPLY_RESTART_REQUIRED == restart;
851 BOOL fShouldBlockRestart = BOOTSTRAPPER_DISPLAY_FULL <= m_display && BAL_INFO_RESTART_PROMPT >= m_BalInfoCommand.restart; 875 BOOL fShouldBlockRestart = BOOTSTRAPPER_DISPLAY_FULL <= m_commandDisplay && BAL_INFO_RESTART_PROMPT >= m_BalInfoCommand.restart;
852 876
853 if (fRestartRequired && !fShouldBlockRestart) 877 if (fRestartRequired && !fShouldBlockRestart)
854 { 878 {
@@ -1050,20 +1074,6 @@ public: // IBootstrapperApplication
1050 return S_OK; 1074 return S_OK;
1051 } 1075 }
1052 1076
1053 virtual STDMETHODIMP OnSetUpdateBegin()
1054 {
1055 return S_OK;
1056 }
1057
1058 virtual STDMETHODIMP OnSetUpdateComplete(
1059 __in HRESULT /*hrStatus*/,
1060 __in_z_opt LPCWSTR /*wzPreviousPackageId*/,
1061 __in_z_opt LPCWSTR /*wzNewPackageId*/
1062 )
1063 {
1064 return S_OK;
1065 }
1066
1067 virtual STDMETHODIMP OnPlanRestoreRelatedBundle( 1077 virtual STDMETHODIMP OnPlanRestoreRelatedBundle(
1068 __in_z LPCWSTR /*wzBundleId*/, 1078 __in_z LPCWSTR /*wzBundleId*/,
1069 __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, 1079 __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/,
@@ -1127,22 +1137,6 @@ public: // IBootstrapperApplication
1127 return S_OK; 1137 return S_OK;
1128 } 1138 }
1129 1139
1130public: //CBalBaseBootstrapperApplication
1131 virtual STDMETHODIMP Initialize(
1132 __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs
1133 )
1134 {
1135 HRESULT hr = S_OK;
1136
1137 m_display = pCreateArgs->pCommand->display;
1138
1139 hr = BalInfoParseCommandLine(&m_BalInfoCommand, pCreateArgs->pCommand);
1140 BalExitOnFailure(hr, "Failed to parse command line with balutil.");
1141
1142 LExit:
1143 return hr;
1144 }
1145
1146protected: 1140protected:
1147 // 1141 //
1148 // PromptCancel - prompts the user to close (if not forced). 1142 // PromptCancel - prompts the user to close (if not forced).
@@ -1195,16 +1189,14 @@ protected:
1195 } 1189 }
1196 1190
1197 CBalBaseBootstrapperApplication( 1191 CBalBaseBootstrapperApplication(
1198 __in IBootstrapperEngine* pEngine,
1199 __in DWORD dwRetryCount = 0, 1192 __in DWORD dwRetryCount = 0,
1200 __in DWORD dwRetryTimeout = 1000 1193 __in DWORD dwRetryTimeout = 1000
1201 ) 1194 )
1202 { 1195 {
1203 m_cReferences = 1; 1196 m_cReferences = 1;
1204 m_display = BOOTSTRAPPER_DISPLAY_UNKNOWN; 1197 m_commandDisplay = BOOTSTRAPPER_DISPLAY_UNKNOWN;
1205 1198
1206 pEngine->AddRef(); 1199 m_pEngine = NULL;
1207 m_pEngine = pEngine;
1208 1200
1209 ::InitializeCriticalSection(&m_csCanceled); 1201 ::InitializeCriticalSection(&m_csCanceled);
1210 m_fCanceled = FALSE; 1202 m_fCanceled = FALSE;
@@ -1230,12 +1222,12 @@ protected:
1230 CRITICAL_SECTION m_csCanceled; 1222 CRITICAL_SECTION m_csCanceled;
1231 BOOL m_fCanceled; 1223 BOOL m_fCanceled;
1232 1224
1225 IBootstrapperEngine* m_pEngine;
1233 BAL_INFO_COMMAND m_BalInfoCommand; 1226 BAL_INFO_COMMAND m_BalInfoCommand;
1234 1227
1235private: 1228private:
1236 long m_cReferences; 1229 long m_cReferences;
1237 BOOTSTRAPPER_DISPLAY m_display; 1230 BOOTSTRAPPER_DISPLAY m_commandDisplay;
1238 IBootstrapperEngine* m_pEngine;
1239 1231
1240 BOOL m_fRollingBack; 1232 BOOL m_fRollingBack;
1241 1233
diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h
deleted file mode 100644
index 34739ba3..00000000
--- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h
+++ /dev/null
@@ -1,1045 +0,0 @@
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#include <windows.h>
6
7#include "BootstrapperEngine.h"
8#include "BootstrapperApplication.h"
9#include "IBootstrapperEngine.h"
10#include "IBootstrapperApplication.h"
11
12static HRESULT BalBaseBAProcOnDetectBegin(
13 __in IBootstrapperApplication* pBA,
14 __in BA_ONDETECTBEGIN_ARGS* pArgs,
15 __inout BA_ONDETECTBEGIN_RESULTS* pResults
16 )
17{
18 return pBA->OnDetectBegin(pArgs->fCached, pArgs->registrationType, pArgs->cPackages, &pResults->fCancel);
19}
20
21static HRESULT BalBaseBAProcOnDetectComplete(
22 __in IBootstrapperApplication* pBA,
23 __in BA_ONDETECTCOMPLETE_ARGS* pArgs,
24 __inout BA_ONDETECTCOMPLETE_RESULTS* /*pResults*/
25 )
26{
27 return pBA->OnDetectComplete(pArgs->hrStatus, pArgs->fEligibleForCleanup);
28}
29
30static HRESULT BalBaseBAProcOnPlanBegin(
31 __in IBootstrapperApplication* pBA,
32 __in BA_ONPLANBEGIN_ARGS* pArgs,
33 __inout BA_ONPLANBEGIN_RESULTS* pResults
34 )
35{
36 return pBA->OnPlanBegin(pArgs->cPackages, &pResults->fCancel);
37}
38
39static HRESULT BalBaseBAProcOnPlanComplete(
40 __in IBootstrapperApplication* pBA,
41 __in BA_ONPLANCOMPLETE_ARGS* pArgs,
42 __inout BA_ONPLANCOMPLETE_RESULTS* /*pResults*/
43 )
44{
45 return pBA->OnPlanComplete(pArgs->hrStatus);
46}
47
48static HRESULT BalBaseBAProcOnStartup(
49 __in IBootstrapperApplication* pBA,
50 __in BA_ONSTARTUP_ARGS* /*pArgs*/,
51 __inout BA_ONSTARTUP_RESULTS* /*pResults*/
52 )
53{
54 return pBA->OnStartup();
55}
56
57static HRESULT BalBaseBAProcOnShutdown(
58 __in IBootstrapperApplication* pBA,
59 __in BA_ONSHUTDOWN_ARGS* /*pArgs*/,
60 __inout BA_ONSHUTDOWN_RESULTS* pResults
61 )
62{
63 return pBA->OnShutdown(&pResults->action);
64}
65
66static HRESULT BalBaseBAProcOnDetectForwardCompatibleBundle(
67 __in IBootstrapperApplication* pBA,
68 __in BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS* pArgs,
69 __inout BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS* pResults
70 )
71{
72 return pBA->OnDetectForwardCompatibleBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fMissingFromCache, &pResults->fCancel);
73}
74
75static HRESULT BalBaseBAProcOnDetectUpdateBegin(
76 __in IBootstrapperApplication* pBA,
77 __in BA_ONDETECTUPDATEBEGIN_ARGS* pArgs,
78 __inout BA_ONDETECTUPDATEBEGIN_RESULTS* pResults
79 )
80{
81 return pBA->OnDetectUpdateBegin(pArgs->wzUpdateLocation, &pResults->fCancel, &pResults->fSkip);
82}
83
84static HRESULT BalBaseBAProcOnDetectUpdate(
85 __in IBootstrapperApplication* pBA,
86 __in BA_ONDETECTUPDATE_ARGS* pArgs,
87 __inout BA_ONDETECTUPDATE_RESULTS* pResults
88 )
89{
90 return pBA->OnDetectUpdate(pArgs->wzUpdateLocation, pArgs->dw64Size, pArgs->wzHash, pArgs->hashAlgorithm, pArgs->wzVersion, pArgs->wzTitle, pArgs->wzSummary, pArgs->wzContentType, pArgs->wzContent, &pResults->fCancel, &pResults->fStopProcessingUpdates);
91}
92
93static HRESULT BalBaseBAProcOnDetectUpdateComplete(
94 __in IBootstrapperApplication* pBA,
95 __in BA_ONDETECTUPDATECOMPLETE_ARGS* pArgs,
96 __inout BA_ONDETECTUPDATECOMPLETE_RESULTS* pResults
97 )
98{
99 return pBA->OnDetectUpdateComplete(pArgs->hrStatus, &pResults->fIgnoreError);
100}
101
102static HRESULT BalBaseBAProcOnDetectRelatedBundle(
103 __in IBootstrapperApplication* pBA,
104 __in BA_ONDETECTRELATEDBUNDLE_ARGS* pArgs,
105 __inout BA_ONDETECTRELATEDBUNDLE_RESULTS* pResults
106 )
107{
108 return pBA->OnDetectRelatedBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fMissingFromCache, &pResults->fCancel);
109}
110
111static HRESULT BalBaseBAProcOnDetectPackageBegin(
112 __in IBootstrapperApplication* pBA,
113 __in BA_ONDETECTPACKAGEBEGIN_ARGS* pArgs,
114 __inout BA_ONDETECTPACKAGEBEGIN_RESULTS* pResults
115 )
116{
117 return pBA->OnDetectPackageBegin(pArgs->wzPackageId, &pResults->fCancel);
118}
119
120static HRESULT BalBaseBAProcOnDetectCompatiblePackage(
121 __in IBootstrapperApplication* pBA,
122 __in BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS* pArgs,
123 __inout BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS* pResults
124 )
125{
126 return pBA->OnDetectCompatibleMsiPackage(pArgs->wzPackageId, pArgs->wzCompatiblePackageId, pArgs->wzCompatiblePackageVersion, &pResults->fCancel);
127}
128
129static HRESULT BalBaseBAProcOnDetectRelatedMsiPackage(
130 __in IBootstrapperApplication* pBA,
131 __in BA_ONDETECTRELATEDMSIPACKAGE_ARGS* pArgs,
132 __inout BA_ONDETECTRELATEDMSIPACKAGE_RESULTS* pResults
133 )
134{
135 return pBA->OnDetectRelatedMsiPackage(pArgs->wzPackageId, pArgs->wzUpgradeCode, pArgs->wzProductCode, pArgs->fPerMachine, pArgs->wzVersion, pArgs->operation, &pResults->fCancel);
136}
137
138static HRESULT BalBaseBAProcOnDetectPatchTarget(
139 __in IBootstrapperApplication* pBA,
140 __in BA_ONDETECTPATCHTARGET_ARGS* pArgs,
141 __inout BA_ONDETECTPATCHTARGET_RESULTS* pResults
142 )
143{
144 return pBA->OnDetectPatchTarget(pArgs->wzPackageId, pArgs->wzProductCode, pArgs->patchState, &pResults->fCancel);
145}
146
147static HRESULT BalBaseBAProcOnDetectMsiFeature(
148 __in IBootstrapperApplication* pBA,
149 __in BA_ONDETECTMSIFEATURE_ARGS* pArgs,
150 __inout BA_ONDETECTMSIFEATURE_RESULTS* pResults
151 )
152{
153 return pBA->OnDetectMsiFeature(pArgs->wzPackageId, pArgs->wzFeatureId, pArgs->state, &pResults->fCancel);
154}
155
156static HRESULT BalBaseBAProcOnDetectPackageComplete(
157 __in IBootstrapperApplication* pBA,
158 __in BA_ONDETECTPACKAGECOMPLETE_ARGS* pArgs,
159 __inout BA_ONDETECTPACKAGECOMPLETE_RESULTS* /*pResults*/
160 )
161{
162 return pBA->OnDetectPackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->state, pArgs->fCached);
163}
164
165static HRESULT BalBaseBAProcOnPlanRelatedBundle(
166 __in IBootstrapperApplication* pBA,
167 __in BA_ONPLANRELATEDBUNDLE_ARGS* pArgs,
168 __inout BA_ONPLANRELATEDBUNDLE_RESULTS* pResults
169 )
170{
171 return pBA->OnPlanRelatedBundle(pArgs->wzBundleId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
172}
173
174static HRESULT BalBaseBAProcOnPlanRollbackBoundary(
175 __in IBootstrapperApplication* pBA,
176 __in BA_ONPLANROLLBACKBOUNDARY_ARGS* pArgs,
177 __inout BA_ONPLANROLLBACKBOUNDARY_RESULTS* pResults
178 )
179{
180 return pBA->OnPlanRollbackBoundary(pArgs->wzRollbackBoundaryId, pArgs->fRecommendedTransaction, &pResults->fTransaction, &pResults->fCancel);
181}
182
183static HRESULT BalBaseBAProcOnPlanPackageBegin(
184 __in IBootstrapperApplication* pBA,
185 __in BA_ONPLANPACKAGEBEGIN_ARGS* pArgs,
186 __inout BA_ONPLANPACKAGEBEGIN_RESULTS* pResults
187 )
188{
189 return pBA->OnPlanPackageBegin(pArgs->wzPackageId, pArgs->state, pArgs->fCached, pArgs->installCondition, pArgs->repairCondition, pArgs->recommendedState, pArgs->recommendedCacheType, &pResults->requestedState, &pResults->requestedCacheType, &pResults->fCancel);
190}
191
192static HRESULT BalBaseBAProcOnPlanCompatibleMsiPackageBegin(
193 __in IBootstrapperApplication* pBA,
194 __in BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS* pArgs,
195 __inout BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS* pResults
196 )
197{
198 return pBA->OnPlanCompatibleMsiPackageBegin(pArgs->wzPackageId, pArgs->wzCompatiblePackageId, pArgs->wzCompatiblePackageVersion, pArgs->fRecommendedRemove, &pResults->fRequestRemove, &pResults->fCancel);
199}
200
201static HRESULT BalBaseBAProcOnPlanCompatibleMsiPackageComplete(
202 __in IBootstrapperApplication* pBA,
203 __in BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS* pArgs,
204 __inout BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS* /*pResults*/
205 )
206{
207 return pBA->OnPlanCompatibleMsiPackageComplete(pArgs->wzPackageId, pArgs->wzCompatiblePackageId, pArgs->hrStatus, pArgs->fRequestedRemove);
208}
209
210static HRESULT BalBaseBAProcOnPlanPatchTarget(
211 __in IBootstrapperApplication* pBA,
212 __in BA_ONPLANPATCHTARGET_ARGS* pArgs,
213 __inout BA_ONPLANPATCHTARGET_RESULTS* pResults
214 )
215{
216 return pBA->OnPlanPatchTarget(pArgs->wzPackageId, pArgs->wzProductCode, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
217}
218
219static HRESULT BalBaseBAProcOnPlanMsiFeature(
220 __in IBootstrapperApplication* pBA,
221 __in BA_ONPLANMSIFEATURE_ARGS* pArgs,
222 __inout BA_ONPLANMSIFEATURE_RESULTS* pResults
223 )
224{
225 return pBA->OnPlanMsiFeature(pArgs->wzPackageId, pArgs->wzFeatureId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
226}
227
228static HRESULT BalBaseBAProcOnPlanPackageComplete(
229 __in IBootstrapperApplication* pBA,
230 __in BA_ONPLANPACKAGECOMPLETE_ARGS* pArgs,
231 __inout BA_ONPLANPACKAGECOMPLETE_RESULTS* /*pResults*/
232 )
233{
234 return pBA->OnPlanPackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->requested);
235}
236
237static HRESULT BalBaseBAProcOnPlannedCompatiblePackage(
238 __in IBootstrapperApplication* pBA,
239 __in BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS* pArgs,
240 __inout BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS* /*pResults*/
241 )
242{
243 return pBA->OnPlannedCompatiblePackage(pArgs->wzPackageId, pArgs->wzCompatiblePackageId, pArgs->fRemove);
244}
245
246static HRESULT BalBaseBAProcOnPlannedPackage(
247 __in IBootstrapperApplication* pBA,
248 __in BA_ONPLANNEDPACKAGE_ARGS* pArgs,
249 __inout BA_ONPLANNEDPACKAGE_RESULTS* /*pResults*/
250 )
251{
252 return pBA->OnPlannedPackage(pArgs->wzPackageId, pArgs->execute, pArgs->rollback, pArgs->fPlannedCache, pArgs->fPlannedUncache);
253}
254
255static HRESULT BalBaseBAProcOnApplyBegin(
256 __in IBootstrapperApplication* pBA,
257 __in BA_ONAPPLYBEGIN_ARGS* pArgs,
258 __inout BA_ONAPPLYBEGIN_RESULTS* pResults
259 )
260{
261 return pBA->OnApplyBegin(pArgs->dwPhaseCount, &pResults->fCancel);
262}
263
264static HRESULT BalBaseBAProcOnElevateBegin(
265 __in IBootstrapperApplication* pBA,
266 __in BA_ONELEVATEBEGIN_ARGS* /*pArgs*/,
267 __inout BA_ONELEVATEBEGIN_RESULTS* pResults
268 )
269{
270 return pBA->OnElevateBegin(&pResults->fCancel);
271}
272
273static HRESULT BalBaseBAProcOnElevateComplete(
274 __in IBootstrapperApplication* pBA,
275 __in BA_ONELEVATECOMPLETE_ARGS* pArgs,
276 __inout BA_ONELEVATECOMPLETE_RESULTS* /*pResults*/
277 )
278{
279 return pBA->OnElevateComplete(pArgs->hrStatus);
280}
281
282static HRESULT BalBaseBAProcOnProgress(
283 __in IBootstrapperApplication* pBA,
284 __in BA_ONPROGRESS_ARGS* pArgs,
285 __inout BA_ONPROGRESS_RESULTS* pResults
286 )
287{
288 return pBA->OnProgress(pArgs->dwProgressPercentage, pArgs->dwOverallPercentage, &pResults->fCancel);
289}
290
291static HRESULT BalBaseBAProcOnError(
292 __in IBootstrapperApplication* pBA,
293 __in BA_ONERROR_ARGS* pArgs,
294 __inout BA_ONERROR_RESULTS* pResults
295 )
296{
297 return pBA->OnError(pArgs->errorType, pArgs->wzPackageId, pArgs->dwCode, pArgs->wzError, pArgs->dwUIHint, pArgs->cData, pArgs->rgwzData, pArgs->nRecommendation, &pResults->nResult);
298}
299
300static HRESULT BalBaseBAProcOnRegisterBegin(
301 __in IBootstrapperApplication* pBA,
302 __in BA_ONREGISTERBEGIN_ARGS* pArgs,
303 __inout BA_ONREGISTERBEGIN_RESULTS* pResults
304 )
305{
306 return pBA->OnRegisterBegin(pArgs->recommendedRegistrationType, &pResults->fCancel, &pResults->registrationType);
307}
308
309static HRESULT BalBaseBAProcOnRegisterComplete(
310 __in IBootstrapperApplication* pBA,
311 __in BA_ONREGISTERCOMPLETE_ARGS* pArgs,
312 __inout BA_ONREGISTERCOMPLETE_RESULTS* /*pResults*/
313 )
314{
315 return pBA->OnRegisterComplete(pArgs->hrStatus);
316}
317
318static HRESULT BalBaseBAProcOnCacheBegin(
319 __in IBootstrapperApplication* pBA,
320 __in BA_ONCACHEBEGIN_ARGS* /*pArgs*/,
321 __inout BA_ONCACHEBEGIN_RESULTS* pResults
322 )
323{
324 return pBA->OnCacheBegin(&pResults->fCancel);
325}
326
327static HRESULT BalBaseBAProcOnCachePackageBegin(
328 __in IBootstrapperApplication* pBA,
329 __in BA_ONCACHEPACKAGEBEGIN_ARGS* pArgs,
330 __inout BA_ONCACHEPACKAGEBEGIN_RESULTS* pResults
331 )
332{
333 return pBA->OnCachePackageBegin(pArgs->wzPackageId, pArgs->cCachePayloads, pArgs->dw64PackageCacheSize, pArgs->fVital, &pResults->fCancel);
334}
335
336static HRESULT BalBaseBAProcOnCacheAcquireBegin(
337 __in IBootstrapperApplication* pBA,
338 __in BA_ONCACHEACQUIREBEGIN_ARGS* pArgs,
339 __inout BA_ONCACHEACQUIREBEGIN_RESULTS* pResults
340 )
341{
342 return pBA->OnCacheAcquireBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->wzSource, pArgs->wzDownloadUrl, pArgs->wzPayloadContainerId, pArgs->recommendation, &pResults->action, &pResults->fCancel);
343}
344
345static HRESULT BalBaseBAProcOnCacheAcquireProgress(
346 __in IBootstrapperApplication* pBA,
347 __in BA_ONCACHEACQUIREPROGRESS_ARGS* pArgs,
348 __inout BA_ONCACHEACQUIREPROGRESS_RESULTS* pResults
349 )
350{
351 return pBA->OnCacheAcquireProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel);
352}
353
354static HRESULT BalBaseBAProcOnCacheAcquireResolving(
355 __in IBootstrapperApplication* pBA,
356 __in BA_ONCACHEACQUIRERESOLVING_ARGS* pArgs,
357 __inout BA_ONCACHEACQUIRERESOLVING_RESULTS* pResults
358 )
359{
360 return pBA->OnCacheAcquireResolving(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->rgSearchPaths, pArgs->cSearchPaths, pArgs->fFoundLocal, pArgs->dwRecommendedSearchPath, pArgs->wzDownloadUrl, pArgs->wzPayloadContainerId, pArgs->recommendation, &pResults->dwChosenSearchPath, &pResults->action, &pResults->fCancel);
361}
362
363static HRESULT BalBaseBAProcOnCacheAcquireComplete(
364 __in IBootstrapperApplication* pBA,
365 __in BA_ONCACHEACQUIRECOMPLETE_ARGS* pArgs,
366 __inout BA_ONCACHEACQUIRECOMPLETE_RESULTS* pResults
367 )
368{
369 return pBA->OnCacheAcquireComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus, pArgs->recommendation, &pResults->action);
370}
371
372static HRESULT BalBaseBAProcOnCacheVerifyBegin(
373 __in IBootstrapperApplication* pBA,
374 __in BA_ONCACHEVERIFYBEGIN_ARGS* pArgs,
375 __inout BA_ONCACHEVERIFYBEGIN_RESULTS* pResults
376 )
377{
378 return pBA->OnCacheVerifyBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, &pResults->fCancel);
379}
380
381static HRESULT BalBaseBAProcOnCacheVerifyProgress(
382 __in IBootstrapperApplication* pBA,
383 __in BA_ONCACHEVERIFYPROGRESS_ARGS* pArgs,
384 __inout BA_ONCACHEVERIFYPROGRESS_RESULTS* pResults
385 )
386{
387 return pBA->OnCacheVerifyProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, pArgs->verifyStep, &pResults->fCancel);
388}
389
390static HRESULT BalBaseBAProcOnCacheVerifyComplete(
391 __in IBootstrapperApplication* pBA,
392 __in BA_ONCACHEVERIFYCOMPLETE_ARGS* pArgs,
393 __inout BA_ONCACHEVERIFYCOMPLETE_RESULTS* pResults
394 )
395{
396 return pBA->OnCacheVerifyComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus, pArgs->recommendation, &pResults->action);
397}
398
399static HRESULT BalBaseBAProcOnCachePackageComplete(
400 __in IBootstrapperApplication* pBA,
401 __in BA_ONCACHEPACKAGECOMPLETE_ARGS* pArgs,
402 __inout BA_ONCACHEPACKAGECOMPLETE_RESULTS* pResults
403 )
404{
405 return pBA->OnCachePackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->recommendation, &pResults->action);
406}
407
408static HRESULT BalBaseBAProcOnCacheComplete(
409 __in IBootstrapperApplication* pBA,
410 __in BA_ONCACHECOMPLETE_ARGS* pArgs,
411 __inout BA_ONCACHECOMPLETE_RESULTS* /*pResults*/
412 )
413{
414 return pBA->OnCacheComplete(pArgs->hrStatus);
415}
416
417static HRESULT BalBaseBAProcOnExecuteBegin(
418 __in IBootstrapperApplication* pBA,
419 __in BA_ONEXECUTEBEGIN_ARGS* pArgs,
420 __inout BA_ONEXECUTEBEGIN_RESULTS* pResults
421 )
422{
423 return pBA->OnExecuteBegin(pArgs->cExecutingPackages, &pResults->fCancel);
424}
425
426static HRESULT BalBaseBAProcOnExecutePackageBegin(
427 __in IBootstrapperApplication* pBA,
428 __in BA_ONEXECUTEPACKAGEBEGIN_ARGS* pArgs,
429 __inout BA_ONEXECUTEPACKAGEBEGIN_RESULTS* pResults
430 )
431{
432 return pBA->OnExecutePackageBegin(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, pArgs->uiLevel, pArgs->fDisableExternalUiHandler, &pResults->fCancel);
433}
434
435static HRESULT BalBaseBAProcOnExecutePatchTarget(
436 __in IBootstrapperApplication* pBA,
437 __in BA_ONEXECUTEPATCHTARGET_ARGS* pArgs,
438 __inout BA_ONEXECUTEPATCHTARGET_RESULTS* pResults
439 )
440{
441 return pBA->OnExecutePatchTarget(pArgs->wzPackageId, pArgs->wzTargetProductCode, &pResults->fCancel);
442}
443
444static HRESULT BalBaseBAProcOnExecuteProgress(
445 __in IBootstrapperApplication* pBA,
446 __in BA_ONEXECUTEPROGRESS_ARGS* pArgs,
447 __inout BA_ONEXECUTEPROGRESS_RESULTS* pResults
448 )
449{
450 return pBA->OnExecuteProgress(pArgs->wzPackageId, pArgs->dwProgressPercentage, pArgs->dwOverallPercentage, &pResults->fCancel);
451}
452
453static HRESULT BalBaseBAProcOnExecuteMsiMessage(
454 __in IBootstrapperApplication* pBA,
455 __in BA_ONEXECUTEMSIMESSAGE_ARGS* pArgs,
456 __inout BA_ONEXECUTEMSIMESSAGE_RESULTS* pResults
457 )
458{
459 return pBA->OnExecuteMsiMessage(pArgs->wzPackageId, pArgs->messageType, pArgs->dwUIHint, pArgs->wzMessage, pArgs->cData, pArgs->rgwzData, pArgs->nRecommendation, &pResults->nResult);
460}
461
462static HRESULT BalBaseBAProcOnExecuteFilesInUse(
463 __in IBootstrapperApplication* pBA,
464 __in BA_ONEXECUTEFILESINUSE_ARGS* pArgs,
465 __inout BA_ONEXECUTEFILESINUSE_RESULTS* pResults
466 )
467{
468 return pBA->OnExecuteFilesInUse(pArgs->wzPackageId, pArgs->cFiles, pArgs->rgwzFiles, pArgs->nRecommendation, pArgs->source, &pResults->nResult);
469}
470
471static HRESULT BalBaseBAProcOnExecutePackageComplete(
472 __in IBootstrapperApplication* pBA,
473 __in BA_ONEXECUTEPACKAGECOMPLETE_ARGS* pArgs,
474 __inout BA_ONEXECUTEPACKAGECOMPLETE_RESULTS* pResults
475 )
476{
477 return pBA->OnExecutePackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action);
478}
479
480static HRESULT BalBaseBAProcOnExecuteProcessCancel(
481 __in IBootstrapperApplication* pBA,
482 __in BA_ONEXECUTEPROCESSCANCEL_ARGS* pArgs,
483 __inout BA_ONEXECUTEPROCESSCANCEL_RESULTS* pResults
484 )
485{
486 return pBA->OnExecuteProcessCancel(pArgs->wzPackageId, pArgs->dwProcessId, pArgs->recommendation, &pResults->action);
487}
488
489static HRESULT BalBaseBAProcOnExecuteComplete(
490 __in IBootstrapperApplication* pBA,
491 __in BA_ONEXECUTECOMPLETE_ARGS* pArgs,
492 __inout BA_ONEXECUTECOMPLETE_RESULTS* /*pResults*/
493 )
494{
495 return pBA->OnExecuteComplete(pArgs->hrStatus);
496}
497
498static HRESULT BalBaseBAProcOnUnregisterBegin(
499 __in IBootstrapperApplication* pBA,
500 __in BA_ONUNREGISTERBEGIN_ARGS* pArgs,
501 __inout BA_ONUNREGISTERBEGIN_RESULTS* pResults
502 )
503{
504 return pBA->OnUnregisterBegin(pArgs->recommendedRegistrationType, &pResults->registrationType);
505}
506
507static HRESULT BalBaseBAProcOnUnregisterComplete(
508 __in IBootstrapperApplication* pBA,
509 __in BA_ONUNREGISTERCOMPLETE_ARGS* pArgs,
510 __inout BA_ONUNREGISTERCOMPLETE_RESULTS* /*pResults*/
511 )
512{
513 return pBA->OnUnregisterComplete(pArgs->hrStatus);
514}
515
516static HRESULT BalBaseBAProcOnApplyComplete(
517 __in IBootstrapperApplication* pBA,
518 __in BA_ONAPPLYCOMPLETE_ARGS* pArgs,
519 __inout BA_ONAPPLYCOMPLETE_RESULTS* pResults
520 )
521{
522 return pBA->OnApplyComplete(pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action);
523}
524
525static HRESULT BalBaseBAProcOnLaunchApprovedExeBegin(
526 __in IBootstrapperApplication* pBA,
527 __in BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS* /*pArgs*/,
528 __inout BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS* pResults
529 )
530{
531 return pBA->OnLaunchApprovedExeBegin(&pResults->fCancel);
532}
533
534static HRESULT BalBaseBAProcOnLaunchApprovedExeComplete(
535 __in IBootstrapperApplication* pBA,
536 __in BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS* pArgs,
537 __inout BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS* /*pResults*/
538 )
539{
540 return pBA->OnLaunchApprovedExeComplete(pArgs->hrStatus, pArgs->dwProcessId);
541}
542
543static HRESULT BalBaseBAProcOnPlanMsiPackage(
544 __in IBootstrapperApplication* pBA,
545 __in BA_ONPLANMSIPACKAGE_ARGS* pArgs,
546 __inout BA_ONPLANMSIPACKAGE_RESULTS* pResults
547 )
548{
549 return pBA->OnPlanMsiPackage(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, pArgs->recommendedFileVersioning, &pResults->fCancel, &pResults->actionMsiProperty, &pResults->uiLevel, &pResults->fDisableExternalUiHandler, &pResults->fileVersioning);
550}
551
552static HRESULT BalBaseBAProcOnBeginMsiTransactionBegin(
553 __in IBootstrapperApplication* pBA,
554 __in BA_ONBEGINMSITRANSACTIONBEGIN_ARGS* pArgs,
555 __inout BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS* pResults
556 )
557{
558 return pBA->OnBeginMsiTransactionBegin(pArgs->wzTransactionId, &pResults->fCancel);
559}
560
561static HRESULT BalBaseBAProcOnBeginMsiTransactionComplete(
562 __in IBootstrapperApplication* pBA,
563 __in BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS* pArgs,
564 __inout BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS* /*pResults*/
565 )
566{
567 return pBA->OnBeginMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus);
568}
569
570static HRESULT BalBaseBAProcOnCommitMsiTransactionBegin(
571 __in IBootstrapperApplication* pBA,
572 __in BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS* pArgs,
573 __inout BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS* pResults
574 )
575{
576 return pBA->OnCommitMsiTransactionBegin(pArgs->wzTransactionId, &pResults->fCancel);
577}
578
579static HRESULT BalBaseBAProcOnCommitMsiTransactionComplete(
580 __in IBootstrapperApplication* pBA,
581 __in BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS* pArgs,
582 __inout BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS* pResults
583 )
584{
585 return pBA->OnCommitMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action);
586}
587
588static HRESULT BalBaseBAProcOnRollbackMsiTransactionBegin(
589 __in IBootstrapperApplication* pBA,
590 __in BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS* pArgs,
591 __inout BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS* /*pResults*/
592 )
593{
594 return pBA->OnRollbackMsiTransactionBegin(pArgs->wzTransactionId);
595}
596
597static HRESULT BalBaseBAProcOnRollbackMsiTransactionComplete(
598 __in IBootstrapperApplication* pBA,
599 __in BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS* pArgs,
600 __inout BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS* pResults
601 )
602{
603 return pBA->OnRollbackMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action);
604}
605
606static HRESULT BalBaseBAProcOnPauseAutomaticUpdatesBegin(
607 __in IBootstrapperApplication* pBA,
608 __in BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS* /*pArgs*/,
609 __inout BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS* /*pResults*/
610 )
611{
612 return pBA->OnPauseAutomaticUpdatesBegin();
613}
614
615static HRESULT BalBaseBAProcOnPauseAutomaticUpdatesComplete(
616 __in IBootstrapperApplication* pBA,
617 __in BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS* pArgs,
618 __inout BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS* /*pResults*/
619 )
620{
621 return pBA->OnPauseAutomaticUpdatesComplete(pArgs->hrStatus);
622}
623
624static HRESULT BalBaseBAProcOnSystemRestorePointBegin(
625 __in IBootstrapperApplication* pBA,
626 __in BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS* /*pArgs*/,
627 __inout BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS* /*pResults*/
628 )
629{
630 return pBA->OnSystemRestorePointBegin();
631}
632
633static HRESULT BalBaseBAProcOnSystemRestorePointComplete(
634 __in IBootstrapperApplication* pBA,
635 __in BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS* pArgs,
636 __inout BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS* /*pResults*/
637 )
638{
639 return pBA->OnSystemRestorePointComplete(pArgs->hrStatus);
640}
641
642static HRESULT BalBaseBAProcOnPlanForwardCompatibleBundle(
643 __in IBootstrapperApplication* pBA,
644 __in BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS* pArgs,
645 __inout BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS* pResults
646 )
647{
648 return pBA->OnPlanForwardCompatibleBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fRecommendedIgnoreBundle, &pResults->fCancel, &pResults->fIgnoreBundle);
649}
650
651static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyBegin(
652 __in IBootstrapperApplication* pBA,
653 __in BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS* pArgs,
654 __inout BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS* pResults
655 )
656{
657 return pBA->OnCacheContainerOrPayloadVerifyBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, &pResults->fCancel);
658}
659
660static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyProgress(
661 __in IBootstrapperApplication* pBA,
662 __in BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS* pArgs,
663 __inout BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS* pResults
664 )
665{
666 return pBA->OnCacheContainerOrPayloadVerifyProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel);
667}
668
669static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyComplete(
670 __in IBootstrapperApplication* pBA,
671 __in BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS* pArgs,
672 __inout BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS* /*pResults*/
673 )
674{
675 return pBA->OnCacheContainerOrPayloadVerifyComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus);
676}
677
678static HRESULT BalBaseBAProcOnCachePayloadExtractBegin(
679 __in IBootstrapperApplication* pBA,
680 __in BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS* pArgs,
681 __inout BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS* pResults
682 )
683{
684 return pBA->OnCachePayloadExtractBegin(pArgs->wzContainerId, pArgs->wzPayloadId, &pResults->fCancel);
685}
686
687static HRESULT BalBaseBAProcOnCachePayloadExtractProgress(
688 __in IBootstrapperApplication* pBA,
689 __in BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS* pArgs,
690 __inout BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS* pResults
691 )
692{
693 return pBA->OnCachePayloadExtractProgress(pArgs->wzContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel);
694}
695
696static HRESULT BalBaseBAProcOnCachePayloadExtractComplete(
697 __in IBootstrapperApplication* pBA,
698 __in BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS* pArgs,
699 __inout BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS* /*pResults*/
700 )
701{
702 return pBA->OnCachePayloadExtractComplete(pArgs->wzContainerId, pArgs->wzPayloadId, pArgs->hrStatus);
703}
704
705static HRESULT BalBaseBAProcOnSetUpdateBegin(
706 __in IBootstrapperApplication* pBA,
707 __in BA_ONSETUPDATEBEGIN_ARGS* /*pArgs*/,
708 __inout BA_ONSETUPDATEBEGIN_RESULTS* /*pResults*/
709 )
710{
711 return pBA->OnSetUpdateBegin();
712}
713
714static HRESULT BalBaseBAProcOnSetUpdateComplete(
715 __in IBootstrapperApplication* pBA,
716 __in BA_ONSETUPDATECOMPLETE_ARGS* pArgs,
717 __inout BA_ONSETUPDATECOMPLETE_RESULTS* /*pResults*/
718 )
719{
720 return pBA->OnSetUpdateComplete(pArgs->hrStatus, pArgs->wzPreviousPackageId, pArgs->wzNewPackageId);
721}
722
723static HRESULT BalBaseBAProcOnPlanRestoreRelatedBundle(
724 __in IBootstrapperApplication* pBA,
725 __in BA_ONPLANRESTORERELATEDBUNDLE_ARGS* pArgs,
726 __inout BA_ONPLANRESTORERELATEDBUNDLE_RESULTS* pResults
727 )
728{
729 return pBA->OnPlanRestoreRelatedBundle(pArgs->wzBundleId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
730}
731
732static HRESULT BalBaseBAProcOnPlanRelatedBundleType(
733 __in IBootstrapperApplication* pBA,
734 __in BA_ONPLANRELATEDBUNDLETYPE_ARGS* pArgs,
735 __inout BA_ONPLANRELATEDBUNDLETYPE_RESULTS* pResults
736 )
737{
738 return pBA->OnPlanRelatedBundleType(pArgs->wzBundleId, pArgs->recommendedType, &pResults->requestedType, &pResults->fCancel);
739}
740
741static HRESULT BalBaseBAProcOnApplyDowngrade(
742 __in IBootstrapperApplication* pBA,
743 __in BA_ONAPPLYDOWNGRADE_ARGS* pArgs,
744 __inout BA_ONAPPLYDOWNGRADE_RESULTS* pResults
745 )
746{
747 return pBA->OnApplyDowngrade(pArgs->hrRecommended, &pResults->hrStatus);
748}
749
750static HRESULT BalBaseBAProcOnDetectRelatedBundlePackage(
751 __in IBootstrapperApplication* pBA,
752 __in BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS* pArgs,
753 __inout BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS* pResults
754 )
755{
756 return pBA->OnDetectRelatedBundlePackage(pArgs->wzPackageId, pArgs->wzBundleId, pArgs->relationType, pArgs->fPerMachine, pArgs->wzVersion, &pResults->fCancel);
757}
758
759static HRESULT BalBaseBAProcOnCachePackageNonVitalValidationFailure(
760 __in IBootstrapperApplication* pBA,
761 __in BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS* pArgs,
762 __inout BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS* pResults
763 )
764{
765 return pBA->OnCachePackageNonVitalValidationFailure(pArgs->wzPackageId, pArgs->hrStatus, pArgs->recommendation, &pResults->action);
766}
767
768/*******************************************************************
769BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication.
770 Provides a default mapping between the new message based BA interface and
771 the old COM-based BA interface.
772
773*******************************************************************/
774static HRESULT WINAPI BalBaseBootstrapperApplicationProc(
775 __in BOOTSTRAPPER_APPLICATION_MESSAGE message,
776 __in const LPVOID pvArgs,
777 __inout LPVOID pvResults,
778 __in_opt LPVOID pvContext
779 )
780{
781 IBootstrapperApplication* pBA = reinterpret_cast<IBootstrapperApplication*>(pvContext);
782 HRESULT hr = pBA->BAProc(message, pvArgs, pvResults, pvContext);
783
784 if (E_NOTIMPL == hr)
785 {
786 switch (message)
787 {
788 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN:
789 hr = BalBaseBAProcOnDetectBegin(pBA, reinterpret_cast<BA_ONDETECTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTBEGIN_RESULTS*>(pvResults));
790 break;
791 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE:
792 hr = BalBaseBAProcOnDetectComplete(pBA, reinterpret_cast<BA_ONDETECTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTCOMPLETE_RESULTS*>(pvResults));
793 break;
794 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN:
795 hr = BalBaseBAProcOnPlanBegin(pBA, reinterpret_cast<BA_ONPLANBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANBEGIN_RESULTS*>(pvResults));
796 break;
797 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE:
798 hr = BalBaseBAProcOnPlanComplete(pBA, reinterpret_cast<BA_ONPLANCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANCOMPLETE_RESULTS*>(pvResults));
799 break;
800 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP:
801 hr = BalBaseBAProcOnStartup(pBA, reinterpret_cast<BA_ONSTARTUP_ARGS*>(pvArgs), reinterpret_cast<BA_ONSTARTUP_RESULTS*>(pvResults));
802 break;
803 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN:
804 hr = BalBaseBAProcOnShutdown(pBA, reinterpret_cast<BA_ONSHUTDOWN_ARGS*>(pvArgs), reinterpret_cast<BA_ONSHUTDOWN_RESULTS*>(pvResults));
805 break;
806 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE:
807 hr = BalBaseBAProcOnDetectForwardCompatibleBundle(pBA, reinterpret_cast<BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS*>(pvResults));
808 break;
809 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN:
810 hr = BalBaseBAProcOnDetectUpdateBegin(pBA, reinterpret_cast<BA_ONDETECTUPDATEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATEBEGIN_RESULTS*>(pvResults));
811 break;
812 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE:
813 hr = BalBaseBAProcOnDetectUpdate(pBA, reinterpret_cast<BA_ONDETECTUPDATE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATE_RESULTS*>(pvResults));
814 break;
815 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE:
816 hr = BalBaseBAProcOnDetectUpdateComplete(pBA, reinterpret_cast<BA_ONDETECTUPDATECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATECOMPLETE_RESULTS*>(pvResults));
817 break;
818 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE:
819 hr = BalBaseBAProcOnDetectRelatedBundle(pBA, reinterpret_cast<BA_ONDETECTRELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTRELATEDBUNDLE_RESULTS*>(pvResults));
820 break;
821 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN:
822 hr = BalBaseBAProcOnDetectPackageBegin(pBA, reinterpret_cast<BA_ONDETECTPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPACKAGEBEGIN_RESULTS*>(pvResults));
823 break;
824 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE:
825 hr = BalBaseBAProcOnDetectRelatedMsiPackage(pBA, reinterpret_cast<BA_ONDETECTRELATEDMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTRELATEDMSIPACKAGE_RESULTS*>(pvResults));
826 break;
827 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET:
828 hr = BalBaseBAProcOnDetectPatchTarget(pBA, reinterpret_cast<BA_ONDETECTPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPATCHTARGET_RESULTS*>(pvResults));
829 break;
830 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE:
831 hr = BalBaseBAProcOnDetectMsiFeature(pBA, reinterpret_cast<BA_ONDETECTMSIFEATURE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTMSIFEATURE_RESULTS*>(pvResults));
832 break;
833 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE:
834 hr = BalBaseBAProcOnDetectPackageComplete(pBA, reinterpret_cast<BA_ONDETECTPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPACKAGECOMPLETE_RESULTS*>(pvResults));
835 break;
836 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE:
837 hr = BalBaseBAProcOnPlanRelatedBundle(pBA, reinterpret_cast<BA_ONPLANRELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRELATEDBUNDLE_RESULTS*>(pvResults));
838 break;
839 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN:
840 hr = BalBaseBAProcOnPlanPackageBegin(pBA, reinterpret_cast<BA_ONPLANPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPACKAGEBEGIN_RESULTS*>(pvResults));
841 break;
842 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET:
843 hr = BalBaseBAProcOnPlanPatchTarget(pBA, reinterpret_cast<BA_ONPLANPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPATCHTARGET_RESULTS*>(pvResults));
844 break;
845 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE:
846 hr = BalBaseBAProcOnPlanMsiFeature(pBA, reinterpret_cast<BA_ONPLANMSIFEATURE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANMSIFEATURE_RESULTS*>(pvResults));
847 break;
848 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE:
849 hr = BalBaseBAProcOnPlanPackageComplete(pBA, reinterpret_cast<BA_ONPLANPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPACKAGECOMPLETE_RESULTS*>(pvResults));
850 break;
851 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN:
852 hr = BalBaseBAProcOnApplyBegin(pBA, reinterpret_cast<BA_ONAPPLYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYBEGIN_RESULTS*>(pvResults));
853 break;
854 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN:
855 hr = BalBaseBAProcOnElevateBegin(pBA, reinterpret_cast<BA_ONELEVATEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONELEVATEBEGIN_RESULTS*>(pvResults));
856 break;
857 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE:
858 hr = BalBaseBAProcOnElevateComplete(pBA, reinterpret_cast<BA_ONELEVATECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONELEVATECOMPLETE_RESULTS*>(pvResults));
859 break;
860 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS:
861 hr = BalBaseBAProcOnProgress(pBA, reinterpret_cast<BA_ONPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONPROGRESS_RESULTS*>(pvResults));
862 break;
863 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR:
864 hr = BalBaseBAProcOnError(pBA, reinterpret_cast<BA_ONERROR_ARGS*>(pvArgs), reinterpret_cast<BA_ONERROR_RESULTS*>(pvResults));
865 break;
866 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN:
867 hr = BalBaseBAProcOnRegisterBegin(pBA, reinterpret_cast<BA_ONREGISTERBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONREGISTERBEGIN_RESULTS*>(pvResults));
868 break;
869 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE:
870 hr = BalBaseBAProcOnRegisterComplete(pBA, reinterpret_cast<BA_ONREGISTERCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONREGISTERCOMPLETE_RESULTS*>(pvResults));
871 break;
872 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN:
873 hr = BalBaseBAProcOnCacheBegin(pBA, reinterpret_cast<BA_ONCACHEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEBEGIN_RESULTS*>(pvResults));
874 break;
875 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN:
876 hr = BalBaseBAProcOnCachePackageBegin(pBA, reinterpret_cast<BA_ONCACHEPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPACKAGEBEGIN_RESULTS*>(pvResults));
877 break;
878 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN:
879 hr = BalBaseBAProcOnCacheAcquireBegin(pBA, reinterpret_cast<BA_ONCACHEACQUIREBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIREBEGIN_RESULTS*>(pvResults));
880 break;
881 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS:
882 hr = BalBaseBAProcOnCacheAcquireProgress(pBA, reinterpret_cast<BA_ONCACHEACQUIREPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIREPROGRESS_RESULTS*>(pvResults));
883 break;
884 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING:
885 hr = BalBaseBAProcOnCacheAcquireResolving(pBA, reinterpret_cast<BA_ONCACHEACQUIRERESOLVING_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIRERESOLVING_RESULTS*>(pvResults));
886 break;
887 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE:
888 hr = BalBaseBAProcOnCacheAcquireComplete(pBA, reinterpret_cast<BA_ONCACHEACQUIRECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIRECOMPLETE_RESULTS*>(pvResults));
889 break;
890 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN:
891 hr = BalBaseBAProcOnCacheVerifyBegin(pBA, reinterpret_cast<BA_ONCACHEVERIFYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYBEGIN_RESULTS*>(pvResults));
892 break;
893 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS:
894 hr = BalBaseBAProcOnCacheVerifyProgress(pBA, reinterpret_cast<BA_ONCACHEVERIFYPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYPROGRESS_RESULTS*>(pvResults));
895 break;
896 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE:
897 hr = BalBaseBAProcOnCacheVerifyComplete(pBA, reinterpret_cast<BA_ONCACHEVERIFYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYCOMPLETE_RESULTS*>(pvResults));
898 break;
899 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE:
900 hr = BalBaseBAProcOnCachePackageComplete(pBA, reinterpret_cast<BA_ONCACHEPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPACKAGECOMPLETE_RESULTS*>(pvResults));
901 break;
902 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE:
903 hr = BalBaseBAProcOnCacheComplete(pBA, reinterpret_cast<BA_ONCACHECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECOMPLETE_RESULTS*>(pvResults));
904 break;
905 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN:
906 hr = BalBaseBAProcOnExecuteBegin(pBA, reinterpret_cast<BA_ONEXECUTEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEBEGIN_RESULTS*>(pvResults));
907 break;
908 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN:
909 hr = BalBaseBAProcOnExecutePackageBegin(pBA, reinterpret_cast<BA_ONEXECUTEPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPACKAGEBEGIN_RESULTS*>(pvResults));
910 break;
911 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET:
912 hr = BalBaseBAProcOnExecutePatchTarget(pBA, reinterpret_cast<BA_ONEXECUTEPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPATCHTARGET_RESULTS*>(pvResults));
913 break;
914 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS:
915 hr = BalBaseBAProcOnExecuteProgress(pBA, reinterpret_cast<BA_ONEXECUTEPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPROGRESS_RESULTS*>(pvResults));
916 break;
917 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE:
918 hr = BalBaseBAProcOnExecuteMsiMessage(pBA, reinterpret_cast<BA_ONEXECUTEMSIMESSAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEMSIMESSAGE_RESULTS*>(pvResults));
919 break;
920 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE:
921 hr = BalBaseBAProcOnExecuteFilesInUse(pBA, reinterpret_cast<BA_ONEXECUTEFILESINUSE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEFILESINUSE_RESULTS*>(pvResults));
922 break;
923 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE:
924 hr = BalBaseBAProcOnExecutePackageComplete(pBA, reinterpret_cast<BA_ONEXECUTEPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPACKAGECOMPLETE_RESULTS*>(pvResults));
925 break;
926 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE:
927 hr = BalBaseBAProcOnExecuteComplete(pBA, reinterpret_cast<BA_ONEXECUTECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTECOMPLETE_RESULTS*>(pvResults));
928 break;
929 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN:
930 hr = BalBaseBAProcOnUnregisterBegin(pBA, reinterpret_cast<BA_ONUNREGISTERBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONUNREGISTERBEGIN_RESULTS*>(pvResults));
931 break;
932 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE:
933 hr = BalBaseBAProcOnUnregisterComplete(pBA, reinterpret_cast<BA_ONUNREGISTERCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONUNREGISTERCOMPLETE_RESULTS*>(pvResults));
934 break;
935 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE:
936 hr = BalBaseBAProcOnApplyComplete(pBA, reinterpret_cast<BA_ONAPPLYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYCOMPLETE_RESULTS*>(pvResults));
937 break;
938 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN:
939 hr = BalBaseBAProcOnLaunchApprovedExeBegin(pBA, reinterpret_cast<BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS*>(pvResults));
940 break;
941 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE:
942 hr = BalBaseBAProcOnLaunchApprovedExeComplete(pBA, reinterpret_cast<BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS*>(pvResults));
943 break;
944 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE:
945 hr = BalBaseBAProcOnPlanMsiPackage(pBA, reinterpret_cast<BA_ONPLANMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANMSIPACKAGE_RESULTS*>(pvResults));
946 break;
947 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN:
948 hr = BalBaseBAProcOnBeginMsiTransactionBegin(pBA, reinterpret_cast<BA_ONBEGINMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS*>(pvResults));
949 break;
950 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE:
951 hr = BalBaseBAProcOnBeginMsiTransactionComplete(pBA, reinterpret_cast<BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults));
952 break;
953 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN:
954 hr = BalBaseBAProcOnCommitMsiTransactionBegin(pBA, reinterpret_cast<BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS*>(pvResults));
955 break;
956 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE:
957 hr = BalBaseBAProcOnCommitMsiTransactionComplete(pBA, reinterpret_cast<BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults));
958 break;
959 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN:
960 hr = BalBaseBAProcOnRollbackMsiTransactionBegin(pBA, reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS*>(pvResults));
961 break;
962 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE:
963 hr = BalBaseBAProcOnRollbackMsiTransactionComplete(pBA, reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults));
964 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN:
965 hr = BalBaseBAProcOnPauseAutomaticUpdatesBegin(pBA, reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS*>(pvResults));
966 break;
967 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE:
968 hr = BalBaseBAProcOnPauseAutomaticUpdatesComplete(pBA, reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS*>(pvResults));
969 break;
970 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN:
971 hr = BalBaseBAProcOnSystemRestorePointBegin(pBA, reinterpret_cast<BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS*>(pvResults));
972 break;
973 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE:
974 hr = BalBaseBAProcOnSystemRestorePointComplete(pBA, reinterpret_cast<BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS*>(pvResults));
975 break;
976 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE:
977 hr = BalBaseBAProcOnPlannedPackage(pBA, reinterpret_cast<BA_ONPLANNEDPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANNEDPACKAGE_RESULTS*>(pvResults));
978 break;
979 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE:
980 hr = BalBaseBAProcOnPlanForwardCompatibleBundle(pBA, reinterpret_cast<BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS*>(pvResults));
981 break;
982 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN:
983 hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyBegin(pBA, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS*>(pvResults));
984 break;
985 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS:
986 hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyProgress(pBA, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS*>(pvResults));
987 break;
988 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE:
989 hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyComplete(pBA, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS*>(pvResults));
990 break;
991 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN:
992 hr = BalBaseBAProcOnCachePayloadExtractBegin(pBA, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS*>(pvResults));
993 break;
994 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS:
995 hr = BalBaseBAProcOnCachePayloadExtractProgress(pBA, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS*>(pvResults));
996 break;
997 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE:
998 hr = BalBaseBAProcOnCachePayloadExtractComplete(pBA, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS*>(pvResults));
999 break;
1000 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY:
1001 hr = BalBaseBAProcOnPlanRollbackBoundary(pBA, reinterpret_cast<BA_ONPLANROLLBACKBOUNDARY_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANROLLBACKBOUNDARY_RESULTS*>(pvResults));
1002 break;
1003 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATEBEGIN:
1004 hr = BalBaseBAProcOnSetUpdateBegin(pBA, reinterpret_cast<BA_ONSETUPDATEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONSETUPDATEBEGIN_RESULTS*>(pvResults));
1005 break;
1006 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATECOMPLETE:
1007 hr = BalBaseBAProcOnSetUpdateComplete(pBA, reinterpret_cast<BA_ONSETUPDATECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONSETUPDATECOMPLETE_RESULTS*>(pvResults));
1008 break;
1009 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE:
1010 hr = BalBaseBAProcOnDetectCompatiblePackage(pBA, reinterpret_cast<BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS*>(pvResults));
1011 break;
1012 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN:
1013 hr = BalBaseBAProcOnPlanCompatibleMsiPackageBegin(pBA, reinterpret_cast<BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS*>(pvResults));
1014 break;
1015 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE:
1016 hr = BalBaseBAProcOnPlanCompatibleMsiPackageComplete(pBA, reinterpret_cast<BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS*>(pvResults));
1017 break;
1018 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE:
1019 hr = BalBaseBAProcOnPlannedCompatiblePackage(pBA, reinterpret_cast<BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS*>(pvResults));
1020 break;
1021 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE:
1022 hr = BalBaseBAProcOnPlanRestoreRelatedBundle(pBA, reinterpret_cast<BA_ONPLANRESTORERELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRESTORERELATEDBUNDLE_RESULTS*>(pvResults));
1023 break;
1024 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE:
1025 hr = BalBaseBAProcOnPlanRelatedBundleType(pBA, reinterpret_cast<BA_ONPLANRELATEDBUNDLETYPE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRELATEDBUNDLETYPE_RESULTS*>(pvResults));
1026 break;
1027 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE:
1028 hr = BalBaseBAProcOnApplyDowngrade(pBA, reinterpret_cast<BA_ONAPPLYDOWNGRADE_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYDOWNGRADE_RESULTS*>(pvResults));
1029 break;
1030 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROCESSCANCEL:
1031 hr = BalBaseBAProcOnExecuteProcessCancel(pBA, reinterpret_cast<BA_ONEXECUTEPROCESSCANCEL_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPROCESSCANCEL_RESULTS*>(pvResults));
1032 break;
1033 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE:
1034 hr = BalBaseBAProcOnDetectRelatedBundlePackage(pBA, reinterpret_cast<BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS*>(pvResults));
1035 break;
1036 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE:
1037 hr = BalBaseBAProcOnCachePackageNonVitalValidationFailure(pBA, reinterpret_cast<BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS*>(pvResults));
1038 break;
1039 }
1040 }
1041
1042 pBA->BAProcFallback(message, pvArgs, pvResults, &hr, pvContext);
1043
1044 return hr;
1045}
diff --git a/src/api/burn/balutil/inc/IBAFunctions.h b/src/api/burn/balutil/inc/IBAFunctions.h
index bb911040..b0afabb3 100644
--- a/src/api/burn/balutil/inc/IBAFunctions.h
+++ b/src/api/burn/balutil/inc/IBAFunctions.h
@@ -2,6 +2,8 @@
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. 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 3
4 4
5#include "IBootstrapperApplication.h"
6
5DECLARE_INTERFACE_IID_(IBAFunctions, IBootstrapperApplication, "0FB445ED-17BD-49C7-BE19-479776F8AE96") 7DECLARE_INTERFACE_IID_(IBAFunctions, IBootstrapperApplication, "0FB445ED-17BD-49C7-BE19-479776F8AE96")
6{ 8{
7 // OnThemeLoaded - Called after the BA finished loading all the controls for the theme. 9 // OnThemeLoaded - Called after the BA finished loading all the controls for the theme.
diff --git a/src/api/burn/balutil/inc/IBootstrapperApplication.h b/src/api/burn/balutil/inc/IBootstrapperApplication.h
index faa211e4..6eb32ee6 100644
--- a/src/api/burn/balutil/inc/IBootstrapperApplication.h
+++ b/src/api/burn/balutil/inc/IBootstrapperApplication.h
@@ -1,6 +1,8 @@
1#pragma once 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. 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 3
4#include <batypes.h>
5
4 6
5DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-AB06-099D717C67FE") 7DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-AB06-099D717C67FE")
6{ 8{
@@ -9,8 +11,7 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A
9 STDMETHOD(BAProc)( 11 STDMETHOD(BAProc)(
10 __in BOOTSTRAPPER_APPLICATION_MESSAGE message, 12 __in BOOTSTRAPPER_APPLICATION_MESSAGE message,
11 __in const LPVOID pvArgs, 13 __in const LPVOID pvArgs,
12 __inout LPVOID pvResults, 14 __inout LPVOID pvResults
13 __in_opt LPVOID pvContext
14 ) = 0; 15 ) = 0;
15 16
16 // BAProcFallback - The PFN_BOOTSTRAPPER_APPLICATION_PROC can call this method 17 // BAProcFallback - The PFN_BOOTSTRAPPER_APPLICATION_PROC can call this method
@@ -20,10 +21,22 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A
20 __in BOOTSTRAPPER_APPLICATION_MESSAGE message, 21 __in BOOTSTRAPPER_APPLICATION_MESSAGE message,
21 __in const LPVOID pvArgs, 22 __in const LPVOID pvArgs,
22 __inout LPVOID pvResults, 23 __inout LPVOID pvResults,
23 __inout HRESULT* phr, 24 __inout HRESULT* phr
24 __in_opt LPVOID pvContext 25 ) = 0;
26
27 // OnCreate - called when the bootstrapper application is created.
28 //
29 virtual STDMETHODIMP OnCreate(
30 __in IBootstrapperEngine* pEngine,
31 __in BOOTSTRAPPER_COMMAND* pCommand
25 ) = 0; 32 ) = 0;
26 33
34 // OnDestroy - called before the bootstrapper application stops.
35 //
36 STDMETHOD(OnDestroy)(
37 __in BOOL fReload
38 ) = 0;
39
27 // OnStartup - called when the engine is ready for the bootstrapper application to start. 40 // OnStartup - called when the engine is ready for the bootstrapper application to start.
28 // 41 //
29 STDMETHOD(OnStartup)() = 0; 42 STDMETHOD(OnStartup)() = 0;
@@ -688,14 +701,6 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A
688 __in HRESULT hrStatus 701 __in HRESULT hrStatus
689 ) = 0; 702 ) = 0;
690 703
691 STDMETHOD(OnSetUpdateBegin)() = 0;
692
693 STDMETHOD(OnSetUpdateComplete)(
694 __in HRESULT hrStatus,
695 __in_z_opt LPCWSTR wzPreviousPackageId,
696 __in_z_opt LPCWSTR wzNewPackageId
697 ) = 0;
698
699 // OnPlanRestoreRelatedBundle - called when the engine begins planning an upgrade related bundle for restoring in case of failure. 704 // OnPlanRestoreRelatedBundle - called when the engine begins planning an upgrade related bundle for restoring in case of failure.
700 STDMETHOD(OnPlanRestoreRelatedBundle)( 705 STDMETHOD(OnPlanRestoreRelatedBundle)(
701 __in_z LPCWSTR wzBundleId, 706 __in_z LPCWSTR wzBundleId,
diff --git a/src/api/burn/balutil/inc/IBootstrapperApplicationFactory.h b/src/api/burn/balutil/inc/IBootstrapperApplicationFactory.h
deleted file mode 100644
index fd603e50..00000000
--- a/src/api/burn/balutil/inc/IBootstrapperApplicationFactory.h
+++ /dev/null
@@ -1,13 +0,0 @@
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#include "precomp.h"
6
7DECLARE_INTERFACE_IID_(IBootstrapperApplicationFactory, IUnknown, "2965A12F-AC7B-43A0-85DF-E4B2168478A4")
8{
9 STDMETHOD(Create)(
10 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
11 __inout BOOTSTRAPPER_CREATE_RESULTS *pResults
12 );
13};
diff --git a/src/api/burn/balutil/inc/IBootstrapperEngine.h b/src/api/burn/balutil/inc/IBootstrapperEngine.h
index bfa13997..3c1afb77 100644
--- a/src/api/burn/balutil/inc/IBootstrapperEngine.h
+++ b/src/api/burn/balutil/inc/IBootstrapperEngine.h
@@ -1,6 +1,7 @@
1#pragma once 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. 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 3
4#include <baenginetypes.h>
4 5
5DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-81512C29C2FB") 6DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-81512C29C2FB")
6{ 7{
@@ -65,7 +66,8 @@ DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-8
65 __in_z_opt LPCWSTR wzDownloadSource, 66 __in_z_opt LPCWSTR wzDownloadSource,
66 __in DWORD64 qwSize, 67 __in DWORD64 qwSize,
67 __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashType, 68 __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashType,
68 __in_z_opt LPCWSTR wzHash 69 __in_z_opt LPCWSTR wzHash,
70 __in_z_opt LPCWSTR wzUpdatePackageId
69 ) = 0; 71 ) = 0;
70 72
71 STDMETHOD(SetLocalSource)( 73 STDMETHOD(SetLocalSource)(
@@ -79,7 +81,8 @@ DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-8
79 __in_z_opt LPCWSTR wzPayloadId, 81 __in_z_opt LPCWSTR wzPayloadId,
80 __in_z LPCWSTR wzUrl, 82 __in_z LPCWSTR wzUrl,
81 __in_z_opt LPCWSTR wzUser, 83 __in_z_opt LPCWSTR wzUser,
82 __in_z_opt LPCWSTR wzPassword 84 __in_z_opt LPCWSTR wzPassword,
85 __in_z_opt LPCWSTR wzAuthorizationHeader
83 ) = 0; 86 ) = 0;
84 87
85 STDMETHOD(SetVariableNumeric)( 88 STDMETHOD(SetVariableNumeric)(
@@ -128,7 +131,8 @@ DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-8
128 ) = 0; 131 ) = 0;
129 132
130 STDMETHOD(SetUpdateSource)( 133 STDMETHOD(SetUpdateSource)(
131 __in_z LPCWSTR wzUrl 134 __in_z LPCWSTR wzUrl,
135 __in_z_opt LPCWSTR wzAuthorizationHeader
132 ) = 0; 136 ) = 0;
133 137
134 STDMETHOD(CompareVersions)( 138 STDMETHOD(CompareVersions)(
@@ -143,5 +147,4 @@ DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-8
143 __out_ecount_opt(*pcchValue) LPWSTR wzValue, 147 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
144 __inout SIZE_T* pcchValue 148 __inout SIZE_T* pcchValue
145 ) = 0; 149 ) = 0;
146
147}; 150};
diff --git a/src/api/burn/balutil/inc/balinfo.h b/src/api/burn/balutil/inc/balinfo.h
index 7c607c44..234284f6 100644
--- a/src/api/burn/balutil/inc/balinfo.h
+++ b/src/api/burn/balutil/inc/balinfo.h
@@ -152,7 +152,6 @@ DAPI_(HRESULT) BalInfoAddRelatedBundleAsPackage(
152DAPI_(HRESULT) BalInfoAddUpdateBundleAsPackage( 152DAPI_(HRESULT) BalInfoAddUpdateBundleAsPackage(
153 __in BAL_INFO_PACKAGES* pPackages, 153 __in BAL_INFO_PACKAGES* pPackages,
154 __in_z LPCWSTR wzId, 154 __in_z LPCWSTR wzId,
155 __in_z LPCWSTR wzPreviousId,
156 __out_opt BAL_INFO_PACKAGE** ppPackage 155 __out_opt BAL_INFO_PACKAGE** ppPackage
157 ); 156 );
158 157
diff --git a/src/api/burn/balutil/inc/balutil.h b/src/api/burn/balutil/inc/balutil.h
index 36c165a3..4f8cb23d 100644
--- a/src/api/burn/balutil/inc/balutil.h
+++ b/src/api/burn/balutil/inc/balutil.h
@@ -39,28 +39,34 @@ const LPCWSTR BAL_MANIFEST_FILENAME = L"BootstrapperApplicationData.xml";
39 39
40static const HRESULT E_WIXSTDBA_CONDITION_FAILED = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1); 40static const HRESULT E_WIXSTDBA_CONDITION_FAILED = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1);
41 41
42static const HRESULT E_MBAHOST_NET452_ON_WIN7RTM = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1000);
43static const HRESULT E_DNCHOST_SCD_RUNTIME_FAILURE = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1001);
44static const HRESULT E_PREREQBA_INFINITE_LOOP = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1002); 42static const HRESULT E_PREREQBA_INFINITE_LOOP = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1002);
45 43
46 44
47/******************************************************************* 45/*******************************************************************
48 BalInitialize - remembers the engine interface to enable logging and 46 BootstrapperApplicationDebuggerCheck - allows bootstrapper application to
49 other functions. 47 explicitly check whether a debugger should be attached to the boostrapper
48 application.
50 49
50 Note: Automatically called in BootstrapperApplicationRun().
51********************************************************************/ 51********************************************************************/
52DAPI_(void) BalInitialize( 52DAPI_(VOID) BootstrapperApplicationDebuggerCheck();
53 __in IBootstrapperEngine* pEngine 53
54/*******************************************************************
55 BootstrapperApplicationRun - runs the IBootstrapperApplication until
56 the application quits.
57
58********************************************************************/
59DAPI_(HRESULT) BootstrapperApplicationRun(
60 __in IBootstrapperApplication* pApplication
54 ); 61 );
55 62
56/******************************************************************* 63/*******************************************************************
57 BalInitializeFromCreateArgs - convenience function to call BalBootstrapperEngineCreate 64 BalInitialize - remembers the engine interface to enable logging and
58 then pass it along to BalInitialize. 65 other functions.
59 66
60********************************************************************/ 67********************************************************************/
61DAPI_(HRESULT) BalInitializeFromCreateArgs( 68DAPI_(void) BalInitialize(
62 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, 69 __in IBootstrapperEngine* pEngine
63 __out_opt IBootstrapperEngine** ppEngine
64 ); 70 );
65 71
66/******************************************************************* 72/*******************************************************************
@@ -292,7 +298,7 @@ DAPI_(HRESULT) BalLogErrorArgs(
292 ); 298 );
293 299
294/******************************************************************* 300/*******************************************************************
295BalLogId - logs a message with the engine with a string embedded in a 301BalLogId - logs a message with the engine with a string embedded in a
296 MESSAGETABLE resource. 302 MESSAGETABLE resource.
297 303
298********************************************************************/ 304********************************************************************/
diff --git a/src/api/burn/balutil/msg.cpp b/src/api/burn/balutil/msg.cpp
new file mode 100644
index 00000000..690108a5
--- /dev/null
+++ b/src/api/burn/balutil/msg.cpp
@@ -0,0 +1,5263 @@
1// 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.
2
3#include "precomp.h"
4
5static HRESULT OnApplyBegin(
6 __in IBootstrapperApplication* pApplication,
7 __in BUFF_READER* pReaderArgs,
8 __in BUFF_READER* pReaderResults,
9 __in BUFF_BUFFER* pBuffer
10 )
11{
12 HRESULT hr = S_OK;
13 BA_ONAPPLYBEGIN_ARGS args = { };
14 BA_ONAPPLYBEGIN_RESULTS results = { };
15
16 // Read args.
17 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
18 ExitOnFailure(hr, "Failed to read API version of OnApplyBegin args.");
19
20 hr = BuffReaderReadNumber(pReaderArgs, &args.dwPhaseCount);
21 ExitOnFailure(hr, "Failed to read phase count of OnApplyBegin args.");
22
23 // Read results.
24 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
25 ExitOnFailure(hr, "Failed to read API version of OnApplyBegin results.");
26
27 // Callback.
28 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, &args, &results);
29
30 if (E_NOTIMPL == hr)
31 {
32 hr = pApplication->OnApplyBegin(args.dwPhaseCount, &results.fCancel);
33 }
34
35 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, &args, &results, &hr);
36 BalExitOnFailure(hr, "BA OnApplyBegin failed.");
37
38 // Write results.
39 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
40 ExitOnFailure(hr, "Failed to write size of OnApplyBegin struct.");
41
42 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
43 ExitOnFailure(hr, "Failed to write cancel of OnApplyBegin struct.");
44
45LExit:
46 return hr;
47}
48
49static HRESULT OnApplyComplete(
50 __in IBootstrapperApplication* pApplication,
51 __in BUFF_READER* pReaderArgs,
52 __in BUFF_READER* pReaderResults,
53 __in BUFF_BUFFER* pBuffer
54 )
55{
56 HRESULT hr = S_OK;
57 BA_ONAPPLYCOMPLETE_ARGS args = { };
58 BA_ONAPPLYCOMPLETE_RESULTS results = { };
59
60 // Read args.
61 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
62 ExitOnFailure(hr, "Failed to read API version of OnApplyComplete args.");
63
64 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
65 ExitOnFailure(hr, "Failed to read status of OnApplyComplete args.");
66
67 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.restart));
68 ExitOnFailure(hr, "Failed to read restart of OnApplyComplete args.");
69
70 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
71 ExitOnFailure(hr, "Failed to read recommendation of OnApplyComplete args.");
72
73 // Read results.
74 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
75 ExitOnFailure(hr, "Failed to read API version of OnApplyComplete results.");
76
77 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
78 ExitOnFailure(hr, "Failed to read action of OnApplyComplete results.");
79
80 // Callback.
81 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, &args, &results);
82
83 if (E_NOTIMPL == hr)
84 {
85 hr = pApplication->OnApplyComplete(args.hrStatus, args.restart, args.recommendation, &results.action);
86 }
87
88 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, &args, &results, &hr);
89 BalExitOnFailure(hr, "BA OnApplyComplete failed.");
90
91 // Write results.
92 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
93 ExitOnFailure(hr, "Failed to write size of OnApplyComplete struct.");
94
95 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
96 ExitOnFailure(hr, "Failed to write action of OnApplyComplete struct.");
97
98LExit:
99 return hr;
100}
101
102static HRESULT OnApplyDowngrade(
103 __in IBootstrapperApplication* pApplication,
104 __in BUFF_READER* pReaderArgs,
105 __in BUFF_READER* pReaderResults,
106 __in BUFF_BUFFER* pBuffer
107 )
108{
109 HRESULT hr = S_OK;
110 BA_ONAPPLYDOWNGRADE_ARGS args = { };
111 BA_ONAPPLYDOWNGRADE_RESULTS results = { };
112
113 // Read args.
114 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
115 ExitOnFailure(hr, "Failed to read API version of OnApplyDowngrade args.");
116
117 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrRecommended));
118 ExitOnFailure(hr, "Failed to read recommended of OnApplyDowngrade args.");
119
120 // Read results.
121 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
122 ExitOnFailure(hr, "Failed to read API version of OnApplyDowngrade results.");
123
124 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.hrStatus));
125 ExitOnFailure(hr, "Failed to read status of OnApplyDowngrade results.");
126
127 // Callback.
128 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE, &args, &results);
129
130 if (E_NOTIMPL == hr)
131 {
132 hr = pApplication->OnApplyDowngrade(args.hrRecommended, &results.hrStatus);
133 }
134
135 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE, &args, &results, &hr);
136 BalExitOnFailure(hr, "BA OnApplyDowngrade failed.");
137
138 // Write results.
139 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
140 ExitOnFailure(hr, "Failed to write size of OnApplyDowngrade struct.");
141
142 hr = BuffWriteNumberToBuffer(pBuffer, results.hrStatus);
143 ExitOnFailure(hr, "Failed to write status of OnApplyDowngrade struct.");
144
145LExit:
146 return hr;
147}
148
149static HRESULT OnBeginMsiTransactionBegin(
150 __in IBootstrapperApplication* pApplication,
151 __in BUFF_READER* pReaderArgs,
152 __in BUFF_READER* pReaderResults,
153 __in BUFF_BUFFER* pBuffer
154 )
155{
156 HRESULT hr = S_OK;
157 BA_ONBEGINMSITRANSACTIONBEGIN_ARGS args = { };
158 BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS results = { };
159 LPWSTR sczTransactionId = NULL;
160
161 // Read args.
162 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
163 ExitOnFailure(hr, "Failed to read API version of OnBeginMsiTransactionBegin args.");
164
165 hr = BuffReaderReadString(pReaderArgs, &sczTransactionId);
166 ExitOnFailure(hr, "Failed to read recommended of OnBeginMsiTransactionBegin args.");
167
168 args.wzTransactionId = sczTransactionId;
169
170 // Read results.
171 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
172 ExitOnFailure(hr, "Failed to read API version of OnBeginMsiTransactionBegin results.");
173
174 // Callback.
175 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &args, &results);
176
177 if (E_NOTIMPL == hr)
178 {
179 hr = pApplication->OnBeginMsiTransactionBegin(args.wzTransactionId, &results.fCancel);
180 }
181
182 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &args, &results, &hr);
183 BalExitOnFailure(hr, "BA OnBeginMsiTransactionBegin failed.");
184
185 // Write results.
186 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
187 ExitOnFailure(hr, "Failed to write size of OnBeginMsiTransactionBegin struct.");
188
189 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
190 ExitOnFailure(hr, "Failed to write cancel of OnBeginMsiTransactionBegin struct.");
191
192LExit:
193 ReleaseStr(sczTransactionId);
194 return hr;
195}
196
197static HRESULT OnBeginMsiTransactionComplete(
198 __in IBootstrapperApplication* pApplication,
199 __in BUFF_READER* pReaderArgs,
200 __in BUFF_READER* pReaderResults,
201 __in BUFF_BUFFER* pBuffer
202 )
203{
204 HRESULT hr = S_OK;
205 BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS args = { };
206 BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS results = { };
207 LPWSTR sczTransactionId = NULL;
208
209 // Read args.
210 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
211 ExitOnFailure(hr, "Failed to read API version of OnBeginMsiTransactionComplete args.");
212
213 hr = BuffReaderReadString(pReaderArgs, &sczTransactionId);
214 ExitOnFailure(hr, "Failed to read transaction id of OnBeginMsiTransactionComplete args.");
215
216 args.wzTransactionId = sczTransactionId;
217
218 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
219 ExitOnFailure(hr, "Failed to read status of OnBeginMsiTransactionComplete args.");
220
221 // Read results.
222 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
223 ExitOnFailure(hr, "Failed to read API version of OnBeginMsiTransactionComplete results.");
224
225 // Callback.
226 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &args, &results);
227
228 if (E_NOTIMPL == hr)
229 {
230 hr = pApplication->OnBeginMsiTransactionComplete(args.wzTransactionId, args.hrStatus);
231 }
232
233 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &args, &results, &hr);
234 BalExitOnFailure(hr, "BA OnBeginMsiTransactionComplete failed.");
235
236 // Write results.
237 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
238 ExitOnFailure(hr, "Failed to write size of OnBeginMsiTransactionComplete struct.");
239
240LExit:
241 ReleaseStr(sczTransactionId);
242 return hr;
243}
244
245static HRESULT OnCacheAcquireBegin(
246 __in IBootstrapperApplication* pApplication,
247 __in BUFF_READER* pReaderArgs,
248 __in BUFF_READER* pReaderResults,
249 __in BUFF_BUFFER* pBuffer
250 )
251{
252 HRESULT hr = S_OK;
253 BA_ONCACHEACQUIREBEGIN_ARGS args = { };
254 BA_ONCACHEACQUIREBEGIN_RESULTS results = { };
255 LPWSTR sczPackageOrContainerId = NULL;
256 LPWSTR sczPayloadId = NULL;
257 LPWSTR sczSource = NULL;
258 LPWSTR sczDownloadUrl = NULL;
259 LPWSTR sczPayloadContainerId = NULL;
260
261 // Read args.
262 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
263 ExitOnFailure(hr, "Failed to read API version of OnCacheAcquireBegin args.");
264
265 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
266 ExitOnFailure(hr, "Failed to read package or container id of OnCacheAcquireBegin args.");
267
268 args.wzPackageOrContainerId = sczPackageOrContainerId;
269
270 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
271 ExitOnFailure(hr, "Failed to read payload id of OnCacheAcquireBegin args.");
272
273 args.wzPayloadId = sczPayloadId;
274
275 hr = BuffReaderReadString(pReaderArgs, &sczSource);
276 ExitOnFailure(hr, "Failed to read source of OnCacheAcquireBegin args.");
277
278 args.wzSource = sczSource;
279
280 hr = BuffReaderReadString(pReaderArgs, &sczDownloadUrl);
281 ExitOnFailure(hr, "Failed to read download url of OnCacheAcquireBegin args.");
282
283 args.wzDownloadUrl = sczDownloadUrl;
284
285 hr = BuffReaderReadString(pReaderArgs, &sczPayloadContainerId);
286 ExitOnFailure(hr, "Failed to read payload container id of OnCacheAcquireBegin args.");
287
288 args.wzPayloadContainerId = sczPayloadContainerId;
289
290 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
291 ExitOnFailure(hr, "Failed to read recommendation of OnCacheAcquireBegin args.");
292
293 // Read results.
294 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
295 ExitOnFailure(hr, "Failed to read API version of OnCacheAcquireBegin results.");
296
297 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
298 ExitOnFailure(hr, "Failed to read action of OnCacheAcquireBegin results.");
299
300 // Callback.
301 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, &args, &results);
302
303 if (E_NOTIMPL == hr)
304 {
305 hr = pApplication->OnCacheAcquireBegin(args.wzPackageOrContainerId, args.wzPayloadId, args.wzSource, args.wzDownloadUrl, args.wzPayloadContainerId, args.recommendation, &results.action, &results.fCancel);
306 }
307
308 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, &args, &results, &hr);
309 BalExitOnFailure(hr, "BA OnCacheAcquireBegin failed.");
310
311 // Write results.
312 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
313 ExitOnFailure(hr, "Failed to write size of OnCacheAcquireBegin struct.");
314
315 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
316 ExitOnFailure(hr, "Failed to write cancel of OnCacheAcquireBegin struct.");
317
318 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
319 ExitOnFailure(hr, "Failed to write action of OnCacheAcquireBegin struct.");
320
321LExit:
322 ReleaseStr(sczPayloadContainerId);
323 ReleaseStr(sczDownloadUrl);
324 ReleaseStr(sczSource);
325 ReleaseStr(sczPayloadId);
326 ReleaseStr(sczPackageOrContainerId);
327 return hr;
328}
329
330static HRESULT OnCacheAcquireComplete(
331 __in IBootstrapperApplication* pApplication,
332 __in BUFF_READER* pReaderArgs,
333 __in BUFF_READER* pReaderResults,
334 __in BUFF_BUFFER* pBuffer
335 )
336{
337 HRESULT hr = S_OK;
338 BA_ONCACHEACQUIRECOMPLETE_ARGS args = { };
339 BA_ONCACHEACQUIRECOMPLETE_RESULTS results = { };
340 LPWSTR sczPackageOrContainerId = NULL;
341 LPWSTR sczPayloadId = NULL;
342
343 // Read args.
344 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
345 ExitOnFailure(hr, "Failed to read API version of OnCacheAcquireComplete args.");
346
347 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
348 ExitOnFailure(hr, "Failed to read package or container id of OnCacheAcquireComplete args.");
349
350 args.wzPackageOrContainerId = sczPackageOrContainerId;
351
352 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
353 ExitOnFailure(hr, "Failed to read payload id of OnCacheAcquireComplete args.");
354
355 args.wzPayloadId = sczPayloadId;
356
357 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
358 ExitOnFailure(hr, "Failed to read status of OnCacheAcquireComplete args.");
359
360 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
361 ExitOnFailure(hr, "Failed to read recommendation of OnCacheAcquireComplete args.");
362
363 // Read results.
364 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
365 ExitOnFailure(hr, "Failed to read API version of OnCacheAcquireComplete results.");
366
367 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
368 ExitOnFailure(hr, "Failed to read action of OnCacheAcquireComplete results.");
369
370 // Callback.
371 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, &args, &results);
372
373 if (E_NOTIMPL == hr)
374 {
375 hr = pApplication->OnCacheAcquireComplete(args.wzPackageOrContainerId, args.wzPayloadId, args.hrStatus, args.recommendation, &results.action);
376 }
377
378 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, &args, &results, &hr);
379 BalExitOnFailure(hr, "BA OnCacheAcquireComplete failed.");
380
381 // Write results.
382 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
383 ExitOnFailure(hr, "Failed to write size of OnCacheAcquireComplete struct.");
384
385 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
386 ExitOnFailure(hr, "Failed to write action of OnCacheAcquireComplete struct.");
387
388LExit:
389 ReleaseStr(sczPayloadId);
390 ReleaseStr(sczPackageOrContainerId);
391 return hr;
392}
393
394static HRESULT OnCacheAcquireProgress(
395 __in IBootstrapperApplication* pApplication,
396 __in BUFF_READER* pReaderArgs,
397 __in BUFF_READER* pReaderResults,
398 __in BUFF_BUFFER* pBuffer
399 )
400{
401 HRESULT hr = S_OK;
402 BA_ONCACHEACQUIREPROGRESS_ARGS args = { };
403 BA_ONCACHEACQUIREPROGRESS_RESULTS results = { };
404 LPWSTR sczPackageOrContainerId = NULL;
405 LPWSTR sczPayloadId = NULL;
406
407 // Read args.
408 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
409 ExitOnFailure(hr, "Failed to read API version of OnCacheAcquireProgress args.");
410
411 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
412 ExitOnFailure(hr, "Failed to read package or container id of OnCacheAcquireProgress args.");
413
414 args.wzPackageOrContainerId = sczPackageOrContainerId;
415
416 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
417 ExitOnFailure(hr, "Failed to read payload id of OnCacheAcquireProgress args.");
418
419 args.wzPayloadId = sczPayloadId;
420
421 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Progress);
422 ExitOnFailure(hr, "Failed to read progress of OnCacheAcquireProgress args.");
423
424 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Total);
425 ExitOnFailure(hr, "Failed to read total progress of OnCacheAcquireProgress args.");
426
427 hr = BuffReaderReadNumber(pReaderArgs, &args.dwOverallPercentage);
428 ExitOnFailure(hr, "Failed to read overall percentage of OnCacheAcquireProgress args.");
429
430 // Read results.
431 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
432 ExitOnFailure(hr, "Failed to read API version of OnCacheAcquireProgress results.");
433
434 // Callback.
435 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, &args, &results);
436
437 if (E_NOTIMPL == hr)
438 {
439 hr = pApplication->OnCacheAcquireProgress(args.wzPackageOrContainerId, args.wzPayloadId, args.dw64Progress, args.dw64Total, args.dwOverallPercentage, &results.fCancel);
440 }
441
442 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, &args, &results, &hr);
443 BalExitOnFailure(hr, "BA OnCacheAcquireProgress failed.");
444
445 // Write results.
446 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
447 ExitOnFailure(hr, "Failed to write size of OnCacheAcquireProgress struct.");
448
449 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
450 ExitOnFailure(hr, "Failed to write cancel of OnCacheAcquireProgress struct.");
451
452LExit:
453 ReleaseStr(sczPayloadId);
454 ReleaseStr(sczPackageOrContainerId);
455 return hr;
456}
457
458static HRESULT OnCacheAcquireResolving(
459 __in IBootstrapperApplication* pApplication,
460 __in BUFF_READER* pReaderArgs,
461 __in BUFF_READER* pReaderResults,
462 __in BUFF_BUFFER* pBuffer
463 )
464{
465 HRESULT hr = S_OK;
466 BA_ONCACHEACQUIRERESOLVING_ARGS args = { };
467 BA_ONCACHEACQUIRERESOLVING_RESULTS results = { };
468 LPWSTR sczPackageOrContainerId = NULL;
469 LPWSTR sczPayloadId = NULL;
470 DWORD cSearchPaths = 0;
471 LPWSTR* rgsczSearchPaths = NULL;
472 LPWSTR sczDownloadUrl = NULL;
473 LPWSTR sczPayloadContainerId = NULL;
474
475 // Read args.
476 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
477 ExitOnFailure(hr, "Failed to read API version of OnCacheAcquireResolving args.");
478
479 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
480 ExitOnFailure(hr, "Failed to read package or container id of OnCacheAcquireResolving args.");
481
482 args.wzPackageOrContainerId = sczPackageOrContainerId;
483
484 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
485 ExitOnFailure(hr, "Failed to read payload id of OnCacheAcquireResolving args.");
486
487 args.wzPayloadId = sczPayloadId;
488
489 hr = BuffReaderReadNumber(pReaderArgs, &cSearchPaths);
490 ExitOnFailure(hr, "Failed to read overall percentage of OnCacheAcquireResolving args.");
491
492 if (cSearchPaths)
493 {
494 rgsczSearchPaths = static_cast<LPWSTR*>(MemAlloc(sizeof(LPWSTR) * cSearchPaths, TRUE));
495 ExitOnNull(rgsczSearchPaths, hr, E_OUTOFMEMORY, "Failed to allocate memory for search paths of OnCacheAcquireResolving args.");
496
497 for (DWORD i = 0; i < cSearchPaths; ++i)
498 {
499 hr = BuffReaderReadString(pReaderArgs, &rgsczSearchPaths[i]);
500 ExitOnFailure(hr, "Failed to read search path[%u] of OnCacheAcquireResolving args.", i);
501 }
502 }
503
504 args.cSearchPaths = cSearchPaths;
505 args.rgSearchPaths = const_cast<LPCWSTR*>(rgsczSearchPaths);
506
507 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fFoundLocal));
508 ExitOnFailure(hr, "Failed to read found local of OnCacheAcquireResolving args.");
509
510 hr = BuffReaderReadNumber(pReaderArgs, &args.dwRecommendedSearchPath);
511 ExitOnFailure(hr, "Failed to read recommended search path of OnCacheAcquireResolving args.");
512
513 hr = BuffReaderReadString(pReaderArgs, &sczDownloadUrl);
514 ExitOnFailure(hr, "Failed to read download url of OnCacheAcquireResolving args.");
515
516 hr = BuffReaderReadString(pReaderArgs, &sczPayloadContainerId);
517 ExitOnFailure(hr, "Failed to read payload container id of OnCacheAcquireResolving args.");
518
519 args.wzPayloadContainerId = sczPayloadContainerId;
520
521 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
522 ExitOnFailure(hr, "Failed to read recommendedation of OnCacheAcquireResolving args.");
523
524 // Read results.
525 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
526 ExitOnFailure(hr, "Failed to read API version of OnCacheAcquireResolving results.");
527
528 hr = BuffReaderReadNumber(pReaderResults, &results.dwChosenSearchPath);
529 ExitOnFailure(hr, "Failed to read chosen search path of OnCacheAcquireResolving results.");
530
531 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
532 ExitOnFailure(hr, "Failed to read action of OnCacheAcquireResolving results.");
533
534 // Callback.
535 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING, &args, &results);
536
537 if (E_NOTIMPL == hr)
538 {
539 hr = pApplication->OnCacheAcquireResolving(args.wzPackageOrContainerId, args.wzPayloadId, args.rgSearchPaths, args.cSearchPaths, args.fFoundLocal, args.dwRecommendedSearchPath, args.wzDownloadUrl, args.wzPayloadContainerId, args.recommendation, &results.dwChosenSearchPath, &results.action, &results.fCancel);
540 }
541
542 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING, &args, &results, &hr);
543 BalExitOnFailure(hr, "BA OnCacheAcquireResolving failed.");
544
545 // Write results.
546 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
547 ExitOnFailure(hr, "Failed to write size of OnCacheAcquireResolving struct.");
548
549 hr = BuffWriteNumberToBuffer(pBuffer, results.dwChosenSearchPath);
550 ExitOnFailure(hr, "Failed to write chosen search path of OnCacheAcquireResolving struct.");
551
552 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
553 ExitOnFailure(hr, "Failed to write action of OnCacheAcquireResolving struct.");
554
555 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
556 ExitOnFailure(hr, "Failed to write cancel of OnCacheAcquireResolving struct.");
557
558LExit:
559 for (DWORD i = 0; rgsczSearchPaths && i < cSearchPaths; ++i)
560 {
561 ReleaseStr(rgsczSearchPaths[i]);
562 }
563 ReleaseMem(rgsczSearchPaths);
564
565 ReleaseStr(sczPayloadContainerId);
566 ReleaseStr(sczDownloadUrl);
567 ReleaseStr(sczPayloadId);
568 ReleaseStr(sczPackageOrContainerId);
569
570 return hr;
571}
572
573static HRESULT OnCacheBegin(
574 __in IBootstrapperApplication* pApplication,
575 __in BUFF_READER* pReaderArgs,
576 __in BUFF_READER* pReaderResults,
577 __in BUFF_BUFFER* pBuffer
578 )
579{
580 HRESULT hr = S_OK;
581 BA_ONCACHEBEGIN_ARGS args = { };
582 BA_ONCACHEBEGIN_RESULTS results = { };
583
584 // Read args.
585 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
586 ExitOnFailure(hr, "Failed to read API version of OnCacheBegin args.");
587
588 // Read results.
589 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
590 ExitOnFailure(hr, "Failed to read API version of OnCacheBegin results.");
591
592 // Callback.
593 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, &args, &results);
594
595 if (E_NOTIMPL == hr)
596 {
597 hr = pApplication->OnCacheBegin(&results.fCancel);
598 }
599
600 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, &args, &results, &hr);
601 BalExitOnFailure(hr, "BA OnCacheBegin failed.");
602
603 // Write results.
604 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
605 ExitOnFailure(hr, "Failed to write size of OnCacheBegin struct.");
606
607 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
608 ExitOnFailure(hr, "Failed to write cancel of OnCacheBegin struct.");
609
610LExit:
611 return hr;
612}
613
614static HRESULT OnCacheComplete(
615 __in IBootstrapperApplication* pApplication,
616 __in BUFF_READER* pReaderArgs,
617 __in BUFF_READER* pReaderResults,
618 __in BUFF_BUFFER* pBuffer
619 )
620{
621 HRESULT hr = S_OK;
622 BA_ONCACHECOMPLETE_ARGS args = { };
623 BA_ONCACHECOMPLETE_RESULTS results = { };
624
625 // Read args.
626 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
627 ExitOnFailure(hr, "Failed to read API version of OnCacheComplete args.");
628
629 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
630 ExitOnFailure(hr, "Failed to read status of OnCacheComplete args.");
631
632 // Read results.
633 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
634 ExitOnFailure(hr, "Failed to read API version of OnCacheComplete results.");
635
636 // Callback.
637 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, &args, &results);
638
639 if (E_NOTIMPL == hr)
640 {
641 hr = pApplication->OnCacheComplete(args.hrStatus);
642 }
643
644 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, &args, &results, &hr);
645 BalExitOnFailure(hr, "BA OnCacheComplete failed.");
646
647 // Write results.
648 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
649 ExitOnFailure(hr, "Failed to write size of OnCacheComplete struct.");
650
651LExit:
652 return hr;
653}
654
655static HRESULT OnCacheContainerOrPayloadVerifyBegin(
656 __in IBootstrapperApplication* pApplication,
657 __in BUFF_READER* pReaderArgs,
658 __in BUFF_READER* pReaderResults,
659 __in BUFF_BUFFER* pBuffer
660 )
661{
662 HRESULT hr = S_OK;
663 BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS args = { };
664 BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS results = { };
665 LPWSTR sczPackageOrContainerId = NULL;
666 LPWSTR sczPayloadId = NULL;
667
668 // Read args.
669 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
670 ExitOnFailure(hr, "Failed to read API version of OnCacheContainerOrPayloadVerifyBegin args.");
671
672 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
673 ExitOnFailure(hr, "Failed to read package or container id of OnCacheContainerOrPayloadVerifyBegin args.");
674
675 args.wzPackageOrContainerId = sczPackageOrContainerId;
676
677 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
678 ExitOnFailure(hr, "Failed to read payload id of OnCacheContainerOrPayloadVerifyBegin args.");
679
680 args.wzPayloadId = sczPayloadId;
681
682 // Read results.
683 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
684 ExitOnFailure(hr, "Failed to read API version of OnCacheContainerOrPayloadVerifyBegin results.");
685
686 // Callback.
687 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, &args, &results);
688
689 if (E_NOTIMPL == hr)
690 {
691 hr = pApplication->OnCacheContainerOrPayloadVerifyBegin(args.wzPackageOrContainerId, args.wzPayloadId, &results.fCancel);
692 }
693
694 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, &args, &results, &hr);
695 BalExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyBegin failed.");
696
697 // Write results.
698 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
699 ExitOnFailure(hr, "Failed to write size of OnCacheContainerOrPayloadVerifyBegin struct.");
700
701 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
702 ExitOnFailure(hr, "Failed to write cancel of OnCacheContainerOrPayloadVerifyBegin struct.");
703
704LExit:
705 ReleaseStr(sczPayloadId);
706 ReleaseStr(sczPackageOrContainerId);
707 return hr;
708}
709
710static HRESULT OnCacheContainerOrPayloadVerifyComplete(
711 __in IBootstrapperApplication* pApplication,
712 __in BUFF_READER* pReaderArgs,
713 __in BUFF_READER* pReaderResults,
714 __in BUFF_BUFFER* pBuffer
715 )
716{
717 HRESULT hr = S_OK;
718 BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS args = { };
719 BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS results = { };
720 LPWSTR sczPackageOrContainerId = NULL;
721 LPWSTR sczPayloadId = NULL;
722
723 // Read args.
724 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
725 ExitOnFailure(hr, "Failed to read API version of OnCacheContainerOrPayloadVerifyComplete args.");
726
727 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
728 ExitOnFailure(hr, "Failed to read package or container id of OnCacheContainerOrPayloadVerifyComplete args.");
729
730 args.wzPackageOrContainerId = sczPackageOrContainerId;
731
732 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
733 ExitOnFailure(hr, "Failed to read payload id of OnCacheContainerOrPayloadVerifyComplete args.");
734
735 args.wzPayloadId = sczPayloadId;
736
737 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
738 ExitOnFailure(hr, "Failed to read status of OnCacheContainerOrPayloadVerifyComplete args.");
739
740 // Read results.
741 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
742 ExitOnFailure(hr, "Failed to read API version of OnCacheContainerOrPayloadVerifyComplete results.");
743
744 // Callback.
745 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, &args, &results);
746
747 if (E_NOTIMPL == hr)
748 {
749 hr = pApplication->OnCacheContainerOrPayloadVerifyComplete(args.wzPackageOrContainerId, args.wzPayloadId, args.hrStatus);
750 }
751
752 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, &args, &results, &hr);
753 BalExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyComplete failed.");
754
755 // Write results.
756 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
757 ExitOnFailure(hr, "Failed to write size of OnCacheContainerOrPayloadVerifyComplete struct.");
758
759LExit:
760 ReleaseStr(sczPayloadId);
761 ReleaseStr(sczPackageOrContainerId);
762 return hr;
763}
764
765static HRESULT OnCacheContainerOrPayloadVerifyProgress(
766 __in IBootstrapperApplication* pApplication,
767 __in BUFF_READER* pReaderArgs,
768 __in BUFF_READER* pReaderResults,
769 __in BUFF_BUFFER* pBuffer
770 )
771{
772 HRESULT hr = S_OK;
773 BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS args = { };
774 BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS results = { };
775 LPWSTR sczPackageOrContainerId = NULL;
776 LPWSTR sczPayloadId = NULL;
777
778 // Read args.
779 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
780 ExitOnFailure(hr, "Failed to read API version of OnCacheContainerOrPayloadVerifyProgress args.");
781
782 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
783 ExitOnFailure(hr, "Failed to read package or container id of OnCacheContainerOrPayloadVerifyProgress args.");
784
785 args.wzPackageOrContainerId = sczPackageOrContainerId;
786
787 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
788 ExitOnFailure(hr, "Failed to read payload id of OnCacheContainerOrPayloadVerifyProgress args.");
789
790 args.wzPayloadId = sczPayloadId;
791
792 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Progress);
793 ExitOnFailure(hr, "Failed to read progress of OnCacheContainerOrPayloadVerifyProgress args.");
794
795 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Total);
796 ExitOnFailure(hr, "Failed to read total progress of OnCacheContainerOrPayloadVerifyProgress args.");
797
798 hr = BuffReaderReadNumber(pReaderArgs, &args.dwOverallPercentage);
799 ExitOnFailure(hr, "Failed to read overall percentage of OnCacheContainerOrPayloadVerifyProgress args.");
800
801 // Read results.
802 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
803 ExitOnFailure(hr, "Failed to read API version of OnCacheContainerOrPayloadVerifyProgress results.");
804
805 // Callback.
806 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, &args, &results);
807
808 if (E_NOTIMPL == hr)
809 {
810 hr = pApplication->OnCacheContainerOrPayloadVerifyProgress(args.wzPackageOrContainerId, args.wzPayloadId, args.dw64Progress, args.dw64Total, args.dwOverallPercentage, &results.fCancel);
811 }
812
813 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, &args, &results, &hr);
814 BalExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyProgress failed.");
815
816 // Write results.
817 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
818 ExitOnFailure(hr, "Failed to write size of OnCacheContainerOrPayloadVerifyProgress struct.");
819
820 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
821 ExitOnFailure(hr, "Failed to write cancel of OnCacheContainerOrPayloadVerifyProgress struct.");
822
823LExit:
824 ReleaseStr(sczPayloadId);
825 ReleaseStr(sczPackageOrContainerId);
826 return hr;
827}
828
829static HRESULT OnCachePackageBegin(
830 __in IBootstrapperApplication* pApplication,
831 __in BUFF_READER* pReaderArgs,
832 __in BUFF_READER* pReaderResults,
833 __in BUFF_BUFFER* pBuffer
834 )
835{
836 HRESULT hr = S_OK;
837 BA_ONCACHEPACKAGEBEGIN_ARGS args = { };
838 BA_ONCACHEPACKAGEBEGIN_RESULTS results = { };
839 LPWSTR sczPackageId = NULL;
840
841 // Read args.
842 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
843 ExitOnFailure(hr, "Failed to read API version of OnCachePackageBegin args.");
844
845 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
846 ExitOnFailure(hr, "Failed to read package id of OnCachePackageBegin args.");
847
848 args.wzPackageId = sczPackageId;
849
850 hr = BuffReaderReadNumber(pReaderArgs, &args.cCachePayloads);
851 ExitOnFailure(hr, "Failed to read count of cached payloads of OnCachePackageBegin args.");
852
853 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64PackageCacheSize);
854 ExitOnFailure(hr, "Failed to read package cache size of OnCachePackageBegin args.");
855
856 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fVital));
857 ExitOnFailure(hr, "Failed to read vital of OnCachePackageBegin args.");
858
859 // Read results.
860 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
861 ExitOnFailure(hr, "Failed to read API version of OnCachePackageBegin results.");
862
863 // Callback.
864 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, &args, &results);
865
866 if (E_NOTIMPL == hr)
867 {
868 hr = pApplication->OnCachePackageBegin(args.wzPackageId, args.cCachePayloads, args.dw64PackageCacheSize, args.fVital, &results.fCancel);
869 }
870
871 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, &args, &results, &hr);
872 BalExitOnFailure(hr, "BA OnCachePackageBegin failed.");
873
874 // Write results.
875 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
876 ExitOnFailure(hr, "Failed to write size of OnCachePackageBegin struct.");
877
878 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
879 ExitOnFailure(hr, "Failed to write cancel of OnCachePackageBegin struct.");
880
881LExit:
882 ReleaseStr(sczPackageId);
883 return hr;
884}
885
886static HRESULT OnCachePackageComplete(
887 __in IBootstrapperApplication* pApplication,
888 __in BUFF_READER* pReaderArgs,
889 __in BUFF_READER* pReaderResults,
890 __in BUFF_BUFFER* pBuffer
891 )
892{
893 HRESULT hr = S_OK;
894 BA_ONCACHEPACKAGECOMPLETE_ARGS args = { };
895 BA_ONCACHEPACKAGECOMPLETE_RESULTS results = { };
896 LPWSTR sczPackageId = NULL;
897
898 // Read args.
899 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
900 ExitOnFailure(hr, "Failed to read API version of OnCachePackageComplete args.");
901
902 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
903 ExitOnFailure(hr, "Failed to read package id of OnCachePackageComplete args.");
904
905 args.wzPackageId = sczPackageId;
906
907 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
908 ExitOnFailure(hr, "Failed to read status of OnCachePackageComplete args.");
909
910 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
911 ExitOnFailure(hr, "Failed to read recommendation of OnCachePackageComplete args.");
912
913 // Read results.
914 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
915 ExitOnFailure(hr, "Failed to read API version of OnCachePackageComplete results.");
916
917 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
918 ExitOnFailure(hr, "Failed to read action of OnCachePackageComplete results.");
919
920 // Callback.
921 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, &args, &results);
922
923 if (E_NOTIMPL == hr)
924 {
925 hr = pApplication->OnCachePackageComplete(args.wzPackageId, args.hrStatus, args.recommendation, &results.action);
926 }
927
928 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, &args, &results, &hr);
929 BalExitOnFailure(hr, "BA OnCachePackageComplete failed.");
930
931 // Write results.
932 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
933 ExitOnFailure(hr, "Failed to write size of OnCachePackageComplete struct.");
934
935 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
936 ExitOnFailure(hr, "Failed to write action of OnCachePackageComplete struct.");
937
938LExit:
939 ReleaseStr(sczPackageId);
940 return hr;
941}
942
943static HRESULT OnCachePackageNonVitalValidationFailure(
944 __in IBootstrapperApplication* pApplication,
945 __in BUFF_READER* pReaderArgs,
946 __in BUFF_READER* pReaderResults,
947 __in BUFF_BUFFER* pBuffer
948 )
949{
950 HRESULT hr = S_OK;
951 BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS args = { };
952 BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS results = { };
953 LPWSTR sczPackageId = NULL;
954
955 // Read args.
956 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
957 ExitOnFailure(hr, "Failed to read API version of OnCachePackageNonVitalValidationFailure args.");
958
959 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
960 ExitOnFailure(hr, "Failed to read package id of OnCachePackageNonVitalValidationFailure args.");
961
962 args.wzPackageId = sczPackageId;
963
964 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
965 ExitOnFailure(hr, "Failed to read status of OnCachePackageNonVitalValidationFailure args.");
966
967 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
968 ExitOnFailure(hr, "Failed to read recommendation of OnCachePackageNonVitalValidationFailure args.");
969
970 // Read results.
971 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
972 ExitOnFailure(hr, "Failed to read API version of OnCachePackageNonVitalValidationFailure results.");
973
974 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
975 ExitOnFailure(hr, "Failed to read action of OnCachePackageNonVitalValidationFailure results.");
976
977 // Callback.
978 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE, &args, &results);
979
980 if (E_NOTIMPL == hr)
981 {
982 hr = pApplication->OnCachePackageNonVitalValidationFailure(args.wzPackageId, args.hrStatus, args.recommendation, &results.action);
983 }
984
985 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE, &args, &results, &hr);
986 BalExitOnFailure(hr, "BA OnCachePackageNonVitalValidationFailure failed.");
987
988 // Write results.
989 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
990 ExitOnFailure(hr, "Failed to write size of OnCachePackageNonVitalValidationFailure struct.");
991
992 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
993 ExitOnFailure(hr, "Failed to write action of OnCachePackageNonVitalValidationFailure struct.");
994
995LExit:
996 ReleaseStr(sczPackageId);
997 return hr;
998}
999
1000static HRESULT OnCachePayloadExtractBegin(
1001 __in IBootstrapperApplication* pApplication,
1002 __in BUFF_READER* pReaderArgs,
1003 __in BUFF_READER* pReaderResults,
1004 __in BUFF_BUFFER* pBuffer
1005 )
1006{
1007 HRESULT hr = S_OK;
1008 BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS args = { };
1009 BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS results = { };
1010 LPWSTR sczContainerId = NULL;
1011 LPWSTR sczPayloadId = NULL;
1012
1013 // Read args.
1014 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1015 ExitOnFailure(hr, "Failed to read API version of OnCachePayloadExtractBegin args.");
1016
1017 hr = BuffReaderReadString(pReaderArgs, &sczContainerId);
1018 ExitOnFailure(hr, "Failed to read container id of OnCachePayloadExtractBegin args.");
1019
1020 args.wzContainerId = sczContainerId;
1021
1022 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
1023 ExitOnFailure(hr, "Failed to read payload id of OnCachePayloadExtractBegin args.");
1024
1025 args.wzPayloadId = sczPayloadId;
1026
1027 // Read results.
1028 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1029 ExitOnFailure(hr, "Failed to read API version of OnCachePayloadExtractBegin results.");
1030
1031 // Callback.
1032 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, &args, &results);
1033
1034 if (E_NOTIMPL == hr)
1035 {
1036 hr = pApplication->OnCachePayloadExtractBegin(args.wzContainerId, args.wzPayloadId, &results.fCancel);
1037 }
1038
1039 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, &args, &results, &hr);
1040 BalExitOnFailure(hr, "BA OnCachePayloadExtractBegin failed.");
1041
1042 // Write results.
1043 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1044 ExitOnFailure(hr, "Failed to write size of OnCachePayloadExtractBegin struct.");
1045
1046 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1047 ExitOnFailure(hr, "Failed to write cancel of OnCachePayloadExtractBegin struct.");
1048
1049LExit:
1050 ReleaseStr(sczPayloadId);
1051 ReleaseStr(sczContainerId);
1052 return hr;
1053}
1054
1055static HRESULT OnCachePayloadExtractComplete(
1056 __in IBootstrapperApplication* pApplication,
1057 __in BUFF_READER* pReaderArgs,
1058 __in BUFF_READER* pReaderResults,
1059 __in BUFF_BUFFER* pBuffer
1060 )
1061{
1062 HRESULT hr = S_OK;
1063 BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS args = { };
1064 BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS results = { };
1065 LPWSTR sczContainerId = NULL;
1066 LPWSTR sczPayloadId = NULL;
1067
1068 // Read args.
1069 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1070 ExitOnFailure(hr, "Failed to read API version of OnCachePayloadExtractComplete args.");
1071
1072 hr = BuffReaderReadString(pReaderArgs, &sczContainerId);
1073 ExitOnFailure(hr, "Failed to read container id of OnCachePayloadExtractComplete args.");
1074
1075 args.wzContainerId = sczContainerId;
1076
1077 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
1078 ExitOnFailure(hr, "Failed to read payload id of OnCachePayloadExtractComplete args.");
1079
1080 args.wzPayloadId = sczPayloadId;
1081
1082 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
1083 ExitOnFailure(hr, "Failed to read status of OnCachePayloadExtractComplete args.");
1084
1085 // Read results.
1086 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1087 ExitOnFailure(hr, "Failed to read API version of OnCachePayloadExtractComplete results.");
1088
1089 // Callback.
1090 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, &args, &results);
1091
1092 if (E_NOTIMPL == hr)
1093 {
1094 hr = pApplication->OnCachePayloadExtractComplete(args.wzContainerId, args.wzPayloadId, args.hrStatus);
1095 }
1096
1097 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, &args, &results, &hr);
1098 BalExitOnFailure(hr, "BA OnCachePayloadExtractComplete failed.");
1099
1100 // Write results.
1101 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1102 ExitOnFailure(hr, "Failed to write size of OnCachePayloadExtractComplete struct.");
1103
1104LExit:
1105 ReleaseStr(sczPayloadId);
1106 ReleaseStr(sczContainerId);
1107 return hr;
1108}
1109
1110static HRESULT OnCachePayloadExtractProgress(
1111 __in IBootstrapperApplication* pApplication,
1112 __in BUFF_READER* pReaderArgs,
1113 __in BUFF_READER* pReaderResults,
1114 __in BUFF_BUFFER* pBuffer
1115 )
1116{
1117 HRESULT hr = S_OK;
1118 BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS args = { };
1119 BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS results = { };
1120 LPWSTR sczContainerId = NULL;
1121 LPWSTR sczPayloadId = NULL;
1122
1123 // Read args.
1124 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1125 ExitOnFailure(hr, "Failed to read API version of OnCachePayloadExtractProgress args.");
1126
1127 hr = BuffReaderReadString(pReaderArgs, &sczContainerId);
1128 ExitOnFailure(hr, "Failed to read container id of OnCachePayloadExtractProgress args.");
1129
1130 args.wzContainerId = sczContainerId;
1131
1132 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
1133 ExitOnFailure(hr, "Failed to read payload id of OnCachePayloadExtractProgress args.");
1134
1135 args.wzPayloadId = sczPayloadId;
1136
1137 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Progress);
1138 ExitOnFailure(hr, "Failed to read progress of OnCachePayloadExtractProgress args.");
1139
1140 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Total);
1141 ExitOnFailure(hr, "Failed to read total progress of OnCachePayloadExtractProgress args.");
1142
1143 hr = BuffReaderReadNumber(pReaderArgs, &args.dwOverallPercentage);
1144 ExitOnFailure(hr, "Failed to read overall percentage of OnCachePayloadExtractProgress args.");
1145
1146 // Read results.
1147 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1148 ExitOnFailure(hr, "Failed to read API version of OnCachePayloadExtractProgress results.");
1149
1150 // Callback.
1151 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, &args, &results);
1152
1153 if (E_NOTIMPL == hr)
1154 {
1155 hr = pApplication->OnCachePayloadExtractProgress(args.wzContainerId, args.wzPayloadId, args.dw64Progress, args.dw64Total, args.dwOverallPercentage, &results.fCancel);
1156 }
1157
1158 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, &args, &results, &hr);
1159 BalExitOnFailure(hr, "BA OnCachePayloadExtractProgress failed.");
1160
1161 // Write results.
1162 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1163 ExitOnFailure(hr, "Failed to write size of OnCachePayloadExtractProgress struct.");
1164
1165 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1166 ExitOnFailure(hr, "Failed to write cancel of OnCachePayloadExtractProgress struct.");
1167
1168LExit:
1169 ReleaseStr(sczPayloadId);
1170 ReleaseStr(sczContainerId);
1171 return hr;
1172}
1173
1174static HRESULT OnCacheVerifyBegin(
1175 __in IBootstrapperApplication* pApplication,
1176 __in BUFF_READER* pReaderArgs,
1177 __in BUFF_READER* pReaderResults,
1178 __in BUFF_BUFFER* pBuffer
1179 )
1180{
1181 HRESULT hr = S_OK;
1182 BA_ONCACHEVERIFYBEGIN_ARGS args = { };
1183 BA_ONCACHEVERIFYBEGIN_RESULTS results = { };
1184 LPWSTR sczPackageOrContainerId = NULL;
1185 LPWSTR sczPayloadId = NULL;
1186
1187 // Read args.
1188 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1189 ExitOnFailure(hr, "Failed to read API version of OnCacheVerifyBegin args.");
1190
1191 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
1192 ExitOnFailure(hr, "Failed to read package or container id of OnCacheVerifyBegin args.");
1193
1194 args.wzPackageOrContainerId = sczPackageOrContainerId;
1195
1196 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
1197 ExitOnFailure(hr, "Failed to read payload id of OnCacheVerifyBegin args.");
1198
1199 args.wzPayloadId = sczPayloadId;
1200
1201 // Read results.
1202 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1203 ExitOnFailure(hr, "Failed to read API version of OnCacheVerifyBegin results.");
1204
1205 // Callback.
1206 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, &args, &results);
1207
1208 if (E_NOTIMPL == hr)
1209 {
1210 hr = pApplication->OnCacheVerifyBegin(args.wzPackageOrContainerId, args.wzPayloadId, &results.fCancel);
1211 }
1212
1213 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, &args, &results, &hr);
1214 BalExitOnFailure(hr, "BA OnCacheVerifyBegin failed.");
1215
1216 // Write results.
1217 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1218 ExitOnFailure(hr, "Failed to write size of OnCacheVerifyBegin struct.");
1219
1220 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1221 ExitOnFailure(hr, "Failed to write cancel of OnCacheVerifyBegin struct.");
1222
1223LExit:
1224 ReleaseStr(sczPayloadId);
1225 ReleaseStr(sczPackageOrContainerId);
1226 return hr;
1227}
1228
1229static HRESULT OnCacheVerifyComplete(
1230 __in IBootstrapperApplication* pApplication,
1231 __in BUFF_READER* pReaderArgs,
1232 __in BUFF_READER* pReaderResults,
1233 __in BUFF_BUFFER* pBuffer
1234 )
1235{
1236 HRESULT hr = S_OK;
1237 BA_ONCACHEVERIFYCOMPLETE_ARGS args = { };
1238 BA_ONCACHEVERIFYCOMPLETE_RESULTS results = { };
1239 LPWSTR sczPackageOrContainerId = NULL;
1240 LPWSTR sczPayloadId = NULL;
1241
1242 // Read args.
1243 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1244 ExitOnFailure(hr, "Failed to read API version of OnCacheVerifyComplete args.");
1245
1246 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
1247 ExitOnFailure(hr, "Failed to read package or container id of OnCacheVerifyComplete args.");
1248
1249 args.wzPackageOrContainerId = sczPackageOrContainerId;
1250
1251 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
1252 ExitOnFailure(hr, "Failed to read payload id of OnCacheVerifyComplete args.");
1253
1254 args.wzPayloadId = sczPayloadId;
1255
1256 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
1257 ExitOnFailure(hr, "Failed to read status of OnCacheVerifyComplete args.");
1258
1259 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
1260 ExitOnFailure(hr, "Failed to read recommendation of OnCacheVerifyComplete args.");
1261
1262 // Read results.
1263 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1264 ExitOnFailure(hr, "Failed to read API version of OnCacheVerifyComplete results.");
1265
1266 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
1267 ExitOnFailure(hr, "Failed to read API version of OnCacheVerifyComplete results.");
1268
1269 // Callback.
1270 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, &args, &results);
1271
1272 if (E_NOTIMPL == hr)
1273 {
1274 hr = pApplication->OnCacheVerifyComplete(args.wzPackageOrContainerId, args.wzPayloadId, args.hrStatus, args.recommendation, &results.action);
1275 }
1276
1277 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, &args, &results, &hr);
1278 BalExitOnFailure(hr, "BA OnCacheVerifyComplete failed.");
1279
1280 // Write results.
1281 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1282 ExitOnFailure(hr, "Failed to write size of OnCacheVerifyComplete struct.");
1283
1284 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
1285 ExitOnFailure(hr, "Failed to write action of OnCacheVerifyComplete struct.");
1286
1287LExit:
1288 ReleaseStr(sczPayloadId);
1289 ReleaseStr(sczPackageOrContainerId);
1290 return hr;
1291}
1292
1293static HRESULT OnCacheVerifyProgress(
1294 __in IBootstrapperApplication* pApplication,
1295 __in BUFF_READER* pReaderArgs,
1296 __in BUFF_READER* pReaderResults,
1297 __in BUFF_BUFFER* pBuffer
1298 )
1299{
1300 HRESULT hr = S_OK;
1301 BA_ONCACHEVERIFYPROGRESS_ARGS args = { };
1302 BA_ONCACHEVERIFYPROGRESS_RESULTS results = { };
1303 LPWSTR sczPackageOrContainerId = NULL;
1304 LPWSTR sczPayloadId = NULL;
1305
1306 // Read args.
1307 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1308 ExitOnFailure(hr, "Failed to read API version of OnCacheVerifyProgress args.");
1309
1310 hr = BuffReaderReadString(pReaderArgs, &sczPackageOrContainerId);
1311 ExitOnFailure(hr, "Failed to read package or container id of OnCacheVerifyProgress args.");
1312
1313 args.wzPackageOrContainerId = sczPackageOrContainerId;
1314
1315 hr = BuffReaderReadString(pReaderArgs, &sczPayloadId);
1316 ExitOnFailure(hr, "Failed to read payload id of OnCacheVerifyProgress args.");
1317
1318 args.wzPayloadId = sczPayloadId;
1319
1320 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Progress);
1321 ExitOnFailure(hr, "Failed to read progress of OnCacheVerifyProgress args.");
1322
1323 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Total);
1324 ExitOnFailure(hr, "Failed to read total progress of OnCacheVerifyProgress args.");
1325
1326 hr = BuffReaderReadNumber(pReaderArgs, &args.dwOverallPercentage);
1327 ExitOnFailure(hr, "Failed to read overall percentage of OnCacheVerifyProgress args.");
1328
1329 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.verifyStep));
1330 ExitOnFailure(hr, "Failed to read verify step of OnCacheVerifyProgress args.");
1331
1332 // Read results.
1333 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1334 ExitOnFailure(hr, "Failed to read API version of OnCacheVerifyProgress results.");
1335
1336 // Callback.
1337 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, &args, &results);
1338
1339 if (E_NOTIMPL == hr)
1340 {
1341 hr = pApplication->OnCacheVerifyProgress(args.wzPackageOrContainerId, args.wzPayloadId, args.dw64Progress, args.dw64Total, args.dwOverallPercentage, args.verifyStep, &results.fCancel);
1342 }
1343
1344 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, &args, &results, &hr);
1345 BalExitOnFailure(hr, "BA OnCacheVerifyProgress failed.");
1346
1347 // Write results.
1348 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1349 ExitOnFailure(hr, "Failed to write size of OnCacheVerifyProgress struct.");
1350
1351 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1352 ExitOnFailure(hr, "Failed to write cancel of OnCacheVerifyProgress struct.");
1353
1354LExit:
1355 ReleaseStr(sczPayloadId);
1356 ReleaseStr(sczPackageOrContainerId);
1357 return hr;
1358}
1359
1360static HRESULT OnCommitMsiTransactionBegin(
1361 __in IBootstrapperApplication* pApplication,
1362 __in BUFF_READER* pReaderArgs,
1363 __in BUFF_READER* pReaderResults,
1364 __in BUFF_BUFFER* pBuffer
1365 )
1366{
1367 HRESULT hr = S_OK;
1368 BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS args = { };
1369 BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS results = { };
1370 LPWSTR sczTransactionId = NULL;
1371
1372 // Read args.
1373 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1374 ExitOnFailure(hr, "Failed to read API version of OnCommitMsiTransactionBegin args.");
1375
1376 hr = BuffReaderReadString(pReaderArgs, &sczTransactionId);
1377 ExitOnFailure(hr, "Failed to read transaction id of OnCommitMsiTransactionBegin args.");
1378
1379 args.wzTransactionId = sczTransactionId;
1380
1381 // Read results.
1382 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1383 ExitOnFailure(hr, "Failed to read API version of OnCommitMsiTransactionBegin results.");
1384
1385 // Callback.
1386 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &args, &results);
1387
1388 if (E_NOTIMPL == hr)
1389 {
1390 hr = pApplication->OnCommitMsiTransactionBegin(args.wzTransactionId, &results.fCancel);
1391 }
1392
1393 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &args, &results, &hr);
1394 BalExitOnFailure(hr, "BA OnCommitMsiTransactionBegin failed.");
1395
1396 // Write results.
1397 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1398 ExitOnFailure(hr, "Failed to write size of OnCommitMsiTransactionBegin struct.");
1399
1400 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1401 ExitOnFailure(hr, "Failed to write cancel of OnCommitMsiTransactionBegin struct.");
1402
1403LExit:
1404 ReleaseStr(sczTransactionId);
1405 return hr;
1406}
1407
1408static HRESULT OnCommitMsiTransactionComplete(
1409 __in IBootstrapperApplication* pApplication,
1410 __in BUFF_READER* pReaderArgs,
1411 __in BUFF_READER* pReaderResults,
1412 __in BUFF_BUFFER* pBuffer
1413 )
1414{
1415 HRESULT hr = S_OK;
1416 BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS args = { };
1417 BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS results = { };
1418 LPWSTR sczTransactionId = NULL;
1419
1420 // Read args.
1421 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1422 ExitOnFailure(hr, "Failed to read API version of OnCommitMsiTransactionComplete args.");
1423
1424 hr = BuffReaderReadString(pReaderArgs, &sczTransactionId);
1425 ExitOnFailure(hr, "Failed to read transaction id of OnCommitMsiTransactionComplete args.");
1426
1427 args.wzTransactionId = sczTransactionId;
1428
1429 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
1430 ExitOnFailure(hr, "Failed to read status of OnCommitMsiTransactionComplete args.");
1431
1432 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.restart));
1433 ExitOnFailure(hr, "Failed to read restart of OnCommitMsiTransactionComplete args.");
1434
1435 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
1436 ExitOnFailure(hr, "Failed to read recommendation of OnCommitMsiTransactionComplete args.");
1437
1438 // Read results.
1439 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1440 ExitOnFailure(hr, "Failed to read API version of OnCommitMsiTransactionComplete results.");
1441
1442 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
1443 ExitOnFailure(hr, "Failed to read action of OnCommitMsiTransactionComplete results.");
1444
1445 // Callback.
1446 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &args, &results);
1447
1448 if (E_NOTIMPL == hr)
1449 {
1450 hr = pApplication->OnCommitMsiTransactionComplete(args.wzTransactionId, args.hrStatus, args.restart, args.recommendation, &results.action);
1451 }
1452
1453 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &args, &results, &hr);
1454 BalExitOnFailure(hr, "BA OnCommitMsiTransactionComplete failed.");
1455
1456 // Write results.
1457 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1458 ExitOnFailure(hr, "Failed to write size of OnCommitMsiTransactionComplete struct.");
1459
1460 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
1461 ExitOnFailure(hr, "Failed to write action of OnCommitMsiTransactionComplete struct.");
1462
1463LExit:
1464 ReleaseStr(sczTransactionId);
1465 return hr;
1466}
1467
1468static HRESULT OnCreate(
1469 __in IBootstrapperApplication* pApplication,
1470 __in IBootstrapperEngine* pEngine,
1471 __in BUFF_READER* pReaderArgs,
1472 __in BUFF_READER* pReaderResults,
1473 __in BUFF_BUFFER* pBuffer
1474 )
1475{
1476 HRESULT hr = S_OK;
1477 BA_ONCREATE_ARGS args = { };
1478 BA_ONCREATE_RESULTS results = { };
1479 LPWSTR sczCommandLine = NULL;
1480 LPWSTR sczLayoutDirectory = NULL;
1481 LPWSTR sczBootstrapperWorkingFolder = NULL;
1482 LPWSTR sczBootstrapperApplicationDataPath = NULL;
1483 DWORD64 dw64 = 0;
1484
1485 // Read args.
1486 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1487 ExitOnFailure(hr, "Failed to read API version of OnCreate args.");
1488
1489 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.command.cbSize));
1490 ExitOnFailure(hr, "Failed to size of of OnCreate args command.");
1491
1492 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.command.action));
1493 ExitOnFailure(hr, "Failed to read action of OnCreate args command.");
1494
1495 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.command.display));
1496 ExitOnFailure(hr, "Failed to read action of OnCreate args command.");
1497
1498 hr = BuffReaderReadString(pReaderArgs, &sczCommandLine);
1499 ExitOnFailure(hr, "Failed to read command-line of OnCreate args command.");
1500
1501 args.command.wzCommandLine = sczCommandLine;
1502
1503 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.command.nCmdShow));
1504 ExitOnFailure(hr, "Failed to read show command of OnCreate args command.");
1505
1506 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.command.resumeType));
1507 ExitOnFailure(hr, "Failed to read resume type of OnCreate args command.");
1508
1509 hr = BuffReaderReadNumber64(pReaderArgs, &dw64);
1510 ExitOnFailure(hr, "Failed to read splash screen handle of OnCreate args command.");
1511
1512 args.command.hwndSplashScreen = reinterpret_cast<HWND>(dw64);
1513
1514 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.command.relationType));
1515 ExitOnFailure(hr, "Failed to read relation type of OnCreate args command.");
1516
1517 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.command.fPassthrough));
1518 ExitOnFailure(hr, "Failed to read passthrough of OnCreate args command.");
1519
1520 hr = BuffReaderReadString(pReaderArgs, &sczLayoutDirectory);
1521 ExitOnFailure(hr, "Failed to read command-line of OnCreate args command.");
1522
1523 args.command.wzLayoutDirectory = sczLayoutDirectory;
1524
1525 hr = BuffReaderReadString(pReaderArgs, &sczBootstrapperWorkingFolder);
1526 ExitOnFailure(hr, "Failed to read command-line of OnCreate args command.");
1527
1528 args.command.wzBootstrapperWorkingFolder = sczBootstrapperWorkingFolder;
1529
1530 hr = BuffReaderReadString(pReaderArgs, &sczBootstrapperApplicationDataPath);
1531 ExitOnFailure(hr, "Failed to read command-line of OnCreate args command.");
1532
1533 args.command.wzBootstrapperApplicationDataPath = sczBootstrapperApplicationDataPath;
1534
1535 // Read results.
1536 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1537 ExitOnFailure(hr, "Failed to read API version of OnCreate results.");
1538
1539 // Callback.
1540 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCREATE, &args, &results);
1541
1542 if (E_NOTIMPL == hr)
1543 {
1544 hr = pApplication->OnCreate(pEngine, &args.command);
1545 }
1546
1547 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCREATE, &args, &results, &hr);
1548 BalExitOnFailure(hr, "BA OnCreate failed.");
1549
1550 // Write results.
1551 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1552 ExitOnFailure(hr, "Failed to write size of BA_ONCREATE_RESULTS struct.");
1553
1554LExit:
1555 ReleaseStr(sczBootstrapperApplicationDataPath);
1556 ReleaseStr(sczBootstrapperWorkingFolder);
1557 ReleaseStr(sczLayoutDirectory);
1558 ReleaseStr(sczCommandLine);
1559
1560 return hr;
1561}
1562
1563static HRESULT OnDestroy(
1564 __in IBootstrapperApplication* pApplication,
1565 __in BUFF_READER* pReaderArgs,
1566 __in BUFF_READER* pReaderResults,
1567 __in BUFF_BUFFER* pBuffer
1568 )
1569{
1570 HRESULT hr = S_OK;
1571 BA_ONDESTROY_ARGS args = { };
1572 BA_ONDESTROY_RESULTS results = { };
1573
1574 // Read args.
1575 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1576 ExitOnFailure(hr, "Failed to read API version of OnDestroy args.");
1577
1578 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fReload));
1579 ExitOnFailure(hr, "Failed to read reload of OnDestroy args.");
1580
1581 // Read results.
1582 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1583 ExitOnFailure(hr, "Failed to read API version of OnDestroy results.");
1584
1585 // Callback.
1586 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDESTROY, &args, &results);
1587
1588 if (E_NOTIMPL == hr)
1589 {
1590 hr = pApplication->OnDestroy(args.fReload);
1591 }
1592
1593 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDESTROY, &args, &results, &hr);
1594 BalExitOnFailure(hr, "BA OnDestroy failed.");
1595
1596 // Write results.
1597 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1598 ExitOnFailure(hr, "Failed to write size of OnDestroy struct.");
1599
1600LExit:
1601 return hr;
1602}
1603
1604static HRESULT OnDetectBegin(
1605 __in IBootstrapperApplication* pApplication,
1606 __in BUFF_READER* pReaderArgs,
1607 __in BUFF_READER* pReaderResults,
1608 __in BUFF_BUFFER* pBuffer
1609 )
1610{
1611 HRESULT hr = S_OK;
1612 BA_ONDETECTBEGIN_ARGS args = { };
1613 BA_ONDETECTBEGIN_RESULTS results = { };
1614
1615 // Read args.
1616 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1617 ExitOnFailure(hr, "Failed to read API version of OnDetectBegin args.");
1618
1619 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.registrationType));
1620 ExitOnFailure(hr, "Failed to read registration type of OnDetectBegin args.");
1621
1622 hr = BuffReaderReadNumber(pReaderArgs, &args.cPackages);
1623 ExitOnFailure(hr, "Failed to read package count of OnDetectBegin args.");
1624
1625 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fCached));
1626 ExitOnFailure(hr, "Failed to read cached of OnDetectBegin args.");
1627
1628
1629 // Read results.
1630 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1631 ExitOnFailure(hr, "Failed to read API version of OnDetectBegin results.");
1632
1633 // Callback.
1634 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, &args, &results);
1635
1636 if (E_NOTIMPL == hr)
1637 {
1638 hr = pApplication->OnDetectBegin(args.fCached, args.registrationType, args.cPackages, &results.fCancel);
1639 }
1640
1641 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, &args, &results, &hr);
1642 BalExitOnFailure(hr, "BA OnDetectBegin failed.");
1643
1644 // Write results.
1645 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1646 ExitOnFailure(hr, "Failed to write size of OnDetectBegin struct.");
1647
1648 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1649 ExitOnFailure(hr, "Failed to write cancel of OnDetectBegin struct.");
1650
1651LExit:
1652 return hr;
1653}
1654
1655static HRESULT OnDetectCompatibleMsiPackage(
1656 __in IBootstrapperApplication* pApplication,
1657 __in BUFF_READER* pReaderArgs,
1658 __in BUFF_READER* pReaderResults,
1659 __in BUFF_BUFFER* pBuffer
1660 )
1661{
1662 HRESULT hr = S_OK;
1663 BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS args = { };
1664 BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS results = { };
1665 LPWSTR sczPackageId = NULL;
1666 LPWSTR sczCompatiblePackageId = NULL;
1667 LPWSTR sczCompatiblePackageVersion = NULL;
1668
1669 // Read args.
1670 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1671 ExitOnFailure(hr, "Failed to read API version of OnDetectCompatibleMsiPackage args.");
1672
1673 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
1674 ExitOnFailure(hr, "Failed to read package id of OnDetectCompatibleMsiPackage args.");
1675
1676 args.wzPackageId = sczPackageId;
1677
1678 hr = BuffReaderReadString(pReaderArgs, &sczCompatiblePackageId);
1679 ExitOnFailure(hr, "Failed to read compatible package id of OnDetectCompatibleMsiPackage args.");
1680
1681 args.wzCompatiblePackageId = sczCompatiblePackageId;
1682
1683 hr = BuffReaderReadString(pReaderArgs, &sczCompatiblePackageVersion);
1684 ExitOnFailure(hr, "Failed to read compatible package version of OnDetectCompatibleMsiPackage args.");
1685
1686 args.wzCompatiblePackageVersion = sczCompatiblePackageVersion;
1687
1688 // Read results.
1689 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1690 ExitOnFailure(hr, "Failed to read API version of OnDetectCompatibleMsiPackage results.");
1691
1692 // Callback.
1693 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, &args, &results);
1694
1695 if (E_NOTIMPL == hr)
1696 {
1697 hr = pApplication->OnDetectCompatibleMsiPackage(args.wzPackageId, args.wzCompatiblePackageId, args.wzCompatiblePackageVersion, &results.fCancel);
1698 }
1699
1700 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, &args, &results, &hr);
1701 BalExitOnFailure(hr, "BA OnDetectCompatibleMsiPackage failed.");
1702
1703 // Write results.
1704 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1705 ExitOnFailure(hr, "Failed to write size of OnDetectCompatibleMsiPackage struct.");
1706
1707 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1708 ExitOnFailure(hr, "Failed to write cancel of OnDetectCompatibleMsiPackage struct.");
1709
1710LExit:
1711 ReleaseStr(sczCompatiblePackageVersion);
1712 ReleaseStr(sczCompatiblePackageId);
1713 ReleaseStr(sczPackageId);
1714 return hr;
1715}
1716
1717static HRESULT OnDetectComplete(
1718 __in IBootstrapperApplication* pApplication,
1719 __in BUFF_READER* pReaderArgs,
1720 __in BUFF_READER* pReaderResults,
1721 __in BUFF_BUFFER* pBuffer
1722 )
1723{
1724 HRESULT hr = S_OK;
1725 BA_ONDETECTCOMPLETE_ARGS args = { };
1726 BA_ONDETECTCOMPLETE_RESULTS results = { };
1727
1728 // Read args.
1729 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1730 ExitOnFailure(hr, "Failed to read API version of OnDetectComplete args.");
1731
1732 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
1733 ExitOnFailure(hr, "Failed to read status of OnDetectComplete args.");
1734
1735 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fEligibleForCleanup));
1736 ExitOnFailure(hr, "Failed to read eligible for cleanup of OnDetectComplete args.");
1737
1738 // Read results.
1739 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1740 ExitOnFailure(hr, "Failed to read API version of OnDetectComplete results.");
1741
1742 // Callback.
1743 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, &args, &results);
1744
1745 if (E_NOTIMPL == hr)
1746 {
1747 hr = pApplication->OnDetectComplete(args.hrStatus, args.fEligibleForCleanup);
1748 }
1749
1750 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, &args, &results, &hr);
1751 BalExitOnFailure(hr, "BA OnDetectComplete failed.");
1752
1753 // Write results.
1754 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1755 ExitOnFailure(hr, "Failed to write size of OnDetectComplete struct.");
1756
1757LExit:
1758 return hr;
1759}
1760
1761static HRESULT OnDetectForwardCompatibleBundle(
1762 __in IBootstrapperApplication* pApplication,
1763 __in BUFF_READER* pReaderArgs,
1764 __in BUFF_READER* pReaderResults,
1765 __in BUFF_BUFFER* pBuffer
1766 )
1767{
1768 HRESULT hr = S_OK;
1769 BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS args = { };
1770 BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS results = { };
1771 LPWSTR sczBundleId = NULL;
1772 LPWSTR sczBundleTag = NULL;
1773 LPWSTR sczVersion = NULL;
1774
1775 // Read args.
1776 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1777 ExitOnFailure(hr, "Failed to read API version of OnDetectForwardCompatibleBundle args.");
1778
1779 hr = BuffReaderReadString(pReaderArgs, &sczBundleId);
1780 ExitOnFailure(hr, "Failed to read bundle id of OnDetectForwardCompatibleBundle args.");
1781
1782 args.wzBundleId = sczBundleId;
1783
1784 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.relationType));
1785 ExitOnFailure(hr, "Failed to read relation type of OnDetectForwardCompatibleBundle args.");
1786
1787 hr = BuffReaderReadString(pReaderArgs, &sczBundleTag);
1788 ExitOnFailure(hr, "Failed to read bundle tag of OnDetectForwardCompatibleBundle args.");
1789
1790 args.wzBundleTag = sczBundleTag;
1791
1792 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fPerMachine));
1793 ExitOnFailure(hr, "Failed to read per-machine of OnDetectForwardCompatibleBundle args.");
1794
1795 hr = BuffReaderReadString(pReaderArgs, &sczVersion);
1796 ExitOnFailure(hr, "Failed to read version of OnDetectForwardCompatibleBundle args.");
1797
1798 args.wzVersion = sczVersion;
1799
1800 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fMissingFromCache));
1801 ExitOnFailure(hr, "Failed to read missing from cache of OnDetectForwardCompatibleBundle args.");
1802
1803 // Read results.
1804 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1805 ExitOnFailure(hr, "Failed to read API version of OnDetectForwardCompatibleBundle results.");
1806
1807 // Callback.
1808 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &args, &results);
1809
1810 if (E_NOTIMPL == hr)
1811 {
1812 hr = pApplication->OnDetectForwardCompatibleBundle(args.wzBundleId, args.relationType, args.wzBundleTag, args.fPerMachine, args.wzVersion, args.fMissingFromCache, &results.fCancel);
1813 }
1814
1815 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &args, &results, &hr);
1816 BalExitOnFailure(hr, "BA OnDetectForwardCompatibleBundle failed.");
1817
1818 // Write results.
1819 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1820 ExitOnFailure(hr, "Failed to write size of OnDetectForwardCompatibleBundle struct.");
1821
1822 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1823 ExitOnFailure(hr, "Failed to write cancel of OnDetectForwardCompatibleBundle struct.");
1824
1825LExit:
1826 ReleaseStr(sczVersion);
1827 ReleaseStr(sczBundleTag);
1828 ReleaseStr(sczBundleId);
1829 return hr;
1830}
1831
1832static HRESULT OnDetectMsiFeature(
1833 __in IBootstrapperApplication* pApplication,
1834 __in BUFF_READER* pReaderArgs,
1835 __in BUFF_READER* pReaderResults,
1836 __in BUFF_BUFFER* pBuffer
1837 )
1838{
1839 HRESULT hr = S_OK;
1840 BA_ONDETECTMSIFEATURE_ARGS args = { };
1841 BA_ONDETECTMSIFEATURE_RESULTS results = { };
1842 LPWSTR sczPackageId = NULL;
1843 LPWSTR sczFeatureId = NULL;
1844
1845 // Read args.
1846 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1847 ExitOnFailure(hr, "Failed to read API version of OnDetectMsiFeature args.");
1848
1849 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
1850 ExitOnFailure(hr, "Failed to read package id of OnDetectMsiFeature args.");
1851
1852 args.wzPackageId = sczPackageId;
1853
1854 hr = BuffReaderReadString(pReaderArgs, &sczFeatureId);
1855 ExitOnFailure(hr, "Failed to read feature id of OnDetectMsiFeature args.");
1856
1857 args.wzFeatureId = sczFeatureId;
1858
1859 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.state));
1860 ExitOnFailure(hr, "Failed to read state of OnDetectMsiFeature args.");
1861
1862 // Read results.
1863 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1864 ExitOnFailure(hr, "Failed to read API version of OnDetectMsiFeature results.");
1865
1866 // Callback.
1867 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, &args, &results);
1868
1869 if (E_NOTIMPL == hr)
1870 {
1871 hr = pApplication->OnDetectMsiFeature(args.wzPackageId, args.wzFeatureId, args.state, &results.fCancel);
1872 }
1873
1874 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, &args, &results, &hr);
1875 BalExitOnFailure(hr, "BA OnDetectMsiFeature failed.");
1876
1877 // Write results.
1878 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1879 ExitOnFailure(hr, "Failed to write size of OnDetectMsiFeature struct.");
1880
1881 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1882 ExitOnFailure(hr, "Failed to write cancel of OnDetectMsiFeature struct.");
1883
1884LExit:
1885 ReleaseStr(sczFeatureId);
1886 ReleaseStr(sczPackageId);
1887 return hr;
1888}
1889
1890static HRESULT OnDetectPackageBegin(
1891 __in IBootstrapperApplication* pApplication,
1892 __in BUFF_READER* pReaderArgs,
1893 __in BUFF_READER* pReaderResults,
1894 __in BUFF_BUFFER* pBuffer
1895 )
1896{
1897 HRESULT hr = S_OK;
1898 BA_ONDETECTPACKAGEBEGIN_ARGS args = { };
1899 BA_ONDETECTPACKAGEBEGIN_RESULTS results = { };
1900 LPWSTR sczPackageId = NULL;
1901
1902 // Read args.
1903 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1904 ExitOnFailure(hr, "Failed to read API version of OnDetectPackageBegin args.");
1905
1906 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
1907 ExitOnFailure(hr, "Failed to read package id of OnDetectPackageBegin args.");
1908
1909 args.wzPackageId = sczPackageId;
1910
1911 // Read results.
1912 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1913 ExitOnFailure(hr, "Failed to read API version of OnDetectPackageBegin results.");
1914
1915 // Callback.
1916 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, &args, &results);
1917
1918 if (E_NOTIMPL == hr)
1919 {
1920 hr = pApplication->OnDetectPackageBegin(args.wzPackageId, &results.fCancel);
1921 }
1922
1923 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, &args, &results, &hr);
1924 BalExitOnFailure(hr, "BA OnDetectPackageBegin failed.");
1925
1926 // Write results.
1927 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1928 ExitOnFailure(hr, "Failed to write size of OnDetectPackageBegin struct.");
1929
1930 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
1931 ExitOnFailure(hr, "Failed to write cancel of OnDetectPackageBegin struct.");
1932
1933LExit:
1934 ReleaseStr(sczPackageId);
1935 return hr;
1936}
1937
1938static HRESULT OnDetectPackageComplete(
1939 __in IBootstrapperApplication* pApplication,
1940 __in BUFF_READER* pReaderArgs,
1941 __in BUFF_READER* pReaderResults,
1942 __in BUFF_BUFFER* pBuffer
1943 )
1944{
1945 HRESULT hr = S_OK;
1946 BA_ONDETECTPACKAGECOMPLETE_ARGS args = { };
1947 BA_ONDETECTPACKAGECOMPLETE_RESULTS results = { };
1948 LPWSTR sczPackageId = NULL;
1949
1950 // Read args.
1951 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
1952 ExitOnFailure(hr, "Failed to read API version of OnDetectPackageComplete args.");
1953
1954 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
1955 ExitOnFailure(hr, "Failed to read package id of OnDetectPackageComplete args.");
1956
1957 args.wzPackageId = sczPackageId;
1958
1959 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
1960 ExitOnFailure(hr, "Failed to read status of OnDetectPackageComplete args.");
1961
1962 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.state));
1963 ExitOnFailure(hr, "Failed to read state of OnDetectPackageComplete args.");
1964
1965 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fCached));
1966 ExitOnFailure(hr, "Failed to read cached of OnDetectPackageComplete args.");
1967
1968 // Read results.
1969 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
1970 ExitOnFailure(hr, "Failed to read API version of OnDetectPackageComplete results.");
1971
1972 // Callback.
1973 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, &args, &results);
1974
1975 if (E_NOTIMPL == hr)
1976 {
1977 hr = pApplication->OnDetectPackageComplete(args.wzPackageId, args.hrStatus, args.state, args.fCached);
1978 }
1979
1980 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, &args, &results, &hr);
1981 BalExitOnFailure(hr, "BA OnDetectPackageComplete failed.");
1982
1983 // Write results.
1984 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
1985 ExitOnFailure(hr, "Failed to write size of OnDetectPackageComplete struct.");
1986
1987LExit:
1988 ReleaseStr(sczPackageId);
1989 return hr;
1990}
1991
1992static HRESULT OnDetectRelatedBundle(
1993 __in IBootstrapperApplication* pApplication,
1994 __in BUFF_READER* pReaderArgs,
1995 __in BUFF_READER* pReaderResults,
1996 __in BUFF_BUFFER* pBuffer
1997 )
1998{
1999 HRESULT hr = S_OK;
2000 BA_ONDETECTRELATEDBUNDLE_ARGS args = { };
2001 BA_ONDETECTRELATEDBUNDLE_RESULTS results = { };
2002 LPWSTR sczBundleId = NULL;
2003 LPWSTR sczBundleTag = NULL;
2004 LPWSTR sczVersion = NULL;
2005
2006 // Read args.
2007 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2008 ExitOnFailure(hr, "Failed to read API version of OnDetectRelatedBundle args.");
2009
2010 hr = BuffReaderReadString(pReaderArgs, &sczBundleId);
2011 ExitOnFailure(hr, "Failed to read bundle id of OnDetectRelatedBundle args.");
2012
2013 args.wzBundleId = sczBundleId;
2014
2015 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.relationType));
2016 ExitOnFailure(hr, "Failed to read relation type of OnDetectRelatedBundle args.");
2017
2018 hr = BuffReaderReadString(pReaderArgs, &sczBundleTag);
2019 ExitOnFailure(hr, "Failed to read bundle tag of OnDetectRelatedBundle args.");
2020
2021 args.wzBundleTag = sczBundleTag;
2022
2023 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fPerMachine));
2024 ExitOnFailure(hr, "Failed to read per-machine of OnDetectRelatedBundle args.");
2025
2026 hr = BuffReaderReadString(pReaderArgs, &sczVersion);
2027 ExitOnFailure(hr, "Failed to read version of OnDetectRelatedBundle args.");
2028
2029 args.wzVersion = sczVersion;
2030
2031 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fMissingFromCache));
2032 ExitOnFailure(hr, "Failed to read missing from cache of OnDetectRelatedBundle args.");
2033
2034 // Read results.
2035 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2036 ExitOnFailure(hr, "Failed to read API version of OnDetectRelatedBundle results.");
2037
2038 // Callback.
2039 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, &args, &results);
2040
2041 if (E_NOTIMPL == hr)
2042 {
2043 hr = pApplication->OnDetectRelatedBundle(args.wzBundleId, args.relationType, args.wzBundleTag, args.fPerMachine, args.wzVersion, args.fMissingFromCache, &results.fCancel);
2044 }
2045
2046 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, &args, &results, &hr);
2047 BalExitOnFailure(hr, "BA OnDetectRelatedBundle failed.");
2048
2049 // Write results.
2050 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2051 ExitOnFailure(hr, "Failed to write size of OnDetectRelatedBundle struct.");
2052
2053 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2054 ExitOnFailure(hr, "Failed to write cancel of OnDetectRelatedBundle struct.");
2055
2056LExit:
2057 ReleaseStr(sczVersion);
2058 ReleaseStr(sczBundleTag);
2059 ReleaseStr(sczBundleId);
2060 return hr;
2061}
2062
2063static HRESULT OnDetectRelatedBundlePackage(
2064 __in IBootstrapperApplication* pApplication,
2065 __in BUFF_READER* pReaderArgs,
2066 __in BUFF_READER* pReaderResults,
2067 __in BUFF_BUFFER* pBuffer
2068 )
2069{
2070 HRESULT hr = S_OK;
2071 BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS args = { };
2072 BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS results = { };
2073 LPWSTR sczPackageId = NULL;
2074 LPWSTR sczBundleId = NULL;
2075 LPWSTR sczVersion = NULL;
2076
2077 // Read args.
2078 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2079 ExitOnFailure(hr, "Failed to read API version of OnDetectRelatedBundlePackage args.");
2080
2081 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
2082 ExitOnFailure(hr, "Failed to read package id of OnDetectRelatedBundlePackage args.");
2083
2084 args.wzPackageId = sczPackageId;
2085
2086 hr = BuffReaderReadString(pReaderArgs, &sczBundleId);
2087 ExitOnFailure(hr, "Failed to read bundle id of OnDetectRelatedBundlePackage args.");
2088
2089 args.wzBundleId = sczBundleId;
2090
2091 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.relationType));
2092 ExitOnFailure(hr, "Failed to read relation type of OnDetectRelatedBundlePackage args.");
2093
2094 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fPerMachine));
2095 ExitOnFailure(hr, "Failed to read per-machine of OnDetectRelatedBundlePackage args.");
2096
2097 hr = BuffReaderReadString(pReaderArgs, &sczVersion);
2098 ExitOnFailure(hr, "Failed to read version of OnDetectRelatedBundlePackage args.");
2099
2100 args.wzVersion = sczVersion;
2101
2102 // Read results.
2103 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2104 ExitOnFailure(hr, "Failed to read API version of OnDetectRelatedBundlePackage results.");
2105
2106 // Callback.
2107 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE, &args, &results);
2108
2109 if (E_NOTIMPL == hr)
2110 {
2111 hr = pApplication->OnDetectRelatedBundlePackage(args.wzPackageId, args.wzBundleId, args.relationType, args.fPerMachine, args.wzVersion, &results.fCancel);
2112 }
2113
2114 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE, &args, &results, &hr);
2115 BalExitOnFailure(hr, "BA OnDetectRelatedBundlePackage failed.");
2116
2117 // Write results.
2118 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2119 ExitOnFailure(hr, "Failed to write size of OnDetectRelatedBundlePackage struct.");
2120
2121 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2122 ExitOnFailure(hr, "Failed to write cancel of OnDetectRelatedBundlePackage struct.");
2123
2124LExit:
2125 ReleaseStr(sczVersion);
2126 ReleaseStr(sczBundleId);
2127 ReleaseStr(sczPackageId);
2128 return hr;
2129}
2130
2131static HRESULT OnDetectRelatedMsiPackage(
2132 __in IBootstrapperApplication* pApplication,
2133 __in BUFF_READER* pReaderArgs,
2134 __in BUFF_READER* pReaderResults,
2135 __in BUFF_BUFFER* pBuffer
2136 )
2137{
2138 HRESULT hr = S_OK;
2139 BA_ONDETECTRELATEDMSIPACKAGE_ARGS args = { };
2140 BA_ONDETECTRELATEDMSIPACKAGE_RESULTS results = { };
2141 LPWSTR sczPackageId = NULL;
2142 LPWSTR sczUpgradeCode = NULL;
2143 LPWSTR sczProductCode = NULL;
2144 LPWSTR sczVersion = NULL;
2145
2146 // Read args.
2147 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2148 ExitOnFailure(hr, "Failed to read API version of OnDetectRelatedMsiPackage args.");
2149
2150 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
2151 ExitOnFailure(hr, "Failed to read package id of OnDetectRelatedMsiPackage args.");
2152
2153 args.wzPackageId = sczPackageId;
2154
2155 hr = BuffReaderReadString(pReaderArgs, &sczUpgradeCode);
2156 ExitOnFailure(hr, "Failed to read upgrade code of OnDetectRelatedMsiPackage args.");
2157
2158 args.wzUpgradeCode = sczUpgradeCode;
2159
2160 hr = BuffReaderReadString(pReaderArgs, &sczProductCode);
2161 ExitOnFailure(hr, "Failed to read product code of OnDetectRelatedMsiPackage args.");
2162
2163 args.wzProductCode = sczProductCode;
2164
2165 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fPerMachine));
2166 ExitOnFailure(hr, "Failed to read per-machine of OnDetectRelatedMsiPackage args.");
2167
2168 hr = BuffReaderReadString(pReaderArgs, &sczVersion);
2169 ExitOnFailure(hr, "Failed to read version of OnDetectRelatedMsiPackage args.");
2170
2171 args.wzVersion = sczVersion;
2172
2173 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.operation));
2174 ExitOnFailure(hr, "Failed to read per-machine of OnDetectRelatedMsiPackage args.");
2175
2176 // Read results.
2177 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2178 ExitOnFailure(hr, "Failed to read API version of OnDetectRelatedMsiPackage results.");
2179
2180 // Callback.
2181 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, &args, &results);
2182
2183 if (E_NOTIMPL == hr)
2184 {
2185 hr = pApplication->OnDetectRelatedMsiPackage(args.wzPackageId, args.wzUpgradeCode, args.wzProductCode, args.fPerMachine, args.wzVersion, args.operation, &results.fCancel);
2186 }
2187
2188 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, &args, &results, &hr);
2189 BalExitOnFailure(hr, "BA OnDetectRelatedMsiPackage failed.");
2190
2191 // Write results.
2192 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2193 ExitOnFailure(hr, "Failed to write size of OnDetectRelatedMsiPackage struct.");
2194
2195 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2196 ExitOnFailure(hr, "Failed to write cancel of OnDetectRelatedMsiPackage struct.");
2197
2198LExit:
2199 ReleaseStr(sczVersion);
2200 ReleaseStr(sczProductCode);
2201 ReleaseStr(sczUpgradeCode);
2202 ReleaseStr(sczPackageId);
2203 return hr;
2204}
2205
2206static HRESULT OnDetectPatchTarget(
2207 __in IBootstrapperApplication* pApplication,
2208 __in BUFF_READER* pReaderArgs,
2209 __in BUFF_READER* pReaderResults,
2210 __in BUFF_BUFFER* pBuffer
2211 )
2212{
2213 HRESULT hr = S_OK;
2214 BA_ONDETECTPATCHTARGET_ARGS args = { };
2215 BA_ONDETECTPATCHTARGET_RESULTS results = { };
2216 LPWSTR sczPackageId = NULL;
2217 LPWSTR sczProductCode = NULL;
2218
2219 // Read args.
2220 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2221 ExitOnFailure(hr, "Failed to read API version of OnDetectPatchTarget args.");
2222
2223 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
2224 ExitOnFailure(hr, "Failed to read package id of OnDetectPatchTarget args.");
2225
2226 args.wzPackageId = sczPackageId;
2227
2228 hr = BuffReaderReadString(pReaderArgs, &sczProductCode);
2229 ExitOnFailure(hr, "Failed to read product code of OnDetectPatchTarget args.");
2230
2231 args.wzProductCode = sczProductCode;
2232
2233 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.patchState));
2234 ExitOnFailure(hr, "Failed to read patch state of OnDetectPatchTarget args.");
2235
2236 // Read results.
2237 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2238 ExitOnFailure(hr, "Failed to read API version of OnDetectPatchTarget results.");
2239
2240 // Callback.
2241 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET, &args, &results);
2242
2243 if (E_NOTIMPL == hr)
2244 {
2245 hr = pApplication->OnDetectPatchTarget(args.wzPackageId, args.wzProductCode, args.patchState, &results.fCancel);
2246 }
2247
2248 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET, &args, &results, &hr);
2249 BalExitOnFailure(hr, "BA OnDetectPatchTarget failed.");
2250
2251 // Write results.
2252 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2253 ExitOnFailure(hr, "Failed to write size of OnDetectPatchTarget struct.");
2254
2255 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2256 ExitOnFailure(hr, "Failed to write cancel of OnDetectPatchTarget struct.");
2257
2258LExit:
2259 ReleaseStr(sczProductCode);
2260 ReleaseStr(sczPackageId);
2261 return hr;
2262}
2263
2264static HRESULT OnDetectUpdate(
2265 __in IBootstrapperApplication* pApplication,
2266 __in BUFF_READER* pReaderArgs,
2267 __in BUFF_READER* pReaderResults,
2268 __in BUFF_BUFFER* pBuffer
2269 )
2270{
2271 HRESULT hr = S_OK;
2272 BA_ONDETECTUPDATE_ARGS args = { };
2273 BA_ONDETECTUPDATE_RESULTS results = { };
2274 LPWSTR sczUpdateLocation = NULL;
2275 LPWSTR sczHash = NULL;
2276 LPWSTR sczVersion = NULL;
2277 LPWSTR sczTitle = NULL;
2278 LPWSTR sczSummary = NULL;
2279 LPWSTR sczContentType = NULL;
2280 LPWSTR sczContent = NULL;
2281
2282 // Read args.
2283 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2284 ExitOnFailure(hr, "Failed to read API version of OnDetectUpdate args.");
2285
2286 hr = BuffReaderReadString(pReaderArgs, &sczUpdateLocation);
2287 ExitOnFailure(hr, "Failed to read update location of OnDetectUpdate args.");
2288
2289 args.wzUpdateLocation = sczUpdateLocation;
2290
2291 hr = BuffReaderReadNumber64(pReaderArgs, &args.dw64Size);
2292 ExitOnFailure(hr, "Failed to read update size of OnDetectUpdate args.");
2293
2294 hr = BuffReaderReadString(pReaderArgs, &sczHash);
2295 ExitOnFailure(hr, "Failed to read hash of OnDetectUpdate args.");
2296
2297 args.wzHash = sczHash;
2298
2299 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hashAlgorithm));
2300 ExitOnFailure(hr, "Failed to read hash algorithm of OnDetectUpdate args.");
2301
2302 hr = BuffReaderReadString(pReaderArgs, &sczVersion);
2303 ExitOnFailure(hr, "Failed to read version of OnDetectUpdate args.");
2304
2305 args.wzVersion = sczVersion;
2306
2307 hr = BuffReaderReadString(pReaderArgs, &sczTitle);
2308 ExitOnFailure(hr, "Failed to read title of OnDetectUpdate args.");
2309
2310 args.wzTitle = sczTitle;
2311
2312 hr = BuffReaderReadString(pReaderArgs, &sczSummary);
2313 ExitOnFailure(hr, "Failed to read summary of OnDetectUpdate args.");
2314
2315 args.wzSummary = sczSummary;
2316
2317 hr = BuffReaderReadString(pReaderArgs, &sczContentType);
2318 ExitOnFailure(hr, "Failed to read content type of OnDetectUpdate args.");
2319
2320 args.wzContentType = sczContentType;
2321
2322 hr = BuffReaderReadString(pReaderArgs, &sczContent);
2323 ExitOnFailure(hr, "Failed to read content of OnDetectUpdate args.");
2324
2325 args.wzContent = sczContent;
2326
2327 // Read results.
2328 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2329 ExitOnFailure(hr, "Failed to read API version of OnDetectUpdate results.");
2330
2331 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.fStopProcessingUpdates));
2332 ExitOnFailure(hr, "Failed to read stop processing updates of OnDetectUpdate results.");
2333
2334 // Callback.
2335 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, &args, &results);
2336
2337 if (E_NOTIMPL == hr)
2338 {
2339 hr = pApplication->OnDetectUpdate(args.wzUpdateLocation, args.dw64Size, args.wzHash, args.hashAlgorithm, args.wzVersion, args.wzTitle, args.wzSummary, args.wzContentType, args.wzContent, &results.fCancel, &results.fStopProcessingUpdates);
2340 }
2341
2342 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, &args, &results, &hr);
2343 BalExitOnFailure(hr, "BA OnDetectUpdate failed.");
2344
2345 // Write results.
2346 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2347 ExitOnFailure(hr, "Failed to write size of OnDetectUpdate struct.");
2348
2349 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2350 ExitOnFailure(hr, "Failed to write cancel of OnDetectUpdate struct.");
2351
2352 hr = BuffWriteNumberToBuffer(pBuffer, results.fStopProcessingUpdates);
2353 ExitOnFailure(hr, "Failed to write stop processing updates of OnDetectUpdate struct.");
2354
2355LExit:
2356 ReleaseStr(sczContent);
2357 ReleaseStr(sczContentType);
2358 ReleaseStr(sczSummary);
2359 ReleaseStr(sczTitle);
2360 ReleaseStr(sczVersion);
2361 ReleaseStr(sczHash);
2362 ReleaseStr(sczUpdateLocation);
2363 return hr;
2364}
2365
2366static HRESULT OnDetectUpdateBegin(
2367 __in IBootstrapperApplication* pApplication,
2368 __in BUFF_READER* pReaderArgs,
2369 __in BUFF_READER* pReaderResults,
2370 __in BUFF_BUFFER* pBuffer
2371 )
2372{
2373 HRESULT hr = S_OK;
2374 BA_ONDETECTUPDATEBEGIN_ARGS args = { };
2375 BA_ONDETECTUPDATEBEGIN_RESULTS results = { };
2376 LPWSTR sczUpdateLocation = NULL;
2377
2378 // Read args.
2379 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2380 ExitOnFailure(hr, "Failed to read API version of OnDetectUpdateBegin args.");
2381
2382 hr = BuffReaderReadString(pReaderArgs, &sczUpdateLocation);
2383 ExitOnFailure(hr, "Failed to read update location of OnDetectUpdateBegin args.");
2384
2385 args.wzUpdateLocation = sczUpdateLocation;
2386
2387 // Read results.
2388 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2389 ExitOnFailure(hr, "Failed to read API version of OnDetectUpdateBegin results.");
2390
2391 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.fSkip));
2392 ExitOnFailure(hr, "Failed to read skip of OnDetectUpdateBegin results.");
2393
2394 // Callback.
2395 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, &args, &results);
2396
2397 if (E_NOTIMPL == hr)
2398 {
2399 hr = pApplication->OnDetectUpdateBegin(args.wzUpdateLocation, &results.fCancel, &results.fSkip);
2400 }
2401
2402 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, &args, &results, &hr);
2403 BalExitOnFailure(hr, "BA OnDetectUpdateBegin failed.");
2404
2405 // Write results.
2406 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2407 ExitOnFailure(hr, "Failed to write size of OnDetectUpdateBegin struct.");
2408
2409 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2410 ExitOnFailure(hr, "Failed to write cancel of OnDetectUpdateBegin struct.");
2411
2412 hr = BuffWriteNumberToBuffer(pBuffer, results.fSkip);
2413 ExitOnFailure(hr, "Failed to write skip processing updates of OnDetectUpdateBegin struct.");
2414
2415LExit:
2416 ReleaseStr(sczUpdateLocation);
2417 return hr;
2418}
2419
2420
2421static HRESULT OnDetectUpdateComplete(
2422 __in IBootstrapperApplication* pApplication,
2423 __in BUFF_READER* pReaderArgs,
2424 __in BUFF_READER* pReaderResults,
2425 __in BUFF_BUFFER* pBuffer
2426 )
2427{
2428 HRESULT hr = S_OK;
2429 BA_ONDETECTUPDATECOMPLETE_ARGS args = { };
2430 BA_ONDETECTUPDATECOMPLETE_RESULTS results = { };
2431 LPWSTR sczUpdateLocation = NULL;
2432
2433 // Read args.
2434 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2435 ExitOnFailure(hr, "Failed to read API version of OnDetectUpdateComplete args.");
2436
2437 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
2438 ExitOnFailure(hr, "Failed to read status of OnDetectUpdateComplete args.");
2439
2440 // Read results.
2441 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2442 ExitOnFailure(hr, "Failed to read API version of OnDetectUpdateComplete results.");
2443
2444 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.fIgnoreError));
2445 ExitOnFailure(hr, "Failed to read ignore error of OnDetectUpdateComplete results.");
2446
2447 // Callback.
2448 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, &args, &results);
2449
2450 if (E_NOTIMPL == hr)
2451 {
2452 hr = pApplication->OnDetectUpdateComplete(args.hrStatus, &results.fIgnoreError);
2453 }
2454
2455 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, &args, &results, &hr);
2456 BalExitOnFailure(hr, "BA OnDetectUpdateComplete failed.");
2457
2458 // Write results.
2459 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2460 ExitOnFailure(hr, "Failed to write size of OnDetectUpdateComplete struct.");
2461
2462 hr = BuffWriteNumberToBuffer(pBuffer, results.fIgnoreError);
2463 ExitOnFailure(hr, "Failed to write ignore error of OnDetectUpdateComplete struct.");
2464
2465LExit:
2466 ReleaseStr(sczUpdateLocation);
2467 return hr;
2468}
2469
2470static HRESULT OnElevateBegin(
2471 __in IBootstrapperApplication* pApplication,
2472 __in BUFF_READER* pReaderArgs,
2473 __in BUFF_READER* pReaderResults,
2474 __in BUFF_BUFFER* pBuffer
2475 )
2476{
2477 HRESULT hr = S_OK;
2478 BA_ONELEVATEBEGIN_ARGS args = { };
2479 BA_ONELEVATEBEGIN_RESULTS results = { };
2480
2481 // Read args.
2482 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2483 ExitOnFailure(hr, "Failed to read API version of OnElevateBegin args.");
2484
2485 // Read results.
2486 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2487 ExitOnFailure(hr, "Failed to read API version of OnElevateBegin results.");
2488
2489 // Callback.
2490 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, &args, &results);
2491
2492 if (E_NOTIMPL == hr)
2493 {
2494 hr = pApplication->OnElevateBegin(&results.fCancel);
2495 }
2496
2497 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, &args, &results, &hr);
2498 BalExitOnFailure(hr, "BA OnElevateBegin failed.");
2499
2500 // Write results.
2501 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2502 ExitOnFailure(hr, "Failed to write size of OnElevateBegin struct.");
2503
2504 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2505 ExitOnFailure(hr, "Failed to write cancel of OnElevateBegin struct.");
2506
2507LExit:
2508 return hr;
2509}
2510
2511static HRESULT OnElevateComplete(
2512 __in IBootstrapperApplication* pApplication,
2513 __in BUFF_READER* pReaderArgs,
2514 __in BUFF_READER* pReaderResults,
2515 __in BUFF_BUFFER* pBuffer
2516 )
2517{
2518 HRESULT hr = S_OK;
2519 BA_ONELEVATECOMPLETE_ARGS args = { };
2520 BA_ONELEVATECOMPLETE_RESULTS results = { };
2521
2522 // Read args.
2523 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2524 ExitOnFailure(hr, "Failed to read API version of OnElevateComplete args.");
2525
2526 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
2527 ExitOnFailure(hr, "Failed to read status of OnElevateComplete args.");
2528
2529 // Read results.
2530 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2531 ExitOnFailure(hr, "Failed to read API version of OnElevateComplete results.");
2532
2533 // Callback.
2534 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, &args, &results);
2535
2536 if (E_NOTIMPL == hr)
2537 {
2538 hr = pApplication->OnElevateComplete(args.hrStatus);
2539 }
2540
2541 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, &args, &results, &hr);
2542 BalExitOnFailure(hr, "BA OnElevateComplete failed.");
2543
2544 // Write results.
2545 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2546 ExitOnFailure(hr, "Failed to write size of OnElevateComplete struct.");
2547
2548LExit:
2549 return hr;
2550}
2551
2552static HRESULT OnError(
2553 __in IBootstrapperApplication* pApplication,
2554 __in BUFF_READER* pReaderArgs,
2555 __in BUFF_READER* pReaderResults,
2556 __in BUFF_BUFFER* pBuffer
2557 )
2558{
2559 HRESULT hr = S_OK;
2560 BA_ONERROR_ARGS args = { };
2561 BA_ONERROR_RESULTS results = { };
2562 LPWSTR sczPackageId = NULL;
2563 LPWSTR sczError = NULL;
2564 DWORD cData = 0;
2565 LPWSTR* rgsczData = NULL;
2566
2567 // Read args.
2568 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2569 ExitOnFailure(hr, "Failed to read API version of OnError args.");
2570
2571 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.errorType));
2572 ExitOnFailure(hr, "Failed to read error type of OnError args.");
2573
2574 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
2575 ExitOnFailure(hr, "Failed to read package id of OnError args.");
2576
2577 args.wzPackageId = sczPackageId;
2578
2579 hr = BuffReaderReadNumber(pReaderArgs, &args.dwCode);
2580 ExitOnFailure(hr, "Failed to read code of OnError args.");
2581
2582 hr = BuffReaderReadString(pReaderArgs, &sczError);
2583 ExitOnFailure(hr, "Failed to read error of OnError args.");
2584
2585 args.wzError = sczError;
2586
2587 hr = BuffReaderReadNumber(pReaderArgs, &args.dwUIHint);
2588 ExitOnFailure(hr, "Failed to read UI hint of OnError args.");
2589
2590 hr = BuffReaderReadNumber(pReaderArgs, &cData);
2591 ExitOnFailure(hr, "Failed to read count of data of OnError args.");
2592
2593 if (cData)
2594 {
2595 rgsczData = static_cast<LPWSTR*>(MemAlloc(sizeof(LPWSTR) * cData, TRUE));
2596 ExitOnNull(rgsczData, hr, E_OUTOFMEMORY, "Failed to allocate memory for data of OnError args.");
2597
2598 for (DWORD i = 0; i < cData; ++i)
2599 {
2600 hr = BuffReaderReadString(pReaderArgs, &rgsczData[i]);
2601 ExitOnFailure(hr, "Failed to read search path[%u] of OnError args.", i);
2602 }
2603 }
2604
2605 args.cData = cData;
2606 args.rgwzData = const_cast<LPCWSTR*>(rgsczData);
2607
2608 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.nRecommendation));
2609 ExitOnFailure(hr, "Failed to read recommendation of OnError args.");
2610
2611 // Read results.
2612 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2613 ExitOnFailure(hr, "Failed to read API version of OnError results.");
2614
2615 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.nResult));
2616 ExitOnFailure(hr, "Failed to read cancel of OnError results.");
2617
2618 // Callback.
2619 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, &args, &results);
2620
2621 if (E_NOTIMPL == hr)
2622 {
2623 hr = pApplication->OnError(args.errorType, args.wzPackageId, args.dwCode, args.wzError, args.dwUIHint, args.cData, args.rgwzData, args.nRecommendation, &results.nResult);
2624 }
2625
2626 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, &args, &results, &hr);
2627 BalExitOnFailure(hr, "BA OnError failed.");
2628
2629 // Write results.
2630 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2631 ExitOnFailure(hr, "Failed to write size of OnError struct.");
2632
2633 hr = BuffWriteNumberToBuffer(pBuffer, results.nResult);
2634 ExitOnFailure(hr, "Failed to write result of OnError struct.");
2635
2636LExit:
2637 for (DWORD i = 0; rgsczData && i < cData; ++i)
2638 {
2639 ReleaseStr(rgsczData[i]);
2640 }
2641 ReleaseMem(rgsczData);
2642
2643 ReleaseStr(sczError);
2644 ReleaseStr(sczPackageId);
2645 return hr;
2646}
2647
2648static HRESULT OnExecuteBegin(
2649 __in IBootstrapperApplication* pApplication,
2650 __in BUFF_READER* pReaderArgs,
2651 __in BUFF_READER* pReaderResults,
2652 __in BUFF_BUFFER* pBuffer
2653 )
2654{
2655 HRESULT hr = S_OK;
2656 BA_ONEXECUTEBEGIN_ARGS args = { };
2657 BA_ONEXECUTEBEGIN_RESULTS results = { };
2658
2659 // Read args.
2660 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2661 ExitOnFailure(hr, "Failed to read API version of OnExecuteBegin args.");
2662
2663 hr = BuffReaderReadNumber(pReaderArgs, &args.cExecutingPackages);
2664 ExitOnFailure(hr, "Failed to executing packages of OnExecuteBegin args.");
2665
2666 // Read results.
2667 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2668 ExitOnFailure(hr, "Failed to read API version of OnExecuteBegin results.");
2669
2670 // Callback.
2671 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, &args, &results);
2672
2673 if (E_NOTIMPL == hr)
2674 {
2675 hr = pApplication->OnExecuteBegin(args.cExecutingPackages, &results.fCancel);
2676 }
2677
2678 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, &args, &results, &hr);
2679 BalExitOnFailure(hr, "BA OnExecuteBegin failed.");
2680
2681 // Write results.
2682 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2683 ExitOnFailure(hr, "Failed to write size of OnExecuteBegin struct.");
2684
2685 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2686 ExitOnFailure(hr, "Failed to write cancel of OnExecuteBegin struct.");
2687
2688LExit:
2689 return hr;
2690}
2691
2692
2693static HRESULT OnExecuteComplete(
2694 __in IBootstrapperApplication* pApplication,
2695 __in BUFF_READER* pReaderArgs,
2696 __in BUFF_READER* pReaderResults,
2697 __in BUFF_BUFFER* pBuffer
2698 )
2699{
2700 HRESULT hr = S_OK;
2701 BA_ONEXECUTECOMPLETE_ARGS args = { };
2702 BA_ONEXECUTECOMPLETE_RESULTS results = { };
2703
2704 // Read args.
2705 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2706 ExitOnFailure(hr, "Failed to read API version of OnExecuteComplete args.");
2707
2708 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
2709 ExitOnFailure(hr, "Failed to status of OnExecuteComplete args.");
2710
2711 // Read results.
2712 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2713 ExitOnFailure(hr, "Failed to read API version of OnExecuteComplete results.");
2714
2715 // Callback.
2716 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, &args, &results);
2717
2718 if (E_NOTIMPL == hr)
2719 {
2720 hr = pApplication->OnExecuteComplete(args.hrStatus);
2721 }
2722
2723 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, &args, &results, &hr);
2724 BalExitOnFailure(hr, "BA OnExecuteComplete failed.");
2725
2726 // Write results.
2727 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2728 ExitOnFailure(hr, "Failed to write size of OnExecuteComplete struct.");
2729
2730LExit:
2731 return hr;
2732}
2733
2734static HRESULT OnExecuteFilesInUse(
2735 __in IBootstrapperApplication* pApplication,
2736 __in BUFF_READER* pReaderArgs,
2737 __in BUFF_READER* pReaderResults,
2738 __in BUFF_BUFFER* pBuffer
2739 )
2740{
2741 HRESULT hr = S_OK;
2742 BA_ONEXECUTEFILESINUSE_ARGS args = { };
2743 BA_ONEXECUTEFILESINUSE_RESULTS results = { };
2744 LPWSTR sczPackageId = NULL;
2745 DWORD cFiles = 0;
2746 LPWSTR* rgsczFiles = NULL;
2747
2748 // Read args.
2749 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2750 ExitOnFailure(hr, "Failed to read API version of OnExecuteFilesInUse args.");
2751
2752 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
2753 ExitOnFailure(hr, "Failed to read package id of OnExecuteFilesInUse args.");
2754
2755 args.wzPackageId = sczPackageId;
2756
2757 hr = BuffReaderReadNumber(pReaderArgs, &cFiles);
2758 ExitOnFailure(hr, "Failed to read count of files of OnExecuteFilesInUse args.");
2759
2760 if (cFiles)
2761 {
2762 rgsczFiles = static_cast<LPWSTR*>(MemAlloc(sizeof(LPWSTR) * cFiles, TRUE));
2763 ExitOnNull(rgsczFiles, hr, E_OUTOFMEMORY, "Failed to allocate memory for files of OnExecuteFilesInUse args.");
2764
2765 for (DWORD i = 0; i < cFiles; ++i)
2766 {
2767 hr = BuffReaderReadString(pReaderArgs, &rgsczFiles[i]);
2768 ExitOnFailure(hr, "Failed to read file[%u] of OnExecuteFilesInUse args.", i);
2769 }
2770 }
2771
2772 args.cFiles = cFiles;
2773 args.rgwzFiles = const_cast<LPCWSTR*>(rgsczFiles);
2774
2775 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.nRecommendation));
2776 ExitOnFailure(hr, "Failed to read recommendation of OnExecuteFilesInUse args.");
2777
2778 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.source));
2779 ExitOnFailure(hr, "Failed to read source of OnExecuteFilesInUse args.");
2780
2781 // Read results.
2782 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2783 ExitOnFailure(hr, "Failed to read API version of OnExecuteFilesInUse results.");
2784
2785 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.nResult));
2786 ExitOnFailure(hr, "Failed to read result of OnExecuteFilesInUse results.");
2787
2788 // Callback.
2789 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, &args, &results);
2790
2791 if (E_NOTIMPL == hr)
2792 {
2793 hr = pApplication->OnExecuteFilesInUse(args.wzPackageId, args.cFiles, args.rgwzFiles, args.nRecommendation, args.source, &results.nResult);
2794 }
2795
2796 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, &args, &results, &hr);
2797 BalExitOnFailure(hr, "BA OnExecuteFilesInUse failed.");
2798
2799 // Write results.
2800 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2801 ExitOnFailure(hr, "Failed to write size of OnExecuteFilesInUse struct.");
2802
2803 hr = BuffWriteNumberToBuffer(pBuffer, results.nResult);
2804 ExitOnFailure(hr, "Failed to write result of OnExecuteFilesInUse struct.");
2805
2806LExit:
2807 for (DWORD i = 0; rgsczFiles && i < cFiles; ++i)
2808 {
2809 ReleaseStr(rgsczFiles[i]);
2810 }
2811 ReleaseMem(rgsczFiles);
2812
2813 ReleaseStr(sczPackageId);
2814 return hr;
2815}
2816
2817static HRESULT OnExecuteMsiMessage(
2818 __in IBootstrapperApplication* pApplication,
2819 __in BUFF_READER* pReaderArgs,
2820 __in BUFF_READER* pReaderResults,
2821 __in BUFF_BUFFER* pBuffer
2822 )
2823{
2824 HRESULT hr = S_OK;
2825 BA_ONEXECUTEMSIMESSAGE_ARGS args = { };
2826 BA_ONEXECUTEMSIMESSAGE_RESULTS results = { };
2827 LPWSTR sczPackageId = NULL;
2828 LPWSTR sczMessage = NULL;
2829 DWORD cData = 0;
2830 LPWSTR* rgsczData = NULL;
2831
2832 // Read args.
2833 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2834 ExitOnFailure(hr, "Failed to read API version of OnExecuteMsiMessage args.");
2835
2836 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
2837 ExitOnFailure(hr, "Failed to read package id of OnExecuteMsiMessage args.");
2838
2839 args.wzPackageId = sczPackageId;
2840
2841 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.messageType));
2842 ExitOnFailure(hr, "Failed to read messageType of OnExecuteMsiMessage args.");
2843
2844 hr = BuffReaderReadNumber(pReaderArgs, &args.dwUIHint);
2845 ExitOnFailure(hr, "Failed to read UI hint of OnExecuteMsiMessage args.");
2846
2847 hr = BuffReaderReadString(pReaderArgs, &sczMessage);
2848 ExitOnFailure(hr, "Failed to read message of OnExecuteMsiMessage args.");
2849
2850 args.wzMessage = sczMessage;
2851
2852 hr = BuffReaderReadNumber(pReaderArgs, &cData);
2853 ExitOnFailure(hr, "Failed to read count of files of OnExecuteMsiMessage args.");
2854
2855 if (cData)
2856 {
2857 rgsczData = static_cast<LPWSTR*>(MemAlloc(sizeof(LPWSTR) * cData, TRUE));
2858 ExitOnNull(rgsczData, hr, E_OUTOFMEMORY, "Failed to allocate memory for data of OnExecuteMsiMessage args.");
2859
2860 for (DWORD i = 0; i < cData; ++i)
2861 {
2862 hr = BuffReaderReadString(pReaderArgs, &rgsczData[i]);
2863 ExitOnFailure(hr, "Failed to read data[%u] of OnExecuteMsiMessage args.", i);
2864 }
2865 }
2866
2867 args.cData = cData;
2868 args.rgwzData = const_cast<LPCWSTR*>(rgsczData);
2869
2870 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.nRecommendation));
2871 ExitOnFailure(hr, "Failed to read recommendation of OnExecuteMsiMessage args.");
2872
2873 // Read results.
2874 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2875 ExitOnFailure(hr, "Failed to read API version of OnExecuteMsiMessage results.");
2876
2877 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.nResult));
2878 ExitOnFailure(hr, "Failed to read result of OnExecuteMsiMessage results.");
2879
2880 // Callback.
2881 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, &args, &results);
2882
2883 if (E_NOTIMPL == hr)
2884 {
2885 hr = pApplication->OnExecuteMsiMessage(args.wzPackageId, args.messageType, args.dwUIHint, args.wzMessage, args.cData, args.rgwzData, args.nRecommendation, &results.nResult);
2886 }
2887
2888 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, &args, &results, &hr);
2889 BalExitOnFailure(hr, "BA OnExecuteMsiMessage failed.");
2890
2891 // Write results.
2892 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2893 ExitOnFailure(hr, "Failed to write size of OnExecuteMsiMessage struct.");
2894
2895 hr = BuffWriteNumberToBuffer(pBuffer, results.nResult);
2896 ExitOnFailure(hr, "Failed to write result of OnExecuteMsiMessage struct.");
2897
2898LExit:
2899 for (DWORD i = 0; rgsczData && i < cData; ++i)
2900 {
2901 ReleaseStr(rgsczData[i]);
2902 }
2903 ReleaseMem(rgsczData);
2904
2905 ReleaseStr(sczMessage);
2906 ReleaseStr(sczPackageId);
2907 return hr;
2908}
2909
2910static HRESULT OnExecutePackageBegin(
2911 __in IBootstrapperApplication* pApplication,
2912 __in BUFF_READER* pReaderArgs,
2913 __in BUFF_READER* pReaderResults,
2914 __in BUFF_BUFFER* pBuffer
2915 )
2916{
2917 HRESULT hr = S_OK;
2918 BA_ONEXECUTEPACKAGEBEGIN_ARGS args = { };
2919 BA_ONEXECUTEPACKAGEBEGIN_RESULTS results = { };
2920 LPWSTR sczPackageId = NULL;
2921
2922 // Read args.
2923 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2924 ExitOnFailure(hr, "Failed to read API version of OnExecutePackageBegin args.");
2925
2926 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
2927 ExitOnFailure(hr, "Failed to read package id of OnExecutePackageBegin args.");
2928
2929 args.wzPackageId = sczPackageId;
2930
2931 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fExecute));
2932 ExitOnFailure(hr, "Failed to read execute of OnExecutePackageBegin args.");
2933
2934 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.action));
2935 ExitOnFailure(hr, "Failed to read action of OnExecutePackageBegin args.");
2936
2937 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.uiLevel));
2938 ExitOnFailure(hr, "Failed to read UI level of OnExecutePackageBegin args.");
2939
2940 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fDisableExternalUiHandler));
2941 ExitOnFailure(hr, "Failed to read disable external UI handler of OnExecutePackageBegin args.");
2942
2943 // Read results.
2944 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
2945 ExitOnFailure(hr, "Failed to read API version of OnExecutePackageBegin results.");
2946
2947 // Callback.
2948 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, &args, &results);
2949
2950 if (E_NOTIMPL == hr)
2951 {
2952 hr = pApplication->OnExecutePackageBegin(args.wzPackageId, args.fExecute, args.action, args.uiLevel, args.fDisableExternalUiHandler, &results.fCancel);
2953 }
2954
2955 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, &args, &results, &hr);
2956 BalExitOnFailure(hr, "BA OnExecutePackageBegin failed.");
2957
2958 // Write results.
2959 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
2960 ExitOnFailure(hr, "Failed to write size of OnExecutePackageBegin struct.");
2961
2962 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
2963 ExitOnFailure(hr, "Failed to write cancel of OnExecutePackageBegin struct.");
2964
2965LExit:
2966 ReleaseStr(sczPackageId);
2967 return hr;
2968}
2969
2970static HRESULT OnExecutePackageComplete(
2971 __in IBootstrapperApplication* pApplication,
2972 __in BUFF_READER* pReaderArgs,
2973 __in BUFF_READER* pReaderResults,
2974 __in BUFF_BUFFER* pBuffer
2975 )
2976{
2977 HRESULT hr = S_OK;
2978 BA_ONEXECUTEPACKAGECOMPLETE_ARGS args = { };
2979 BA_ONEXECUTEPACKAGECOMPLETE_RESULTS results = { };
2980 LPWSTR sczPackageId = NULL;
2981
2982 // Read args.
2983 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
2984 ExitOnFailure(hr, "Failed to read API version of OnExecutePackageComplete args.");
2985
2986 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
2987 ExitOnFailure(hr, "Failed to read package id of OnExecutePackageComplete args.");
2988
2989 args.wzPackageId = sczPackageId;
2990
2991 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
2992 ExitOnFailure(hr, "Failed to read status of OnExecutePackageComplete args.");
2993
2994 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.restart));
2995 ExitOnFailure(hr, "Failed to read restart of OnExecutePackageComplete args.");
2996
2997 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
2998 ExitOnFailure(hr, "Failed to read recommendation of OnExecutePackageComplete args.");
2999
3000 // Read results.
3001 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3002 ExitOnFailure(hr, "Failed to read API version of OnExecutePackageComplete results.");
3003
3004 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
3005 ExitOnFailure(hr, "Failed to read action of OnExecutePackageComplete results.");
3006
3007 // Callback.
3008 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, &args, &results);
3009
3010 if (E_NOTIMPL == hr)
3011 {
3012 hr = pApplication->OnExecutePackageComplete(args.wzPackageId, args.hrStatus, args.restart, args.recommendation, &results.action);
3013 }
3014
3015 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, &args, &results, &hr);
3016 BalExitOnFailure(hr, "BA OnExecutePackageComplete failed.");
3017
3018 // Write results.
3019 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3020 ExitOnFailure(hr, "Failed to write size of OnExecutePackageComplete struct.");
3021
3022 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
3023 ExitOnFailure(hr, "Failed to write action of OnExecutePackageComplete struct.");
3024
3025LExit:
3026 ReleaseStr(sczPackageId);
3027 return hr;
3028}
3029
3030static HRESULT OnExecutePatchTarget(
3031 __in IBootstrapperApplication* pApplication,
3032 __in BUFF_READER* pReaderArgs,
3033 __in BUFF_READER* pReaderResults,
3034 __in BUFF_BUFFER* pBuffer
3035 )
3036{
3037 HRESULT hr = S_OK;
3038 BA_ONEXECUTEPATCHTARGET_ARGS args = { };
3039 BA_ONEXECUTEPATCHTARGET_RESULTS results = { };
3040 LPWSTR sczPackageId = NULL;
3041 LPWSTR sczTargetProductCode = NULL;
3042
3043 // Read args.
3044 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3045 ExitOnFailure(hr, "Failed to read API version of OnExecutePatchTarget args.");
3046
3047 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3048 ExitOnFailure(hr, "Failed to read package id of OnExecutePatchTarget args.");
3049
3050 args.wzPackageId = sczPackageId;
3051
3052 hr = BuffReaderReadString(pReaderArgs, &sczTargetProductCode);
3053 ExitOnFailure(hr, "Failed to read target product code of OnExecutePatchTarget args.");
3054
3055 args.wzTargetProductCode = sczTargetProductCode;
3056
3057
3058 // Read results.
3059 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3060 ExitOnFailure(hr, "Failed to read API version of OnExecutePatchTarget results.");
3061
3062 // Callback.
3063 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, &args, &results);
3064
3065 if (E_NOTIMPL == hr)
3066 {
3067 hr = pApplication->OnExecutePatchTarget(args.wzPackageId, args.wzTargetProductCode, &results.fCancel);
3068 }
3069
3070 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, &args, &results, &hr);
3071 BalExitOnFailure(hr, "BA OnExecutePatchTarget failed.");
3072
3073 // Write results.
3074 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3075 ExitOnFailure(hr, "Failed to write size of OnExecutePatchTarget struct.");
3076
3077 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3078 ExitOnFailure(hr, "Failed to write cancel of OnExecutePatchTarget struct.");
3079
3080LExit:
3081 ReleaseStr(sczTargetProductCode);
3082 ReleaseStr(sczPackageId);
3083 return hr;
3084}
3085
3086static HRESULT OnExecuteProcessCancel(
3087 __in IBootstrapperApplication* pApplication,
3088 __in BUFF_READER* pReaderArgs,
3089 __in BUFF_READER* pReaderResults,
3090 __in BUFF_BUFFER* pBuffer
3091 )
3092{
3093 HRESULT hr = S_OK;
3094 BA_ONEXECUTEPROCESSCANCEL_ARGS args = { };
3095 BA_ONEXECUTEPROCESSCANCEL_RESULTS results = { };
3096 LPWSTR sczPackageId = NULL;
3097
3098 // Read args.
3099 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3100 ExitOnFailure(hr, "Failed to read API version of OnExecuteProcessCancel args.");
3101
3102 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3103 ExitOnFailure(hr, "Failed to read package id of OnExecuteProcessCancel args.");
3104
3105 args.wzPackageId = sczPackageId;
3106
3107 hr = BuffReaderReadNumber(pReaderArgs, &args.dwProcessId);
3108 ExitOnFailure(hr, "Failed to read process id of OnExecuteProcessCancel args.");
3109
3110 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
3111 ExitOnFailure(hr, "Failed to read recommendation of OnExecuteProcessCancel args.");
3112
3113 // Read results.
3114 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3115 ExitOnFailure(hr, "Failed to read API version of OnExecuteProcessCancel results.");
3116
3117 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
3118 ExitOnFailure(hr, "Failed to read action of OnExecuteProcessCancel results.");
3119
3120 // Callback.
3121 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROCESSCANCEL, &args, &results);
3122
3123 if (E_NOTIMPL == hr)
3124 {
3125 hr = pApplication->OnExecuteProcessCancel(args.wzPackageId, args.dwProcessId, args.recommendation, &results.action);
3126 }
3127
3128 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROCESSCANCEL, &args, &results, &hr);
3129 BalExitOnFailure(hr, "BA OnExecuteProcessCancel failed.");
3130
3131 // Write results.
3132 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3133 ExitOnFailure(hr, "Failed to write size of OnExecuteProcessCancel struct.");
3134
3135 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
3136 ExitOnFailure(hr, "Failed to write action of OnExecuteProcessCancel struct.");
3137
3138LExit:
3139 ReleaseStr(sczPackageId);
3140 return hr;
3141}
3142
3143static HRESULT OnExecuteProgress(
3144 __in IBootstrapperApplication* pApplication,
3145 __in BUFF_READER* pReaderArgs,
3146 __in BUFF_READER* pReaderResults,
3147 __in BUFF_BUFFER* pBuffer
3148 )
3149{
3150 HRESULT hr = S_OK;
3151 BA_ONEXECUTEPROGRESS_ARGS args = { };
3152 BA_ONEXECUTEPROGRESS_RESULTS results = { };
3153 LPWSTR sczPackageId = NULL;
3154
3155 // Read args.
3156 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3157 ExitOnFailure(hr, "Failed to read API version of OnExecuteProgress args.");
3158
3159 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3160 ExitOnFailure(hr, "Failed to read package id of OnExecuteProgress args.");
3161
3162 args.wzPackageId = sczPackageId;
3163
3164 hr = BuffReaderReadNumber(pReaderArgs, &args.dwProgressPercentage);
3165 ExitOnFailure(hr, "Failed to read progress of OnExecuteProgress args.");
3166
3167 hr = BuffReaderReadNumber(pReaderArgs, &args.dwOverallPercentage);
3168 ExitOnFailure(hr, "Failed to read overall progress of OnExecuteProgress args.");
3169
3170 // Read results.
3171 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3172 ExitOnFailure(hr, "Failed to read API version of OnExecuteProgress results.");
3173
3174 // Callback.
3175 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, &args, &results);
3176
3177 if (E_NOTIMPL == hr)
3178 {
3179 hr = pApplication->OnExecuteProgress(args.wzPackageId, args.dwProgressPercentage, args.dwOverallPercentage, &results.fCancel);
3180 }
3181
3182 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, &args, &results, &hr);
3183 BalExitOnFailure(hr, "BA OnExecuteProgress failed.");
3184
3185 // Write results.
3186 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3187 ExitOnFailure(hr, "Failed to write size of OnExecuteProgress struct.");
3188
3189 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3190 ExitOnFailure(hr, "Failed to write cancel of OnExecuteProgress struct.");
3191
3192LExit:
3193 ReleaseStr(sczPackageId);
3194 return hr;
3195}
3196
3197static HRESULT OnLaunchApprovedExeBegin(
3198 __in IBootstrapperApplication* pApplication,
3199 __in BUFF_READER* pReaderArgs,
3200 __in BUFF_READER* pReaderResults,
3201 __in BUFF_BUFFER* pBuffer
3202 )
3203{
3204 HRESULT hr = S_OK;
3205 BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS args = { };
3206 BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS results = { };
3207
3208 // Read args.
3209 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3210 ExitOnFailure(hr, "Failed to read API version of OnLaunchApprovedExeBegin args.");
3211
3212 // Read results.
3213 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3214 ExitOnFailure(hr, "Failed to read API version of OnLaunchApprovedExeBegin results.");
3215
3216 // Callback.
3217 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, &args, &results);
3218
3219 if (E_NOTIMPL == hr)
3220 {
3221 hr = pApplication->OnLaunchApprovedExeBegin(&results.fCancel);
3222 }
3223
3224 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, &args, &results, &hr);
3225 BalExitOnFailure(hr, "BA OnLaunchApprovedExeBegin failed.");
3226
3227 // Write results.
3228 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3229 ExitOnFailure(hr, "Failed to write size of OnLaunchApprovedExeBegin struct.");
3230
3231 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3232 ExitOnFailure(hr, "Failed to write cancel of OnLaunchApprovedExeBegin struct.");
3233
3234LExit:
3235 return hr;
3236}
3237
3238static HRESULT OnLaunchApprovedExeComplete(
3239 __in IBootstrapperApplication* pApplication,
3240 __in BUFF_READER* pReaderArgs,
3241 __in BUFF_READER* pReaderResults,
3242 __in BUFF_BUFFER* pBuffer
3243 )
3244{
3245 HRESULT hr = S_OK;
3246 BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS args = { };
3247 BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS results = { };
3248
3249 // Read args.
3250 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3251 ExitOnFailure(hr, "Failed to read API version of OnLaunchApprovedExeComplete args.");
3252
3253 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
3254 ExitOnFailure(hr, "Failed to read status of OnLaunchApprovedExeComplete args.");
3255
3256 hr = BuffReaderReadNumber(pReaderArgs, &args.dwProcessId);
3257 ExitOnFailure(hr, "Failed to read process id of OnLaunchApprovedExeComplete args.");
3258
3259 // Read results.
3260 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3261 ExitOnFailure(hr, "Failed to read API version of OnLaunchApprovedExeComplete results.");
3262
3263 // Callback.
3264 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, &args, &results);
3265
3266 if (E_NOTIMPL == hr)
3267 {
3268 hr = pApplication->OnLaunchApprovedExeComplete(args.hrStatus, args.dwProcessId);
3269 }
3270
3271 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, &args, &results, &hr);
3272 BalExitOnFailure(hr, "BA OnLaunchApprovedExeComplete failed.");
3273
3274 // Write results.
3275 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3276 ExitOnFailure(hr, "Failed to write size of OnLaunchApprovedExeComplete struct.");
3277
3278LExit:
3279 return hr;
3280}
3281
3282static HRESULT OnPauseAutomaticUpdatesBegin(
3283 __in IBootstrapperApplication* pApplication,
3284 __in BUFF_READER* pReaderArgs,
3285 __in BUFF_READER* pReaderResults,
3286 __in BUFF_BUFFER* pBuffer
3287 )
3288{
3289 HRESULT hr = S_OK;
3290 BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS args = { };
3291 BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS results = { };
3292
3293 // Read args.
3294 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3295 ExitOnFailure(hr, "Failed to read API version of OnPauseAutomaticUpdatesBegin args.");
3296
3297 // Read results.
3298 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3299 ExitOnFailure(hr, "Failed to read API version of OnPauseAutomaticUpdatesBegin results.");
3300
3301 // Callback.
3302 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, &args, &results);
3303
3304 if (E_NOTIMPL == hr)
3305 {
3306 hr = pApplication->OnPauseAutomaticUpdatesBegin();
3307 }
3308
3309 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, &args, &results, &hr);
3310 BalExitOnFailure(hr, "BA OnPauseAutomaticUpdatesBegin failed.");
3311
3312 // Write results.
3313 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3314 ExitOnFailure(hr, "Failed to write size of OnPauseAutomaticUpdatesBegin struct.");
3315
3316LExit:
3317 return hr;
3318}
3319
3320static HRESULT OnPauseAutomaticUpdatesComplete(
3321 __in IBootstrapperApplication* pApplication,
3322 __in BUFF_READER* pReaderArgs,
3323 __in BUFF_READER* pReaderResults,
3324 __in BUFF_BUFFER* pBuffer
3325 )
3326{
3327 HRESULT hr = S_OK;
3328 BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS args = { };
3329 BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS results = { };
3330
3331 // Read args.
3332 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3333 ExitOnFailure(hr, "Failed to read API version of OnPauseAutomaticUpdatesComplete args.");
3334
3335 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
3336 ExitOnFailure(hr, "Failed to read status of OnPauseAutomaticUpdatesComplete args.");
3337
3338 // Read results.
3339 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3340 ExitOnFailure(hr, "Failed to read API version of OnPauseAutomaticUpdatesComplete results.");
3341
3342 // Callback.
3343 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, &args, &results);
3344
3345 if (E_NOTIMPL == hr)
3346 {
3347 hr = pApplication->OnPauseAutomaticUpdatesComplete(args.hrStatus);
3348 }
3349
3350 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, &args, &results, &hr);
3351 BalExitOnFailure(hr, "BA OnPauseAutomaticUpdatesComplete failed.");
3352
3353 // Write results.
3354 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3355 ExitOnFailure(hr, "Failed to write size of OnPauseAutomaticUpdatesComplete struct.");
3356
3357LExit:
3358 return hr;
3359}
3360
3361static HRESULT OnPlanBegin(
3362 __in IBootstrapperApplication* pApplication,
3363 __in BUFF_READER* pReaderArgs,
3364 __in BUFF_READER* pReaderResults,
3365 __in BUFF_BUFFER* pBuffer
3366 )
3367{
3368 HRESULT hr = S_OK;
3369 BA_ONPLANBEGIN_ARGS args = { };
3370 BA_ONPLANBEGIN_RESULTS results = { };
3371
3372 // Read args.
3373 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3374 ExitOnFailure(hr, "Failed to read API version of OnPlanBegin args.");
3375
3376 hr = BuffReaderReadNumber(pReaderArgs, &args.cPackages);
3377 ExitOnFailure(hr, "Failed to read count of packages of OnPlanBegin args.");
3378
3379 // Read results.
3380 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3381 ExitOnFailure(hr, "Failed to read API version of OnPlanBegin results.");
3382
3383 // Callback.
3384 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, &args, &results);
3385
3386 if (E_NOTIMPL == hr)
3387 {
3388 hr = pApplication->OnPlanBegin(args.cPackages, &results.fCancel);
3389 }
3390
3391 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, &args, &results, &hr);
3392 BalExitOnFailure(hr, "BA OnPlanBegin failed.");
3393
3394 // Write results.
3395 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3396 ExitOnFailure(hr, "Failed to write size of OnPlanBegin struct.");
3397
3398 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3399 ExitOnFailure(hr, "Failed to write cancel of OnPlanBegin struct.");
3400
3401LExit:
3402 return hr;
3403}
3404
3405static HRESULT OnPlanCompatibleMsiPackageBegin(
3406 __in IBootstrapperApplication* pApplication,
3407 __in BUFF_READER* pReaderArgs,
3408 __in BUFF_READER* pReaderResults,
3409 __in BUFF_BUFFER* pBuffer
3410 )
3411{
3412 HRESULT hr = S_OK;
3413 BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS args = { };
3414 BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS results = { };
3415 LPWSTR sczPackageId = NULL;
3416 LPWSTR sczCompatiblePackageId = NULL;
3417 LPWSTR sczCompatiblePackageVersion = NULL;
3418
3419 // Read args.
3420 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3421 ExitOnFailure(hr, "Failed to read API version of OnPlanCompatibleMsiPackageBegin args.");
3422
3423 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3424 ExitOnFailure(hr, "Failed to read package id of OnPlanCompatibleMsiPackageBegin args.");
3425
3426 args.wzPackageId = sczPackageId;
3427
3428 hr = BuffReaderReadString(pReaderArgs, &sczCompatiblePackageId);
3429 ExitOnFailure(hr, "Failed to read compatible package id of OnPlanCompatibleMsiPackageBegin args.");
3430
3431 args.wzCompatiblePackageId = sczCompatiblePackageId;
3432
3433 hr = BuffReaderReadString(pReaderArgs, &sczCompatiblePackageVersion);
3434 ExitOnFailure(hr, "Failed to read compatible package version of OnPlanCompatibleMsiPackageBegin args.");
3435
3436 args.wzCompatiblePackageVersion = sczCompatiblePackageVersion;
3437
3438 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fRecommendedRemove));
3439 ExitOnFailure(hr, "Failed to read recommend remove of OnPlanCompatibleMsiPackageBegin args.");
3440
3441 // Read results.
3442 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3443 ExitOnFailure(hr, "Failed to read API version of OnPlanCompatibleMsiPackageBegin results.");
3444
3445 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.fRequestRemove));
3446 ExitOnFailure(hr, "Failed to read request remove of OnPlanCompatibleMsiPackageBegin results.");
3447
3448 // Callback.
3449 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, &args, &results);
3450
3451 if (E_NOTIMPL == hr)
3452 {
3453 hr = pApplication->OnPlanCompatibleMsiPackageBegin(args.wzPackageId, args.wzCompatiblePackageId, args.wzCompatiblePackageVersion, args.fRecommendedRemove, &results.fCancel, &results.fRequestRemove);
3454 }
3455
3456 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, &args, &results, &hr);
3457 BalExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageBegin failed.");
3458
3459 // Write results.
3460 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3461 ExitOnFailure(hr, "Failed to write size of OnPlanCompatibleMsiPackageBegin struct.");
3462
3463 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3464 ExitOnFailure(hr, "Failed to write cancel of OnPlanCompatibleMsiPackageBegin struct.");
3465
3466 hr = BuffWriteNumberToBuffer(pBuffer, results.fRequestRemove);
3467 ExitOnFailure(hr, "Failed to write requested remove of OnPlanCompatibleMsiPackageBegin struct.");
3468
3469LExit:
3470 ReleaseStr(sczCompatiblePackageVersion);
3471 ReleaseStr(sczCompatiblePackageId);
3472 ReleaseStr(sczPackageId);
3473
3474 return hr;
3475}
3476
3477static HRESULT OnPlanCompatibleMsiPackageComplete(
3478 __in IBootstrapperApplication* pApplication,
3479 __in BUFF_READER* pReaderArgs,
3480 __in BUFF_READER* pReaderResults,
3481 __in BUFF_BUFFER* pBuffer
3482 )
3483{
3484 HRESULT hr = S_OK;
3485 BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS args = { };
3486 BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS results = { };
3487 LPWSTR sczPackageId = NULL;
3488 LPWSTR sczCompatiblePackageId = NULL;
3489
3490 // Read args.
3491 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3492 ExitOnFailure(hr, "Failed to read API version of OnPlanCompatibleMsiPackageComplete args.");
3493
3494 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3495 ExitOnFailure(hr, "Failed to read package id of OnPlanCompatibleMsiPackageComplete args.");
3496
3497 args.wzPackageId = sczPackageId;
3498
3499 hr = BuffReaderReadString(pReaderArgs, &sczCompatiblePackageId);
3500 ExitOnFailure(hr, "Failed to read compatible package id of OnPlanCompatibleMsiPackageComplete args.");
3501
3502 args.wzCompatiblePackageId = sczCompatiblePackageId;
3503
3504 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
3505 ExitOnFailure(hr, "Failed to read status of OnPlanCompatibleMsiPackageComplete args.");
3506
3507 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fRequestedRemove));
3508 ExitOnFailure(hr, "Failed to read requested remove of OnPlanCompatibleMsiPackageComplete args.");
3509
3510 // Read results.
3511 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3512 ExitOnFailure(hr, "Failed to read API version of OnPlanCompatibleMsiPackageComplete results.");
3513
3514 // Callback.
3515 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, &args, &results);
3516
3517 if (E_NOTIMPL == hr)
3518 {
3519 hr = pApplication->OnPlanCompatibleMsiPackageComplete(args.wzPackageId, args.wzCompatiblePackageId, args.hrStatus, args.fRequestedRemove);
3520 }
3521
3522 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, &args, &results, &hr);
3523 BalExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageComplete failed.");
3524
3525 // Write results.
3526 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3527 ExitOnFailure(hr, "Failed to write size of OnPlanCompatibleMsiPackageComplete struct.");
3528
3529
3530LExit:
3531 ReleaseStr(sczCompatiblePackageId);
3532 ReleaseStr(sczPackageId);
3533
3534 return hr;
3535}
3536
3537static HRESULT OnPlanMsiFeature(
3538 __in IBootstrapperApplication* pApplication,
3539 __in BUFF_READER* pReaderArgs,
3540 __in BUFF_READER* pReaderResults,
3541 __in BUFF_BUFFER* pBuffer
3542 )
3543{
3544 HRESULT hr = S_OK;
3545 BA_ONPLANMSIFEATURE_ARGS args = { };
3546 BA_ONPLANMSIFEATURE_RESULTS results = { };
3547 LPWSTR sczPackageId = NULL;
3548 LPWSTR sczFeatureId = NULL;
3549
3550 // Read args.
3551 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3552 ExitOnFailure(hr, "Failed to read API version of OnPlanMsiFeature args.");
3553
3554 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3555 ExitOnFailure(hr, "Failed to read package id of OnPlanMsiFeature args.");
3556
3557 args.wzPackageId = sczPackageId;
3558
3559 hr = BuffReaderReadString(pReaderArgs, &sczFeatureId);
3560 ExitOnFailure(hr, "Failed to read feature id of OnPlanMsiFeature args.");
3561
3562 args.wzFeatureId = sczFeatureId;
3563
3564 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedState));
3565 ExitOnFailure(hr, "Failed to read recommended state of OnPlanMsiFeature args.");
3566
3567 // Read results.
3568 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3569 ExitOnFailure(hr, "Failed to read API version of OnPlanMsiFeature results.");
3570
3571 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.requestedState));
3572 ExitOnFailure(hr, "Failed to read requested state of OnPlanMsiFeature results.");
3573
3574 // Callback.
3575 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, &args, &results);
3576
3577 if (E_NOTIMPL == hr)
3578 {
3579 hr = pApplication->OnPlanMsiFeature(args.wzPackageId, args.wzFeatureId, args.recommendedState, &results.requestedState, &results.fCancel);
3580 }
3581
3582 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, &args, &results, &hr);
3583 BalExitOnFailure(hr, "BA OnPlanMsiFeature failed.");
3584
3585 // Write results.
3586 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3587 ExitOnFailure(hr, "Failed to write size of OnPlanMsiFeature struct.");
3588
3589 hr = BuffWriteNumberToBuffer(pBuffer, results.requestedState);
3590 ExitOnFailure(hr, "Failed to write requested state of OnPlanMsiFeature struct.");
3591
3592 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3593 ExitOnFailure(hr, "Failed to write cancel of OnPlanMsiFeature struct.");
3594
3595LExit:
3596 ReleaseStr(sczFeatureId);
3597 ReleaseStr(sczPackageId);
3598
3599 return hr;
3600}
3601
3602static HRESULT OnPlanComplete(
3603 __in IBootstrapperApplication* pApplication,
3604 __in BUFF_READER* pReaderArgs,
3605 __in BUFF_READER* pReaderResults,
3606 __in BUFF_BUFFER* pBuffer
3607 )
3608{
3609 HRESULT hr = S_OK;
3610 BA_ONPLANCOMPLETE_ARGS args = { };
3611 BA_ONPLANCOMPLETE_RESULTS results = { };
3612
3613 // Read args.
3614 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3615 ExitOnFailure(hr, "Failed to read API version of OnPlanComplete args.");
3616
3617 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
3618 ExitOnFailure(hr, "Failed to read status of OnPlanComplete args.");
3619
3620 // Read results.
3621 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3622 ExitOnFailure(hr, "Failed to read API version of OnPlanComplete results.");
3623
3624 // Callback.
3625 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, &args, &results);
3626
3627 if (E_NOTIMPL == hr)
3628 {
3629 hr = pApplication->OnPlanComplete(args.hrStatus);
3630 }
3631
3632 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, &args, &results, &hr);
3633 BalExitOnFailure(hr, "BA OnPlanComplete failed.");
3634
3635 // Write results.
3636 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3637 ExitOnFailure(hr, "Failed to write size of OnPlanComplete struct.");
3638
3639LExit:
3640 return hr;
3641}
3642
3643static HRESULT OnPlanForwardCompatibleBundle(
3644 __in IBootstrapperApplication* pApplication,
3645 __in BUFF_READER* pReaderArgs,
3646 __in BUFF_READER* pReaderResults,
3647 __in BUFF_BUFFER* pBuffer
3648 )
3649{
3650 HRESULT hr = S_OK;
3651 BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS args = { };
3652 BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS results = { };
3653 LPWSTR sczBundleId = NULL;
3654 LPWSTR sczBundleTag = NULL;
3655 LPWSTR sczVersion = NULL;
3656
3657 // Read args.
3658 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3659 ExitOnFailure(hr, "Failed to read API version of OnPlanForwardCompatibleBundle args.");
3660
3661 hr = BuffReaderReadString(pReaderArgs, &sczBundleId);
3662 ExitOnFailure(hr, "Failed to read bundle id of OnPlanForwardCompatibleBundle args.");
3663
3664 args.wzBundleId = sczBundleId;
3665
3666 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.relationType));
3667 ExitOnFailure(hr, "Failed to read relation type of OnPlanForwardCompatibleBundle args.");
3668
3669 hr = BuffReaderReadString(pReaderArgs, &sczBundleTag);
3670 ExitOnFailure(hr, "Failed to read bundle tag of OnPlanForwardCompatibleBundle args.");
3671
3672 args.wzBundleTag = sczBundleTag;
3673
3674 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fPerMachine));
3675 ExitOnFailure(hr, "Failed to read per-machine of OnPlanForwardCompatibleBundle args.");
3676
3677 hr = BuffReaderReadString(pReaderArgs, &sczVersion);
3678 ExitOnFailure(hr, "Failed to read version of OnPlanForwardCompatibleBundle args.");
3679
3680 args.wzVersion = sczVersion;
3681
3682 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fRecommendedIgnoreBundle));
3683 ExitOnFailure(hr, "Failed to read recommended ignore bundle of OnPlanForwardCompatibleBundle args.");
3684
3685 // Read results.
3686 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3687 ExitOnFailure(hr, "Failed to read API version of OnPlanForwardCompatibleBundle results.");
3688
3689 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.fIgnoreBundle));
3690 ExitOnFailure(hr, "Failed to read requested ignore bundle of OnPlanForwardCompatibleBundle results.");
3691
3692 // Callback.
3693 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, &args, &results);
3694
3695 if (E_NOTIMPL == hr)
3696 {
3697 hr = pApplication->OnPlanForwardCompatibleBundle(args.wzBundleId, args.relationType, args.wzBundleTag, args.fPerMachine, args.wzVersion, args.fRecommendedIgnoreBundle, &results.fCancel, &results.fIgnoreBundle);
3698 }
3699
3700 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, &args, &results, &hr);
3701 BalExitOnFailure(hr, "BA OnPlanForwardCompatibleBundle failed.");
3702
3703 // Write results.
3704 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3705 ExitOnFailure(hr, "Failed to write size of OnPlanForwardCompatibleBundle struct.");
3706
3707 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3708 ExitOnFailure(hr, "Failed to write cancel of OnPlanForwardCompatibleBundle struct.");
3709
3710 hr = BuffWriteNumberToBuffer(pBuffer, results.fIgnoreBundle);
3711 ExitOnFailure(hr, "Failed to write ignore bundle of OnPlanForwardCompatibleBundle struct.");
3712
3713LExit:
3714 ReleaseStr(sczVersion);
3715 ReleaseStr(sczBundleTag);
3716 ReleaseStr(sczBundleId);
3717 return hr;
3718}
3719
3720static HRESULT OnPlanMsiPackage(
3721 __in IBootstrapperApplication* pApplication,
3722 __in BUFF_READER* pReaderArgs,
3723 __in BUFF_READER* pReaderResults,
3724 __in BUFF_BUFFER* pBuffer
3725 )
3726{
3727 HRESULT hr = S_OK;
3728 BA_ONPLANMSIPACKAGE_ARGS args = { };
3729 BA_ONPLANMSIPACKAGE_RESULTS results = { };
3730 LPWSTR sczPackageId = NULL;
3731
3732 // Read args.
3733 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3734 ExitOnFailure(hr, "Failed to read API version of OnPlanMsiPackage args.");
3735
3736 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3737 ExitOnFailure(hr, "Failed to read package id of OnPlanMsiPackage args.");
3738
3739 args.wzPackageId = sczPackageId;
3740
3741 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fExecute));
3742 ExitOnFailure(hr, "Failed to read execute of OnPlanMsiPackage args.");
3743
3744 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.action));
3745 ExitOnFailure(hr, "Failed to read action of OnPlanMsiPackage args.");
3746
3747 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedFileVersioning));
3748 ExitOnFailure(hr, "Failed to read recommended file versioning of OnPlanMsiPackage args.");
3749
3750 // Read results.
3751 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3752 ExitOnFailure(hr, "Failed to read API version of OnPlanMsiPackage results.");
3753
3754 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.actionMsiProperty));
3755 ExitOnFailure(hr, "Failed to read action msi property of OnPlanMsiPackage results.");
3756
3757 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.uiLevel));
3758 ExitOnFailure(hr, "Failed to read UI level of OnPlanMsiPackage results.");
3759
3760 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.fDisableExternalUiHandler));
3761 ExitOnFailure(hr, "Failed to read disable external UI handler of OnPlanMsiPackage results.");
3762
3763 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.fileVersioning));
3764 ExitOnFailure(hr, "Failed to read file versioning of OnPlanMsiPackage results.");
3765
3766 // Callback.
3767 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, &args, &results);
3768
3769 if (E_NOTIMPL == hr)
3770 {
3771 hr = pApplication->OnPlanMsiPackage(args.wzPackageId, args.fExecute, args.action, args.recommendedFileVersioning, &results.fCancel, &results.actionMsiProperty, &results.uiLevel, &results.fDisableExternalUiHandler, &results.fileVersioning);
3772 }
3773
3774 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, &args, &results, &hr);
3775 BalExitOnFailure(hr, "BA OnPlanMsiPackage failed.");
3776
3777 // Write results.
3778 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3779 ExitOnFailure(hr, "Failed to write size of OnPlanMsiPackage struct.");
3780
3781 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3782 ExitOnFailure(hr, "Failed to write cancel of OnPlanMsiPackage struct.");
3783
3784 hr = BuffWriteNumberToBuffer(pBuffer, results.actionMsiProperty);
3785 ExitOnFailure(hr, "Failed to write action MSI property of OnPlanMsiPackage struct.");
3786
3787 hr = BuffWriteNumberToBuffer(pBuffer, results.uiLevel);
3788 ExitOnFailure(hr, "Failed to write UI level of OnPlanMsiPackage struct.");
3789
3790 hr = BuffWriteNumberToBuffer(pBuffer, results.fDisableExternalUiHandler);
3791 ExitOnFailure(hr, "Failed to write external UI handler of OnPlanMsiPackage struct.");
3792
3793 hr = BuffWriteNumberToBuffer(pBuffer, results.fileVersioning);
3794 ExitOnFailure(hr, "Failed to write file versioning of OnPlanMsiPackage struct.");
3795
3796LExit:
3797 ReleaseStr(sczPackageId);
3798 return hr;
3799}
3800
3801static HRESULT OnPlannedCompatiblePackage(
3802 __in IBootstrapperApplication* pApplication,
3803 __in BUFF_READER* pReaderArgs,
3804 __in BUFF_READER* pReaderResults,
3805 __in BUFF_BUFFER* pBuffer
3806 )
3807{
3808 HRESULT hr = S_OK;
3809 BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS args = { };
3810 BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS results = { };
3811 LPWSTR sczPackageId = NULL;
3812 LPWSTR sczCompatiblePackageId = NULL;
3813
3814 // Read args.
3815 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3816 ExitOnFailure(hr, "Failed to read API version of OnPlannedCompatiblePackage args.");
3817
3818 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3819 ExitOnFailure(hr, "Failed to read package id of OnPlannedCompatiblePackage args.");
3820
3821 args.wzPackageId = sczPackageId;
3822
3823 hr = BuffReaderReadString(pReaderArgs, &sczCompatiblePackageId);
3824 ExitOnFailure(hr, "Failed to read compatible package id of OnPlannedCompatiblePackage args.");
3825
3826 args.wzCompatiblePackageId = sczCompatiblePackageId;
3827
3828 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fRemove));
3829 ExitOnFailure(hr, "Failed to read remove of OnPlannedCompatiblePackage args.");
3830
3831 // Read results.
3832 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3833 ExitOnFailure(hr, "Failed to read API version of OnPlannedCompatiblePackage results.");
3834
3835 // Callback.
3836 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, &args, &results);
3837
3838 if (E_NOTIMPL == hr)
3839 {
3840 hr = pApplication->OnPlannedCompatiblePackage(args.wzPackageId, args.wzCompatiblePackageId, args.fRemove);
3841 }
3842
3843 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, &args, &results, &hr);
3844 BalExitOnFailure(hr, "BA OnPlannedCompatiblePackage failed.");
3845
3846 // Write results.
3847 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3848 ExitOnFailure(hr, "Failed to write size of OnPlannedCompatiblePackage struct.");
3849
3850LExit:
3851 ReleaseStr(sczCompatiblePackageId);
3852 ReleaseStr(sczPackageId);
3853 return hr;
3854}
3855
3856static HRESULT OnPlannedPackage(
3857 __in IBootstrapperApplication* pApplication,
3858 __in BUFF_READER* pReaderArgs,
3859 __in BUFF_READER* pReaderResults,
3860 __in BUFF_BUFFER* pBuffer
3861 )
3862{
3863 HRESULT hr = S_OK;
3864 BA_ONPLANNEDPACKAGE_ARGS args = { };
3865 BA_ONPLANNEDPACKAGE_RESULTS results = { };
3866 LPWSTR sczPackageId = NULL;
3867
3868 // Read args.
3869 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3870 ExitOnFailure(hr, "Failed to read API version of OnPlannedPackage args.");
3871
3872 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3873 ExitOnFailure(hr, "Failed to read package id of OnPlannedPackage args.");
3874
3875 args.wzPackageId = sczPackageId;
3876
3877 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.execute));
3878 ExitOnFailure(hr, "Failed to read execute of OnPlannedPackage args.");
3879
3880 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.rollback));
3881 ExitOnFailure(hr, "Failed to read rollback of OnPlannedPackage args.");
3882
3883 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fPlannedCache));
3884 ExitOnFailure(hr, "Failed to read planned cache of OnPlannedPackage args.");
3885
3886 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fPlannedUncache));
3887 ExitOnFailure(hr, "Failed to read planned uncache of OnPlannedPackage args.");
3888
3889 // Read results.
3890 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3891 ExitOnFailure(hr, "Failed to read API version of OnPlannedPackage results.");
3892
3893 // Callback.
3894 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, &args, &results);
3895
3896 if (E_NOTIMPL == hr)
3897 {
3898 hr = pApplication->OnPlannedPackage(args.wzPackageId, args.execute, args.rollback, args.fPlannedCache, args.fPlannedUncache);
3899 }
3900
3901 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, &args, &results, &hr);
3902 BalExitOnFailure(hr, "BA OnPlannedPackage failed.");
3903
3904 // Write results.
3905 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3906 ExitOnFailure(hr, "Failed to write size of OnPlannedPackage struct.");
3907
3908LExit:
3909 ReleaseStr(sczPackageId);
3910 return hr;
3911}
3912
3913static HRESULT OnPlanPackageBegin(
3914 __in IBootstrapperApplication* pApplication,
3915 __in BUFF_READER* pReaderArgs,
3916 __in BUFF_READER* pReaderResults,
3917 __in BUFF_BUFFER* pBuffer
3918 )
3919{
3920 HRESULT hr = S_OK;
3921 BA_ONPLANPACKAGEBEGIN_ARGS args = { };
3922 BA_ONPLANPACKAGEBEGIN_RESULTS results = { };
3923 LPWSTR sczPackageId = NULL;
3924
3925 // Read args.
3926 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
3927 ExitOnFailure(hr, "Failed to read API version of OnPlanPackageBegin args.");
3928
3929 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
3930 ExitOnFailure(hr, "Failed to read package id of OnPlanPackageBegin args.");
3931
3932 args.wzPackageId = sczPackageId;
3933
3934 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.state));
3935 ExitOnFailure(hr, "Failed to read state of OnPlanPackageBegin args.");
3936
3937 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fCached));
3938 ExitOnFailure(hr, "Failed to read cached of OnPlanPackageBegin args.");
3939
3940 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.installCondition));
3941 ExitOnFailure(hr, "Failed to read install condition of OnPlanPackageBegin args.");
3942
3943 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.repairCondition));
3944 ExitOnFailure(hr, "Failed to read repair condition of OnPlanPackageBegin args.");
3945
3946 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedState));
3947 ExitOnFailure(hr, "Failed to read recommended state of OnPlanPackageBegin args.");
3948
3949 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedCacheType));
3950 ExitOnFailure(hr, "Failed to read recommended cache type of OnPlanPackageBegin args.");
3951
3952 // Read results.
3953 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
3954 ExitOnFailure(hr, "Failed to read API version of OnPlanPackageBegin results.");
3955
3956 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.requestedState));
3957 ExitOnFailure(hr, "Failed to read requested state of OnPlanPackageBegin results.");
3958
3959 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.requestedCacheType));
3960 ExitOnFailure(hr, "Failed to read requested cache type of OnPlanPackageBegin results.");
3961
3962 // Callback.
3963 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, &args, &results);
3964
3965 if (E_NOTIMPL == hr)
3966 {
3967 hr = pApplication->OnPlanPackageBegin(args.wzPackageId, args.state, args.fCached, args.installCondition, args.repairCondition, args.recommendedState, args.recommendedCacheType, &results.requestedState, &results.requestedCacheType, &results.fCancel);
3968 }
3969
3970 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, &args, &results, &hr);
3971 BalExitOnFailure(hr, "BA OnPlanPackageBegin failed.");
3972
3973 // Write results.
3974 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
3975 ExitOnFailure(hr, "Failed to write size of OnPlanPackageBegin struct.");
3976
3977 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
3978 ExitOnFailure(hr, "Failed to write cancel of OnPlanPackageBegin struct.");
3979
3980 hr = BuffWriteNumberToBuffer(pBuffer, results.requestedState);
3981 ExitOnFailure(hr, "Failed to write requested state of OnPlanPackageBegin struct.");
3982
3983 hr = BuffWriteNumberToBuffer(pBuffer, results.requestedCacheType);
3984 ExitOnFailure(hr, "Failed to write requested cache type of OnPlanPackageBegin struct.");
3985
3986LExit:
3987 ReleaseStr(sczPackageId);
3988 return hr;
3989}
3990
3991static HRESULT OnPlanPackageComplete(
3992 __in IBootstrapperApplication* pApplication,
3993 __in BUFF_READER* pReaderArgs,
3994 __in BUFF_READER* pReaderResults,
3995 __in BUFF_BUFFER* pBuffer
3996 )
3997{
3998 HRESULT hr = S_OK;
3999 BA_ONPLANPACKAGECOMPLETE_ARGS args = { };
4000 BA_ONPLANPACKAGECOMPLETE_RESULTS results = { };
4001 LPWSTR sczPackageId = NULL;
4002
4003 // Read args.
4004 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4005 ExitOnFailure(hr, "Failed to read API version of OnPlanPackageComplete args.");
4006
4007 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
4008 ExitOnFailure(hr, "Failed to read package id of OnPlanPackageComplete args.");
4009
4010 args.wzPackageId = sczPackageId;
4011
4012 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
4013 ExitOnFailure(hr, "Failed to read status of OnPlanPackageComplete args.");
4014
4015 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.requested));
4016 ExitOnFailure(hr, "Failed to read requested of OnPlanPackageComplete args.");
4017
4018 // Read results.
4019 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4020 ExitOnFailure(hr, "Failed to read API version of OnPlanPackageComplete results.");
4021
4022 // Callback.
4023 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, &args, &results);
4024
4025 if (E_NOTIMPL == hr)
4026 {
4027 hr = pApplication->OnPlanPackageComplete(args.wzPackageId, args.hrStatus, args.requested);
4028 }
4029
4030 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, &args, &results, &hr);
4031 BalExitOnFailure(hr, "BA OnPlanPackageComplete failed.");
4032
4033 // Write results.
4034 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4035 ExitOnFailure(hr, "Failed to write size of OnPlanPackageComplete struct.");
4036
4037LExit:
4038 ReleaseStr(sczPackageId);
4039 return hr;
4040}
4041
4042static HRESULT OnPlanRelatedBundle(
4043 __in IBootstrapperApplication* pApplication,
4044 __in BUFF_READER* pReaderArgs,
4045 __in BUFF_READER* pReaderResults,
4046 __in BUFF_BUFFER* pBuffer
4047 )
4048{
4049 HRESULT hr = S_OK;
4050 BA_ONPLANRELATEDBUNDLE_ARGS args = { };
4051 BA_ONPLANRELATEDBUNDLE_RESULTS results = { };
4052 LPWSTR sczBundleId = NULL;
4053
4054 // Read args.
4055 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4056 ExitOnFailure(hr, "Failed to read API version of OnPlanRelatedBundle args.");
4057
4058 hr = BuffReaderReadString(pReaderArgs, &sczBundleId);
4059 ExitOnFailure(hr, "Failed to read package id of OnPlanRelatedBundle args.");
4060
4061 args.wzBundleId = sczBundleId;
4062
4063 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedState));
4064 ExitOnFailure(hr, "Failed to read recommended state of OnPlanRelatedBundle args.");
4065
4066 // Read results.
4067 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4068 ExitOnFailure(hr, "Failed to read API version of OnPlanRelatedBundle results.");
4069
4070 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.requestedState));
4071 ExitOnFailure(hr, "Failed to read requested state of OnPlanRelatedBundle results.");
4072
4073 // Callback.
4074 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, &args, &results);
4075
4076 if (E_NOTIMPL == hr)
4077 {
4078 hr = pApplication->OnPlanRelatedBundle(args.wzBundleId, args.recommendedState, &results.requestedState, &results.fCancel);
4079 }
4080
4081 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, &args, &results, &hr);
4082 BalExitOnFailure(hr, "BA OnPlanRelatedBundle failed.");
4083
4084 // Write results.
4085 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4086 ExitOnFailure(hr, "Failed to write size of OnPlanRelatedBundle struct.");
4087
4088 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
4089 ExitOnFailure(hr, "Failed to write cancel of OnPlanRelatedBundle struct.");
4090
4091 hr = BuffWriteNumberToBuffer(pBuffer, results.requestedState);
4092 ExitOnFailure(hr, "Failed to write requested state of OnPlanRelatedBundle struct.");
4093
4094LExit:
4095 ReleaseStr(sczBundleId);
4096 return hr;
4097}
4098
4099static HRESULT OnPlanRelatedBundleType(
4100 __in IBootstrapperApplication* pApplication,
4101 __in BUFF_READER* pReaderArgs,
4102 __in BUFF_READER* pReaderResults,
4103 __in BUFF_BUFFER* pBuffer
4104 )
4105{
4106 HRESULT hr = S_OK;
4107 BA_ONPLANRELATEDBUNDLETYPE_ARGS args = { };
4108 BA_ONPLANRELATEDBUNDLETYPE_RESULTS results = { };
4109 LPWSTR sczBundleId = NULL;
4110
4111 // Read args.
4112 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4113 ExitOnFailure(hr, "Failed to read API version of OnPlanRelatedBundleType args.");
4114
4115 hr = BuffReaderReadString(pReaderArgs, &sczBundleId);
4116 ExitOnFailure(hr, "Failed to read package id of OnPlanRelatedBundleType args.");
4117
4118 args.wzBundleId = sczBundleId;
4119
4120 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedType));
4121 ExitOnFailure(hr, "Failed to read recommended type of OnPlanRelatedBundleType args.");
4122
4123 // Read results.
4124 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4125 ExitOnFailure(hr, "Failed to read API version of OnPlanRelatedBundleType results.");
4126
4127 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.requestedType));
4128 ExitOnFailure(hr, "Failed to read requested type of OnPlanRelatedBundleType results.");
4129
4130 // Callback.
4131 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, &args, &results);
4132
4133 if (E_NOTIMPL == hr)
4134 {
4135 hr = pApplication->OnPlanRelatedBundleType(args.wzBundleId, args.recommendedType, &results.requestedType, &results.fCancel);
4136 }
4137
4138 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, &args, &results, &hr);
4139 BalExitOnFailure(hr, "BA OnPlanRelatedBundleType failed.");
4140
4141 // Write results.
4142 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4143 ExitOnFailure(hr, "Failed to write size of OnPlanRelatedBundleType struct.");
4144
4145 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
4146 ExitOnFailure(hr, "Failed to write cancel of OnPlanRelatedBundleType struct.");
4147
4148 hr = BuffWriteNumberToBuffer(pBuffer, results.requestedType);
4149 ExitOnFailure(hr, "Failed to write requested type of OnPlanRelatedBundleType struct.");
4150
4151LExit:
4152 ReleaseStr(sczBundleId);
4153 return hr;
4154}
4155
4156static HRESULT OnPlanRestoreRelatedBundle(
4157 __in IBootstrapperApplication* pApplication,
4158 __in BUFF_READER* pReaderArgs,
4159 __in BUFF_READER* pReaderResults,
4160 __in BUFF_BUFFER* pBuffer
4161 )
4162{
4163 HRESULT hr = S_OK;
4164 BA_ONPLANRESTORERELATEDBUNDLE_ARGS args = { };
4165 BA_ONPLANRESTORERELATEDBUNDLE_RESULTS results = { };
4166 LPWSTR sczBundleId = NULL;
4167
4168 // Read args.
4169 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4170 ExitOnFailure(hr, "Failed to read API version of OnPlanRestoreRelatedBundle args.");
4171
4172 hr = BuffReaderReadString(pReaderArgs, &sczBundleId);
4173 ExitOnFailure(hr, "Failed to read package id of OnPlanRestoreRelatedBundle args.");
4174
4175 args.wzBundleId = sczBundleId;
4176
4177 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedState));
4178 ExitOnFailure(hr, "Failed to read recommended state of OnPlanRestoreRelatedBundle args.");
4179
4180 // Read results.
4181 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4182 ExitOnFailure(hr, "Failed to read API version of OnPlanRestoreRelatedBundle results.");
4183
4184 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.requestedState));
4185 ExitOnFailure(hr, "Failed to read requested state of OnPlanRestoreRelatedBundle results.");
4186
4187 // Callback.
4188 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, &args, &results);
4189
4190 if (E_NOTIMPL == hr)
4191 {
4192 hr = pApplication->OnPlanRestoreRelatedBundle(args.wzBundleId, args.recommendedState, &results.requestedState, &results.fCancel);
4193 }
4194
4195 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, &args, &results, &hr);
4196 BalExitOnFailure(hr, "BA OnPlanRestoreRelatedBundle failed.");
4197
4198 // Write results.
4199 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4200 ExitOnFailure(hr, "Failed to write size of OnPlanRestoreRelatedBundle struct.");
4201
4202 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
4203 ExitOnFailure(hr, "Failed to write cancel of OnPlanRestoreRelatedBundle struct.");
4204
4205 hr = BuffWriteNumberToBuffer(pBuffer, results.requestedState);
4206 ExitOnFailure(hr, "Failed to write requested state of OnPlanRestoreRelatedBundle struct.");
4207
4208LExit:
4209 ReleaseStr(sczBundleId);
4210 return hr;
4211}
4212
4213static HRESULT OnPlanRollbackBoundary(
4214 __in IBootstrapperApplication* pApplication,
4215 __in BUFF_READER* pReaderArgs,
4216 __in BUFF_READER* pReaderResults,
4217 __in BUFF_BUFFER* pBuffer
4218 )
4219{
4220 HRESULT hr = S_OK;
4221 BA_ONPLANROLLBACKBOUNDARY_ARGS args = { };
4222 BA_ONPLANROLLBACKBOUNDARY_RESULTS results = { };
4223 LPWSTR sczRollbackBoundaryId = NULL;
4224
4225 // Read args.
4226 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4227 ExitOnFailure(hr, "Failed to read API version of OnPlanRollbackBoundary args.");
4228
4229 hr = BuffReaderReadString(pReaderArgs, &sczRollbackBoundaryId);
4230 ExitOnFailure(hr, "Failed to read rollback boundary id of OnPlanRollbackBoundary args.");
4231
4232 args.wzRollbackBoundaryId = sczRollbackBoundaryId;
4233
4234 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.fRecommendedTransaction));
4235 ExitOnFailure(hr, "Failed to read recommended transaction of OnPlanRollbackBoundary args.");
4236
4237 // Read results.
4238 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4239 ExitOnFailure(hr, "Failed to read API version of OnPlanRollbackBoundary results.");
4240
4241 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.fTransaction));
4242 ExitOnFailure(hr, "Failed to read transaction of OnPlanRollbackBoundary results.");
4243
4244 // Callback.
4245 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY, &args, &results);
4246
4247 if (E_NOTIMPL == hr)
4248 {
4249 hr = pApplication->OnPlanRollbackBoundary(args.wzRollbackBoundaryId, args.fRecommendedTransaction, &results.fTransaction, &results.fCancel);
4250 }
4251
4252 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY, &args, &results, &hr);
4253 BalExitOnFailure(hr, "BA OnPlanRollbackBoundary failed.");
4254
4255 // Write results.
4256 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4257 ExitOnFailure(hr, "Failed to write size of OnPlanRollbackBoundary struct.");
4258
4259 hr = BuffWriteNumberToBuffer(pBuffer, results.fTransaction);
4260 ExitOnFailure(hr, "Failed to write transaction of OnPlanRollbackBoundary struct.");
4261
4262 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
4263 ExitOnFailure(hr, "Failed to write cancel of OnPlanRollbackBoundary struct.");
4264
4265LExit:
4266 ReleaseStr(sczRollbackBoundaryId);
4267 return hr;
4268}
4269
4270static HRESULT OnPlanPatchTarget(
4271 __in IBootstrapperApplication* pApplication,
4272 __in BUFF_READER* pReaderArgs,
4273 __in BUFF_READER* pReaderResults,
4274 __in BUFF_BUFFER* pBuffer
4275 )
4276{
4277 HRESULT hr = S_OK;
4278 BA_ONPLANPATCHTARGET_ARGS args = { };
4279 BA_ONPLANPATCHTARGET_RESULTS results = { };
4280 LPWSTR sczPackageId = NULL;
4281 LPWSTR sczProductCode = NULL;
4282
4283 // Read args.
4284 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4285 ExitOnFailure(hr, "Failed to read API version of OnPlanPatchTarget args.");
4286
4287 hr = BuffReaderReadString(pReaderArgs, &sczPackageId);
4288 ExitOnFailure(hr, "Failed to read package id of OnPlanPatchTarget args.");
4289
4290 args.wzPackageId = sczPackageId;
4291
4292 hr = BuffReaderReadString(pReaderArgs, &sczProductCode);
4293 ExitOnFailure(hr, "Failed to read product code of OnPlanPatchTarget args.");
4294
4295 args.wzProductCode = sczProductCode;
4296
4297 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedState));
4298 ExitOnFailure(hr, "Failed to read recommended state transaction of OnPlanPatchTarget args.");
4299
4300 // Read results.
4301 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4302 ExitOnFailure(hr, "Failed to read API version of OnPlanPatchTarget results.");
4303
4304 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.requestedState));
4305 ExitOnFailure(hr, "Failed to read requested state of OnPlanPatchTarget results.");
4306
4307 // Callback.
4308 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET, &args, &results);
4309
4310 if (E_NOTIMPL == hr)
4311 {
4312 hr = pApplication->OnPlanPatchTarget(args.wzPackageId, args.wzProductCode, args.recommendedState, &results.requestedState, &results.fCancel);
4313 }
4314
4315 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET, &args, &results, &hr);
4316 BalExitOnFailure(hr, "BA OnPlanPatchTarget failed.");
4317
4318 // Write results.
4319 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4320 ExitOnFailure(hr, "Failed to write size of OnPlanPatchTarget struct.");
4321
4322 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
4323 ExitOnFailure(hr, "Failed to write cancel of OnPlanPatchTarget struct.");
4324
4325 hr = BuffWriteNumberToBuffer(pBuffer, results.requestedState);
4326 ExitOnFailure(hr, "Failed to write transaction of OnPlanPatchTarget struct.");
4327
4328LExit:
4329 ReleaseStr(sczProductCode);
4330 ReleaseStr(sczPackageId);
4331 return hr;
4332}
4333
4334static HRESULT OnProgress(
4335 __in IBootstrapperApplication* pApplication,
4336 __in BUFF_READER* pReaderArgs,
4337 __in BUFF_READER* pReaderResults,
4338 __in BUFF_BUFFER* pBuffer
4339 )
4340{
4341 HRESULT hr = S_OK;
4342 BA_ONPROGRESS_ARGS args = { };
4343 BA_ONPROGRESS_RESULTS results = { };
4344
4345 // Read args.
4346 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4347 ExitOnFailure(hr, "Failed to read API version of OnProgress args.");
4348
4349 hr = BuffReaderReadNumber(pReaderArgs, &args.dwProgressPercentage);
4350 ExitOnFailure(hr, "Failed to read progress of OnProgress args.");
4351
4352 hr = BuffReaderReadNumber(pReaderArgs, &args.dwOverallPercentage);
4353 ExitOnFailure(hr, "Failed to read overall progress of OnProgress args.");
4354
4355 // Read results.
4356 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4357 ExitOnFailure(hr, "Failed to read API version of OnProgress results.");
4358
4359 // Callback.
4360 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, &args, &results);
4361
4362 if (E_NOTIMPL == hr)
4363 {
4364 hr = pApplication->OnProgress(args.dwProgressPercentage, args.dwOverallPercentage, &results.fCancel);
4365 }
4366
4367 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, &args, &results, &hr);
4368 BalExitOnFailure(hr, "BA OnProgress failed.");
4369
4370 // Write results.
4371 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4372 ExitOnFailure(hr, "Failed to write size of OnProgress struct.");
4373
4374 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
4375 ExitOnFailure(hr, "Failed to write cancel of OnProgress struct.");
4376
4377LExit:
4378 return hr;
4379}
4380
4381static HRESULT OnRegisterBegin(
4382 __in IBootstrapperApplication* pApplication,
4383 __in BUFF_READER* pReaderArgs,
4384 __in BUFF_READER* pReaderResults,
4385 __in BUFF_BUFFER* pBuffer
4386 )
4387{
4388 HRESULT hr = S_OK;
4389 BA_ONREGISTERBEGIN_ARGS args = { };
4390 BA_ONREGISTERBEGIN_RESULTS results = { };
4391
4392 // Read args.
4393 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4394 ExitOnFailure(hr, "Failed to read API version of OnRegisterBegin args.");
4395
4396 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedRegistrationType));
4397 ExitOnFailure(hr, "Failed to read recommended registration type of OnRegisterBegin args.");
4398
4399 // Read results.
4400 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4401 ExitOnFailure(hr, "Failed to read API version of OnRegisterBegin results.");
4402
4403 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.registrationType));
4404 ExitOnFailure(hr, "Failed to read registration type of OnRegisterBegin results.");
4405
4406 // Callback.
4407 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, &args, &results);
4408
4409 if (E_NOTIMPL == hr)
4410 {
4411 hr = pApplication->OnRegisterBegin(args.recommendedRegistrationType, &results.fCancel, &results.registrationType);
4412 }
4413
4414 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, &args, &results, &hr);
4415 BalExitOnFailure(hr, "BA OnRegisterBegin failed.");
4416
4417 // Write results.
4418 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4419 ExitOnFailure(hr, "Failed to write size of OnRegisterBegin struct.");
4420
4421 hr = BuffWriteNumberToBuffer(pBuffer, results.fCancel);
4422 ExitOnFailure(hr, "Failed to write cancel of OnRegisterBegin struct.");
4423
4424 hr = BuffWriteNumberToBuffer(pBuffer, results.registrationType);
4425 ExitOnFailure(hr, "Failed to write registration type of OnRegisterBegin struct.");
4426
4427LExit:
4428 return hr;
4429}
4430
4431static HRESULT OnRegisterComplete(
4432 __in IBootstrapperApplication* pApplication,
4433 __in BUFF_READER* pReaderArgs,
4434 __in BUFF_READER* pReaderResults,
4435 __in BUFF_BUFFER* pBuffer
4436 )
4437{
4438 HRESULT hr = S_OK;
4439 BA_ONREGISTERCOMPLETE_ARGS args = { };
4440 BA_ONREGISTERCOMPLETE_RESULTS results = { };
4441
4442 // Read args.
4443 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4444 ExitOnFailure(hr, "Failed to read API version of OnRegisterComplete args.");
4445
4446 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
4447 ExitOnFailure(hr, "Failed to read status of OnRegisterComplete args.");
4448
4449 // Read results.
4450 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4451 ExitOnFailure(hr, "Failed to read API version of OnRegisterComplete results.");
4452
4453 // Callback.
4454 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, &args, &results);
4455
4456 if (E_NOTIMPL == hr)
4457 {
4458 hr = pApplication->OnRegisterComplete(args.hrStatus);
4459 }
4460
4461 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, &args, &results, &hr);
4462 BalExitOnFailure(hr, "BA OnRegisterComplete failed.");
4463
4464 // Write results.
4465 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4466 ExitOnFailure(hr, "Failed to write size of OnRegisterComplete struct.");
4467
4468LExit:
4469 return hr;
4470}
4471
4472static HRESULT OnRollbackMsiTransactionBegin(
4473 __in IBootstrapperApplication* pApplication,
4474 __in BUFF_READER* pReaderArgs,
4475 __in BUFF_READER* pReaderResults,
4476 __in BUFF_BUFFER* pBuffer
4477 )
4478{
4479 HRESULT hr = S_OK;
4480 BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS args = { };
4481 BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS results = { };
4482 LPWSTR sczTransactionId = NULL;
4483
4484 // Read args.
4485 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4486 ExitOnFailure(hr, "Failed to read API version of OnRollbackMsiTransactionBegin args.");
4487
4488 hr = BuffReaderReadString(pReaderArgs, &sczTransactionId);
4489 ExitOnFailure(hr, "Failed to read transaction id of OnRollbackMsiTransactionBegin args.");
4490
4491 args.wzTransactionId = sczTransactionId;
4492
4493 // Read results.
4494 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4495 ExitOnFailure(hr, "Failed to read API version of OnRollbackMsiTransactionBegin results.");
4496
4497 // Callback.
4498 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &args, &results);
4499
4500 if (E_NOTIMPL == hr)
4501 {
4502 hr = pApplication->OnRollbackMsiTransactionBegin(args.wzTransactionId);
4503 }
4504
4505 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &args, &results, &hr);
4506 BalExitOnFailure(hr, "BA OnRollbackMsiTransactionBegin failed.");
4507
4508 // Write results.
4509 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4510 ExitOnFailure(hr, "Failed to write size of OnRollbackMsiTransactionBegin struct.");
4511
4512LExit:
4513 ReleaseStr(sczTransactionId);
4514 return hr;
4515}
4516
4517static HRESULT OnRollbackMsiTransactionComplete(
4518 __in IBootstrapperApplication* pApplication,
4519 __in BUFF_READER* pReaderArgs,
4520 __in BUFF_READER* pReaderResults,
4521 __in BUFF_BUFFER* pBuffer
4522 )
4523{
4524 HRESULT hr = S_OK;
4525 BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS args = { };
4526 BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS results = { };
4527 LPWSTR sczTransactionId = NULL;
4528
4529 // Read args.
4530 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4531 ExitOnFailure(hr, "Failed to read API version of OnRollbackMsiTransactionComplete args.");
4532
4533 hr = BuffReaderReadString(pReaderArgs, &sczTransactionId);
4534 ExitOnFailure(hr, "Failed to read transaction id of OnRollbackMsiTransactionComplete args.");
4535
4536 args.wzTransactionId = sczTransactionId;
4537
4538 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
4539 ExitOnFailure(hr, "Failed to read status of OnRollbackMsiTransactionComplete args.");
4540
4541 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.restart));
4542 ExitOnFailure(hr, "Failed to read restart of OnRollbackMsiTransactionComplete args.");
4543
4544 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendation));
4545 ExitOnFailure(hr, "Failed to read recommendation of OnRollbackMsiTransactionComplete args.");
4546
4547 // Read results.
4548 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4549 ExitOnFailure(hr, "Failed to read API version of OnRollbackMsiTransactionComplete results.");
4550
4551 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
4552 ExitOnFailure(hr, "Failed to read action of OnRollbackMsiTransactionComplete results.");
4553
4554 // Callback.
4555 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &args, &results);
4556
4557 if (E_NOTIMPL == hr)
4558 {
4559 hr = pApplication->OnRollbackMsiTransactionComplete(args.wzTransactionId, args.hrStatus, args.restart, args.recommendation, &results.action);
4560 }
4561
4562 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &args, &results, &hr);
4563 BalExitOnFailure(hr, "BA OnRollbackMsiTransactionComplete failed.");
4564
4565 // Write results.
4566 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4567 ExitOnFailure(hr, "Failed to write size of OnRollbackMsiTransactionComplete struct.");
4568
4569 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
4570 ExitOnFailure(hr, "Failed to write action of OnRollbackMsiTransactionComplete struct.");
4571
4572LExit:
4573 ReleaseStr(sczTransactionId);
4574 return hr;
4575}
4576
4577static HRESULT OnShutdown(
4578 __in IBootstrapperApplication* pApplication,
4579 __in BUFF_READER* pReaderArgs,
4580 __in BUFF_READER* pReaderResults,
4581 __in BUFF_BUFFER* pBuffer
4582 )
4583{
4584 HRESULT hr = S_OK;
4585 BA_ONSHUTDOWN_ARGS args = { };
4586 BA_ONSHUTDOWN_RESULTS results = { };
4587
4588 // Read args.
4589 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4590 ExitOnFailure(hr, "Failed to read API version of OnShutdown args.");
4591
4592 // Read results.
4593 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4594 ExitOnFailure(hr, "Failed to read API version of OnShutdown results.");
4595
4596 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.action));
4597 ExitOnFailure(hr, "Failed to read action of OnShutdown results.");
4598
4599 // Callback.
4600 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &args, &results);
4601
4602 if (E_NOTIMPL == hr)
4603 {
4604 hr = pApplication->OnShutdown(&results.action);
4605 }
4606
4607 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &args, &results, &hr);
4608 BalExitOnFailure(hr, "BA OnStartup failed.");
4609
4610 // Write results.
4611 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4612 ExitOnFailure(hr, "Failed to write size of OnShutdown struct.");
4613
4614 hr = BuffWriteNumberToBuffer(pBuffer, results.action);
4615 ExitOnFailure(hr, "Failed to write action of OnShutdown struct.");
4616
4617LExit:
4618 return hr;
4619}
4620
4621static HRESULT OnStartup(
4622 __in IBootstrapperApplication* pApplication,
4623 __in BUFF_READER* pReaderArgs,
4624 __in BUFF_READER* pReaderResults,
4625 __in BUFF_BUFFER* pBuffer
4626 )
4627{
4628 HRESULT hr = S_OK;
4629 BA_ONSTARTUP_ARGS args = { };
4630 BA_ONSTARTUP_RESULTS results = { };
4631
4632 // Read args.
4633 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4634 ExitOnFailure(hr, "Failed to read API version of OnStartup args.");
4635
4636 // Read results.
4637 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4638 ExitOnFailure(hr, "Failed to read API version of OnStartup results.");
4639
4640 // Callback.
4641 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &args, &results);
4642
4643 if (E_NOTIMPL == hr)
4644 {
4645 hr = pApplication->OnStartup();
4646 }
4647
4648 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &args, &results, &hr);
4649 BalExitOnFailure(hr, "BA OnStartup failed.");
4650
4651 // Write results.
4652 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4653 ExitOnFailure(hr, "Failed to write size of OnStartup struct.");
4654
4655LExit:
4656 return hr;
4657}
4658
4659static HRESULT OnSystemRestorePointBegin(
4660 __in IBootstrapperApplication* pApplication,
4661 __in BUFF_READER* pReaderArgs,
4662 __in BUFF_READER* pReaderResults,
4663 __in BUFF_BUFFER* pBuffer
4664 )
4665{
4666 HRESULT hr = S_OK;
4667 BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS args = { };
4668 BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS results = { };
4669
4670 // Read args.
4671 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4672 ExitOnFailure(hr, "Failed to read API version of OnSystemRestorePointBegin args.");
4673
4674 // Read results.
4675 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4676 ExitOnFailure(hr, "Failed to read API version of OnSystemRestorePointBegin results.");
4677
4678 // Callback.
4679 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, &args, &results);
4680
4681 if (E_NOTIMPL == hr)
4682 {
4683 hr = pApplication->OnSystemRestorePointBegin();
4684 }
4685
4686 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, &args, &results, &hr);
4687 BalExitOnFailure(hr, "BA OnSystemRestorePointBegin failed.");
4688
4689 // Write results.
4690 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4691 ExitOnFailure(hr, "Failed to write size of OnSystemRestorePointBegin struct.");
4692
4693LExit:
4694 return hr;
4695}
4696
4697static HRESULT OnSystemRestorePointComplete(
4698 __in IBootstrapperApplication* pApplication,
4699 __in BUFF_READER* pReaderArgs,
4700 __in BUFF_READER* pReaderResults,
4701 __in BUFF_BUFFER* pBuffer
4702 )
4703{
4704 HRESULT hr = S_OK;
4705 BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS args = { };
4706 BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS results = { };
4707
4708 // Read args.
4709 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4710 ExitOnFailure(hr, "Failed to read API version of OnSystemRestorePointComplete args.");
4711
4712 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
4713 ExitOnFailure(hr, "Failed to read status of OnSystemRestorePointComplete args.");
4714
4715 // Read results.
4716 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4717 ExitOnFailure(hr, "Failed to read API version of OnSystemRestorePointComplete results.");
4718
4719 // Callback.
4720 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, &args, &results);
4721
4722 if (E_NOTIMPL == hr)
4723 {
4724 hr = pApplication->OnSystemRestorePointComplete(args.hrStatus);
4725 }
4726
4727 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, &args, &results, &hr);
4728 BalExitOnFailure(hr, "BA OnSystemRestorePointComplete failed.");
4729
4730 // Write results.
4731 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4732 ExitOnFailure(hr, "Failed to write size of OnSystemRestorePointComplete struct.");
4733
4734LExit:
4735 return hr;
4736}
4737
4738static HRESULT OnUnregisterBegin(
4739 __in IBootstrapperApplication* pApplication,
4740 __in BUFF_READER* pReaderArgs,
4741 __in BUFF_READER* pReaderResults,
4742 __in BUFF_BUFFER* pBuffer
4743 )
4744{
4745 HRESULT hr = S_OK;
4746 BA_ONUNREGISTERBEGIN_ARGS args = { };
4747 BA_ONUNREGISTERBEGIN_RESULTS results = { };
4748
4749 // Read args.
4750 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4751 ExitOnFailure(hr, "Failed to read API version of OnUnregisterBegin args.");
4752
4753 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.recommendedRegistrationType));
4754 ExitOnFailure(hr, "Failed to read recommended registration type of OnUnregisterBegin args.");
4755
4756 // Read results.
4757 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4758 ExitOnFailure(hr, "Failed to read API version of OnUnregisterBegin results.");
4759
4760 hr = BuffReaderReadNumber(pReaderResults, reinterpret_cast<DWORD*>(&results.registrationType));
4761 ExitOnFailure(hr, "Failed to read registration type of OnUnregisterBegin results.");
4762
4763 // Callback.
4764 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &args, &results);
4765
4766 if (E_NOTIMPL == hr)
4767 {
4768 hr = pApplication->OnUnregisterBegin(args.recommendedRegistrationType, &results.registrationType);
4769 }
4770
4771 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &args, &results, &hr);
4772 BalExitOnFailure(hr, "BA OnUnregisterBegin failed.");
4773
4774 // Write results.
4775 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4776 ExitOnFailure(hr, "Failed to write size of OnUnregisterBegin struct.");
4777
4778 hr = BuffWriteNumberToBuffer(pBuffer, results.registrationType);
4779 ExitOnFailure(hr, "Failed to write registration type of OnUnregisterBegin struct.");
4780
4781LExit:
4782 return hr;
4783}
4784
4785static HRESULT OnUnregisterComplete(
4786 __in IBootstrapperApplication* pApplication,
4787 __in BUFF_READER* pReaderArgs,
4788 __in BUFF_READER* pReaderResults,
4789 __in BUFF_BUFFER* pBuffer
4790 )
4791{
4792 HRESULT hr = S_OK;
4793 BA_ONUNREGISTERCOMPLETE_ARGS args = { };
4794 BA_ONUNREGISTERCOMPLETE_RESULTS results = { };
4795
4796 // Read args.
4797 hr = BuffReaderReadNumber(pReaderArgs, &args.dwApiVersion);
4798 ExitOnFailure(hr, "Failed to read API version of OnUnregisterComplete args.");
4799
4800 hr = BuffReaderReadNumber(pReaderArgs, reinterpret_cast<DWORD*>(&args.hrStatus));
4801 ExitOnFailure(hr, "Failed to read status of OnUnregisterComplete args.");
4802
4803 // Read results.
4804 hr = BuffReaderReadNumber(pReaderResults, &results.dwApiVersion);
4805 ExitOnFailure(hr, "Failed to read API version of OnUnregisterComplete results.");
4806
4807 // Callback.
4808 hr = pApplication->BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, &args, &results);
4809
4810 if (E_NOTIMPL == hr)
4811 {
4812 hr = pApplication->OnUnregisterComplete(args.hrStatus);
4813 }
4814
4815 pApplication->BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, &args, &results, &hr);
4816 BalExitOnFailure(hr, "BA OnUnregisterComplete failed.");
4817
4818 // Write results.
4819 hr = BuffWriteNumberToBuffer(pBuffer, sizeof(results));
4820 ExitOnFailure(hr, "Failed to write size of OnUnregisterComplete struct.");
4821
4822LExit:
4823 return hr;
4824}
4825
4826static HRESULT ParseArgsAndResults(
4827 __in_bcount(cbData) LPCBYTE pbData,
4828 __in SIZE_T cbData,
4829 __in BUFF_READER* pBufferArgs,
4830 __in BUFF_READER* pBufferResults
4831)
4832{
4833 HRESULT hr = S_OK;
4834 SIZE_T iData = 0;
4835 DWORD dw = 0;
4836
4837 // Get the args reader size and point to the data just after the size.
4838 hr = BuffReadNumber(pbData, cbData, &iData, &dw);
4839 ExitOnFailure(hr, "Failed to parse size of args");
4840
4841 pBufferArgs->pbData = pbData + iData;
4842 pBufferArgs->cbData = dw;
4843 pBufferArgs->iBuffer = 0;
4844
4845 // Get the results reader size and point to the data just after the size.
4846 hr = ::SIZETAdd(iData, dw, &iData);
4847 ExitOnFailure(hr, "Failed to advance index beyond args");
4848
4849 hr = BuffReadNumber(pbData, cbData, &iData, &dw);
4850 ExitOnFailure(hr, "Failed to parse size of results");
4851
4852 pBufferResults->pbData = pbData + iData;
4853 pBufferResults->cbData = dw;
4854 pBufferResults->iBuffer = 0;
4855
4856LExit:
4857 return hr;
4858}
4859
4860static HRESULT ProcessMessage(
4861 __in PIPE_RPC_HANDLE* phRpcPipe,
4862 __in IBootstrapperApplication* pApplication,
4863 __in IBootstrapperEngine* pEngine,
4864 __in BOOTSTRAPPER_APPLICATION_MESSAGE messageType,
4865 __in_bcount(cbData) LPCBYTE pbData,
4866 __in SIZE_T cbData
4867 )
4868{
4869 HRESULT hr = S_OK;
4870 BUFF_READER readerArgs = { };
4871 BUFF_READER readerResults = { };
4872 BUFF_BUFFER bufferResponse = { };
4873
4874 hr = ParseArgsAndResults(pbData, cbData, &readerArgs, &readerResults);
4875 if (SUCCEEDED(hr))
4876 {
4877 switch (messageType)
4878 {
4879 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCREATE:
4880 hr = OnCreate(pApplication, pEngine, &readerArgs, &readerResults, &bufferResponse);
4881 break;
4882
4883 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDESTROY:
4884 hr = OnDestroy(pApplication, &readerArgs, &readerResults, &bufferResponse);
4885 break;
4886
4887 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP:
4888 hr = OnStartup(pApplication, &readerArgs, &readerResults, &bufferResponse);
4889 break;
4890
4891 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN:
4892 hr = OnShutdown(pApplication, &readerArgs, &readerResults, &bufferResponse);
4893 break;
4894
4895 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN:
4896 hr = OnDetectBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
4897 break;
4898
4899 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE:
4900 hr = OnDetectComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
4901 break;
4902
4903 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE:
4904 hr = OnDetectForwardCompatibleBundle(pApplication, &readerArgs, &readerResults, &bufferResponse);
4905 break;
4906
4907 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE:
4908 hr = OnDetectMsiFeature(pApplication, &readerArgs, &readerResults, &bufferResponse);
4909 break;
4910
4911 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE:
4912 hr = OnDetectRelatedBundle(pApplication, &readerArgs, &readerResults, &bufferResponse);
4913 break;
4914
4915 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN:
4916 hr = OnDetectPackageBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
4917 break;
4918
4919 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE:
4920 hr = OnDetectPackageComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
4921 break;
4922
4923 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE:
4924 hr = OnDetectRelatedMsiPackage(pApplication, &readerArgs, &readerResults, &bufferResponse);
4925 break;
4926
4927 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET:
4928 hr = OnDetectPatchTarget(pApplication, &readerArgs, &readerResults, &bufferResponse);
4929 break;
4930
4931 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN:
4932 hr = OnDetectUpdateBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
4933 break;
4934
4935 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE:
4936 hr = OnDetectUpdate(pApplication, &readerArgs, &readerResults, &bufferResponse);
4937 break;
4938
4939 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE:
4940 hr = OnDetectUpdateComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
4941 break;
4942
4943 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN:
4944 hr = OnPlanBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
4945 break;
4946
4947 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE:
4948 hr = OnPlanComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
4949 break;
4950
4951 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE:
4952 hr = OnPlanMsiFeature(pApplication, &readerArgs, &readerResults, &bufferResponse);
4953 break;
4954
4955 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN:
4956 hr = OnPlanPackageBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
4957 break;
4958
4959 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE:
4960 hr = OnPlanPackageComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
4961 break;
4962
4963 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET:
4964 hr = OnPlanPatchTarget(pApplication, &readerArgs, &readerResults, &bufferResponse);
4965 break;
4966
4967 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE:
4968 hr = OnPlanRelatedBundle(pApplication, &readerArgs, &readerResults, &bufferResponse);
4969 break;
4970
4971 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN:
4972 hr = OnApplyBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
4973 break;
4974
4975 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN:
4976 hr = OnElevateBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
4977 break;
4978
4979 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE:
4980 hr = OnElevateComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
4981 break;
4982
4983 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS:
4984 hr = OnProgress(pApplication, &readerArgs, &readerResults, &bufferResponse);
4985 break;
4986
4987 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR:
4988 hr = OnError(pApplication, &readerArgs, &readerResults, &bufferResponse);
4989 break;
4990
4991 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN:
4992 hr = OnRegisterBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
4993 break;
4994
4995 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE:
4996 hr = OnRegisterComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
4997 break;
4998
4999 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN:
5000 hr = OnCacheBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5001 break;
5002
5003 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN:
5004 hr = OnCachePackageBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5005 break;
5006
5007 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN:
5008 hr = OnCacheAcquireBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5009 break;
5010
5011 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS:
5012 hr = OnCacheAcquireProgress(pApplication, &readerArgs, &readerResults, &bufferResponse);
5013 break;
5014
5015 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING:
5016 hr = OnCacheAcquireResolving(pApplication, &readerArgs, &readerResults, &bufferResponse);
5017 break;
5018
5019 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE:
5020 hr = OnCacheAcquireComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5021 break;
5022
5023 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN:
5024 hr = OnCacheVerifyBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5025 break;
5026
5027 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE:
5028 hr = OnCacheVerifyComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5029 break;
5030
5031 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE:
5032 hr = OnCachePackageComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5033 break;
5034
5035 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE:
5036 hr = OnCacheComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5037 break;
5038
5039 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN:
5040 hr = OnExecuteBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5041 break;
5042
5043 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN:
5044 hr = OnExecutePackageBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5045 break;
5046
5047 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET:
5048 hr = OnExecutePatchTarget(pApplication, &readerArgs, &readerResults, &bufferResponse);
5049 break;
5050
5051 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS:
5052 hr = OnExecuteProgress(pApplication, &readerArgs, &readerResults, &bufferResponse);
5053 break;
5054
5055 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE:
5056 hr = OnExecuteMsiMessage(pApplication, &readerArgs, &readerResults, &bufferResponse);
5057 break;
5058
5059 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE:
5060 hr = OnExecuteFilesInUse(pApplication, &readerArgs, &readerResults, &bufferResponse);
5061 break;
5062
5063 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE:
5064 hr = OnExecutePackageComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5065 break;
5066
5067 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE:
5068 hr = OnExecuteComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5069 break;
5070
5071 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN:
5072 hr = OnUnregisterBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5073 break;
5074
5075 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE:
5076 hr = OnUnregisterComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5077 break;
5078
5079 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE:
5080 hr = OnApplyComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5081 break;
5082
5083 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN:
5084 hr = OnLaunchApprovedExeBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5085 break;
5086
5087 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE:
5088 hr = OnLaunchApprovedExeComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5089 break;
5090
5091 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE:
5092 hr = OnPlanMsiPackage(pApplication, &readerArgs, &readerResults, &bufferResponse);
5093 break;
5094
5095 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN:
5096 hr = OnBeginMsiTransactionBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5097 break;
5098
5099 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE:
5100 hr = OnBeginMsiTransactionComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5101 break;
5102
5103 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN:
5104 hr = OnCommitMsiTransactionBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5105 break;
5106
5107 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE:
5108 hr = OnCommitMsiTransactionComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5109 break;
5110
5111 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN:
5112 hr = OnRollbackMsiTransactionBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5113 break;
5114
5115 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE:
5116 hr = OnRollbackMsiTransactionComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5117 break;
5118
5119 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN:
5120 hr = OnPauseAutomaticUpdatesBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5121 break;
5122
5123 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE:
5124 hr = OnPauseAutomaticUpdatesComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5125 break;
5126
5127 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN:
5128 hr = OnSystemRestorePointBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5129 break;
5130
5131 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE:
5132 hr = OnSystemRestorePointComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5133 break;
5134
5135 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE:
5136 hr = OnPlannedPackage(pApplication, &readerArgs, &readerResults, &bufferResponse);
5137 break;
5138
5139 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE:
5140 hr = OnPlanForwardCompatibleBundle(pApplication, &readerArgs, &readerResults, &bufferResponse);
5141 break;
5142
5143 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS:
5144 hr = OnCacheVerifyProgress(pApplication, &readerArgs, &readerResults, &bufferResponse);
5145 break;
5146
5147 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN:
5148 hr = OnCacheContainerOrPayloadVerifyBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5149 break;
5150
5151 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE:
5152 hr = OnCacheContainerOrPayloadVerifyComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5153 break;
5154
5155 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS:
5156 hr = OnCacheContainerOrPayloadVerifyProgress(pApplication, &readerArgs, &readerResults, &bufferResponse);
5157 break;
5158
5159 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN:
5160 hr = OnCachePayloadExtractBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5161 break;
5162
5163 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE:
5164 hr = OnCachePayloadExtractComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5165 break;
5166
5167 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS:
5168 hr = OnCachePayloadExtractProgress(pApplication, &readerArgs, &readerResults, &bufferResponse);
5169 break;
5170
5171 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY:
5172 hr = OnPlanRollbackBoundary(pApplication, &readerArgs, &readerResults, &bufferResponse);
5173 break;
5174
5175 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE:
5176 hr = OnDetectCompatibleMsiPackage(pApplication, &readerArgs, &readerResults, &bufferResponse);
5177 break;
5178
5179 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN:
5180 hr = OnPlanCompatibleMsiPackageBegin(pApplication, &readerArgs, &readerResults, &bufferResponse);
5181 break;
5182
5183 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE:
5184 hr = OnPlanCompatibleMsiPackageComplete(pApplication, &readerArgs, &readerResults, &bufferResponse);
5185 break;
5186
5187 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE:
5188 hr = OnPlannedCompatiblePackage(pApplication, &readerArgs, &readerResults, &bufferResponse);
5189 break;
5190
5191 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE:
5192 hr = OnPlanRestoreRelatedBundle(pApplication, &readerArgs, &readerResults, &bufferResponse);
5193 break;
5194
5195 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE:
5196 hr = OnPlanRelatedBundleType(pApplication, &readerArgs, &readerResults, &bufferResponse);
5197 break;
5198
5199 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE:
5200 hr = OnApplyDowngrade(pApplication, &readerArgs, &readerResults, &bufferResponse);
5201 break;
5202
5203 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROCESSCANCEL:
5204 hr = OnExecuteProcessCancel(pApplication, &readerArgs, &readerResults, &bufferResponse);
5205 break;
5206
5207 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE:
5208 hr = OnDetectRelatedBundlePackage(pApplication, &readerArgs, &readerResults, &bufferResponse);
5209 break;
5210
5211 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE:
5212 hr = OnCachePackageNonVitalValidationFailure(pApplication, &readerArgs, &readerResults, &bufferResponse);
5213 break;
5214
5215 default:
5216 hr = E_NOTIMPL;
5217 break;
5218 // BalExitWithRootFailure(hr, E_NOTIMPL, "Unknown message type %d sent to bootstrapper application.", messageType)
5219 }
5220 }
5221
5222 hr = PipeRpcResponse(phRpcPipe, messageType, hr, bufferResponse.pbData, bufferResponse.cbData);
5223 BalExitOnFailure(hr, "Failed to send bootstrapper application callback result to engine.");
5224
5225LExit:
5226 ReleaseBuffer(bufferResponse);
5227
5228 return hr;
5229}
5230
5231EXTERN_C HRESULT MsgPump(
5232 __in HANDLE hPipe,
5233 __in IBootstrapperApplication* pApplication,
5234 __in IBootstrapperEngine* pEngine
5235 )
5236{
5237 HRESULT hr = S_OK;
5238 PIPE_RPC_HANDLE hRpcPipe = { INVALID_HANDLE_VALUE };
5239 PIPE_MESSAGE msg = { };
5240
5241 PipeRpcInitialize(&hRpcPipe, hPipe, FALSE);
5242
5243 // Pump messages sent to bootstrapper application until the pipe is closed.
5244 while (S_OK == (hr = PipeRpcReadMessage(&hRpcPipe, &msg)))
5245 {
5246 ProcessMessage(&hRpcPipe, pApplication, pEngine, static_cast<BOOTSTRAPPER_APPLICATION_MESSAGE>(msg.dwMessageType), reinterpret_cast<LPCBYTE>(msg.pvData), msg.cbData);
5247
5248 ReleasePipeMessage(&msg);
5249 }
5250 BalExitOnFailure(hr, "Failed to get message over bootstrapper application pipe");
5251
5252 if (S_FALSE == hr)
5253 {
5254 hr = S_OK;
5255 }
5256
5257LExit:
5258 ReleasePipeMessage(&msg);
5259
5260 PipeRpcUninitiailize(&hRpcPipe);
5261
5262 return hr;
5263}
diff --git a/src/api/burn/balutil/msg.h b/src/api/burn/balutil/msg.h
new file mode 100644
index 00000000..ae8a60c1
--- /dev/null
+++ b/src/api/burn/balutil/msg.h
@@ -0,0 +1,8 @@
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
4EXTERN_C HRESULT MsgPump(
5 __in HANDLE hPipe,
6 __in IBootstrapperApplication* pApplication,
7 __in IBootstrapperEngine* pEngine
8 );
diff --git a/src/api/burn/balutil/precomp.h b/src/api/burn/balutil/precomp.h
index 64d4a6cf..ace4f3ec 100644
--- a/src/api/burn/balutil/precomp.h
+++ b/src/api/burn/balutil/precomp.h
@@ -13,20 +13,25 @@
13#include <msi.h> 13#include <msi.h>
14#include <wininet.h> 14#include <wininet.h>
15#include <CommCtrl.h> 15#include <CommCtrl.h>
16#include <intsafe.h>
16#include <strsafe.h> 17#include <strsafe.h>
17 18
18#include <dutil.h> 19#include <dutil.h>
19#include <apputil.h> 20#include <apputil.h>
21#include <buffutil.h>
20#include <pathutil.h> 22#include <pathutil.h>
21#include <locutil.h> 23#include <locutil.h>
22#include <memutil.h> 24#include <memutil.h>
23#include <dictutil.h> 25#include <dictutil.h>
26#include <fileutil.h>
27#include <pipeutil.h>
28#include <regutil.h>
24#include <strutil.h> 29#include <strutil.h>
25#include <thmutil.h> 30#include <thmutil.h>
26#include <xmlutil.h> 31#include <xmlutil.h>
27 32
28#include <BootstrapperEngine.h> 33#include <baenginetypes.h>
29#include <BootstrapperApplication.h> 34#include <batypes.h>
30 35
31#include "IBootstrapperEngine.h" 36#include "IBootstrapperEngine.h"
32#include "IBootstrapperApplication.h" 37#include "IBootstrapperApplication.h"
@@ -39,3 +44,6 @@
39#include "balcondition.h" 44#include "balcondition.h"
40#include "balinfo.h" 45#include "balinfo.h"
41#include "balretry.h" 46#include "balretry.h"
47
48#include "BalBaseBAFunctionsProc.h"
49#include "msg.h"
diff --git a/src/api/burn/mbanative/mbanative.cpp b/src/api/burn/mbanative/mbanative.cpp
deleted file mode 100644
index 98ea3c30..00000000
--- a/src/api/burn/mbanative/mbanative.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
1// 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.
2
3#include "precomp.h"
4#include "BalBaseBootstrapperApplicationProc.h"
5
6extern "C" HRESULT WINAPI InitializeFromCreateArgs(
7 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
8 __inout BOOTSTRAPPER_COMMAND* pCommand,
9 __out IBootstrapperEngine** ppEngine
10 )
11{
12 HRESULT hr = S_OK;
13
14 hr = BalInitializeFromCreateArgs(pArgs, ppEngine);
15 ExitOnFailure(hr, "Failed to initialize Bal.");
16
17 memcpy_s(pCommand, pCommand->cbSize, pArgs->pCommand, min(pArgs->pCommand->cbSize, pCommand->cbSize));
18LExit:
19 return hr;
20}
21
22extern "C" void WINAPI StoreBAInCreateResults(
23 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults,
24 __in IBootstrapperApplication* pBA
25 )
26{
27 pResults->pfnBootstrapperApplicationProc = BalBaseBootstrapperApplicationProc;
28 pResults->pvBootstrapperApplicationProcContext = pBA;
29}
diff --git a/src/api/burn/mbanative/mbanative.def b/src/api/burn/mbanative/mbanative.def
index b7a858df..bd013699 100644
--- a/src/api/burn/mbanative/mbanative.def
+++ b/src/api/burn/mbanative/mbanative.def
@@ -8,8 +8,8 @@ EXPORTS
8 BalGetVersionVariableFromEngine 8 BalGetVersionVariableFromEngine
9 BalGetRelatedBundleVariableFromEngine 9 BalGetRelatedBundleVariableFromEngine
10 BalVariableExistsFromEngine 10 BalVariableExistsFromEngine
11 InitializeFromCreateArgs 11 BootstrapperApplicationDebuggerCheck
12 StoreBAInCreateResults 12 BootstrapperApplicationRun
13 StrFree 13 StrFree
14 VerCompareParsedVersions 14 VerCompareParsedVersions
15 VerCompareStringVersions 15 VerCompareStringVersions
diff --git a/src/api/burn/mbanative/mbanative.vcxproj b/src/api/burn/mbanative/mbanative.vcxproj
index 47d09591..a1f79f4d 100644
--- a/src/api/burn/mbanative/mbanative.vcxproj
+++ b/src/api/burn/mbanative/mbanative.vcxproj
@@ -46,7 +46,6 @@
46 </PropertyGroup> 46 </PropertyGroup>
47 47
48 <ItemGroup> 48 <ItemGroup>
49 <ClCompile Include="mbanative.cpp" />
50 <ClCompile Include="precomp.cpp"> 49 <ClCompile Include="precomp.cpp">
51 <PrecompiledHeader>Create</PrecompiledHeader> 50 <PrecompiledHeader>Create</PrecompiledHeader>
52 </ClCompile> 51 </ClCompile>
diff --git a/src/api/burn/mbanative/precomp.h b/src/api/burn/mbanative/precomp.h
index 2e2f3ff8..622f341a 100644
--- a/src/api/burn/mbanative/precomp.h
+++ b/src/api/burn/mbanative/precomp.h
@@ -8,8 +8,8 @@
8#include <dutil.h> 8#include <dutil.h>
9#include <verutil.h> 9#include <verutil.h>
10 10
11#include <BootstrapperEngine.h> 11// #include <BootstrapperEngine.h>
12#include <BootstrapperApplication.h> 12// #include <BootstrapperApplication.h>
13 13
14#include <IBootstrapperEngine.h> 14#include <IBootstrapperEngine.h>
15#include <IBootstrapperApplication.h> 15#include <IBootstrapperApplication.h>
diff --git a/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp b/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp
index 2ae539ee..ba04c1bb 100644
--- a/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp
+++ b/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp
@@ -12,32 +12,30 @@ namespace BalUtilTests
12 public ref class BAFunctions 12 public ref class BAFunctions
13 { 13 {
14 public: 14 public:
15 [Fact] 15 [Fact(Skip = "Need a mock implementation of IBootstrapperEngine to test BAFunctions.")]
16 void CanCreateTestBAFunctions() 16 void CanCreateTestBAFunctions()
17 { 17 {
18 HRESULT hr = S_OK; 18 HRESULT hr = S_OK;
19 BOOTSTRAPPER_CREATE_ARGS bootstrapperArgs = { };
20 BOOTSTRAPPER_COMMAND bootstrapperCommand = { };
21 BA_FUNCTIONS_CREATE_ARGS args = { }; 19 BA_FUNCTIONS_CREATE_ARGS args = { };
22 BA_FUNCTIONS_CREATE_RESULTS results = { }; 20 BA_FUNCTIONS_CREATE_RESULTS results = { };
23 IBootstrapperEngine* pEngine = NULL; 21 IBootstrapperEngine* pEngine = NULL;
22 BOOTSTRAPPER_COMMAND command = { };
24 IBAFunctions* pBAFunctions = NULL; 23 IBAFunctions* pBAFunctions = NULL;
25 24
26 bootstrapperArgs.cbSize = sizeof(bootstrapperArgs);
27 bootstrapperArgs.pCommand = &bootstrapperCommand;
28
29 args.cbSize = sizeof(args); 25 args.cbSize = sizeof(args);
30 args.pBootstrapperCreateArgs = &bootstrapperArgs; 26 args.pEngine = pEngine;
27 args.pCommand = &command;
31 28
32 results.cbSize = sizeof(results); 29 results.cbSize = sizeof(results);
33 30
34 try 31 try
35 { 32 {
36 hr = BalInitializeFromCreateArgs(&bootstrapperArgs, &pEngine); 33 BalInitialize(pEngine);
37 NativeAssert::Succeeded(hr, "Failed to create engine.");
38 34
39 hr = CreateBAFunctions(NULL, pEngine, &args, &results, &pBAFunctions); 35 hr = CreateBAFunctions(NULL, &args, &results);
40 NativeAssert::Succeeded(hr, "Failed to create BAFunctions."); 36 NativeAssert::Succeeded(hr, "Failed to create BAFunctions.");
37
38 pBAFunctions = reinterpret_cast<IBAFunctions*>(results.pvBAFunctionsProcContext);
41 } 39 }
42 finally 40 finally
43 { 41 {
diff --git a/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp b/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp
index 70b01a42..9a68c738 100644
--- a/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp
+++ b/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp
@@ -12,28 +12,21 @@ namespace BalUtilTests
12 public ref class BootstrapperApplication 12 public ref class BootstrapperApplication
13 { 13 {
14 public: 14 public:
15 [Fact] 15 [Fact(Skip = "Need a mock implementation of IBootstrapperEngine to test BootstrapperApplication.")]
16 void CanCreateTestBootstrapperApplication() 16 void CanCreateTestBootstrapperApplication()
17 { 17 {
18 HRESULT hr = S_OK; 18 HRESULT hr = S_OK;
19 BOOTSTRAPPER_CREATE_ARGS args = { };
20 BOOTSTRAPPER_COMMAND command = { };
21 BOOTSTRAPPER_CREATE_RESULTS results = { };
22 IBootstrapperEngine* pEngine = NULL;
23 IBootstrapperApplication* pApplication = NULL; 19 IBootstrapperApplication* pApplication = NULL;
24 20 IBootstrapperEngine* pEngine = NULL;
25 args.cbSize = sizeof(args); 21 BOOTSTRAPPER_COMMAND command = { };
26 args.pCommand = &command;
27
28 results.cbSize = sizeof(results);
29 22
30 try 23 try
31 { 24 {
32 hr = BalInitializeFromCreateArgs(&args, &pEngine); 25 hr = CreateBootstrapperApplication(&pApplication);
33 NativeAssert::Succeeded(hr, "Failed to create engine.");
34
35 hr = CreateBootstrapperApplication(pEngine, &args, &results, &pApplication);
36 NativeAssert::Succeeded(hr, "Failed to create BootstrapperApplication."); 26 NativeAssert::Succeeded(hr, "Failed to create BootstrapperApplication.");
27
28 hr = pApplication->OnCreate(pEngine, &command);
29 NativeAssert::Succeeded(hr, "Failed to initialize BootstrapperApplication.");
37 } 30 }
38 finally 31 finally
39 { 32 {
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp
index 927a8d10..3e850442 100644
--- a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp
+++ b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp
@@ -8,34 +8,32 @@ class CTestBAFunctions : public CBalBaseBAFunctions
8{ 8{
9public: 9public:
10 CTestBAFunctions( 10 CTestBAFunctions(
11 __in HMODULE hModule, 11 __in HMODULE hModule
12 __in IBootstrapperEngine* pEngine, 12 ) : CBalBaseBAFunctions(hModule)
13 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs
14 ) : CBalBaseBAFunctions(hModule, pEngine, pArgs)
15 { 13 {
16 } 14 }
17}; 15};
18 16
19HRESULT CreateBAFunctions( 17HRESULT CreateBAFunctions(
20 __in HMODULE hModule, 18 __in HMODULE hModule,
21 __in IBootstrapperEngine* pEngine,
22 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, 19 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs,
23 __in BA_FUNCTIONS_CREATE_RESULTS* pResults, 20 __inout BA_FUNCTIONS_CREATE_RESULTS* pResults
24 __out IBAFunctions** ppApplication
25 ) 21 )
26{ 22{
27 HRESULT hr = S_OK; 23 HRESULT hr = S_OK;
28 CTestBAFunctions* pApplication = NULL; 24 CTestBAFunctions* pFunction = NULL;
29 25
30 pApplication = new CTestBAFunctions(hModule, pEngine, pArgs); 26 pFunction = new CTestBAFunctions(hModule);
31 ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bafunctions object."); 27 ExitOnNull(pFunction, hr, E_OUTOFMEMORY, "Failed to create new test bafunctions object.");
28
29 hr = pFunction->OnCreate(pArgs->pEngine, pArgs->pCommand);
30 ExitOnFailure(hr, "Failed to initialize new test bafunctions.");
32 31
33 pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; 32 pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc;
34 pResults->pvBAFunctionsProcContext = pApplication; 33 pResults->pvBAFunctionsProcContext = pFunction;
35 *ppApplication = pApplication; 34 pFunction = NULL;
36 pApplication = NULL;
37 35
38LExit: 36LExit:
39 ReleaseObject(pApplication); 37 ReleaseObject(pFunction);
40 return hr; 38 return hr;
41} 39}
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h
index 41f36df8..e25e40c3 100644
--- a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h
+++ b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h
@@ -3,8 +3,6 @@
3 3
4HRESULT CreateBAFunctions( 4HRESULT CreateBAFunctions(
5 __in HMODULE hModule, 5 __in HMODULE hModule,
6 __in IBootstrapperEngine* pEngine,
7 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, 6 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs,
8 __in BA_FUNCTIONS_CREATE_RESULTS* pResults, 7 __inout BA_FUNCTIONS_CREATE_RESULTS* pResults
9 __out IBAFunctions** ppApplication
10 ); 8 );
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp
index daa1d690..b345ab9f 100644
--- a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp
+++ b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp
@@ -2,36 +2,25 @@
2 2
3#include "precomp.h" 3#include "precomp.h"
4#include "BalBaseBootstrapperApplication.h" 4#include "BalBaseBootstrapperApplication.h"
5#include "BalBaseBootstrapperApplicationProc.h"
6 5
7class CTestBootstrapperApplication : public CBalBaseBootstrapperApplication 6class CTestBootstrapperApplication : public CBalBaseBootstrapperApplication
8{ 7{
9public: 8public:
10 CTestBootstrapperApplication( 9 CTestBootstrapperApplication() : CBalBaseBootstrapperApplication()
11 __in IBootstrapperEngine* pEngine
12 ) : CBalBaseBootstrapperApplication(pEngine)
13 { 10 {
14 } 11 }
15}; 12};
16 13
17HRESULT CreateBootstrapperApplication( 14HRESULT CreateBootstrapperApplication(
18 __in IBootstrapperEngine* pEngine,
19 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
20 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults,
21 __out IBootstrapperApplication** ppApplication 15 __out IBootstrapperApplication** ppApplication
22 ) 16 )
23{ 17{
24 HRESULT hr = S_OK; 18 HRESULT hr = S_OK;
25 CTestBootstrapperApplication* pApplication = NULL; 19 CTestBootstrapperApplication* pApplication = NULL;
26 20
27 pApplication = new CTestBootstrapperApplication(pEngine); 21 pApplication = new CTestBootstrapperApplication();
28 ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bootstrapper application object."); 22 ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bootstrapper application object.");
29 23
30 hr = pApplication->Initialize(pArgs);
31 ExitOnFailure(hr, "CTestBootstrapperApplication initialization failed.");
32
33 pResults->pfnBootstrapperApplicationProc = BalBaseBootstrapperApplicationProc;
34 pResults->pvBootstrapperApplicationProcContext = pApplication;
35 *ppApplication = pApplication; 24 *ppApplication = pApplication;
36 pApplication = NULL; 25 pApplication = NULL;
37 26
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h
index c173e9ee..313bfede 100644
--- a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h
+++ b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h
@@ -2,8 +2,5 @@
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. 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 3
4HRESULT CreateBootstrapperApplication( 4HRESULT CreateBootstrapperApplication(
5 __in IBootstrapperEngine* pEngine,
6 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
7 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults,
8 __out IBootstrapperApplication** ppApplication 5 __out IBootstrapperApplication** ppApplication
9 ); 6 );
diff --git a/src/api/burn/test/BalUtilUnitTest/precomp.h b/src/api/burn/test/BalUtilUnitTest/precomp.h
index 218cab68..57487bc5 100644
--- a/src/api/burn/test/BalUtilUnitTest/precomp.h
+++ b/src/api/burn/test/BalUtilUnitTest/precomp.h
@@ -15,8 +15,8 @@
15#include <dutil.h> 15#include <dutil.h>
16#include <dictutil.h> 16#include <dictutil.h>
17 17
18#include <BootstrapperEngine.h> 18#include <baenginetypes.h>
19#include <BootstrapperApplication.h> 19#include <batypes.h>
20 20
21#include <BAFunctions.h> 21#include <BAFunctions.h>
22#include <IBootstrapperEngine.h> 22#include <IBootstrapperEngine.h>
diff --git a/src/api/burn/test/WixToolsetTest.Mba.Core/BaseBootstrapperApplicationFactoryFixture.cs b/src/api/burn/test/WixToolsetTest.Mba.Core/BaseBootstrapperApplicationFactoryFixture.cs
deleted file mode 100644
index 7074c166..00000000
--- a/src/api/burn/test/WixToolsetTest.Mba.Core/BaseBootstrapperApplicationFactoryFixture.cs
+++ /dev/null
@@ -1,141 +0,0 @@
1// 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.
2
3namespace WixToolsetTest.Mba.Core
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Runtime.InteropServices;
8 using WixInternal.TestSupport;
9 using WixToolset.Mba.Core;
10 using Xunit;
11
12 public class BaseBootstrapperApplicationFactoryFixture
13 {
14 [Fact]
15 public void CanCreateBA()
16 {
17 var command = new TestCommand
18 {
19 action = LaunchAction.Install,
20 cbSize = Marshal.SizeOf(typeof(TestCommand)),
21 display = Display.Full,
22 wzCommandLine = "this \"is a\" test VariableA=AVariable =EmptyName EmptyValue=",
23 };
24 var pCommand = Marshal.AllocHGlobal(command.cbSize);
25 try
26 {
27 Marshal.StructureToPtr(command, pCommand, false);
28 var createArgs = new BootstrapperCreateArgs(0, IntPtr.Zero, IntPtr.Zero, pCommand);
29 var pArgs = Marshal.AllocHGlobal(createArgs.cbSize);
30 try
31 {
32 Marshal.StructureToPtr(createArgs, pArgs, false);
33 var createResults = new TestCreateResults
34 {
35 cbSize = Marshal.SizeOf<TestCreateResults>(),
36 };
37 var pResults = Marshal.AllocHGlobal(createResults.cbSize);
38 try
39 {
40 var baFactory = new TestBAFactory();
41 baFactory.Create(pArgs, pResults);
42
43 createResults = Marshal.PtrToStructure<TestCreateResults>(pResults);
44 Assert.Equal(baFactory.BA, createResults.pBA);
45 Assert.Equal(baFactory.BA.Command.Action, command.action);
46 Assert.Equal(baFactory.BA.Command.Display, command.display);
47
48 var mbaCommand = baFactory.BA.Command.ParseCommandLine();
49 WixAssert.CompareLineByLine(mbaCommand.UnknownCommandLineArgs, new string[] { "this", "is a", "test" });
50 Assert.Equal(mbaCommand.Variables, new KeyValuePair<string, string>[]
51 {
52 new KeyValuePair<string, string>("VariableA", "AVariable"),
53 new KeyValuePair<string, string>("", "EmptyName"),
54 new KeyValuePair<string, string>("EmptyValue", ""),
55 });
56 }
57 finally
58 {
59 Marshal.FreeHGlobal(pResults);
60 }
61 }
62 finally
63 {
64 Marshal.FreeHGlobal(pArgs);
65 }
66 }
67 finally
68 {
69 Marshal.FreeHGlobal(pCommand);
70 }
71 }
72
73 internal class TestBAFactory : BaseBootstrapperApplicationFactory
74 {
75 public TestBA BA { get; private set; }
76
77 protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand)
78 {
79 this.BA = new TestBA(engine, bootstrapperCommand);
80 return this.BA;
81 }
82 }
83
84 internal class TestBA : BootstrapperApplication
85 {
86 public IBootstrapperCommand Command { get; }
87
88 public TestBA(IEngine engine, IBootstrapperCommand command)
89 : base(engine)
90 {
91 this.Command = command;
92 }
93
94 protected override void Run()
95 {
96 }
97 }
98
99 [StructLayout(LayoutKind.Sequential)]
100 public struct TestCommand
101 {
102 public int cbSize;
103 public LaunchAction action;
104 public Display display;
105 [MarshalAs(UnmanagedType.LPWStr)] public string wzCommandLine;
106 public int nCmdShow;
107 public ResumeType resume;
108 public IntPtr hwndSplashScreen;
109 public RelationType relation;
110 [MarshalAs(UnmanagedType.Bool)] public bool passthrough;
111 [MarshalAs(UnmanagedType.LPWStr)] public string wzLayoutDirectory;
112 }
113
114 [StructLayout(LayoutKind.Sequential)]
115 public struct BootstrapperCreateArgs
116 {
117 [MarshalAs(UnmanagedType.I4)] public readonly int cbSize;
118 [MarshalAs(UnmanagedType.I8)] public readonly long qwEngineAPIVersion;
119 public readonly IntPtr pfnBootstrapperEngineProc;
120 public readonly IntPtr pvBootstrapperEngineProcContext;
121 public readonly IntPtr pCommand;
122
123 public BootstrapperCreateArgs(long version, IntPtr pEngineProc, IntPtr pEngineContext, IntPtr pCommand)
124 {
125 this.cbSize = Marshal.SizeOf(typeof(BootstrapperCreateArgs));
126 this.qwEngineAPIVersion = version;
127 this.pfnBootstrapperEngineProc = pEngineProc;
128 this.pvBootstrapperEngineProcContext = pEngineContext;
129 this.pCommand = pCommand;
130 }
131 }
132
133 [StructLayout(LayoutKind.Sequential)]
134 public struct TestCreateResults
135 {
136 public int cbSize;
137 public IntPtr pBAProc;
138 [MarshalAs(UnmanagedType.Interface)] public IBootstrapperApplication pBA;
139 }
140 }
141}
diff --git a/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs b/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs
index 67c00431..688c34ed 100644
--- a/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs
+++ b/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs
@@ -550,8 +550,10 @@ namespace WixToolset.Data
550 case SymbolDefinitionType.WixBootstrapperApplication: 550 case SymbolDefinitionType.WixBootstrapperApplication:
551 return SymbolDefinitions.WixBootstrapperApplication; 551 return SymbolDefinitions.WixBootstrapperApplication;
552 552
553#pragma warning disable 612
553 case SymbolDefinitionType.WixBootstrapperApplicationDll: 554 case SymbolDefinitionType.WixBootstrapperApplicationDll:
554 return SymbolDefinitions.WixBootstrapperApplicationDll; 555 return SymbolDefinitions.WixBootstrapperApplicationDll;
556#pragma warning restore 612
555 557
556 case SymbolDefinitionType.WixBuildInfo: 558 case SymbolDefinitionType.WixBuildInfo:
557 return SymbolDefinitions.WixBuildInfo; 559 return SymbolDefinitions.WixBuildInfo;
diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationDllSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationDllSymbol.cs
index d3a66754..250028d0 100644
--- a/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationDllSymbol.cs
+++ b/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationDllSymbol.cs
@@ -2,10 +2,12 @@
2 2
3namespace WixToolset.Data 3namespace WixToolset.Data
4{ 4{
5 using System;
5 using WixToolset.Data.Symbols; 6 using WixToolset.Data.Symbols;
6 7
7 public static partial class SymbolDefinitions 8 public static partial class SymbolDefinitions
8 { 9 {
10 [Obsolete]
9 public static readonly IntermediateSymbolDefinition WixBootstrapperApplicationDll = new IntermediateSymbolDefinition( 11 public static readonly IntermediateSymbolDefinition WixBootstrapperApplicationDll = new IntermediateSymbolDefinition(
10 SymbolDefinitionType.WixBootstrapperApplicationDll, 12 SymbolDefinitionType.WixBootstrapperApplicationDll,
11 new IntermediateFieldDefinition[] 13 new IntermediateFieldDefinition[]
@@ -18,11 +20,14 @@ namespace WixToolset.Data
18 20
19namespace WixToolset.Data.Symbols 21namespace WixToolset.Data.Symbols
20{ 22{
23 using System;
24
21 public enum WixBootstrapperApplicationDllSymbolFields 25 public enum WixBootstrapperApplicationDllSymbolFields
22 { 26 {
23 DpiAwareness, 27 DpiAwareness,
24 } 28 }
25 29
30 [Obsolete]
26 public enum WixBootstrapperApplicationDpiAwarenessType 31 public enum WixBootstrapperApplicationDpiAwarenessType
27 { 32 {
28 Unaware, 33 Unaware,
@@ -32,6 +37,7 @@ namespace WixToolset.Data.Symbols
32 GdiScaled, 37 GdiScaled,
33 } 38 }
34 39
40 [Obsolete]
35 public class WixBootstrapperApplicationDllSymbol : IntermediateSymbol 41 public class WixBootstrapperApplicationDllSymbol : IntermediateSymbol
36 { 42 {
37 public WixBootstrapperApplicationDllSymbol() : base(SymbolDefinitions.WixBootstrapperApplicationDll, null, null) 43 public WixBootstrapperApplicationDllSymbol() : base(SymbolDefinitions.WixBootstrapperApplicationDll, null, null)
diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationSymbol.cs
index 3d7876fd..abef2cfc 100644
--- a/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationSymbol.cs
+++ b/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperApplicationSymbol.cs
@@ -10,6 +10,8 @@ namespace WixToolset.Data
10 SymbolDefinitionType.WixBootstrapperApplication, 10 SymbolDefinitionType.WixBootstrapperApplication,
11 new IntermediateFieldDefinition[] 11 new IntermediateFieldDefinition[]
12 { 12 {
13 new IntermediateFieldDefinition(nameof(WixBootstrapperApplicationSymbolFields.ExePayloadRef), IntermediateFieldType.String),
14 new IntermediateFieldDefinition(nameof(WixBootstrapperApplicationSymbolFields.Secondary), IntermediateFieldType.Number),
13 }, 15 },
14 typeof(WixBootstrapperApplicationSymbol)); 16 typeof(WixBootstrapperApplicationSymbol));
15 } 17 }
@@ -19,6 +21,8 @@ namespace WixToolset.Data.Symbols
19{ 21{
20 public enum WixBootstrapperApplicationSymbolFields 22 public enum WixBootstrapperApplicationSymbolFields
21 { 23 {
24 ExePayloadRef,
25 Secondary
22 } 26 }
23 27
24 public class WixBootstrapperApplicationSymbol : IntermediateSymbol 28 public class WixBootstrapperApplicationSymbol : IntermediateSymbol
@@ -32,5 +36,17 @@ namespace WixToolset.Data.Symbols
32 } 36 }
33 37
34 public IntermediateField this[WixBootstrapperApplicationSymbolFields index] => this.Fields[(int)index]; 38 public IntermediateField this[WixBootstrapperApplicationSymbolFields index] => this.Fields[(int)index];
39
40 public string ExePayloadRef
41 {
42 get => (string)this.Fields[(int)WixBootstrapperApplicationSymbolFields.ExePayloadRef];
43 set => this.Set((int)WixBootstrapperApplicationSymbolFields.ExePayloadRef, value);
44 }
45
46 public bool? Secondary
47 {
48 get => (bool?)this.Fields[(int)WixBootstrapperApplicationSymbolFields.Secondary];
49 set => this.Set((int)WixBootstrapperApplicationSymbolFields.Secondary, value);
50 }
35 } 51 }
36} 52}
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs b/src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs
index 2de9c028..cc4f6963 100644
--- a/src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs
+++ b/src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs
@@ -2,13 +2,29 @@
2 2
3namespace WixToolset.Extensibility.Data 3namespace WixToolset.Extensibility.Data
4{ 4{
5#pragma warning disable 1591 // TODO: add documentation 5 using WixToolset.Data;
6
7 /// <summary>
8 /// Interface used to by extensions to define a component key path or
9 /// (non-intuitively) the executable payload for a the bootstrapper application.
10 /// </summary>
6 public interface IComponentKeyPath 11 public interface IComponentKeyPath
7 { 12 {
13 /// <summary>
14 /// Indicates whether the key path was specified explicitly.
15 /// </summary>
8 bool Explicit { get; set; } 16 bool Explicit { get; set; }
9 17
10 string Id { get; set; } 18 /// <summary>
19 /// Gets or sets the key path or executable payload identifier.
20 /// </summary>
21 Identifier Id { get; set; }
11 22
23 /// <summary>
24 /// Gets or sets the key path type for the component or if the
25 /// executable payload for a bootstrapper application is provided
26 /// as a File.
27 /// </summary>
12 PossibleKeyPathType Type { get; set; } 28 PossibleKeyPathType Type { get; set; }
13 } 29 }
14} 30}