diff options
author | Rob Mensching <rob@firegiant.com> | 2021-04-22 17:06:54 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-04-29 16:36:06 -0700 |
commit | af10c45d7b3a44af0b461a557847fe03263dcc10 (patch) | |
tree | 6a5c1532304782c36ffe4200b38f3afb76789a43 /src/burn/engine/userexperience.cpp | |
parent | 9c2aed97299fb96aeee3f1471ce40225437aaecf (diff) | |
download | wix-af10c45d7b3a44af0b461a557847fe03263dcc10.tar.gz wix-af10c45d7b3a44af0b461a557847fe03263dcc10.tar.bz2 wix-af10c45d7b3a44af0b461a557847fe03263dcc10.zip |
Move burn into burn
Diffstat (limited to 'src/burn/engine/userexperience.cpp')
-rw-r--r-- | src/burn/engine/userexperience.cpp | 2653 |
1 files changed, 2653 insertions, 0 deletions
diff --git a/src/burn/engine/userexperience.cpp b/src/burn/engine/userexperience.cpp new file mode 100644 index 00000000..2215a070 --- /dev/null +++ b/src/burn/engine/userexperience.cpp | |||
@@ -0,0 +1,2653 @@ | |||
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 | |||
5 | // internal function declarations | ||
6 | |||
7 | static int FilterResult( | ||
8 | __in DWORD dwAllowedResults, | ||
9 | __in int nResult | ||
10 | ); | ||
11 | |||
12 | static HRESULT FilterExecuteResult( | ||
13 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
14 | __in HRESULT hrStatus, | ||
15 | __in BOOL fRollback, | ||
16 | __in BOOL fCancel, | ||
17 | __in LPCWSTR sczEventName | ||
18 | ); | ||
19 | |||
20 | static HRESULT SendBAMessage( | ||
21 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
22 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
23 | __in const LPVOID pvArgs, | ||
24 | __inout LPVOID pvResults | ||
25 | ); | ||
26 | |||
27 | static HRESULT SendBAMessageFromInactiveEngine( | ||
28 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
29 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
30 | __in const LPVOID pvArgs, | ||
31 | __inout LPVOID pvResults | ||
32 | ); | ||
33 | |||
34 | |||
35 | // function definitions | ||
36 | |||
37 | /******************************************************************* | ||
38 | UserExperienceParseFromXml - | ||
39 | |||
40 | *******************************************************************/ | ||
41 | extern "C" HRESULT UserExperienceParseFromXml( | ||
42 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
43 | __in IXMLDOMNode* pixnBundle | ||
44 | ) | ||
45 | { | ||
46 | HRESULT hr = S_OK; | ||
47 | IXMLDOMNode* pixnUserExperienceNode = NULL; | ||
48 | |||
49 | // select UX node | ||
50 | hr = XmlSelectSingleNode(pixnBundle, L"UX", &pixnUserExperienceNode); | ||
51 | if (S_FALSE == hr) | ||
52 | { | ||
53 | hr = E_NOTFOUND; | ||
54 | } | ||
55 | ExitOnFailure(hr, "Failed to select user experience node."); | ||
56 | |||
57 | // parse splash screen | ||
58 | hr = XmlGetYesNoAttribute(pixnUserExperienceNode, L"SplashScreen", &pUserExperience->fSplashScreen); | ||
59 | if (E_NOTFOUND != hr) | ||
60 | { | ||
61 | ExitOnFailure(hr, "Failed to to get UX/@SplashScreen"); | ||
62 | } | ||
63 | |||
64 | // parse payloads | ||
65 | hr = PayloadsParseFromXml(&pUserExperience->payloads, NULL, NULL, pixnUserExperienceNode); | ||
66 | ExitOnFailure(hr, "Failed to parse user experience payloads."); | ||
67 | |||
68 | // make sure we have at least one payload | ||
69 | if (0 == pUserExperience->payloads.cPayloads) | ||
70 | { | ||
71 | hr = E_UNEXPECTED; | ||
72 | ExitOnFailure(hr, "Too few UX payloads."); | ||
73 | } | ||
74 | |||
75 | LExit: | ||
76 | ReleaseObject(pixnUserExperienceNode); | ||
77 | |||
78 | return hr; | ||
79 | } | ||
80 | |||
81 | /******************************************************************* | ||
82 | UserExperienceUninitialize - | ||
83 | |||
84 | *******************************************************************/ | ||
85 | extern "C" void UserExperienceUninitialize( | ||
86 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
87 | ) | ||
88 | { | ||
89 | ReleaseStr(pUserExperience->sczTempDirectory); | ||
90 | PayloadsUninitialize(&pUserExperience->payloads); | ||
91 | |||
92 | // clear struct | ||
93 | memset(pUserExperience, 0, sizeof(BURN_USER_EXPERIENCE)); | ||
94 | } | ||
95 | |||
96 | /******************************************************************* | ||
97 | UserExperienceLoad - | ||
98 | |||
99 | *******************************************************************/ | ||
100 | extern "C" HRESULT UserExperienceLoad( | ||
101 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
102 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | ||
103 | __in BOOTSTRAPPER_COMMAND* pCommand | ||
104 | ) | ||
105 | { | ||
106 | HRESULT hr = S_OK; | ||
107 | BOOTSTRAPPER_CREATE_ARGS args = { }; | ||
108 | BOOTSTRAPPER_CREATE_RESULTS results = { }; | ||
109 | |||
110 | args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS); | ||
111 | args.pCommand = pCommand; | ||
112 | args.pfnBootstrapperEngineProc = EngineForApplicationProc; | ||
113 | args.pvBootstrapperEngineProcContext = pEngineContext; | ||
114 | args.qwEngineAPIVersion = MAKEQWORDVERSION(2021, 4, 27, 0); | ||
115 | |||
116 | results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); | ||
117 | |||
118 | // Load BA DLL. | ||
119 | pUserExperience->hUXModule = ::LoadLibraryExW(pUserExperience->payloads.rgPayloads[0].sczLocalFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); | ||
120 | ExitOnNullWithLastError(pUserExperience->hUXModule, hr, "Failed to load BA DLL."); | ||
121 | |||
122 | // Get BootstrapperApplicationCreate entry-point. | ||
123 | PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(pUserExperience->hUXModule, "BootstrapperApplicationCreate"); | ||
124 | ExitOnNullWithLastError(pfnCreate, hr, "Failed to get BootstrapperApplicationCreate entry-point"); | ||
125 | |||
126 | // Create BA. | ||
127 | hr = pfnCreate(&args, &results); | ||
128 | ExitOnFailure(hr, "Failed to create BA."); | ||
129 | |||
130 | pUserExperience->pfnBAProc = results.pfnBootstrapperApplicationProc; | ||
131 | pUserExperience->pvBAProcContext = results.pvBootstrapperApplicationProcContext; | ||
132 | pUserExperience->fDisableUnloading = results.fDisableUnloading; | ||
133 | |||
134 | LExit: | ||
135 | return hr; | ||
136 | } | ||
137 | |||
138 | /******************************************************************* | ||
139 | UserExperienceUnload - | ||
140 | |||
141 | *******************************************************************/ | ||
142 | extern "C" HRESULT UserExperienceUnload( | ||
143 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
144 | ) | ||
145 | { | ||
146 | HRESULT hr = S_OK; | ||
147 | |||
148 | if (pUserExperience->hUXModule) | ||
149 | { | ||
150 | // Get BootstrapperApplicationDestroy entry-point and call it if it exists. | ||
151 | PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = (PFN_BOOTSTRAPPER_APPLICATION_DESTROY)::GetProcAddress(pUserExperience->hUXModule, "BootstrapperApplicationDestroy"); | ||
152 | if (pfnDestroy) | ||
153 | { | ||
154 | pfnDestroy(); | ||
155 | } | ||
156 | |||
157 | // Free BA DLL if it supports it. | ||
158 | if (!pUserExperience->fDisableUnloading && !::FreeLibrary(pUserExperience->hUXModule)) | ||
159 | { | ||
160 | hr = HRESULT_FROM_WIN32(::GetLastError()); | ||
161 | TraceError(hr, "Failed to unload BA DLL."); | ||
162 | } | ||
163 | pUserExperience->hUXModule = NULL; | ||
164 | } | ||
165 | |||
166 | //LExit: | ||
167 | return hr; | ||
168 | } | ||
169 | |||
170 | extern "C" HRESULT UserExperienceEnsureWorkingFolder( | ||
171 | __in LPCWSTR wzBundleId, | ||
172 | __deref_out_z LPWSTR* psczUserExperienceWorkingFolder | ||
173 | ) | ||
174 | { | ||
175 | HRESULT hr = S_OK; | ||
176 | LPWSTR sczWorkingFolder = NULL; | ||
177 | |||
178 | hr = CacheEnsureWorkingFolder(wzBundleId, &sczWorkingFolder); | ||
179 | ExitOnFailure(hr, "Failed to create working folder."); | ||
180 | |||
181 | hr = StrAllocFormatted(psczUserExperienceWorkingFolder, L"%ls%ls\\", sczWorkingFolder, L".ba"); | ||
182 | ExitOnFailure(hr, "Failed to calculate the bootstrapper application working path."); | ||
183 | |||
184 | hr = DirEnsureExists(*psczUserExperienceWorkingFolder, NULL); | ||
185 | ExitOnFailure(hr, "Failed create bootstrapper application working folder."); | ||
186 | |||
187 | LExit: | ||
188 | ReleaseStr(sczWorkingFolder); | ||
189 | |||
190 | return hr; | ||
191 | } | ||
192 | |||
193 | |||
194 | extern "C" HRESULT UserExperienceRemove( | ||
195 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
196 | ) | ||
197 | { | ||
198 | HRESULT hr = S_OK; | ||
199 | |||
200 | // Remove temporary UX directory | ||
201 | if (pUserExperience->sczTempDirectory) | ||
202 | { | ||
203 | hr = DirEnsureDeleteEx(pUserExperience->sczTempDirectory, DIR_DELETE_FILES | DIR_DELETE_RECURSE | DIR_DELETE_SCHEDULE); | ||
204 | TraceError(hr, "Could not delete bootstrapper application folder. Some files will be left in the temp folder."); | ||
205 | } | ||
206 | |||
207 | //LExit: | ||
208 | return hr; | ||
209 | } | ||
210 | |||
211 | extern "C" int UserExperienceSendError( | ||
212 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
213 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
214 | __in_z_opt LPCWSTR wzPackageId, | ||
215 | __in HRESULT hrCode, | ||
216 | __in_z_opt LPCWSTR wzError, | ||
217 | __in DWORD uiFlags, | ||
218 | __in int nRecommendation | ||
219 | ) | ||
220 | { | ||
221 | int nResult = nRecommendation; | ||
222 | DWORD dwCode = HRESULT_CODE(hrCode); | ||
223 | LPWSTR sczError = NULL; | ||
224 | |||
225 | // If no error string was provided, try to get the error string from the HRESULT. | ||
226 | if (!wzError) | ||
227 | { | ||
228 | if (SUCCEEDED(StrAllocFromError(&sczError, hrCode, NULL))) | ||
229 | { | ||
230 | wzError = sczError; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | UserExperienceOnError(pUserExperience, errorType, wzPackageId, dwCode, wzError, uiFlags, 0, NULL, &nResult); // ignore return value. | ||
235 | |||
236 | ReleaseStr(sczError); | ||
237 | return nResult; | ||
238 | } | ||
239 | |||
240 | extern "C" void UserExperienceActivateEngine( | ||
241 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
242 | ) | ||
243 | { | ||
244 | ::EnterCriticalSection(&pUserExperience->csEngineActive); | ||
245 | AssertSz(!pUserExperience->fEngineActive, "Engine should have been deactivated before activating it."); | ||
246 | pUserExperience->fEngineActive = TRUE; | ||
247 | ::LeaveCriticalSection(&pUserExperience->csEngineActive); | ||
248 | } | ||
249 | |||
250 | extern "C" void UserExperienceDeactivateEngine( | ||
251 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
252 | ) | ||
253 | { | ||
254 | ::EnterCriticalSection(&pUserExperience->csEngineActive); | ||
255 | AssertSz(pUserExperience->fEngineActive, "Engine should have been active before deactivating it."); | ||
256 | pUserExperience->fEngineActive = FALSE; | ||
257 | ::LeaveCriticalSection(&pUserExperience->csEngineActive); | ||
258 | } | ||
259 | |||
260 | extern "C" HRESULT UserExperienceEnsureEngineInactive( | ||
261 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
262 | ) | ||
263 | { | ||
264 | // Make a slight optimization here by ignoring the critical section, because all callers should have needed to enter it for their operation anyway. | ||
265 | HRESULT hr = pUserExperience->fEngineActive ? HRESULT_FROM_WIN32(ERROR_BUSY) : S_OK; | ||
266 | ExitOnRootFailure(hr, "Engine is active, cannot proceed."); | ||
267 | |||
268 | LExit: | ||
269 | return hr; | ||
270 | } | ||
271 | |||
272 | extern "C" void UserExperienceExecuteReset( | ||
273 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
274 | ) | ||
275 | { | ||
276 | pUserExperience->hrApplyError = S_OK; | ||
277 | pUserExperience->hwndApply = NULL; | ||
278 | } | ||
279 | |||
280 | extern "C" void UserExperienceExecutePhaseComplete( | ||
281 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
282 | __in HRESULT hrResult | ||
283 | ) | ||
284 | { | ||
285 | if (FAILED(hrResult)) | ||
286 | { | ||
287 | pUserExperience->hrApplyError = hrResult; | ||
288 | } | ||
289 | } | ||
290 | |||
291 | EXTERN_C BAAPI UserExperienceOnApplyBegin( | ||
292 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
293 | __in DWORD dwPhaseCount | ||
294 | ) | ||
295 | { | ||
296 | HRESULT hr = S_OK; | ||
297 | BA_ONAPPLYBEGIN_ARGS args = { }; | ||
298 | BA_ONAPPLYBEGIN_RESULTS results = { }; | ||
299 | |||
300 | args.cbSize = sizeof(args); | ||
301 | args.dwPhaseCount = dwPhaseCount; | ||
302 | |||
303 | results.cbSize = sizeof(results); | ||
304 | |||
305 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, &args, &results); | ||
306 | ExitOnFailure(hr, "BA OnApplyBegin failed."); | ||
307 | |||
308 | if (results.fCancel) | ||
309 | { | ||
310 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
311 | } | ||
312 | |||
313 | LExit: | ||
314 | return hr; | ||
315 | } | ||
316 | |||
317 | EXTERN_C BAAPI UserExperienceOnApplyComplete( | ||
318 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
319 | __in HRESULT hrStatus, | ||
320 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
321 | __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction | ||
322 | ) | ||
323 | { | ||
324 | HRESULT hr = S_OK; | ||
325 | BA_ONAPPLYCOMPLETE_ARGS args = { }; | ||
326 | BA_ONAPPLYCOMPLETE_RESULTS results = { }; | ||
327 | |||
328 | args.cbSize = sizeof(args); | ||
329 | args.hrStatus = hrStatus; | ||
330 | args.restart = restart; | ||
331 | args.recommendation = *pAction; | ||
332 | |||
333 | results.cbSize = sizeof(results); | ||
334 | results.action = *pAction; | ||
335 | |||
336 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, &args, &results); | ||
337 | ExitOnFailure(hr, "BA OnApplyComplete failed."); | ||
338 | |||
339 | *pAction = results.action; | ||
340 | |||
341 | LExit: | ||
342 | return hr; | ||
343 | } | ||
344 | |||
345 | EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionBegin( | ||
346 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
347 | __in LPCWSTR wzTransactionId | ||
348 | ) | ||
349 | { | ||
350 | HRESULT hr = S_OK; | ||
351 | BA_ONBEGINMSITRANSACTIONBEGIN_ARGS args = { }; | ||
352 | BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS results = { }; | ||
353 | |||
354 | args.cbSize = sizeof(args); | ||
355 | args.wzTransactionId = wzTransactionId; | ||
356 | |||
357 | results.cbSize = sizeof(results); | ||
358 | |||
359 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &args, &results); | ||
360 | ExitOnFailure(hr, "BA OnBeginMsiTransactionBegin failed."); | ||
361 | |||
362 | if (results.fCancel) | ||
363 | { | ||
364 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
365 | } | ||
366 | |||
367 | LExit: | ||
368 | return hr; | ||
369 | } | ||
370 | |||
371 | EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionComplete( | ||
372 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
373 | __in LPCWSTR wzTransactionId, | ||
374 | __in HRESULT hrStatus | ||
375 | ) | ||
376 | { | ||
377 | HRESULT hr = S_OK; | ||
378 | BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS args = { }; | ||
379 | BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS results = { }; | ||
380 | |||
381 | args.cbSize = sizeof(args); | ||
382 | args.wzTransactionId = wzTransactionId; | ||
383 | args.hrStatus = hrStatus; | ||
384 | |||
385 | results.cbSize = sizeof(results); | ||
386 | |||
387 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &args, &results); | ||
388 | ExitOnFailure(hr, "BA OnBeginMsiTransactionComplete failed."); | ||
389 | |||
390 | LExit: | ||
391 | return hr; | ||
392 | } | ||
393 | |||
394 | EXTERN_C BAAPI UserExperienceOnCacheAcquireBegin( | ||
395 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
396 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
397 | __in_z_opt LPCWSTR wzPayloadId, | ||
398 | __in_z LPWSTR* pwzSource, | ||
399 | __in_z LPWSTR* pwzDownloadUrl, | ||
400 | __in_z_opt LPCWSTR wzPayloadContainerId, | ||
401 | __out BOOTSTRAPPER_CACHE_OPERATION* pCacheOperation | ||
402 | ) | ||
403 | { | ||
404 | HRESULT hr = S_OK; | ||
405 | BA_ONCACHEACQUIREBEGIN_ARGS args = { }; | ||
406 | BA_ONCACHEACQUIREBEGIN_RESULTS results = { }; | ||
407 | *pCacheOperation = BOOTSTRAPPER_CACHE_OPERATION_NONE; | ||
408 | |||
409 | args.cbSize = sizeof(args); | ||
410 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
411 | args.wzPayloadId = wzPayloadId; | ||
412 | args.wzSource = *pwzSource; | ||
413 | args.wzDownloadUrl = *pwzDownloadUrl; | ||
414 | args.wzPayloadContainerId = wzPayloadContainerId; | ||
415 | args.recommendation = *pCacheOperation; | ||
416 | |||
417 | results.cbSize = sizeof(results); | ||
418 | results.action = *pCacheOperation; | ||
419 | |||
420 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, &args, &results); | ||
421 | ExitOnFailure(hr, "BA OnCacheAcquireBegin failed."); | ||
422 | |||
423 | if (results.fCancel) | ||
424 | { | ||
425 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
426 | } | ||
427 | else | ||
428 | { | ||
429 | // Verify the BA requested an action that is possible. | ||
430 | if (BOOTSTRAPPER_CACHE_OPERATION_DOWNLOAD == results.action && *pwzDownloadUrl && **pwzDownloadUrl || | ||
431 | BOOTSTRAPPER_CACHE_OPERATION_EXTRACT == results.action && wzPayloadContainerId || | ||
432 | BOOTSTRAPPER_CACHE_OPERATION_COPY == results.action || | ||
433 | BOOTSTRAPPER_CACHE_OPERATION_NONE == results.action) | ||
434 | { | ||
435 | *pCacheOperation = results.action; | ||
436 | } | ||
437 | } | ||
438 | |||
439 | LExit: | ||
440 | return hr; | ||
441 | } | ||
442 | |||
443 | EXTERN_C BAAPI UserExperienceOnCacheAcquireComplete( | ||
444 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
445 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
446 | __in_z_opt LPCWSTR wzPayloadId, | ||
447 | __in HRESULT hrStatus, | ||
448 | __inout BOOL* pfRetry | ||
449 | ) | ||
450 | { | ||
451 | HRESULT hr = S_OK; | ||
452 | BA_ONCACHEACQUIRECOMPLETE_ARGS args = { }; | ||
453 | BA_ONCACHEACQUIRECOMPLETE_RESULTS results = { }; | ||
454 | |||
455 | args.cbSize = sizeof(args); | ||
456 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
457 | args.wzPayloadId = wzPayloadId; | ||
458 | args.hrStatus = hrStatus; | ||
459 | args.recommendation = *pfRetry ? BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY : BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_NONE; | ||
460 | |||
461 | results.cbSize = sizeof(results); | ||
462 | results.action = args.recommendation; | ||
463 | |||
464 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, &args, &results); | ||
465 | ExitOnFailure(hr, "BA OnCacheAcquireComplete failed."); | ||
466 | |||
467 | if (FAILED(hrStatus)) | ||
468 | { | ||
469 | *pfRetry = BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY == results.action; | ||
470 | } | ||
471 | |||
472 | LExit: | ||
473 | return hr; | ||
474 | } | ||
475 | |||
476 | EXTERN_C BAAPI UserExperienceOnCacheAcquireProgress( | ||
477 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
478 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
479 | __in_z_opt LPCWSTR wzPayloadId, | ||
480 | __in DWORD64 dw64Progress, | ||
481 | __in DWORD64 dw64Total, | ||
482 | __in DWORD dwOverallPercentage | ||
483 | ) | ||
484 | { | ||
485 | HRESULT hr = S_OK; | ||
486 | BA_ONCACHEACQUIREPROGRESS_ARGS args = { }; | ||
487 | BA_ONCACHEACQUIREPROGRESS_RESULTS results = { }; | ||
488 | |||
489 | args.cbSize = sizeof(args); | ||
490 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
491 | args.wzPayloadId = wzPayloadId; | ||
492 | args.dw64Progress = dw64Progress; | ||
493 | args.dw64Total = dw64Total; | ||
494 | args.dwOverallPercentage = dwOverallPercentage; | ||
495 | |||
496 | results.cbSize = sizeof(results); | ||
497 | |||
498 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, &args, &results); | ||
499 | ExitOnFailure(hr, "BA OnCacheAcquireProgress failed."); | ||
500 | |||
501 | if (results.fCancel) | ||
502 | { | ||
503 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
504 | } | ||
505 | |||
506 | LExit: | ||
507 | return hr; | ||
508 | } | ||
509 | |||
510 | EXTERN_C BAAPI UserExperienceOnCacheAcquireResolving( | ||
511 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
512 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
513 | __in_z_opt LPCWSTR wzPayloadId, | ||
514 | __in_z LPWSTR* rgSearchPaths, | ||
515 | __in DWORD cSearchPaths, | ||
516 | __in BOOL fFoundLocal, | ||
517 | __in DWORD* pdwChosenSearchPath, | ||
518 | __in_z_opt LPWSTR* pwzDownloadUrl, | ||
519 | __in_z_opt LPCWSTR wzPayloadContainerId, | ||
520 | __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* pCacheOperation | ||
521 | ) | ||
522 | { | ||
523 | HRESULT hr = S_OK; | ||
524 | BA_ONCACHEACQUIRERESOLVING_ARGS args = { }; | ||
525 | BA_ONCACHEACQUIRERESOLVING_RESULTS results = { }; | ||
526 | |||
527 | args.cbSize = sizeof(args); | ||
528 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
529 | args.wzPayloadId = wzPayloadId; | ||
530 | args.rgSearchPaths = const_cast<LPCWSTR*>(rgSearchPaths); | ||
531 | args.cSearchPaths = cSearchPaths; | ||
532 | args.fFoundLocal = fFoundLocal; | ||
533 | args.dwRecommendedSearchPath = *pdwChosenSearchPath; | ||
534 | args.wzDownloadUrl = *pwzDownloadUrl; | ||
535 | args.recommendation = *pCacheOperation; | ||
536 | |||
537 | results.cbSize = sizeof(results); | ||
538 | results.dwChosenSearchPath = *pdwChosenSearchPath; | ||
539 | results.action = *pCacheOperation; | ||
540 | |||
541 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING, &args, &results); | ||
542 | ExitOnFailure(hr, "BA OnCacheAcquireResolving failed."); | ||
543 | |||
544 | if (results.fCancel) | ||
545 | { | ||
546 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
547 | } | ||
548 | else | ||
549 | { | ||
550 | // Verify the BA requested an action that is possible. | ||
551 | if (BOOTSTRAPPER_CACHE_RESOLVE_DOWNLOAD == results.action && *pwzDownloadUrl && **pwzDownloadUrl || | ||
552 | BOOTSTRAPPER_CACHE_RESOLVE_CONTAINER == results.action && wzPayloadContainerId || | ||
553 | BOOTSTRAPPER_CACHE_RESOLVE_RETRY == results.action || | ||
554 | BOOTSTRAPPER_CACHE_RESOLVE_NONE == results.action) | ||
555 | { | ||
556 | *pCacheOperation = results.action; | ||
557 | } | ||
558 | else if (BOOTSTRAPPER_CACHE_RESOLVE_LOCAL == results.action && results.dwChosenSearchPath < cSearchPaths) | ||
559 | { | ||
560 | *pdwChosenSearchPath = results.dwChosenSearchPath; | ||
561 | *pCacheOperation = results.action; | ||
562 | } | ||
563 | } | ||
564 | |||
565 | LExit: | ||
566 | return hr; | ||
567 | } | ||
568 | |||
569 | EXTERN_C BAAPI UserExperienceOnCacheBegin( | ||
570 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
571 | ) | ||
572 | { | ||
573 | HRESULT hr = S_OK; | ||
574 | BA_ONCACHEBEGIN_ARGS args = { }; | ||
575 | BA_ONCACHEBEGIN_RESULTS results = { }; | ||
576 | |||
577 | args.cbSize = sizeof(args); | ||
578 | |||
579 | results.cbSize = sizeof(results); | ||
580 | |||
581 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, &args, &results); | ||
582 | ExitOnFailure(hr, "BA OnCacheBegin failed."); | ||
583 | |||
584 | if (results.fCancel) | ||
585 | { | ||
586 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
587 | } | ||
588 | |||
589 | LExit: | ||
590 | return hr; | ||
591 | } | ||
592 | |||
593 | EXTERN_C BAAPI UserExperienceOnCacheComplete( | ||
594 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
595 | __in HRESULT hrStatus | ||
596 | ) | ||
597 | { | ||
598 | HRESULT hr = S_OK; | ||
599 | BA_ONCACHECOMPLETE_ARGS args = { }; | ||
600 | BA_ONCACHECOMPLETE_RESULTS results = { }; | ||
601 | |||
602 | args.cbSize = sizeof(args); | ||
603 | args.hrStatus = hrStatus; | ||
604 | |||
605 | results.cbSize = sizeof(results); | ||
606 | |||
607 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, &args, &results); | ||
608 | ExitOnFailure(hr, "BA OnCacheComplete failed."); | ||
609 | |||
610 | LExit: | ||
611 | return hr; | ||
612 | } | ||
613 | |||
614 | EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyBegin( | ||
615 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
616 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
617 | __in_z_opt LPCWSTR wzPayloadId | ||
618 | ) | ||
619 | { | ||
620 | HRESULT hr = S_OK; | ||
621 | BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS args = { }; | ||
622 | BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS results = { }; | ||
623 | |||
624 | args.cbSize = sizeof(args); | ||
625 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
626 | args.wzPayloadId = wzPayloadId; | ||
627 | |||
628 | results.cbSize = sizeof(results); | ||
629 | |||
630 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, &args, &results); | ||
631 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyBegin failed."); | ||
632 | |||
633 | if (results.fCancel) | ||
634 | { | ||
635 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
636 | } | ||
637 | |||
638 | LExit: | ||
639 | return hr; | ||
640 | } | ||
641 | |||
642 | EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyComplete( | ||
643 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
644 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
645 | __in_z_opt LPCWSTR wzPayloadId, | ||
646 | __in HRESULT hrStatus | ||
647 | ) | ||
648 | { | ||
649 | HRESULT hr = S_OK; | ||
650 | BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS args = { }; | ||
651 | BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS results = { }; | ||
652 | |||
653 | args.cbSize = sizeof(args); | ||
654 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
655 | args.wzPayloadId = wzPayloadId; | ||
656 | args.hrStatus = hrStatus; | ||
657 | |||
658 | results.cbSize = sizeof(results); | ||
659 | |||
660 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, &args, &results); | ||
661 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyComplete failed."); | ||
662 | |||
663 | LExit: | ||
664 | return hr; | ||
665 | } | ||
666 | |||
667 | EXTERN_C BAAPI UserExperienceOnCacheContainerOrPayloadVerifyProgress( | ||
668 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
669 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
670 | __in_z_opt LPCWSTR wzPayloadId, | ||
671 | __in DWORD64 dw64Progress, | ||
672 | __in DWORD64 dw64Total, | ||
673 | __in DWORD dwOverallPercentage | ||
674 | ) | ||
675 | { | ||
676 | HRESULT hr = S_OK; | ||
677 | BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS args = { }; | ||
678 | BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS results = { }; | ||
679 | |||
680 | args.cbSize = sizeof(args); | ||
681 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
682 | args.wzPayloadId = wzPayloadId; | ||
683 | args.dw64Progress = dw64Progress; | ||
684 | args.dw64Total = dw64Total; | ||
685 | args.dwOverallPercentage = dwOverallPercentage; | ||
686 | |||
687 | results.cbSize = sizeof(results); | ||
688 | |||
689 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, &args, &results); | ||
690 | ExitOnFailure(hr, "BA OnCacheContainerOrPayloadVerifyProgress failed."); | ||
691 | |||
692 | if (results.fCancel) | ||
693 | { | ||
694 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
695 | } | ||
696 | |||
697 | LExit: | ||
698 | return hr; | ||
699 | } | ||
700 | |||
701 | EXTERN_C BAAPI UserExperienceOnCachePackageBegin( | ||
702 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
703 | __in_z LPCWSTR wzPackageId, | ||
704 | __in DWORD cCachePayloads, | ||
705 | __in DWORD64 dw64PackageCacheSize | ||
706 | ) | ||
707 | { | ||
708 | HRESULT hr = S_OK; | ||
709 | BA_ONCACHEPACKAGEBEGIN_ARGS args = { }; | ||
710 | BA_ONCACHEPACKAGEBEGIN_RESULTS results = { }; | ||
711 | |||
712 | args.cbSize = sizeof(args); | ||
713 | args.wzPackageId = wzPackageId; | ||
714 | args.cCachePayloads = cCachePayloads; | ||
715 | args.dw64PackageCacheSize = dw64PackageCacheSize; | ||
716 | |||
717 | results.cbSize = sizeof(results); | ||
718 | |||
719 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, &args, &results); | ||
720 | ExitOnFailure(hr, "BA OnCachePackageBegin failed."); | ||
721 | |||
722 | if (results.fCancel) | ||
723 | { | ||
724 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
725 | } | ||
726 | |||
727 | LExit: | ||
728 | return hr; | ||
729 | } | ||
730 | |||
731 | EXTERN_C BAAPI UserExperienceOnCachePackageComplete( | ||
732 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
733 | __in_z LPCWSTR wzPackageId, | ||
734 | __in HRESULT hrStatus, | ||
735 | __inout BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION* pAction | ||
736 | ) | ||
737 | { | ||
738 | HRESULT hr = S_OK; | ||
739 | BA_ONCACHEPACKAGECOMPLETE_ARGS args = { }; | ||
740 | BA_ONCACHEPACKAGECOMPLETE_RESULTS results = { }; | ||
741 | |||
742 | args.cbSize = sizeof(args); | ||
743 | args.wzPackageId = wzPackageId; | ||
744 | args.hrStatus = hrStatus; | ||
745 | args.recommendation = *pAction; | ||
746 | |||
747 | results.cbSize = sizeof(results); | ||
748 | results.action = *pAction; | ||
749 | |||
750 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, &args, &results); | ||
751 | ExitOnFailure(hr, "BA OnCachePackageComplete failed."); | ||
752 | |||
753 | if (FAILED(hrStatus)) | ||
754 | { | ||
755 | *pAction = results.action; | ||
756 | } | ||
757 | |||
758 | LExit: | ||
759 | return hr; | ||
760 | } | ||
761 | |||
762 | EXTERN_C BAAPI UserExperienceOnCachePayloadExtractBegin( | ||
763 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
764 | __in_z_opt LPCWSTR wzContainerId, | ||
765 | __in_z_opt LPCWSTR wzPayloadId | ||
766 | ) | ||
767 | { | ||
768 | HRESULT hr = S_OK; | ||
769 | BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS args = { }; | ||
770 | BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS results = { }; | ||
771 | |||
772 | args.cbSize = sizeof(args); | ||
773 | args.wzContainerId = wzContainerId; | ||
774 | args.wzPayloadId = wzPayloadId; | ||
775 | |||
776 | results.cbSize = sizeof(results); | ||
777 | |||
778 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, &args, &results); | ||
779 | ExitOnFailure(hr, "BA OnCachePayloadExtractBegin failed."); | ||
780 | |||
781 | if (results.fCancel) | ||
782 | { | ||
783 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
784 | } | ||
785 | |||
786 | LExit: | ||
787 | return hr; | ||
788 | } | ||
789 | |||
790 | EXTERN_C BAAPI UserExperienceOnCachePayloadExtractComplete( | ||
791 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
792 | __in_z_opt LPCWSTR wzContainerId, | ||
793 | __in_z_opt LPCWSTR wzPayloadId, | ||
794 | __in HRESULT hrStatus | ||
795 | ) | ||
796 | { | ||
797 | HRESULT hr = S_OK; | ||
798 | BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS args = { }; | ||
799 | BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS results = { }; | ||
800 | |||
801 | args.cbSize = sizeof(args); | ||
802 | args.wzContainerId = wzContainerId; | ||
803 | args.wzPayloadId = wzPayloadId; | ||
804 | args.hrStatus = hrStatus; | ||
805 | |||
806 | results.cbSize = sizeof(results); | ||
807 | |||
808 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, &args, &results); | ||
809 | ExitOnFailure(hr, "BA OnCachePayloadExtractComplete failed."); | ||
810 | |||
811 | LExit: | ||
812 | return hr; | ||
813 | } | ||
814 | |||
815 | EXTERN_C BAAPI UserExperienceOnCachePayloadExtractProgress( | ||
816 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
817 | __in_z_opt LPCWSTR wzContainerId, | ||
818 | __in_z_opt LPCWSTR wzPayloadId, | ||
819 | __in DWORD64 dw64Progress, | ||
820 | __in DWORD64 dw64Total, | ||
821 | __in DWORD dwOverallPercentage | ||
822 | ) | ||
823 | { | ||
824 | HRESULT hr = S_OK; | ||
825 | BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS args = { }; | ||
826 | BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS results = { }; | ||
827 | |||
828 | args.cbSize = sizeof(args); | ||
829 | args.wzContainerId = wzContainerId; | ||
830 | args.wzPayloadId = wzPayloadId; | ||
831 | args.dw64Progress = dw64Progress; | ||
832 | args.dw64Total = dw64Total; | ||
833 | args.dwOverallPercentage = dwOverallPercentage; | ||
834 | |||
835 | results.cbSize = sizeof(results); | ||
836 | |||
837 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, &args, &results); | ||
838 | ExitOnFailure(hr, "BA OnCachePayloadExtractProgress failed."); | ||
839 | |||
840 | if (results.fCancel) | ||
841 | { | ||
842 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
843 | } | ||
844 | |||
845 | LExit: | ||
846 | return hr; | ||
847 | } | ||
848 | |||
849 | EXTERN_C BAAPI UserExperienceOnCacheVerifyBegin( | ||
850 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
851 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
852 | __in_z_opt LPCWSTR wzPayloadId | ||
853 | ) | ||
854 | { | ||
855 | HRESULT hr = S_OK; | ||
856 | BA_ONCACHEVERIFYBEGIN_ARGS args = { }; | ||
857 | BA_ONCACHEVERIFYBEGIN_RESULTS results = { }; | ||
858 | |||
859 | args.cbSize = sizeof(args); | ||
860 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
861 | args.wzPayloadId = wzPayloadId; | ||
862 | |||
863 | results.cbSize = sizeof(results); | ||
864 | |||
865 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, &args, &results); | ||
866 | ExitOnFailure(hr, "BA OnCacheVerifyBegin failed."); | ||
867 | |||
868 | if (results.fCancel) | ||
869 | { | ||
870 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
871 | } | ||
872 | |||
873 | LExit: | ||
874 | return hr; | ||
875 | } | ||
876 | |||
877 | EXTERN_C BAAPI UserExperienceOnCacheVerifyComplete( | ||
878 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
879 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
880 | __in_z_opt LPCWSTR wzPayloadId, | ||
881 | __in HRESULT hrStatus, | ||
882 | __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction | ||
883 | ) | ||
884 | { | ||
885 | HRESULT hr = S_OK; | ||
886 | BA_ONCACHEVERIFYCOMPLETE_ARGS args = { }; | ||
887 | BA_ONCACHEVERIFYCOMPLETE_RESULTS results = { }; | ||
888 | |||
889 | args.cbSize = sizeof(args); | ||
890 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
891 | args.wzPayloadId = wzPayloadId; | ||
892 | args.hrStatus = hrStatus; | ||
893 | args.recommendation = *pAction; | ||
894 | |||
895 | results.cbSize = sizeof(results); | ||
896 | results.action = *pAction; | ||
897 | |||
898 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, &args, &results); | ||
899 | ExitOnFailure(hr, "BA OnCacheVerifyComplete failed."); | ||
900 | |||
901 | if (FAILED(hrStatus)) | ||
902 | { | ||
903 | *pAction = results.action; | ||
904 | } | ||
905 | |||
906 | LExit: | ||
907 | return hr; | ||
908 | } | ||
909 | |||
910 | EXTERN_C BAAPI UserExperienceOnCacheVerifyProgress( | ||
911 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
912 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
913 | __in_z_opt LPCWSTR wzPayloadId, | ||
914 | __in DWORD64 dw64Progress, | ||
915 | __in DWORD64 dw64Total, | ||
916 | __in DWORD dwOverallPercentage, | ||
917 | __in BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep | ||
918 | ) | ||
919 | { | ||
920 | HRESULT hr = S_OK; | ||
921 | BA_ONCACHEVERIFYPROGRESS_ARGS args = { }; | ||
922 | BA_ONCACHEVERIFYPROGRESS_RESULTS results = { }; | ||
923 | |||
924 | args.cbSize = sizeof(args); | ||
925 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
926 | args.wzPayloadId = wzPayloadId; | ||
927 | args.dw64Progress = dw64Progress; | ||
928 | args.dw64Total = dw64Total; | ||
929 | args.dwOverallPercentage = dwOverallPercentage; | ||
930 | args.verifyStep = verifyStep; | ||
931 | |||
932 | results.cbSize = sizeof(results); | ||
933 | |||
934 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, &args, &results); | ||
935 | ExitOnFailure(hr, "BA OnCacheVerifyProgress failed."); | ||
936 | |||
937 | if (results.fCancel) | ||
938 | { | ||
939 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
940 | } | ||
941 | |||
942 | LExit: | ||
943 | return hr; | ||
944 | } | ||
945 | |||
946 | EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionBegin( | ||
947 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
948 | __in LPCWSTR wzTransactionId | ||
949 | ) | ||
950 | { | ||
951 | HRESULT hr = S_OK; | ||
952 | BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS args = { }; | ||
953 | BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS results = { }; | ||
954 | |||
955 | args.cbSize = sizeof(args); | ||
956 | args.wzTransactionId = wzTransactionId; | ||
957 | |||
958 | results.cbSize = sizeof(results); | ||
959 | |||
960 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &args, &results); | ||
961 | ExitOnFailure(hr, "BA OnCommitMsiTransactionBegin failed."); | ||
962 | |||
963 | if (results.fCancel) | ||
964 | { | ||
965 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
966 | } | ||
967 | |||
968 | LExit: | ||
969 | return hr; | ||
970 | } | ||
971 | |||
972 | EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionComplete( | ||
973 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
974 | __in LPCWSTR wzTransactionId, | ||
975 | __in HRESULT hrStatus | ||
976 | ) | ||
977 | { | ||
978 | HRESULT hr = S_OK; | ||
979 | BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS args = { }; | ||
980 | BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS results = { }; | ||
981 | |||
982 | args.cbSize = sizeof(args); | ||
983 | args.wzTransactionId = wzTransactionId; | ||
984 | args.hrStatus = hrStatus; | ||
985 | |||
986 | results.cbSize = sizeof(results); | ||
987 | |||
988 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &args, &results); | ||
989 | ExitOnFailure(hr, "BA OnCommitMsiTransactionComplete failed."); | ||
990 | |||
991 | LExit: | ||
992 | return hr; | ||
993 | } | ||
994 | |||
995 | EXTERN_C BAAPI UserExperienceOnDetectBegin( | ||
996 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
997 | __in BOOL fCached, | ||
998 | __in BOOL fInstalled, | ||
999 | __in DWORD cPackages | ||
1000 | ) | ||
1001 | { | ||
1002 | HRESULT hr = S_OK; | ||
1003 | BA_ONDETECTBEGIN_ARGS args = { }; | ||
1004 | BA_ONDETECTBEGIN_RESULTS results = { }; | ||
1005 | |||
1006 | args.cbSize = sizeof(args); | ||
1007 | args.cPackages = cPackages; | ||
1008 | args.fInstalled = fInstalled; | ||
1009 | args.fCached = fCached; | ||
1010 | |||
1011 | results.cbSize = sizeof(results); | ||
1012 | |||
1013 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, &args, &results); | ||
1014 | ExitOnFailure(hr, "BA OnDetectBegin failed."); | ||
1015 | |||
1016 | if (results.fCancel) | ||
1017 | { | ||
1018 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1019 | } | ||
1020 | |||
1021 | LExit: | ||
1022 | return hr; | ||
1023 | } | ||
1024 | |||
1025 | EXTERN_C BAAPI UserExperienceOnDetectComplete( | ||
1026 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1027 | __in HRESULT hrStatus, | ||
1028 | __in BOOL fEligibleForCleanup | ||
1029 | ) | ||
1030 | { | ||
1031 | HRESULT hr = S_OK; | ||
1032 | BA_ONDETECTCOMPLETE_ARGS args = { }; | ||
1033 | BA_ONDETECTCOMPLETE_RESULTS results = { }; | ||
1034 | |||
1035 | args.cbSize = sizeof(args); | ||
1036 | args.hrStatus = hrStatus; | ||
1037 | args.fEligibleForCleanup = fEligibleForCleanup; | ||
1038 | |||
1039 | results.cbSize = sizeof(results); | ||
1040 | |||
1041 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, &args, &results); | ||
1042 | ExitOnFailure(hr, "BA OnDetectComplete failed."); | ||
1043 | |||
1044 | LExit: | ||
1045 | return hr; | ||
1046 | } | ||
1047 | |||
1048 | EXTERN_C BAAPI UserExperienceOnDetectForwardCompatibleBundle( | ||
1049 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1050 | __in_z LPCWSTR wzBundleId, | ||
1051 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
1052 | __in_z LPCWSTR wzBundleTag, | ||
1053 | __in BOOL fPerMachine, | ||
1054 | __in VERUTIL_VERSION* pVersion, | ||
1055 | __in BOOL fMissingFromCache | ||
1056 | ) | ||
1057 | { | ||
1058 | HRESULT hr = S_OK; | ||
1059 | BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; | ||
1060 | BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; | ||
1061 | |||
1062 | args.cbSize = sizeof(args); | ||
1063 | args.wzBundleId = wzBundleId; | ||
1064 | args.relationType = relationType; | ||
1065 | args.wzBundleTag = wzBundleTag; | ||
1066 | args.fPerMachine = fPerMachine; | ||
1067 | args.wzVersion = pVersion->sczVersion; | ||
1068 | args.fMissingFromCache = fMissingFromCache; | ||
1069 | |||
1070 | results.cbSize = sizeof(results); | ||
1071 | |||
1072 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &args, &results); | ||
1073 | ExitOnFailure(hr, "BA OnDetectForwardCompatibleBundle failed."); | ||
1074 | |||
1075 | if (results.fCancel) | ||
1076 | { | ||
1077 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1078 | } | ||
1079 | |||
1080 | LExit: | ||
1081 | return hr; | ||
1082 | } | ||
1083 | |||
1084 | EXTERN_C BAAPI UserExperienceOnDetectMsiFeature( | ||
1085 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1086 | __in_z LPCWSTR wzPackageId, | ||
1087 | __in_z LPCWSTR wzFeatureId, | ||
1088 | __in BOOTSTRAPPER_FEATURE_STATE state | ||
1089 | ) | ||
1090 | { | ||
1091 | HRESULT hr = S_OK; | ||
1092 | BA_ONDETECTMSIFEATURE_ARGS args = { }; | ||
1093 | BA_ONDETECTMSIFEATURE_RESULTS results = { }; | ||
1094 | |||
1095 | args.cbSize = sizeof(args); | ||
1096 | args.wzPackageId = wzPackageId; | ||
1097 | args.wzFeatureId = wzFeatureId; | ||
1098 | args.state = state; | ||
1099 | |||
1100 | results.cbSize = sizeof(results); | ||
1101 | |||
1102 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, &args, &results); | ||
1103 | ExitOnFailure(hr, "BA OnDetectMsiFeature failed."); | ||
1104 | |||
1105 | if (results.fCancel) | ||
1106 | { | ||
1107 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1108 | } | ||
1109 | |||
1110 | LExit: | ||
1111 | return hr; | ||
1112 | } | ||
1113 | |||
1114 | EXTERN_C BAAPI UserExperienceOnDetectPackageBegin( | ||
1115 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1116 | __in_z LPCWSTR wzPackageId | ||
1117 | ) | ||
1118 | { | ||
1119 | HRESULT hr = S_OK; | ||
1120 | BA_ONDETECTPACKAGEBEGIN_ARGS args = { }; | ||
1121 | BA_ONDETECTPACKAGEBEGIN_RESULTS results = { }; | ||
1122 | |||
1123 | args.cbSize = sizeof(args); | ||
1124 | args.wzPackageId = wzPackageId; | ||
1125 | |||
1126 | results.cbSize = sizeof(results); | ||
1127 | |||
1128 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, &args, &results); | ||
1129 | ExitOnFailure(hr, "BA OnDetectPackageBegin failed."); | ||
1130 | |||
1131 | if (results.fCancel) | ||
1132 | { | ||
1133 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1134 | } | ||
1135 | |||
1136 | LExit: | ||
1137 | return hr; | ||
1138 | } | ||
1139 | |||
1140 | EXTERN_C BAAPI UserExperienceOnDetectPackageComplete( | ||
1141 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1142 | __in_z LPCWSTR wzPackageId, | ||
1143 | __in HRESULT hrStatus, | ||
1144 | __in BOOTSTRAPPER_PACKAGE_STATE state, | ||
1145 | __in BOOL fCached | ||
1146 | ) | ||
1147 | { | ||
1148 | HRESULT hr = S_OK; | ||
1149 | BA_ONDETECTPACKAGECOMPLETE_ARGS args = { }; | ||
1150 | BA_ONDETECTPACKAGECOMPLETE_RESULTS results = { }; | ||
1151 | |||
1152 | args.cbSize = sizeof(args); | ||
1153 | args.wzPackageId = wzPackageId; | ||
1154 | args.hrStatus = hrStatus; | ||
1155 | args.state = state; | ||
1156 | args.fCached = fCached; | ||
1157 | |||
1158 | results.cbSize = sizeof(results); | ||
1159 | |||
1160 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, &args, &results); | ||
1161 | ExitOnFailure(hr, "BA OnDetectPackageComplete failed."); | ||
1162 | |||
1163 | LExit: | ||
1164 | return hr; | ||
1165 | } | ||
1166 | |||
1167 | EXTERN_C BAAPI UserExperienceOnDetectRelatedBundle( | ||
1168 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1169 | __in_z LPCWSTR wzBundleId, | ||
1170 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
1171 | __in_z LPCWSTR wzBundleTag, | ||
1172 | __in BOOL fPerMachine, | ||
1173 | __in VERUTIL_VERSION* pVersion, | ||
1174 | __in BOOTSTRAPPER_RELATED_OPERATION operation, | ||
1175 | __in BOOL fMissingFromCache | ||
1176 | ) | ||
1177 | { | ||
1178 | HRESULT hr = S_OK; | ||
1179 | BA_ONDETECTRELATEDBUNDLE_ARGS args = { }; | ||
1180 | BA_ONDETECTRELATEDBUNDLE_RESULTS results = { }; | ||
1181 | |||
1182 | args.cbSize = sizeof(args); | ||
1183 | args.wzBundleId = wzBundleId; | ||
1184 | args.relationType = relationType; | ||
1185 | args.wzBundleTag = wzBundleTag; | ||
1186 | args.fPerMachine = fPerMachine; | ||
1187 | args.wzVersion = pVersion->sczVersion; | ||
1188 | args.operation = operation; | ||
1189 | args.fMissingFromCache = fMissingFromCache; | ||
1190 | |||
1191 | results.cbSize = sizeof(results); | ||
1192 | |||
1193 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, &args, &results); | ||
1194 | ExitOnFailure(hr, "BA OnDetectRelatedBundle failed."); | ||
1195 | |||
1196 | if (results.fCancel) | ||
1197 | { | ||
1198 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1199 | } | ||
1200 | |||
1201 | LExit: | ||
1202 | return hr; | ||
1203 | } | ||
1204 | |||
1205 | EXTERN_C BAAPI UserExperienceOnDetectRelatedMsiPackage( | ||
1206 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1207 | __in_z LPCWSTR wzPackageId, | ||
1208 | __in_z LPCWSTR wzUpgradeCode, | ||
1209 | __in_z LPCWSTR wzProductCode, | ||
1210 | __in BOOL fPerMachine, | ||
1211 | __in VERUTIL_VERSION* pVersion, | ||
1212 | __in BOOTSTRAPPER_RELATED_OPERATION operation | ||
1213 | ) | ||
1214 | { | ||
1215 | HRESULT hr = S_OK; | ||
1216 | BA_ONDETECTRELATEDMSIPACKAGE_ARGS args = { }; | ||
1217 | BA_ONDETECTRELATEDMSIPACKAGE_RESULTS results = { }; | ||
1218 | |||
1219 | args.cbSize = sizeof(args); | ||
1220 | args.wzPackageId = wzPackageId; | ||
1221 | args.wzUpgradeCode = wzUpgradeCode; | ||
1222 | args.wzProductCode = wzProductCode; | ||
1223 | args.fPerMachine = fPerMachine; | ||
1224 | args.wzVersion = pVersion->sczVersion; | ||
1225 | args.operation = operation; | ||
1226 | |||
1227 | results.cbSize = sizeof(results); | ||
1228 | |||
1229 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, &args, &results); | ||
1230 | ExitOnFailure(hr, "BA OnDetectRelatedMsiPackage failed."); | ||
1231 | |||
1232 | if (results.fCancel) | ||
1233 | { | ||
1234 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1235 | } | ||
1236 | |||
1237 | LExit: | ||
1238 | return hr; | ||
1239 | } | ||
1240 | |||
1241 | EXTERN_C BAAPI UserExperienceOnDetectPatchTarget( | ||
1242 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1243 | __in_z LPCWSTR wzPackageId, | ||
1244 | __in_z LPCWSTR wzProductCode, | ||
1245 | __in BOOTSTRAPPER_PACKAGE_STATE patchState | ||
1246 | ) | ||
1247 | { | ||
1248 | HRESULT hr = S_OK; | ||
1249 | BA_ONDETECTPATCHTARGET_ARGS args = { }; | ||
1250 | BA_ONDETECTPATCHTARGET_RESULTS results = { }; | ||
1251 | |||
1252 | args.cbSize = sizeof(args); | ||
1253 | args.wzPackageId = wzPackageId; | ||
1254 | args.wzProductCode = wzProductCode; | ||
1255 | args.patchState = patchState; | ||
1256 | |||
1257 | results.cbSize = sizeof(results); | ||
1258 | |||
1259 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET, &args, &results); | ||
1260 | ExitOnFailure(hr, "BA OnDetectPatchTarget failed."); | ||
1261 | |||
1262 | if (results.fCancel) | ||
1263 | { | ||
1264 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1265 | } | ||
1266 | |||
1267 | LExit: | ||
1268 | return hr; | ||
1269 | } | ||
1270 | |||
1271 | EXTERN_C BAAPI UserExperienceOnDetectUpdate( | ||
1272 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1273 | __in_z_opt LPCWSTR wzUpdateLocation, | ||
1274 | __in DWORD64 dw64Size, | ||
1275 | __in VERUTIL_VERSION* pVersion, | ||
1276 | __in_z_opt LPCWSTR wzTitle, | ||
1277 | __in_z_opt LPCWSTR wzSummary, | ||
1278 | __in_z_opt LPCWSTR wzContentType, | ||
1279 | __in_z_opt LPCWSTR wzContent, | ||
1280 | __inout BOOL* pfStopProcessingUpdates | ||
1281 | ) | ||
1282 | { | ||
1283 | HRESULT hr = S_OK; | ||
1284 | BA_ONDETECTUPDATE_ARGS args = { }; | ||
1285 | BA_ONDETECTUPDATE_RESULTS results = { }; | ||
1286 | |||
1287 | args.cbSize = sizeof(args); | ||
1288 | args.wzUpdateLocation = wzUpdateLocation; | ||
1289 | args.dw64Size = dw64Size; | ||
1290 | args.wzVersion = pVersion->sczVersion; | ||
1291 | args.wzTitle = wzTitle; | ||
1292 | args.wzSummary = wzSummary; | ||
1293 | args.wzContentType = wzContentType; | ||
1294 | args.wzContent = wzContent; | ||
1295 | |||
1296 | results.cbSize = sizeof(results); | ||
1297 | results.fStopProcessingUpdates = *pfStopProcessingUpdates; | ||
1298 | |||
1299 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, &args, &results); | ||
1300 | ExitOnFailure(hr, "BA OnDetectUpdate failed."); | ||
1301 | |||
1302 | if (results.fCancel) | ||
1303 | { | ||
1304 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1305 | } | ||
1306 | *pfStopProcessingUpdates = results.fStopProcessingUpdates; | ||
1307 | |||
1308 | LExit: | ||
1309 | return hr; | ||
1310 | } | ||
1311 | |||
1312 | EXTERN_C BAAPI UserExperienceOnDetectUpdateBegin( | ||
1313 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1314 | __in_z LPCWSTR wzUpdateLocation, | ||
1315 | __inout BOOL* pfSkip | ||
1316 | ) | ||
1317 | { | ||
1318 | HRESULT hr = S_OK; | ||
1319 | BA_ONDETECTUPDATEBEGIN_ARGS args = { }; | ||
1320 | BA_ONDETECTUPDATEBEGIN_RESULTS results = { }; | ||
1321 | |||
1322 | args.cbSize = sizeof(args); | ||
1323 | args.wzUpdateLocation = wzUpdateLocation; | ||
1324 | |||
1325 | results.cbSize = sizeof(results); | ||
1326 | results.fSkip = *pfSkip; | ||
1327 | |||
1328 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, &args, &results); | ||
1329 | ExitOnFailure(hr, "BA OnDetectUpdateBegin failed."); | ||
1330 | |||
1331 | if (results.fCancel) | ||
1332 | { | ||
1333 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1334 | } | ||
1335 | *pfSkip = results.fSkip; | ||
1336 | |||
1337 | LExit: | ||
1338 | return hr; | ||
1339 | } | ||
1340 | |||
1341 | EXTERN_C BAAPI UserExperienceOnDetectUpdateComplete( | ||
1342 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1343 | __in HRESULT hrStatus, | ||
1344 | __inout BOOL* pfIgnoreError | ||
1345 | ) | ||
1346 | { | ||
1347 | HRESULT hr = S_OK; | ||
1348 | BA_ONDETECTUPDATECOMPLETE_ARGS args = { }; | ||
1349 | BA_ONDETECTUPDATECOMPLETE_RESULTS results = { }; | ||
1350 | |||
1351 | args.cbSize = sizeof(args); | ||
1352 | args.hrStatus = hrStatus; | ||
1353 | |||
1354 | results.cbSize = sizeof(results); | ||
1355 | results.fIgnoreError = *pfIgnoreError; | ||
1356 | |||
1357 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, &args, &results); | ||
1358 | ExitOnFailure(hr, "BA OnDetectUpdateComplete failed."); | ||
1359 | |||
1360 | if (FAILED(hrStatus)) | ||
1361 | { | ||
1362 | *pfIgnoreError = results.fIgnoreError; | ||
1363 | } | ||
1364 | |||
1365 | LExit: | ||
1366 | return hr; | ||
1367 | } | ||
1368 | |||
1369 | EXTERN_C BAAPI UserExperienceOnElevateBegin( | ||
1370 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
1371 | ) | ||
1372 | { | ||
1373 | HRESULT hr = S_OK; | ||
1374 | BA_ONELEVATEBEGIN_ARGS args = { }; | ||
1375 | BA_ONELEVATEBEGIN_RESULTS results = { }; | ||
1376 | |||
1377 | args.cbSize = sizeof(args); | ||
1378 | |||
1379 | results.cbSize = sizeof(results); | ||
1380 | |||
1381 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, &args, &results); | ||
1382 | ExitOnFailure(hr, "BA OnElevateBegin failed."); | ||
1383 | |||
1384 | if (results.fCancel) | ||
1385 | { | ||
1386 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1387 | } | ||
1388 | |||
1389 | LExit: | ||
1390 | return hr; | ||
1391 | } | ||
1392 | |||
1393 | EXTERN_C BAAPI UserExperienceOnElevateComplete( | ||
1394 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1395 | __in HRESULT hrStatus | ||
1396 | ) | ||
1397 | { | ||
1398 | HRESULT hr = S_OK; | ||
1399 | BA_ONELEVATECOMPLETE_ARGS args = { }; | ||
1400 | BA_ONELEVATECOMPLETE_RESULTS results = { }; | ||
1401 | |||
1402 | args.cbSize = sizeof(args); | ||
1403 | args.hrStatus = hrStatus; | ||
1404 | |||
1405 | results.cbSize = sizeof(results); | ||
1406 | |||
1407 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, &args, &results); | ||
1408 | ExitOnFailure(hr, "BA OnElevateComplete failed."); | ||
1409 | |||
1410 | LExit: | ||
1411 | return hr; | ||
1412 | } | ||
1413 | |||
1414 | EXTERN_C BAAPI UserExperienceOnError( | ||
1415 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1416 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
1417 | __in_z_opt LPCWSTR wzPackageId, | ||
1418 | __in DWORD dwCode, | ||
1419 | __in_z_opt LPCWSTR wzError, | ||
1420 | __in DWORD dwUIHint, | ||
1421 | __in DWORD cData, | ||
1422 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | ||
1423 | __inout int* pnResult | ||
1424 | ) | ||
1425 | { | ||
1426 | HRESULT hr = S_OK; | ||
1427 | BA_ONERROR_ARGS args = { }; | ||
1428 | BA_ONERROR_RESULTS results = { }; | ||
1429 | |||
1430 | args.cbSize = sizeof(args); | ||
1431 | args.errorType = errorType; | ||
1432 | args.wzPackageId = wzPackageId; | ||
1433 | args.dwCode = dwCode; | ||
1434 | args.wzError = wzError; | ||
1435 | args.dwUIHint = dwUIHint; | ||
1436 | args.cData = cData; | ||
1437 | args.rgwzData = rgwzData; | ||
1438 | args.nRecommendation = *pnResult; | ||
1439 | |||
1440 | results.cbSize = sizeof(results); | ||
1441 | results.nResult = *pnResult; | ||
1442 | |||
1443 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, &args, &results); | ||
1444 | ExitOnFailure(hr, "BA OnError failed."); | ||
1445 | |||
1446 | *pnResult = results.nResult; | ||
1447 | |||
1448 | LExit: | ||
1449 | return hr; | ||
1450 | } | ||
1451 | |||
1452 | EXTERN_C BAAPI UserExperienceOnExecuteBegin( | ||
1453 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1454 | __in DWORD cExecutingPackages | ||
1455 | ) | ||
1456 | { | ||
1457 | HRESULT hr = S_OK; | ||
1458 | BA_ONEXECUTEBEGIN_ARGS args = { }; | ||
1459 | BA_ONEXECUTEBEGIN_RESULTS results = { }; | ||
1460 | |||
1461 | args.cbSize = sizeof(args); | ||
1462 | args.cExecutingPackages = cExecutingPackages; | ||
1463 | |||
1464 | results.cbSize = sizeof(results); | ||
1465 | |||
1466 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, &args, &results); | ||
1467 | ExitOnFailure(hr, "BA OnExecuteBegin failed."); | ||
1468 | |||
1469 | if (results.fCancel) | ||
1470 | { | ||
1471 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1472 | } | ||
1473 | |||
1474 | LExit: | ||
1475 | return hr; | ||
1476 | } | ||
1477 | |||
1478 | EXTERN_C BAAPI UserExperienceOnExecuteComplete( | ||
1479 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1480 | __in HRESULT hrStatus | ||
1481 | ) | ||
1482 | { | ||
1483 | HRESULT hr = S_OK; | ||
1484 | BA_ONEXECUTECOMPLETE_ARGS args = { }; | ||
1485 | BA_ONEXECUTECOMPLETE_RESULTS results = { }; | ||
1486 | |||
1487 | args.cbSize = sizeof(args); | ||
1488 | args.hrStatus = hrStatus; | ||
1489 | |||
1490 | results.cbSize = sizeof(results); | ||
1491 | |||
1492 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, &args, &results); | ||
1493 | ExitOnFailure(hr, "BA OnExecuteComplete failed."); | ||
1494 | |||
1495 | LExit: | ||
1496 | return hr; | ||
1497 | } | ||
1498 | |||
1499 | EXTERN_C BAAPI UserExperienceOnExecuteFilesInUse( | ||
1500 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1501 | __in_z LPCWSTR wzPackageId, | ||
1502 | __in DWORD cFiles, | ||
1503 | __in_ecount_z_opt(cFiles) LPCWSTR* rgwzFiles, | ||
1504 | __inout int* pnResult | ||
1505 | ) | ||
1506 | { | ||
1507 | HRESULT hr = S_OK; | ||
1508 | BA_ONEXECUTEFILESINUSE_ARGS args = { }; | ||
1509 | BA_ONEXECUTEFILESINUSE_RESULTS results = { }; | ||
1510 | |||
1511 | args.cbSize = sizeof(args); | ||
1512 | args.wzPackageId = wzPackageId; | ||
1513 | args.cFiles = cFiles; | ||
1514 | args.rgwzFiles = rgwzFiles; | ||
1515 | args.nRecommendation = *pnResult; | ||
1516 | |||
1517 | results.cbSize = sizeof(results); | ||
1518 | results.nResult = *pnResult; | ||
1519 | |||
1520 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, &args, &results); | ||
1521 | ExitOnFailure(hr, "BA OnExecuteFilesInUse failed."); | ||
1522 | |||
1523 | *pnResult = results.nResult; | ||
1524 | |||
1525 | LExit: | ||
1526 | return hr; | ||
1527 | } | ||
1528 | |||
1529 | EXTERN_C BAAPI UserExperienceOnExecuteMsiMessage( | ||
1530 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1531 | __in_z LPCWSTR wzPackageId, | ||
1532 | __in INSTALLMESSAGE messageType, | ||
1533 | __in DWORD dwUIHint, | ||
1534 | __in_z LPCWSTR wzMessage, | ||
1535 | __in DWORD cData, | ||
1536 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | ||
1537 | __inout int* pnResult | ||
1538 | ) | ||
1539 | { | ||
1540 | HRESULT hr = S_OK; | ||
1541 | BA_ONEXECUTEMSIMESSAGE_ARGS args = { }; | ||
1542 | BA_ONEXECUTEMSIMESSAGE_RESULTS results = { }; | ||
1543 | |||
1544 | args.cbSize = sizeof(args); | ||
1545 | args.wzPackageId = wzPackageId; | ||
1546 | args.messageType = messageType; | ||
1547 | args.dwUIHint = dwUIHint; | ||
1548 | args.wzMessage = wzMessage; | ||
1549 | args.cData = cData; | ||
1550 | args.rgwzData = rgwzData; | ||
1551 | args.nRecommendation = *pnResult; | ||
1552 | |||
1553 | results.cbSize = sizeof(results); | ||
1554 | results.nResult = *pnResult; | ||
1555 | |||
1556 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, &args, &results); | ||
1557 | ExitOnFailure(hr, "BA OnExecuteMsiMessage failed."); | ||
1558 | |||
1559 | *pnResult = results.nResult; | ||
1560 | |||
1561 | LExit: | ||
1562 | return hr; | ||
1563 | } | ||
1564 | |||
1565 | EXTERN_C BAAPI UserExperienceOnExecutePackageBegin( | ||
1566 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1567 | __in_z LPCWSTR wzPackageId, | ||
1568 | __in BOOL fExecute, | ||
1569 | __in BOOTSTRAPPER_ACTION_STATE action, | ||
1570 | __in INSTALLUILEVEL uiLevel, | ||
1571 | __in BOOL fDisableExternalUiHandler | ||
1572 | ) | ||
1573 | { | ||
1574 | HRESULT hr = S_OK; | ||
1575 | BA_ONEXECUTEPACKAGEBEGIN_ARGS args = { }; | ||
1576 | BA_ONEXECUTEPACKAGEBEGIN_RESULTS results = { }; | ||
1577 | |||
1578 | args.cbSize = sizeof(args); | ||
1579 | args.wzPackageId = wzPackageId; | ||
1580 | args.fExecute = fExecute; | ||
1581 | args.action = action; | ||
1582 | args.uiLevel = uiLevel; | ||
1583 | args.fDisableExternalUiHandler = fDisableExternalUiHandler; | ||
1584 | |||
1585 | results.cbSize = sizeof(results); | ||
1586 | |||
1587 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, &args, &results); | ||
1588 | ExitOnFailure(hr, "BA OnExecutePackageBegin failed."); | ||
1589 | |||
1590 | if (results.fCancel) | ||
1591 | { | ||
1592 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1593 | } | ||
1594 | |||
1595 | LExit: | ||
1596 | return hr; | ||
1597 | } | ||
1598 | |||
1599 | EXTERN_C BAAPI UserExperienceOnExecutePackageComplete( | ||
1600 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1601 | __in_z LPCWSTR wzPackageId, | ||
1602 | __in HRESULT hrStatus, | ||
1603 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
1604 | __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* pAction | ||
1605 | ) | ||
1606 | { | ||
1607 | HRESULT hr = S_OK; | ||
1608 | BA_ONEXECUTEPACKAGECOMPLETE_ARGS args = { }; | ||
1609 | BA_ONEXECUTEPACKAGECOMPLETE_RESULTS results = { }; | ||
1610 | |||
1611 | args.cbSize = sizeof(args); | ||
1612 | args.wzPackageId = wzPackageId; | ||
1613 | args.hrStatus = hrStatus; | ||
1614 | args.restart = restart; | ||
1615 | args.recommendation = *pAction; | ||
1616 | |||
1617 | results.cbSize = sizeof(results); | ||
1618 | results.action = *pAction; | ||
1619 | |||
1620 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, &args, &results); | ||
1621 | ExitOnFailure(hr, "BA OnExecutePackageComplete failed."); | ||
1622 | |||
1623 | *pAction = results.action; | ||
1624 | |||
1625 | LExit: | ||
1626 | return hr; | ||
1627 | } | ||
1628 | |||
1629 | EXTERN_C BAAPI UserExperienceOnExecutePatchTarget( | ||
1630 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1631 | __in_z LPCWSTR wzPackageId, | ||
1632 | __in_z LPCWSTR wzTargetProductCode | ||
1633 | ) | ||
1634 | { | ||
1635 | HRESULT hr = S_OK; | ||
1636 | BA_ONEXECUTEPATCHTARGET_ARGS args = { }; | ||
1637 | BA_ONEXECUTEPATCHTARGET_RESULTS results = { }; | ||
1638 | |||
1639 | args.cbSize = sizeof(args); | ||
1640 | args.wzPackageId = wzPackageId; | ||
1641 | args.wzTargetProductCode = wzTargetProductCode; | ||
1642 | |||
1643 | results.cbSize = sizeof(results); | ||
1644 | |||
1645 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, &args, &results); | ||
1646 | ExitOnFailure(hr, "BA OnExecutePatchTarget failed."); | ||
1647 | |||
1648 | if (results.fCancel) | ||
1649 | { | ||
1650 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1651 | } | ||
1652 | |||
1653 | LExit: | ||
1654 | return hr; | ||
1655 | } | ||
1656 | |||
1657 | EXTERN_C BAAPI UserExperienceOnExecuteProgress( | ||
1658 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1659 | __in_z LPCWSTR wzPackageId, | ||
1660 | __in DWORD dwProgressPercentage, | ||
1661 | __in DWORD dwOverallPercentage, | ||
1662 | __out int* pnResult | ||
1663 | ) | ||
1664 | { | ||
1665 | HRESULT hr = S_OK; | ||
1666 | BA_ONEXECUTEPROGRESS_ARGS args = { }; | ||
1667 | BA_ONEXECUTEPROGRESS_RESULTS results = { }; | ||
1668 | |||
1669 | args.cbSize = sizeof(args); | ||
1670 | args.wzPackageId = wzPackageId; | ||
1671 | args.dwProgressPercentage = dwProgressPercentage; | ||
1672 | args.dwOverallPercentage = dwOverallPercentage; | ||
1673 | |||
1674 | results.cbSize = sizeof(results); | ||
1675 | |||
1676 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, &args, &results); | ||
1677 | ExitOnFailure(hr, "BA OnExecuteProgress failed."); | ||
1678 | |||
1679 | LExit: | ||
1680 | if (FAILED(hr)) | ||
1681 | { | ||
1682 | *pnResult = IDERROR; | ||
1683 | } | ||
1684 | else if (results.fCancel) | ||
1685 | { | ||
1686 | *pnResult = IDCANCEL; | ||
1687 | } | ||
1688 | else | ||
1689 | { | ||
1690 | *pnResult = IDNOACTION; | ||
1691 | } | ||
1692 | return hr; | ||
1693 | } | ||
1694 | |||
1695 | EXTERN_C BAAPI UserExperienceOnLaunchApprovedExeBegin( | ||
1696 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
1697 | ) | ||
1698 | { | ||
1699 | HRESULT hr = S_OK; | ||
1700 | BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS args = { }; | ||
1701 | BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS results = { }; | ||
1702 | |||
1703 | args.cbSize = sizeof(args); | ||
1704 | |||
1705 | results.cbSize = sizeof(results); | ||
1706 | |||
1707 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, &args, &results); | ||
1708 | ExitOnFailure(hr, "BA OnLaunchApprovedExeBegin failed."); | ||
1709 | |||
1710 | if (results.fCancel) | ||
1711 | { | ||
1712 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1713 | } | ||
1714 | |||
1715 | LExit: | ||
1716 | return hr; | ||
1717 | } | ||
1718 | |||
1719 | EXTERN_C BAAPI UserExperienceOnLaunchApprovedExeComplete( | ||
1720 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1721 | __in HRESULT hrStatus, | ||
1722 | __in DWORD dwProcessId | ||
1723 | ) | ||
1724 | { | ||
1725 | HRESULT hr = S_OK; | ||
1726 | BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS args = { }; | ||
1727 | BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS results = { }; | ||
1728 | |||
1729 | args.cbSize = sizeof(args); | ||
1730 | args.hrStatus = hrStatus; | ||
1731 | args.dwProcessId = dwProcessId; | ||
1732 | |||
1733 | results.cbSize = sizeof(results); | ||
1734 | |||
1735 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, &args, &results); | ||
1736 | ExitOnFailure(hr, "BA OnLaunchApprovedExeComplete failed."); | ||
1737 | |||
1738 | LExit: | ||
1739 | return hr; | ||
1740 | } | ||
1741 | |||
1742 | EXTERN_C BAAPI UserExperienceOnPauseAUBegin( | ||
1743 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
1744 | ) | ||
1745 | { | ||
1746 | HRESULT hr = S_OK; | ||
1747 | BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS args = { }; | ||
1748 | BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS results = { }; | ||
1749 | |||
1750 | args.cbSize = sizeof(args); | ||
1751 | |||
1752 | results.cbSize = sizeof(results); | ||
1753 | |||
1754 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, &args, &results); | ||
1755 | ExitOnFailure(hr, "BA OnPauseAUBegin failed."); | ||
1756 | |||
1757 | LExit: | ||
1758 | return hr; | ||
1759 | } | ||
1760 | |||
1761 | EXTERN_C BAAPI UserExperienceOnPauseAUComplete( | ||
1762 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1763 | __in HRESULT hrStatus | ||
1764 | ) | ||
1765 | { | ||
1766 | HRESULT hr = S_OK; | ||
1767 | BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS args = { }; | ||
1768 | BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS results = { }; | ||
1769 | |||
1770 | args.cbSize = sizeof(args); | ||
1771 | args.hrStatus = hrStatus; | ||
1772 | |||
1773 | results.cbSize = sizeof(results); | ||
1774 | |||
1775 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, &args, &results); | ||
1776 | ExitOnFailure(hr, "BA OnPauseAUComplete failed."); | ||
1777 | |||
1778 | LExit: | ||
1779 | return hr; | ||
1780 | } | ||
1781 | |||
1782 | EXTERN_C BAAPI UserExperienceOnPlanBegin( | ||
1783 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1784 | __in DWORD cPackages | ||
1785 | ) | ||
1786 | { | ||
1787 | HRESULT hr = S_OK; | ||
1788 | BA_ONPLANBEGIN_ARGS args = { }; | ||
1789 | BA_ONPLANBEGIN_RESULTS results = { }; | ||
1790 | |||
1791 | args.cbSize = sizeof(args); | ||
1792 | args.cPackages = cPackages; | ||
1793 | |||
1794 | results.cbSize = sizeof(results); | ||
1795 | |||
1796 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, &args, &results); | ||
1797 | ExitOnFailure(hr, "BA OnPlanBegin failed."); | ||
1798 | |||
1799 | if (results.fCancel) | ||
1800 | { | ||
1801 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1802 | } | ||
1803 | |||
1804 | LExit: | ||
1805 | return hr; | ||
1806 | } | ||
1807 | |||
1808 | EXTERN_C BAAPI UserExperienceOnPlanMsiFeature( | ||
1809 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1810 | __in_z LPCWSTR wzPackageId, | ||
1811 | __in_z LPCWSTR wzFeatureId, | ||
1812 | __inout BOOTSTRAPPER_FEATURE_STATE* pRequestedState | ||
1813 | ) | ||
1814 | { | ||
1815 | HRESULT hr = S_OK; | ||
1816 | BA_ONPLANMSIFEATURE_ARGS args = { }; | ||
1817 | BA_ONPLANMSIFEATURE_RESULTS results = { }; | ||
1818 | |||
1819 | args.cbSize = sizeof(args); | ||
1820 | args.wzPackageId = wzPackageId; | ||
1821 | args.wzFeatureId = wzFeatureId; | ||
1822 | args.recommendedState = *pRequestedState; | ||
1823 | |||
1824 | results.cbSize = sizeof(results); | ||
1825 | results.requestedState = *pRequestedState; | ||
1826 | |||
1827 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, &args, &results); | ||
1828 | ExitOnFailure(hr, "BA OnPlanMsiFeature failed."); | ||
1829 | |||
1830 | if (results.fCancel) | ||
1831 | { | ||
1832 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1833 | } | ||
1834 | *pRequestedState = results.requestedState; | ||
1835 | |||
1836 | LExit: | ||
1837 | return hr; | ||
1838 | } | ||
1839 | |||
1840 | EXTERN_C BAAPI UserExperienceOnPlanComplete( | ||
1841 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1842 | __in HRESULT hrStatus | ||
1843 | ) | ||
1844 | { | ||
1845 | HRESULT hr = S_OK; | ||
1846 | BA_ONPLANCOMPLETE_ARGS args = { }; | ||
1847 | BA_ONPLANCOMPLETE_RESULTS results = { }; | ||
1848 | |||
1849 | args.cbSize = sizeof(args); | ||
1850 | args.hrStatus = hrStatus; | ||
1851 | |||
1852 | results.cbSize = sizeof(results); | ||
1853 | |||
1854 | hr = SendBAMessageFromInactiveEngine(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, &args, &results); | ||
1855 | ExitOnFailure(hr, "BA OnPlanComplete failed."); | ||
1856 | |||
1857 | LExit: | ||
1858 | return hr; | ||
1859 | } | ||
1860 | |||
1861 | EXTERN_C BAAPI UserExperienceOnPlanForwardCompatibleBundle( | ||
1862 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1863 | __in_z LPCWSTR wzBundleId, | ||
1864 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
1865 | __in_z LPCWSTR wzBundleTag, | ||
1866 | __in BOOL fPerMachine, | ||
1867 | __in VERUTIL_VERSION* pVersion, | ||
1868 | __inout BOOL* pfIgnoreBundle | ||
1869 | ) | ||
1870 | { | ||
1871 | HRESULT hr = S_OK; | ||
1872 | BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; | ||
1873 | BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; | ||
1874 | |||
1875 | args.cbSize = sizeof(args); | ||
1876 | args.wzBundleId = wzBundleId; | ||
1877 | args.relationType = relationType; | ||
1878 | args.wzBundleTag = wzBundleTag; | ||
1879 | args.fPerMachine = fPerMachine; | ||
1880 | args.wzVersion = pVersion->sczVersion; | ||
1881 | args.fRecommendedIgnoreBundle = *pfIgnoreBundle; | ||
1882 | |||
1883 | results.cbSize = sizeof(results); | ||
1884 | results.fIgnoreBundle = *pfIgnoreBundle; | ||
1885 | |||
1886 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, &args, &results); | ||
1887 | ExitOnFailure(hr, "BA OnPlanForwardCompatibleBundle failed."); | ||
1888 | |||
1889 | if (results.fCancel) | ||
1890 | { | ||
1891 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1892 | } | ||
1893 | *pfIgnoreBundle = results.fIgnoreBundle; | ||
1894 | |||
1895 | LExit: | ||
1896 | return hr; | ||
1897 | } | ||
1898 | |||
1899 | EXTERN_C BAAPI UserExperienceOnPlanMsiPackage( | ||
1900 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1901 | __in_z LPCWSTR wzPackageId, | ||
1902 | __in BOOL fExecute, | ||
1903 | __in BOOTSTRAPPER_ACTION_STATE action, | ||
1904 | __inout BURN_MSI_PROPERTY* pActionMsiProperty, | ||
1905 | __inout INSTALLUILEVEL* pUiLevel, | ||
1906 | __inout BOOL* pfDisableExternalUiHandler | ||
1907 | ) | ||
1908 | { | ||
1909 | HRESULT hr = S_OK; | ||
1910 | BA_ONPLANMSIPACKAGE_ARGS args = { }; | ||
1911 | BA_ONPLANMSIPACKAGE_RESULTS results = { }; | ||
1912 | |||
1913 | args.cbSize = sizeof(args); | ||
1914 | args.wzPackageId = wzPackageId; | ||
1915 | args.fExecute = fExecute; | ||
1916 | args.action = action; | ||
1917 | |||
1918 | results.cbSize = sizeof(results); | ||
1919 | results.actionMsiProperty = *pActionMsiProperty; | ||
1920 | results.uiLevel = *pUiLevel; | ||
1921 | results.fDisableExternalUiHandler = *pfDisableExternalUiHandler; | ||
1922 | |||
1923 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, &args, &results); | ||
1924 | ExitOnFailure(hr, "BA OnPlanMsiPackage failed."); | ||
1925 | |||
1926 | if (results.fCancel) | ||
1927 | { | ||
1928 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1929 | } | ||
1930 | *pActionMsiProperty = results.actionMsiProperty; | ||
1931 | *pUiLevel = results.uiLevel; | ||
1932 | *pfDisableExternalUiHandler = results.fDisableExternalUiHandler; | ||
1933 | |||
1934 | LExit: | ||
1935 | return hr; | ||
1936 | } | ||
1937 | |||
1938 | EXTERN_C BAAPI UserExperienceOnPlannedPackage( | ||
1939 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1940 | __in_z LPCWSTR wzPackageId, | ||
1941 | __in BOOTSTRAPPER_ACTION_STATE execute, | ||
1942 | __in BOOTSTRAPPER_ACTION_STATE rollback, | ||
1943 | __in BOOL fPlannedCache, | ||
1944 | __in BOOL fPlannedUncache | ||
1945 | ) | ||
1946 | { | ||
1947 | HRESULT hr = S_OK; | ||
1948 | BA_ONPLANNEDPACKAGE_ARGS args = { }; | ||
1949 | BA_ONPLANNEDPACKAGE_RESULTS results = { }; | ||
1950 | |||
1951 | args.cbSize = sizeof(args); | ||
1952 | args.wzPackageId = wzPackageId; | ||
1953 | args.execute = execute; | ||
1954 | args.rollback = rollback; | ||
1955 | args.fPlannedCache = fPlannedCache; | ||
1956 | args.fPlannedUncache = fPlannedUncache; | ||
1957 | |||
1958 | results.cbSize = sizeof(results); | ||
1959 | |||
1960 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, &args, &results); | ||
1961 | ExitOnFailure(hr, "BA OnPlannedPackage failed."); | ||
1962 | |||
1963 | LExit: | ||
1964 | return hr; | ||
1965 | } | ||
1966 | |||
1967 | EXTERN_C BAAPI UserExperienceOnPlanPackageBegin( | ||
1968 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1969 | __in_z LPCWSTR wzPackageId, | ||
1970 | __in BOOTSTRAPPER_PACKAGE_STATE state, | ||
1971 | __in BOOL fCached, | ||
1972 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | ||
1973 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | ||
1974 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType | ||
1975 | ) | ||
1976 | { | ||
1977 | HRESULT hr = S_OK; | ||
1978 | BA_ONPLANPACKAGEBEGIN_ARGS args = { }; | ||
1979 | BA_ONPLANPACKAGEBEGIN_RESULTS results = { }; | ||
1980 | |||
1981 | args.cbSize = sizeof(args); | ||
1982 | args.wzPackageId = wzPackageId; | ||
1983 | args.state = state; | ||
1984 | args.fCached = fCached; | ||
1985 | args.installCondition = installCondition; | ||
1986 | args.recommendedState = *pRequestedState; | ||
1987 | args.recommendedCacheType = *pRequestedCacheType; | ||
1988 | |||
1989 | results.cbSize = sizeof(results); | ||
1990 | results.requestedState = *pRequestedState; | ||
1991 | results.requestedCacheType = *pRequestedCacheType; | ||
1992 | |||
1993 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, &args, &results); | ||
1994 | ExitOnFailure(hr, "BA OnPlanPackageBegin failed."); | ||
1995 | |||
1996 | if (results.fCancel) | ||
1997 | { | ||
1998 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
1999 | } | ||
2000 | *pRequestedState = results.requestedState; | ||
2001 | *pRequestedCacheType = results.requestedCacheType; | ||
2002 | |||
2003 | LExit: | ||
2004 | return hr; | ||
2005 | } | ||
2006 | |||
2007 | EXTERN_C BAAPI UserExperienceOnPlanPackageComplete( | ||
2008 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2009 | __in_z LPCWSTR wzPackageId, | ||
2010 | __in HRESULT hrStatus, | ||
2011 | __in BOOTSTRAPPER_REQUEST_STATE requested | ||
2012 | ) | ||
2013 | { | ||
2014 | HRESULT hr = S_OK; | ||
2015 | BA_ONPLANPACKAGECOMPLETE_ARGS args = { }; | ||
2016 | BA_ONPLANPACKAGECOMPLETE_RESULTS results = { }; | ||
2017 | |||
2018 | args.cbSize = sizeof(args); | ||
2019 | args.wzPackageId = wzPackageId; | ||
2020 | args.hrStatus = hrStatus; | ||
2021 | args.requested = requested; | ||
2022 | |||
2023 | results.cbSize = sizeof(results); | ||
2024 | |||
2025 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, &args, &results); | ||
2026 | ExitOnFailure(hr, "BA OnPlanPackageComplete failed."); | ||
2027 | |||
2028 | LExit: | ||
2029 | return hr; | ||
2030 | } | ||
2031 | |||
2032 | EXTERN_C BAAPI UserExperienceOnPlanRelatedBundle( | ||
2033 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2034 | __in_z LPCWSTR wzBundleId, | ||
2035 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | ||
2036 | ) | ||
2037 | { | ||
2038 | HRESULT hr = S_OK; | ||
2039 | BA_ONPLANRELATEDBUNDLE_ARGS args = { }; | ||
2040 | BA_ONPLANRELATEDBUNDLE_RESULTS results = { }; | ||
2041 | |||
2042 | args.cbSize = sizeof(args); | ||
2043 | args.wzBundleId = wzBundleId; | ||
2044 | args.recommendedState = *pRequestedState; | ||
2045 | |||
2046 | results.cbSize = sizeof(results); | ||
2047 | results.requestedState = *pRequestedState; | ||
2048 | |||
2049 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, &args, &results); | ||
2050 | ExitOnFailure(hr, "BA OnPlanRelatedBundle failed."); | ||
2051 | |||
2052 | if (results.fCancel) | ||
2053 | { | ||
2054 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
2055 | } | ||
2056 | *pRequestedState = results.requestedState; | ||
2057 | |||
2058 | LExit: | ||
2059 | return hr; | ||
2060 | } | ||
2061 | |||
2062 | EXTERN_C BAAPI UserExperienceOnPlanPatchTarget( | ||
2063 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2064 | __in_z LPCWSTR wzPackageId, | ||
2065 | __in_z LPCWSTR wzProductCode, | ||
2066 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState | ||
2067 | ) | ||
2068 | { | ||
2069 | HRESULT hr = S_OK; | ||
2070 | BA_ONPLANPATCHTARGET_ARGS args = { }; | ||
2071 | BA_ONPLANPATCHTARGET_RESULTS results = { }; | ||
2072 | |||
2073 | args.cbSize = sizeof(args); | ||
2074 | args.wzPackageId = wzPackageId; | ||
2075 | args.wzProductCode = wzProductCode; | ||
2076 | args.recommendedState = *pRequestedState; | ||
2077 | |||
2078 | results.cbSize = sizeof(results); | ||
2079 | results.requestedState = *pRequestedState; | ||
2080 | |||
2081 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET, &args, &results); | ||
2082 | ExitOnFailure(hr, "BA OnPlanPatchTarget failed."); | ||
2083 | |||
2084 | if (results.fCancel) | ||
2085 | { | ||
2086 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
2087 | } | ||
2088 | *pRequestedState = results.requestedState; | ||
2089 | |||
2090 | LExit: | ||
2091 | return hr; | ||
2092 | } | ||
2093 | |||
2094 | EXTERN_C BAAPI UserExperienceOnProgress( | ||
2095 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2096 | __in BOOL fRollback, | ||
2097 | __in DWORD dwProgressPercentage, | ||
2098 | __in DWORD dwOverallPercentage | ||
2099 | ) | ||
2100 | { | ||
2101 | HRESULT hr = S_OK; | ||
2102 | BA_ONPROGRESS_ARGS args = { }; | ||
2103 | BA_ONPROGRESS_RESULTS results = { }; | ||
2104 | |||
2105 | args.cbSize = sizeof(args); | ||
2106 | args.dwProgressPercentage = dwProgressPercentage; | ||
2107 | args.dwOverallPercentage = dwOverallPercentage; | ||
2108 | |||
2109 | results.cbSize = sizeof(results); | ||
2110 | |||
2111 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, &args, &results); | ||
2112 | hr = FilterExecuteResult(pUserExperience, hr, fRollback, results.fCancel, L"OnProgress"); | ||
2113 | |||
2114 | return hr; | ||
2115 | } | ||
2116 | |||
2117 | EXTERN_C BAAPI UserExperienceOnRegisterBegin( | ||
2118 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
2119 | ) | ||
2120 | { | ||
2121 | HRESULT hr = S_OK; | ||
2122 | BA_ONREGISTERBEGIN_ARGS args = { }; | ||
2123 | BA_ONREGISTERBEGIN_RESULTS results = { }; | ||
2124 | |||
2125 | args.cbSize = sizeof(args); | ||
2126 | |||
2127 | results.cbSize = sizeof(results); | ||
2128 | |||
2129 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, &args, &results); | ||
2130 | ExitOnFailure(hr, "BA OnRegisterBegin failed."); | ||
2131 | |||
2132 | if (results.fCancel) | ||
2133 | { | ||
2134 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
2135 | } | ||
2136 | |||
2137 | LExit: | ||
2138 | return hr; | ||
2139 | } | ||
2140 | |||
2141 | EXTERN_C BAAPI UserExperienceOnRegisterComplete( | ||
2142 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2143 | __in HRESULT hrStatus | ||
2144 | ) | ||
2145 | { | ||
2146 | HRESULT hr = S_OK; | ||
2147 | BA_ONREGISTERCOMPLETE_ARGS args = { }; | ||
2148 | BA_ONREGISTERCOMPLETE_RESULTS results = { }; | ||
2149 | |||
2150 | args.cbSize = sizeof(args); | ||
2151 | args.hrStatus = hrStatus; | ||
2152 | |||
2153 | results.cbSize = sizeof(results); | ||
2154 | |||
2155 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, &args, &results); | ||
2156 | ExitOnFailure(hr, "BA OnRegisterComplete failed."); | ||
2157 | |||
2158 | LExit: | ||
2159 | return hr; | ||
2160 | } | ||
2161 | |||
2162 | EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionBegin( | ||
2163 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2164 | __in LPCWSTR wzTransactionId | ||
2165 | ) | ||
2166 | { | ||
2167 | HRESULT hr = S_OK; | ||
2168 | BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS args = { }; | ||
2169 | BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS results = { }; | ||
2170 | |||
2171 | args.cbSize = sizeof(args); | ||
2172 | args.wzTransactionId = wzTransactionId; | ||
2173 | |||
2174 | results.cbSize = sizeof(results); | ||
2175 | |||
2176 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &args, &results); | ||
2177 | ExitOnFailure(hr, "BA OnRollbackMsiTransactionBegin failed."); | ||
2178 | |||
2179 | LExit: | ||
2180 | return hr; | ||
2181 | } | ||
2182 | |||
2183 | EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionComplete( | ||
2184 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2185 | __in LPCWSTR wzTransactionId, | ||
2186 | __in HRESULT hrStatus | ||
2187 | ) | ||
2188 | { | ||
2189 | HRESULT hr = S_OK; | ||
2190 | BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS args = { }; | ||
2191 | BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS results = { }; | ||
2192 | |||
2193 | args.cbSize = sizeof(args); | ||
2194 | args.wzTransactionId = wzTransactionId; | ||
2195 | args.hrStatus = hrStatus; | ||
2196 | |||
2197 | results.cbSize = sizeof(results); | ||
2198 | |||
2199 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &args, &results); | ||
2200 | ExitOnFailure(hr, "BA OnRollbackMsiTransactionComplete failed."); | ||
2201 | |||
2202 | LExit: | ||
2203 | return hr; | ||
2204 | } | ||
2205 | |||
2206 | EXTERN_C BAAPI UserExperienceOnShutdown( | ||
2207 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2208 | __inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction | ||
2209 | ) | ||
2210 | { | ||
2211 | HRESULT hr = S_OK; | ||
2212 | BA_ONSHUTDOWN_ARGS args = { }; | ||
2213 | BA_ONSHUTDOWN_RESULTS results = { }; | ||
2214 | |||
2215 | args.cbSize = sizeof(args); | ||
2216 | |||
2217 | results.cbSize = sizeof(results); | ||
2218 | results.action = *pAction; | ||
2219 | |||
2220 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &args, &results); | ||
2221 | ExitOnFailure(hr, "BA OnShutdown failed."); | ||
2222 | |||
2223 | *pAction = results.action; | ||
2224 | |||
2225 | LExit: | ||
2226 | return hr; | ||
2227 | } | ||
2228 | |||
2229 | EXTERN_C BAAPI UserExperienceOnStartup( | ||
2230 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
2231 | ) | ||
2232 | { | ||
2233 | HRESULT hr = S_OK; | ||
2234 | BA_ONSTARTUP_ARGS args = { }; | ||
2235 | BA_ONSTARTUP_RESULTS results = { }; | ||
2236 | |||
2237 | args.cbSize = sizeof(args); | ||
2238 | |||
2239 | results.cbSize = sizeof(results); | ||
2240 | |||
2241 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &args, &results); | ||
2242 | ExitOnFailure(hr, "BA OnStartup failed."); | ||
2243 | |||
2244 | LExit: | ||
2245 | return hr; | ||
2246 | } | ||
2247 | |||
2248 | EXTERN_C BAAPI UserExperienceOnSystemRestorePointBegin( | ||
2249 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
2250 | ) | ||
2251 | { | ||
2252 | HRESULT hr = S_OK; | ||
2253 | BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS args = { }; | ||
2254 | BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS results = { }; | ||
2255 | |||
2256 | args.cbSize = sizeof(args); | ||
2257 | |||
2258 | results.cbSize = sizeof(results); | ||
2259 | |||
2260 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, &args, &results); | ||
2261 | ExitOnFailure(hr, "BA OnSystemRestorePointBegin failed."); | ||
2262 | |||
2263 | LExit: | ||
2264 | return hr; | ||
2265 | } | ||
2266 | |||
2267 | EXTERN_C BAAPI UserExperienceOnSystemRestorePointComplete( | ||
2268 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2269 | __in HRESULT hrStatus | ||
2270 | ) | ||
2271 | { | ||
2272 | HRESULT hr = S_OK; | ||
2273 | BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS args = { }; | ||
2274 | BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS results = { }; | ||
2275 | |||
2276 | args.cbSize = sizeof(args); | ||
2277 | args.hrStatus = hrStatus; | ||
2278 | |||
2279 | results.cbSize = sizeof(results); | ||
2280 | |||
2281 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, &args, &results); | ||
2282 | ExitOnFailure(hr, "BA OnSystemRestorePointComplete failed."); | ||
2283 | |||
2284 | LExit: | ||
2285 | return hr; | ||
2286 | } | ||
2287 | |||
2288 | EXTERN_C BAAPI UserExperienceOnSystemShutdown( | ||
2289 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2290 | __in DWORD dwEndSession, | ||
2291 | __inout BOOL* pfCancel | ||
2292 | ) | ||
2293 | { | ||
2294 | HRESULT hr = S_OK; | ||
2295 | BA_ONSYSTEMSHUTDOWN_ARGS args = { }; | ||
2296 | BA_ONSYSTEMSHUTDOWN_RESULTS results = { }; | ||
2297 | |||
2298 | args.cbSize = sizeof(args); | ||
2299 | args.dwEndSession = dwEndSession; | ||
2300 | |||
2301 | results.cbSize = sizeof(results); | ||
2302 | results.fCancel = *pfCancel; | ||
2303 | |||
2304 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMSHUTDOWN, &args, &results); | ||
2305 | ExitOnFailure(hr, "BA OnSystemShutdown failed."); | ||
2306 | |||
2307 | *pfCancel = results.fCancel; | ||
2308 | |||
2309 | LExit: | ||
2310 | return hr; | ||
2311 | } | ||
2312 | |||
2313 | EXTERN_C BAAPI UserExperienceOnUnregisterBegin( | ||
2314 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2315 | __inout BOOL* pfKeepRegistration | ||
2316 | ) | ||
2317 | { | ||
2318 | HRESULT hr = S_OK; | ||
2319 | BA_ONUNREGISTERBEGIN_ARGS args = { }; | ||
2320 | BA_ONUNREGISTERBEGIN_RESULTS results = { }; | ||
2321 | |||
2322 | args.cbSize = sizeof(args); | ||
2323 | args.fKeepRegistration = *pfKeepRegistration; | ||
2324 | |||
2325 | results.cbSize = sizeof(results); | ||
2326 | |||
2327 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &args, &results); | ||
2328 | ExitOnFailure(hr, "BA OnUnregisterBegin failed."); | ||
2329 | |||
2330 | if (!args.fKeepRegistration && results.fForceKeepRegistration) | ||
2331 | { | ||
2332 | *pfKeepRegistration = TRUE; | ||
2333 | } | ||
2334 | |||
2335 | LExit: | ||
2336 | return hr; | ||
2337 | } | ||
2338 | |||
2339 | EXTERN_C BAAPI UserExperienceOnUnregisterComplete( | ||
2340 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2341 | __in HRESULT hrStatus | ||
2342 | ) | ||
2343 | { | ||
2344 | HRESULT hr = S_OK; | ||
2345 | BA_ONUNREGISTERCOMPLETE_ARGS args = { }; | ||
2346 | BA_ONUNREGISTERCOMPLETE_RESULTS results = { }; | ||
2347 | |||
2348 | args.cbSize = sizeof(args); | ||
2349 | args.hrStatus = hrStatus; | ||
2350 | |||
2351 | results.cbSize = sizeof(results); | ||
2352 | |||
2353 | hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, &args, &results); | ||
2354 | ExitOnFailure(hr, "BA OnUnregisterComplete failed."); | ||
2355 | |||
2356 | LExit: | ||
2357 | return hr; | ||
2358 | } | ||
2359 | |||
2360 | extern "C" int UserExperienceCheckExecuteResult( | ||
2361 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2362 | __in BOOL fRollback, | ||
2363 | __in DWORD dwAllowedResults, | ||
2364 | __in int nResult | ||
2365 | ) | ||
2366 | { | ||
2367 | // Do not allow canceling while rolling back. | ||
2368 | if (fRollback && (IDCANCEL == nResult || IDABORT == nResult)) | ||
2369 | { | ||
2370 | nResult = IDNOACTION; | ||
2371 | } | ||
2372 | else if (FAILED(pUserExperience->hrApplyError) && !fRollback) // if we failed cancel except not during rollback. | ||
2373 | { | ||
2374 | nResult = IDCANCEL; | ||
2375 | } | ||
2376 | |||
2377 | nResult = FilterResult(dwAllowedResults, nResult); | ||
2378 | return nResult; | ||
2379 | } | ||
2380 | |||
2381 | extern "C" HRESULT UserExperienceInterpretExecuteResult( | ||
2382 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2383 | __in BOOL fRollback, | ||
2384 | __in DWORD dwAllowedResults, | ||
2385 | __in int nResult | ||
2386 | ) | ||
2387 | { | ||
2388 | HRESULT hr = S_OK; | ||
2389 | |||
2390 | // If we failed return that error unless this is rollback which should roll on. | ||
2391 | if (FAILED(pUserExperience->hrApplyError) && !fRollback) | ||
2392 | { | ||
2393 | hr = pUserExperience->hrApplyError; | ||
2394 | } | ||
2395 | else | ||
2396 | { | ||
2397 | int nCheckedResult = UserExperienceCheckExecuteResult(pUserExperience, fRollback, dwAllowedResults, nResult); | ||
2398 | hr = IDOK == nCheckedResult || IDNOACTION == nCheckedResult ? S_OK : IDCANCEL == nCheckedResult || IDABORT == nCheckedResult ? HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) : HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE); | ||
2399 | } | ||
2400 | |||
2401 | return hr; | ||
2402 | } | ||
2403 | |||
2404 | |||
2405 | // internal functions | ||
2406 | |||
2407 | static int FilterResult( | ||
2408 | __in DWORD dwAllowedResults, | ||
2409 | __in int nResult | ||
2410 | ) | ||
2411 | { | ||
2412 | DWORD dwFilteredAllowedResults = dwAllowedResults & MB_TYPEMASK; | ||
2413 | if (IDNOACTION == nResult || IDERROR == nResult) // do nothing and errors pass through. | ||
2414 | { | ||
2415 | } | ||
2416 | else | ||
2417 | { | ||
2418 | switch (dwFilteredAllowedResults) | ||
2419 | { | ||
2420 | case MB_OK: | ||
2421 | nResult = IDOK; | ||
2422 | break; | ||
2423 | |||
2424 | case MB_OKCANCEL: | ||
2425 | if (IDOK == nResult || IDYES == nResult) | ||
2426 | { | ||
2427 | nResult = IDOK; | ||
2428 | } | ||
2429 | else if (IDCANCEL == nResult || IDABORT == nResult || IDNO == nResult) | ||
2430 | { | ||
2431 | nResult = IDCANCEL; | ||
2432 | } | ||
2433 | else | ||
2434 | { | ||
2435 | nResult = IDNOACTION; | ||
2436 | } | ||
2437 | break; | ||
2438 | |||
2439 | case MB_ABORTRETRYIGNORE: | ||
2440 | if (IDCANCEL == nResult || IDABORT == nResult) | ||
2441 | { | ||
2442 | nResult = IDABORT; | ||
2443 | } | ||
2444 | else if (IDRETRY == nResult || IDTRYAGAIN == nResult) | ||
2445 | { | ||
2446 | nResult = IDRETRY; | ||
2447 | } | ||
2448 | else if (IDIGNORE == nResult) | ||
2449 | { | ||
2450 | nResult = IDIGNORE; | ||
2451 | } | ||
2452 | else | ||
2453 | { | ||
2454 | nResult = IDNOACTION; | ||
2455 | } | ||
2456 | break; | ||
2457 | |||
2458 | case MB_YESNO: | ||
2459 | if (IDOK == nResult || IDYES == nResult) | ||
2460 | { | ||
2461 | nResult = IDYES; | ||
2462 | } | ||
2463 | else if (IDCANCEL == nResult || IDABORT == nResult || IDNO == nResult) | ||
2464 | { | ||
2465 | nResult = IDNO; | ||
2466 | } | ||
2467 | else | ||
2468 | { | ||
2469 | nResult = IDNOACTION; | ||
2470 | } | ||
2471 | break; | ||
2472 | |||
2473 | case MB_YESNOCANCEL: | ||
2474 | if (IDOK == nResult || IDYES == nResult) | ||
2475 | { | ||
2476 | nResult = IDYES; | ||
2477 | } | ||
2478 | else if (IDNO == nResult) | ||
2479 | { | ||
2480 | nResult = IDNO; | ||
2481 | } | ||
2482 | else if (IDCANCEL == nResult || IDABORT == nResult) | ||
2483 | { | ||
2484 | nResult = IDCANCEL; | ||
2485 | } | ||
2486 | else | ||
2487 | { | ||
2488 | nResult = IDNOACTION; | ||
2489 | } | ||
2490 | break; | ||
2491 | |||
2492 | case MB_RETRYCANCEL: | ||
2493 | if (IDRETRY == nResult || IDTRYAGAIN == nResult) | ||
2494 | { | ||
2495 | nResult = IDRETRY; | ||
2496 | } | ||
2497 | else if (IDCANCEL == nResult || IDABORT == nResult) | ||
2498 | { | ||
2499 | nResult = IDABORT; | ||
2500 | } | ||
2501 | else | ||
2502 | { | ||
2503 | nResult = IDNOACTION; | ||
2504 | } | ||
2505 | break; | ||
2506 | |||
2507 | case MB_CANCELTRYCONTINUE: | ||
2508 | if (IDCANCEL == nResult || IDABORT == nResult) | ||
2509 | { | ||
2510 | nResult = IDABORT; | ||
2511 | } | ||
2512 | else if (IDRETRY == nResult || IDTRYAGAIN == nResult) | ||
2513 | { | ||
2514 | nResult = IDRETRY; | ||
2515 | } | ||
2516 | else if (IDCONTINUE == nResult || IDIGNORE == nResult) | ||
2517 | { | ||
2518 | nResult = IDCONTINUE; | ||
2519 | } | ||
2520 | else | ||
2521 | { | ||
2522 | nResult = IDNOACTION; | ||
2523 | } | ||
2524 | break; | ||
2525 | |||
2526 | case WIU_MB_OKIGNORECANCELRETRY: // custom Windows Installer utility return code. | ||
2527 | if (IDOK == nResult || IDYES == nResult) | ||
2528 | { | ||
2529 | nResult = IDOK; | ||
2530 | } | ||
2531 | else if (IDCONTINUE == nResult || IDIGNORE == nResult) | ||
2532 | { | ||
2533 | nResult = IDIGNORE; | ||
2534 | } | ||
2535 | else if (IDCANCEL == nResult || IDABORT == nResult) | ||
2536 | { | ||
2537 | nResult = IDCANCEL; | ||
2538 | } | ||
2539 | else if (IDRETRY == nResult || IDTRYAGAIN == nResult || IDNO == nResult) | ||
2540 | { | ||
2541 | nResult = IDRETRY; | ||
2542 | } | ||
2543 | else | ||
2544 | { | ||
2545 | nResult = IDNOACTION; | ||
2546 | } | ||
2547 | break; | ||
2548 | |||
2549 | case MB_RETRYTRYAGAIN: // custom return code. | ||
2550 | if (IDRETRY != nResult && IDTRYAGAIN != nResult) | ||
2551 | { | ||
2552 | nResult = IDNOACTION; | ||
2553 | } | ||
2554 | break; | ||
2555 | |||
2556 | default: | ||
2557 | AssertSz(FALSE, "Unknown allowed results."); | ||
2558 | break; | ||
2559 | } | ||
2560 | } | ||
2561 | |||
2562 | return nResult; | ||
2563 | } | ||
2564 | |||
2565 | // This filters the BA's responses to events during apply. | ||
2566 | // If an apply thread failed, then return its error so this thread will bail out. | ||
2567 | // During rollback, the BA can't cancel. | ||
2568 | static HRESULT FilterExecuteResult( | ||
2569 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2570 | __in HRESULT hrStatus, | ||
2571 | __in BOOL fRollback, | ||
2572 | __in BOOL fCancel, | ||
2573 | __in LPCWSTR sczEventName | ||
2574 | ) | ||
2575 | { | ||
2576 | HRESULT hr = hrStatus; | ||
2577 | HRESULT hrApplyError = pUserExperience->hrApplyError; // make sure to use the same value for the whole method, since it can be changed in other threads. | ||
2578 | |||
2579 | // If we failed return that error unless this is rollback which should roll on. | ||
2580 | if (FAILED(hrApplyError) && !fRollback) | ||
2581 | { | ||
2582 | hr = hrApplyError; | ||
2583 | } | ||
2584 | else if (fRollback) | ||
2585 | { | ||
2586 | if (fCancel) | ||
2587 | { | ||
2588 | LogId(REPORT_STANDARD, MSG_APPLY_CANCEL_IGNORED_DURING_ROLLBACK, sczEventName); | ||
2589 | } | ||
2590 | // TODO: since cancel isn't allowed, should the BA's HRESULT be ignored as well? | ||
2591 | // In the previous code, they could still alter rollback by returning IDERROR. | ||
2592 | } | ||
2593 | else | ||
2594 | { | ||
2595 | ExitOnFailure(hr, "BA %ls failed.", sczEventName); | ||
2596 | |||
2597 | if (fCancel) | ||
2598 | { | ||
2599 | hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); | ||
2600 | } | ||
2601 | } | ||
2602 | |||
2603 | LExit: | ||
2604 | return hr; | ||
2605 | } | ||
2606 | |||
2607 | static HRESULT SendBAMessage( | ||
2608 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2609 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
2610 | __in const LPVOID pvArgs, | ||
2611 | __inout LPVOID pvResults | ||
2612 | ) | ||
2613 | { | ||
2614 | HRESULT hr = S_OK; | ||
2615 | |||
2616 | if (!pUserExperience->hUXModule) | ||
2617 | { | ||
2618 | ExitFunction(); | ||
2619 | } | ||
2620 | |||
2621 | hr = pUserExperience->pfnBAProc(message, pvArgs, pvResults, pUserExperience->pvBAProcContext); | ||
2622 | if (hr == E_NOTIMPL) | ||
2623 | { | ||
2624 | hr = S_OK; | ||
2625 | } | ||
2626 | |||
2627 | LExit: | ||
2628 | return hr; | ||
2629 | } | ||
2630 | |||
2631 | static HRESULT SendBAMessageFromInactiveEngine( | ||
2632 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
2633 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
2634 | __in const LPVOID pvArgs, | ||
2635 | __inout LPVOID pvResults | ||
2636 | ) | ||
2637 | { | ||
2638 | HRESULT hr = S_OK; | ||
2639 | |||
2640 | if (!pUserExperience->hUXModule) | ||
2641 | { | ||
2642 | ExitFunction(); | ||
2643 | } | ||
2644 | |||
2645 | UserExperienceDeactivateEngine(pUserExperience); | ||
2646 | |||
2647 | hr = SendBAMessage(pUserExperience, message, pvArgs, pvResults); | ||
2648 | |||
2649 | UserExperienceActivateEngine(pUserExperience); | ||
2650 | |||
2651 | LExit: | ||
2652 | return hr; | ||
2653 | } | ||