@joebigelow / wix / commits / 643293e4

Allow E_IMPL from BA/bext and check all cbSizes from BA/bext.

Sean Hall committed Nov 17, 2020 at 14:11 UTC 643293e48d176ff78282670512f45b4cf889b0a5
8 files changed +372 -179
src/engine/EngineForApplication.cpp
+139 -77
@@ -5,31 +5,36 @@
5
6 static HRESULT CopyStringToBA(
7 __in LPWSTR wzValue,
8 - __in LPWSTR wzBuffer,
8 + __in_opt LPWSTR wzBuffer,
9 __inout DWORD* pcchBuffer
10 );
11
12 static HRESULT BAEngineGetPackageCount(
13 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
14 - __in BAENGINE_GETPACKAGECOUNT_ARGS* /*pArgs*/,
15 - __in BAENGINE_GETPACKAGECOUNT_RESULTS* pResults
14 + __in const LPVOID pvArgs,
15 + __inout LPVOID pvResults
16 )
17 {
18 HRESULT hr = S_OK;
19 + ValidateMessageArgs(hr, pvArgs, BAENGINE_GETPACKAGECOUNT_ARGS, pArgs);
20 + ValidateMessageResults(hr, pvResults, BAENGINE_GETPACKAGECOUNT_RESULTS, pResults);
21 DWORD* pcPackages = &pResults->cPackages;
22
23 *pcPackages = pContext->pEngineState->packages.cPackages;
24
25 +LExit:
26 return hr;
27 }
28
29 static HRESULT BAEngineGetVariableNumeric(
30 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
28 - __in BAENGINE_GETVARIABLENUMERIC_ARGS* pArgs,
29 - __in BAENGINE_GETVARIABLENUMERIC_RESULTS* pResults
31 + __in const LPVOID pvArgs,
32 + __inout LPVOID pvResults
33 )
34 {
35 HRESULT hr = S_OK;
36 + ValidateMessageArgs(hr, pvArgs, BAENGINE_GETVARIABLENUMERIC_ARGS, pArgs);
37 + ValidateMessageResults(hr, pvResults, BAENGINE_GETVARIABLENUMERIC_RESULTS, pResults);
38 LPCWSTR wzVariable = pArgs->wzVariable;
39 LONGLONG* pllValue = &pResults->llValue;
40
@@ -42,17 +47,20 @@ static HRESULT BAEngineGetVariableNumeric(
47 hr = E_INVALIDARG;
48 }
49
50 +LExit:
51 return hr;
52 }
53
54 static HRESULT BAEngineGetVariableString(
55 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
50 - __in BAENGINE_GETVARIABLESTRING_ARGS* pArgs,
51 - __in BAENGINE_GETVARIABLESTRING_RESULTS* pResults
56 + __in const LPVOID pvArgs,
57 + __inout LPVOID pvResults
58 )
59 {
60 HRESULT hr = S_OK;
61 LPWSTR sczValue = NULL;
62 + ValidateMessageArgs(hr, pvArgs, BAENGINE_GETVARIABLESTRING_ARGS, pArgs);
63 + ValidateMessageResults(hr, pvResults, BAENGINE_GETVARIABLESTRING_RESULTS, pResults);
64 LPCWSTR wzVariable = pArgs->wzVariable;
65 LPWSTR wzValue = pResults->wzValue;
66 DWORD* pcchValue = &pResults->cchValue;
@@ -70,18 +78,21 @@ static HRESULT BAEngineGetVariableString(
78 hr = E_INVALIDARG;
79 }
80
81 +LExit:
82 StrSecureZeroFreeString(sczValue);
83 return hr;
84 }
85
86 static HRESULT BAEngineGetVariableVersion(
87 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
79 - __in BAENGINE_GETVARIABLEVERSION_ARGS* pArgs,
80 - __in BAENGINE_GETVARIABLEVERSION_RESULTS* pResults
88 + __in const LPVOID pvArgs,
89 + __inout LPVOID pvResults
90 )
91 {
92 HRESULT hr = S_OK;
93 VERUTIL_VERSION* pVersion = NULL;
94 + ValidateMessageArgs(hr, pvArgs, BAENGINE_GETVARIABLEVERSION_ARGS, pArgs);
95 + ValidateMessageResults(hr, pvResults, BAENGINE_GETVARIABLEVERSION_RESULTS, pResults);
96 LPCWSTR wzVariable = pArgs->wzVariable;
97 LPWSTR wzValue = pResults->wzValue;
98 DWORD* pcchValue = &pResults->cchValue;
@@ -99,6 +110,7 @@ static HRESULT BAEngineGetVariableVersion(
110 hr = E_INVALIDARG;
111 }
112
113 +LExit:
114 ReleaseVerutilVersion(pVersion);
115
116 return hr;
@@ -106,12 +118,14 @@ static HRESULT BAEngineGetVariableVersion(
118
119 static HRESULT BAEngineFormatString(
120 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
109 - __in BAENGINE_FORMATSTRING_ARGS* pArgs,
110 - __in BAENGINE_FORMATSTRING_RESULTS* pResults
121 + __in const LPVOID pvArgs,
122 + __inout LPVOID pvResults
123 )
124 {
125 HRESULT hr = S_OK;
126 LPWSTR sczValue = NULL;
127 + ValidateMessageArgs(hr, pvArgs, BAENGINE_FORMATSTRING_ARGS, pArgs);
128 + ValidateMessageResults(hr, pvResults, BAENGINE_FORMATSTRING_RESULTS, pResults);
129 LPCWSTR wzIn = pArgs->wzIn;
130 LPWSTR wzOut = pResults->wzOut;
131 DWORD* pcchOut = &pResults->cchOut;
@@ -129,18 +143,21 @@ static HRESULT BAEngineFormatString(
143 hr = E_INVALIDARG;
144 }
145
146 +LExit:
147 StrSecureZeroFreeString(sczValue);
148 return hr;
149 }
150
151 static HRESULT BAEngineEscapeString(
152 __in BOOTSTRAPPER_ENGINE_CONTEXT* /*pContext*/,
138 - __in BAENGINE_ESCAPESTRING_ARGS* pArgs,
139 - __in BAENGINE_ESCAPESTRING_RESULTS* pResults
153 + __in const LPVOID pvArgs,
154 + __inout LPVOID pvResults
155 )
156 {
157 HRESULT hr = S_OK;
158 LPWSTR sczValue = NULL;
159 + ValidateMessageArgs(hr, pvArgs, BAENGINE_ESCAPESTRING_ARGS, pArgs);
160 + ValidateMessageResults(hr, pvResults, BAENGINE_ESCAPESTRING_RESULTS, pResults);
161 LPCWSTR wzIn = pArgs->wzIn;
162 LPWSTR wzOut = pResults->wzOut;
163 DWORD* pcchOut = &pResults->cchOut;
@@ -158,17 +175,20 @@ static HRESULT BAEngineEscapeString(
175 hr = E_INVALIDARG;
176 }
177
178 +LExit:
179 StrSecureZeroFreeString(sczValue);
180 return hr;
181 }
182
183 static HRESULT BAEngineEvaluateCondition(
184 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
167 - __in BAENGINE_EVALUATECONDITION_ARGS* pArgs,
168 - __in BAENGINE_EVALUATECONDITION_RESULTS* pResults
185 + __in const LPVOID pvArgs,
186 + __inout LPVOID pvResults
187 )
188 {
189 HRESULT hr = S_OK;
190 + ValidateMessageArgs(hr, pvArgs, BAENGINE_EVALUATECONDITION_ARGS, pArgs);
191 + ValidateMessageResults(hr, pvResults, BAENGINE_EVALUATECONDITION_RESULTS, pResults);
192 LPCWSTR wzCondition = pArgs->wzCondition;
193 BOOL* pf = &pResults->f;
194
@@ -181,16 +201,19 @@ static HRESULT BAEngineEvaluateCondition(
201 hr = E_INVALIDARG;
202 }
203
204 +LExit:
205 return hr;
206 }
207
208 static HRESULT BAEngineLog(
209 __in BOOTSTRAPPER_ENGINE_CONTEXT* /*pContext*/,
189 - __in BAENGINE_LOG_ARGS* pArgs,
190 - __in BAENGINE_LOG_RESULTS* /*pResults*/
210 + __in const LPVOID pvArgs,
211 + __inout LPVOID pvResults
212 )
213 {
214 HRESULT hr = S_OK;
215 + ValidateMessageArgs(hr, pvArgs, BAENGINE_LOG_ARGS, pArgs);
216 + ValidateMessageResults(hr, pvResults, BAENGINE_LOG_RESULTS, pResults);
217 REPORT_LEVEL rl = REPORT_NONE;
218 BOOTSTRAPPER_LOG_LEVEL level = pArgs->level;
219 LPCWSTR wzMessage = pArgs->wzMessage;
@@ -226,14 +249,16 @@ LExit:
249
250 static HRESULT BAEngineSendEmbeddedError(
251 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
229 - __in BAENGINE_SENDEMBEDDEDERROR_ARGS* pArgs,
230 - __in BAENGINE_SENDEMBEDDEDERROR_RESULTS* pResults
252 + __in const LPVOID pvArgs,
253 + __inout LPVOID pvResults
254 )
255 {
256 HRESULT hr = S_OK;
257 BYTE* pbData = NULL;
258 DWORD cbData = 0;
259 DWORD dwResult = 0;
260 + ValidateMessageArgs(hr, pvArgs, BAENGINE_SENDEMBEDDEDERROR_ARGS, pArgs);
261 + ValidateMessageResults(hr, pvResults, BAENGINE_SENDEMBEDDEDERROR_RESULTS, pResults);
262 DWORD dwErrorCode = pArgs->dwErrorCode;
263 LPCWSTR wzMessage = pArgs->wzMessage;
264 DWORD dwUIHint = pArgs->dwUIHint;
@@ -266,14 +291,16 @@ LExit:
291
292 static HRESULT BAEngineSendEmbeddedProgress(
293 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
269 - __in BAENGINE_SENDEMBEDDEDPROGRESS_ARGS* pArgs,
270 - __in BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS* pResults
294 + __in const LPVOID pvArgs,
295 + __inout LPVOID pvResults
296 )
297 {
298 HRESULT hr = S_OK;
299 BYTE* pbData = NULL;
300 DWORD cbData = 0;
301 DWORD dwResult = 0;
302 + ValidateMessageArgs(hr, pvArgs, BAENGINE_SENDEMBEDDEDPROGRESS_ARGS, pArgs);
303 + ValidateMessageResults(hr, pvResults, BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS, pResults);
304 DWORD dwProgressPercentage = pArgs->dwProgressPercentage;
305 DWORD dwOverallProgressPercentage = pArgs->dwOverallProgressPercentage;
306 int* pnResult = &pResults->nResult;
@@ -302,8 +329,8 @@ LExit:
329
330 static HRESULT BAEngineSetUpdate(
331 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
305 - __in const BAENGINE_SETUPDATE_ARGS* pArgs,
306 - __in BAENGINE_SETUPDATE_RESULTS* /*pResults*/
332 + __in const LPVOID pvArgs,
333 + __inout LPVOID pvResults
334 )
335 {
336 HRESULT hr = S_OK;
@@ -313,6 +340,8 @@ static HRESULT BAEngineSetUpdate(
340 UUID guid = { };
341 WCHAR wzGuid[39];
342 RPC_STATUS rs = RPC_S_OK;
343 + ValidateMessageArgs(hr, pvArgs, BAENGINE_SETUPDATE_ARGS, pArgs);
344 + ValidateMessageResults(hr, pvResults, BAENGINE_SETUPDATE_RESULTS, pResults);
345 LPCWSTR wzLocalSource = pArgs->wzLocalSource;
346 LPCWSTR wzDownloadSource = pArgs->wzDownloadSource;
347 DWORD64 qwSize = pArgs->qwSize;
@@ -385,13 +414,15 @@ LExit:
414
415 static HRESULT BAEngineSetLocalSource(
416 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
388 - __in BAENGINE_SETLOCALSOURCE_ARGS* pArgs,
389 - __in BAENGINE_SETLOCALSOURCE_RESULTS* /*pResults*/
417 + __in const LPVOID pvArgs,
418 + __inout LPVOID pvResults
419 )
420 {
421 HRESULT hr = S_OK;
422 BURN_CONTAINER* pContainer = NULL;
423 BURN_PAYLOAD* pPayload = NULL;
424 + ValidateMessageArgs(hr, pvArgs, BAENGINE_SETLOCALSOURCE_ARGS, pArgs);
425 + ValidateMessageResults(hr, pvResults, BAENGINE_SETLOCALSOURCE_RESULTS, pResults);
426 LPCWSTR wzPackageOrContainerId = pArgs->wzPackageOrContainerId;
427 LPCWSTR wzPayloadId = pArgs->wzPayloadId;
428 LPCWSTR wzPath = pArgs->wzPath;
@@ -438,14 +469,16 @@ LExit:
469
470 static HRESULT BAEngineSetDownloadSource(
471 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
441 - __in BAENGINE_SETDOWNLOADSOURCE_ARGS* pArgs,
442 - __in BAENGINE_SETDOWNLOADSOURCE_RESULTS* /*pResults*/
472 + __in const LPVOID pvArgs,
473 + __inout LPVOID pvResults
474 )
475 {
476 HRESULT hr = S_OK;
477 BURN_CONTAINER* pContainer = NULL;
478 BURN_PAYLOAD* pPayload = NULL;
479 DOWNLOAD_SOURCE* pDownloadSource = NULL;
480 + ValidateMessageArgs(hr, pvArgs, BAENGINE_SETDOWNLOADSOURCE_ARGS, pArgs);
481 + ValidateMessageResults(hr, pvResults, BAENGINE_SETDOWNLOADSOURCE_RESULTS, pResults);
482 LPCWSTR wzPackageOrContainerId = pArgs->wzPackageOrContainerId;
483 LPCWSTR wzPayloadId = pArgs->wzPayloadId;
484 LPCWSTR wzUrl = pArgs->wzUrl;
@@ -522,11 +555,13 @@ LExit:
555
556 static HRESULT BAEngineSetVariableNumeric(
557 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
525 - __in const BAENGINE_SETVARIABLENUMERIC_ARGS* pArgs,
526 - __in BAENGINE_SETVARIABLENUMERIC_RESULTS* /*pResults*/
558 + __in const LPVOID pvArgs,
559 + __inout LPVOID pvResults
560 )
561 {
562 HRESULT hr = S_OK;
563 + ValidateMessageArgs(hr, pvArgs, BAENGINE_SETVARIABLENUMERIC_ARGS, pArgs);
564 + ValidateMessageResults(hr, pvResults, BAENGINE_SETVARIABLENUMERIC_RESULTS, pResults);
565 LPCWSTR wzVariable = pArgs->wzVariable;
566 LONGLONG llValue = pArgs->llValue;
567
@@ -547,11 +582,13 @@ LExit:
582
583 static HRESULT BAEngineSetVariableString(
584 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
550 - __in const BAENGINE_SETVARIABLESTRING_ARGS* pArgs,
551 - __in BAENGINE_SETVARIABLESTRING_RESULTS* /*pResults*/
585 + __in const LPVOID pvArgs,
586 + __inout LPVOID pvResults
587 )
588 {
589 HRESULT hr = S_OK;
590 + ValidateMessageArgs(hr, pvArgs, BAENGINE_SETVARIABLESTRING_ARGS, pArgs);
591 + ValidateMessageResults(hr, pvResults, BAENGINE_SETVARIABLESTRING_RESULTS, pResults);
592 LPCWSTR wzVariable = pArgs->wzVariable;
593 LPCWSTR wzValue = pArgs->wzValue;
594
@@ -572,14 +609,16 @@ LExit:
609
610 static HRESULT BAEngineSetVariableVersion(
611 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
575 - __in const BAENGINE_SETVARIABLEVERSION_ARGS* pArgs,
576 - __in BAENGINE_SETVARIABLEVERSION_RESULTS* /*pResults*/
612 + __in const LPVOID pvArgs,
613 + __inout LPVOID pvResults
614 )
615 {
616 HRESULT hr = S_OK;
617 + VERUTIL_VERSION* pVersion = NULL;
618 + ValidateMessageArgs(hr, pvArgs, BAENGINE_SETVARIABLEVERSION_ARGS, pArgs);
619 + ValidateMessageResults(hr, pvResults, BAENGINE_SETVARIABLEVERSION_RESULTS, pResults);
620 LPCWSTR wzVariable = pArgs->wzVariable;
621 LPCWSTR wzValue = pArgs->wzValue;
582 - VERUTIL_VERSION* pVersion = NULL;
622
623 if (wzVariable && *wzVariable)
624 {
@@ -606,42 +645,52 @@ LExit:
645
646 static HRESULT BAEngineCloseSplashScreen(
647 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
609 - __in const BAENGINE_CLOSESPLASHSCREEN_ARGS* /*pArgs*/,
610 - __in BAENGINE_CLOSESPLASHSCREEN_RESULTS* /*pResults*/
648 + __in const LPVOID pvArgs,
649 + __inout LPVOID pvResults
650 )
651 {
652 + HRESULT hr = S_OK;
653 + ValidateMessageArgs(hr, pvArgs, BAENGINE_CLOSESPLASHSCREEN_ARGS, pArgs);
654 + ValidateMessageResults(hr, pvResults, BAENGINE_CLOSESPLASHSCREEN_RESULTS, pResults);
655 +
656 // If the splash screen is still around, close it.
657 if (::IsWindow(pContext->pEngineState->command.hwndSplashScreen))
658 {
659 ::PostMessageW(pContext->pEngineState->command.hwndSplashScreen, WM_CLOSE, 0, 0);
660 }
661
619 - return S_OK;
662 +LExit:
663 + return hr;
664 }
665
666 static HRESULT BAEngineCompareVersions(
667 __in BOOTSTRAPPER_ENGINE_CONTEXT* /*pContext*/,
624 - __in const BAENGINE_COMPAREVERSIONS_ARGS* pArgs,
625 - __in BAENGINE_COMPAREVERSIONS_RESULTS* pResults
668 + __in const LPVOID pvArgs,
669 + __inout LPVOID pvResults
670 )
671 {
672 HRESULT hr = S_OK;
673 + ValidateMessageArgs(hr, pvArgs, BAENGINE_COMPAREVERSIONS_ARGS, pArgs);
674 + ValidateMessageResults(hr, pvResults, BAENGINE_COMPAREVERSIONS_RESULTS, pResults);
675 LPCWSTR wzVersion1 = pArgs->wzVersion1;
676 LPCWSTR wzVersion2 = pArgs->wzVersion2;
677 int* pnResult = &pResults->nResult;
678
679 hr = VerCompareStringVersions(wzVersion1, wzVersion2, FALSE, pnResult);
680
681 +LExit:
682 return hr;
683 }
684
685 static HRESULT BAEngineDetect(
686 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
640 - __in BAENGINE_DETECT_ARGS* pArgs,
641 - __in BAENGINE_DETECT_RESULTS* /*pResults*/
687 + __in const LPVOID pvArgs,
688 + __inout LPVOID pvResults
689 )
690 {
691 HRESULT hr = S_OK;
692 + ValidateMessageArgs(hr, pvArgs, BAENGINE_DETECT_ARGS, pArgs);
693 + ValidateMessageResults(hr, pvResults, BAENGINE_DETECT_RESULTS, pResults);
694
695 if (!::PostThreadMessageW(pContext->dwThreadId, WM_BURN_DETECT, 0, reinterpret_cast<LPARAM>(pArgs->hwndParent)))
696 {
@@ -654,11 +703,13 @@ LExit:
703
704 static HRESULT BAEnginePlan(
705 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
657 - __in const BAENGINE_PLAN_ARGS* pArgs,
658 - __in BAENGINE_PLAN_RESULTS* /*pResults*/
706 + __in const LPVOID pvArgs,
707 + __inout LPVOID pvResults
708 )
709 {
710 HRESULT hr = S_OK;
711 + ValidateMessageArgs(hr, pvArgs, BAENGINE_PLAN_ARGS, pArgs);
712 + ValidateMessageResults(hr, pvResults, BAENGINE_PLAN_RESULTS, pResults);
713 BOOTSTRAPPER_ACTION action = pArgs->action;
714
715 if (!::PostThreadMessageW(pContext->dwThreadId, WM_BURN_PLAN, 0, action))
@@ -672,11 +723,13 @@ LExit:
723
724 static HRESULT BAEngineElevate(
725 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
675 - __in const BAENGINE_ELEVATE_ARGS* pArgs,
676 - __in BAENGINE_ELEVATE_RESULTS* /*pResults*/
726 + __in const LPVOID pvArgs,
727 + __inout LPVOID pvResults
728 )
729 {
730 HRESULT hr = S_OK;
731 + ValidateMessageArgs(hr, pvArgs, BAENGINE_ELEVATE_ARGS, pArgs);
732 + ValidateMessageResults(hr, pvResults, BAENGINE_ELEVATE_RESULTS, pResults);
733
734 if (INVALID_HANDLE_VALUE != pContext->pEngineState->companionConnection.hPipe)
735 {
@@ -693,11 +746,13 @@ LExit:
746
747 static HRESULT BAEngineApply(
748 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
696 - __in const BAENGINE_APPLY_ARGS* pArgs,
697 - __in BAENGINE_APPLY_RESULTS* /*pResults*/
749 + __in const LPVOID pvArgs,
750 + __inout LPVOID pvResults
751 )
752 {
753 HRESULT hr = S_OK;
754 + ValidateMessageArgs(hr, pvArgs, BAENGINE_APPLY_ARGS, pArgs);
755 + ValidateMessageResults(hr, pvResults, BAENGINE_APPLY_RESULTS, pResults);
756
757 ExitOnNull(pArgs->hwndParent, hr, E_INVALIDARG, "BA passed NULL hwndParent to Apply.");
758 if (!::IsWindow(pArgs->hwndParent))
@@ -716,11 +771,13 @@ LExit:
771
772 static HRESULT BAEngineQuit(
773 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
719 - __in const BAENGINE_QUIT_ARGS* pArgs,
720 - __in BAENGINE_QUIT_RESULTS* /*pResults*/
774 + __in const LPVOID pvArgs,
775 + __inout LPVOID pvResults
776 )
777 {
778 HRESULT hr = S_OK;
779 + ValidateMessageArgs(hr, pvArgs, BAENGINE_QUIT_ARGS, pArgs);
780 + ValidateMessageResults(hr, pvResults, BAENGINE_QUIT_RESULTS, pResults);
781
782 if (!::PostThreadMessageW(pContext->dwThreadId, WM_BURN_QUIT, static_cast<WPARAM>(pArgs->dwExitCode), 0))
783 {
@@ -733,19 +790,24 @@ LExit:
790
791 static HRESULT BAEngineLaunchApprovedExe(
792 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
736 - __in const BAENGINE_LAUNCHAPPROVEDEXE_ARGS* pArgs,
737 - __in BAENGINE_LAUNCHAPPROVEDEXE_RESULTS* /*pResults*/
793 + __in const LPVOID pvArgs,
794 + __inout LPVOID pvResults
795 )
796 {
797 HRESULT hr = S_OK;
798 BURN_APPROVED_EXE* pApprovedExe = NULL;
799 BOOL fLeaveCriticalSection = FALSE;
743 - BURN_LAUNCH_APPROVED_EXE* pLaunchApprovedExe = (BURN_LAUNCH_APPROVED_EXE*)MemAlloc(sizeof(BURN_LAUNCH_APPROVED_EXE), TRUE);
800 + BURN_LAUNCH_APPROVED_EXE* pLaunchApprovedExe = NULL;
801 + ValidateMessageArgs(hr, pvArgs, BAENGINE_LAUNCHAPPROVEDEXE_ARGS, pArgs);
802 + ValidateMessageResults(hr, pvResults, BAENGINE_LAUNCHAPPROVEDEXE_RESULTS, pResults);
803 HWND hwndParent = pArgs->hwndParent;
804 LPCWSTR wzApprovedExeForElevationId = pArgs->wzApprovedExeForElevationId;
805 LPCWSTR wzArguments = pArgs->wzArguments;
806 DWORD dwWaitForInputIdleTimeout = pArgs->dwWaitForInputIdleTimeout;
807
808 + pLaunchApprovedExe = (BURN_LAUNCH_APPROVED_EXE*)MemAlloc(sizeof(BURN_LAUNCH_APPROVED_EXE), TRUE);
809 + ExitOnNull(pLaunchApprovedExe, hr, E_OUTOFMEMORY, "Failed to alloc BURN_LAUNCH_APPROVED_EXE");
810 +
811 ::EnterCriticalSection(&pContext->pEngineState->csActive);
812 fLeaveCriticalSection = TRUE;
813 hr = UserExperienceEnsureEngineInactive(&pContext->pEngineState->userExperience);
@@ -812,76 +874,76 @@ HRESULT WINAPI EngineForApplicationProc(
874 switch (message)
875 {
876 case BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT:
815 - hr = BAEngineGetPackageCount(pContext, reinterpret_cast<BAENGINE_GETPACKAGECOUNT_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_GETPACKAGECOUNT_RESULTS*>(pvResults));
877 + hr = BAEngineGetPackageCount(pContext, pvArgs, pvResults);
878 break;
879 case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC:
818 - hr = BAEngineGetVariableNumeric(pContext, reinterpret_cast<BAENGINE_GETVARIABLENUMERIC_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_GETVARIABLENUMERIC_RESULTS*>(pvResults));
880 + hr = BAEngineGetVariableNumeric(pContext, pvArgs, pvResults);
881 break;
882 case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING:
821 - hr = BAEngineGetVariableString(pContext, reinterpret_cast<BAENGINE_GETVARIABLESTRING_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_GETVARIABLESTRING_RESULTS*>(pvResults));
883 + hr = BAEngineGetVariableString(pContext, pvArgs, pvResults);
884 break;
885 case BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLEVERSION:
824 - hr = BAEngineGetVariableVersion(pContext, reinterpret_cast<BAENGINE_GETVARIABLEVERSION_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_GETVARIABLEVERSION_RESULTS*>(pvResults));
886 + hr = BAEngineGetVariableVersion(pContext, pvArgs, pvResults);
887 break;
888 case BOOTSTRAPPER_ENGINE_MESSAGE_FORMATSTRING:
827 - hr = BAEngineFormatString(pContext, reinterpret_cast<BAENGINE_FORMATSTRING_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_FORMATSTRING_RESULTS*>(pvResults));
889 + hr = BAEngineFormatString(pContext, pvArgs, pvResults);
890 break;
891 case BOOTSTRAPPER_ENGINE_MESSAGE_ESCAPESTRING:
830 - hr = BAEngineEscapeString(pContext, reinterpret_cast<BAENGINE_ESCAPESTRING_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_ESCAPESTRING_RESULTS*>(pvResults));
892 + hr = BAEngineEscapeString(pContext, pvArgs, pvResults);
893 break;
894 case BOOTSTRAPPER_ENGINE_MESSAGE_EVALUATECONDITION:
833 - hr = BAEngineEvaluateCondition(pContext, reinterpret_cast<BAENGINE_EVALUATECONDITION_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_EVALUATECONDITION_RESULTS*>(pvResults));
895 + hr = BAEngineEvaluateCondition(pContext, pvArgs, pvResults);
896 break;
897 case BOOTSTRAPPER_ENGINE_MESSAGE_LOG:
836 - hr = BAEngineLog(pContext, reinterpret_cast<BAENGINE_LOG_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_LOG_RESULTS*>(pvResults));
898 + hr = BAEngineLog(pContext, pvArgs, pvResults);
899 break;
900 case BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDERROR:
839 - hr = BAEngineSendEmbeddedError(pContext, reinterpret_cast<BAENGINE_SENDEMBEDDEDERROR_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_SENDEMBEDDEDERROR_RESULTS*>(pvResults));
901 + hr = BAEngineSendEmbeddedError(pContext, pvArgs, pvResults);
902 break;
903 case BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDPROGRESS:
842 - hr = BAEngineSendEmbeddedProgress(pContext, reinterpret_cast<BAENGINE_SENDEMBEDDEDPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS*>(pvResults));
904 + hr = BAEngineSendEmbeddedProgress(pContext, pvArgs, pvResults);
905 break;
906 case BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATE:
845 - hr = BAEngineSetUpdate(pContext, reinterpret_cast<BAENGINE_SETUPDATE_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_SETUPDATE_RESULTS*>(pvResults));
907 + hr = BAEngineSetUpdate(pContext, pvArgs, pvResults);
908 break;
909 case BOOTSTRAPPER_ENGINE_MESSAGE_SETLOCALSOURCE:
848 - hr = BAEngineSetLocalSource(pContext, reinterpret_cast<BAENGINE_SETLOCALSOURCE_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_SETLOCALSOURCE_RESULTS*>(pvResults));
910 + hr = BAEngineSetLocalSource(pContext, pvArgs, pvResults);
911 break;
912 case BOOTSTRAPPER_ENGINE_MESSAGE_SETDOWNLOADSOURCE:
851 - hr = BAEngineSetDownloadSource(pContext, reinterpret_cast<BAENGINE_SETDOWNLOADSOURCE_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_SETDOWNLOADSOURCE_RESULTS*>(pvResults));
913 + hr = BAEngineSetDownloadSource(pContext, pvArgs, pvResults);
914 break;
915 case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLENUMERIC:
854 - hr = BAEngineSetVariableNumeric(pContext, reinterpret_cast<BAENGINE_SETVARIABLENUMERIC_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_SETVARIABLENUMERIC_RESULTS*>(pvResults));
916 + hr = BAEngineSetVariableNumeric(pContext, pvArgs, pvResults);
917 break;
918 case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLESTRING:
857 - hr = BAEngineSetVariableString(pContext, reinterpret_cast<BAENGINE_SETVARIABLESTRING_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_SETVARIABLESTRING_RESULTS*>(pvResults));
919 + hr = BAEngineSetVariableString(pContext, pvArgs, pvResults);
920 break;
921 case BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLEVERSION:
860 - hr = BAEngineSetVariableVersion(pContext, reinterpret_cast<BAENGINE_SETVARIABLEVERSION_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_SETVARIABLEVERSION_RESULTS*>(pvResults));
922 + hr = BAEngineSetVariableVersion(pContext, pvArgs, pvResults);
923 break;
924 case BOOTSTRAPPER_ENGINE_MESSAGE_CLOSESPLASHSCREEN:
863 - hr = BAEngineCloseSplashScreen(pContext, reinterpret_cast<BAENGINE_CLOSESPLASHSCREEN_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_CLOSESPLASHSCREEN_RESULTS*>(pvResults));
925 + hr = BAEngineCloseSplashScreen(pContext, pvArgs, pvResults);
926 break;
927 case BOOTSTRAPPER_ENGINE_MESSAGE_DETECT:
866 - hr = BAEngineDetect(pContext, reinterpret_cast<BAENGINE_DETECT_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_DETECT_RESULTS*>(pvResults));
928 + hr = BAEngineDetect(pContext, pvArgs, pvResults);
929 break;
930 case BOOTSTRAPPER_ENGINE_MESSAGE_PLAN:
869 - hr = BAEnginePlan(pContext, reinterpret_cast<BAENGINE_PLAN_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_PLAN_RESULTS*>(pvResults));
931 + hr = BAEnginePlan(pContext, pvArgs, pvResults);
932 break;
933 case BOOTSTRAPPER_ENGINE_MESSAGE_ELEVATE:
872 - hr = BAEngineElevate(pContext, reinterpret_cast<BAENGINE_ELEVATE_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_ELEVATE_RESULTS*>(pvResults));
934 + hr = BAEngineElevate(pContext, pvArgs, pvResults);
935 break;
936 case BOOTSTRAPPER_ENGINE_MESSAGE_APPLY:
875 - hr = BAEngineApply(pContext, reinterpret_cast<BAENGINE_APPLY_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_APPLY_RESULTS*>(pvResults));
937 + hr = BAEngineApply(pContext, pvArgs, pvResults);
938 break;
939 case BOOTSTRAPPER_ENGINE_MESSAGE_QUIT:
878 - hr = BAEngineQuit(pContext, reinterpret_cast<BAENGINE_QUIT_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_QUIT_RESULTS*>(pvResults));
940 + hr = BAEngineQuit(pContext, pvArgs, pvResults);
941 break;
942 case BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE:
881 - hr = BAEngineLaunchApprovedExe(pContext, reinterpret_cast<BAENGINE_LAUNCHAPPROVEDEXE_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_LAUNCHAPPROVEDEXE_RESULTS*>(pvResults));
943 + hr = BAEngineLaunchApprovedExe(pContext, pvArgs, pvResults);
944 break;
945 case BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS:
884 - hr = BAEngineCompareVersions(pContext, reinterpret_cast<BAENGINE_COMPAREVERSIONS_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_COMPAREVERSIONS_RESULTS*>(pvResults));
946 + hr = BAEngineCompareVersions(pContext, pvArgs, pvResults);
947 break;
948 default:
949 hr = E_NOTIMPL;
@@ -894,7 +956,7 @@ LExit:
956
957 static HRESULT CopyStringToBA(
958 __in LPWSTR wzValue,
897 - __in LPWSTR wzBuffer,
959 + __in_opt LPWSTR wzBuffer,
960 __inout DWORD* pcchBuffer
961 )
962 {
src/engine/EngineForExtension.cpp
+63 -34
@@ -11,12 +11,14 @@ static HRESULT CopyStringToBE(
11
12 static HRESULT BEEngineEscapeString(
13 __in BURN_EXTENSION_ENGINE_CONTEXT* /*pContext*/,
14 - __in BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS* pArgs,
15 - __in BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS* pResults
14 + __in const LPVOID pvArgs,
15 + __inout LPVOID pvResults
16 )
17 {
18 HRESULT hr = S_OK;
19 LPWSTR sczValue = NULL;
20 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS, pArgs);
21 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS, pResults);
22 LPCWSTR wzIn = pArgs->wzIn;
23 LPWSTR wzOut = pResults->wzOut;
24 DWORD* pcchOut = &pResults->cchOut;
@@ -34,17 +36,20 @@ static HRESULT BEEngineEscapeString(
36 hr = E_INVALIDARG;
37 }
38
39 +LExit:
40 StrSecureZeroFreeString(sczValue);
41 return hr;
42 }
43
44 static HRESULT BEEngineEvaluateCondition(
45 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
43 - __in BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS* pArgs,
44 - __in BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS* pResults
46 + __in const LPVOID pvArgs,
47 + __inout LPVOID pvResults
48 )
49 {
50 HRESULT hr = S_OK;
51 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS, pArgs);
52 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS, pResults);
53 LPCWSTR wzCondition = pArgs->wzCondition;
54 BOOL* pf = &pResults->f;
55
@@ -57,17 +62,20 @@ static HRESULT BEEngineEvaluateCondition(
62 hr = E_INVALIDARG;
63 }
64
65 +LExit:
66 return hr;
67 }
68
69 static HRESULT BEEngineFormatString(
70 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
65 - __in BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS* pArgs,
66 - __in BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS* pResults
71 + __in const LPVOID pvArgs,
72 + __inout LPVOID pvResults
73 )
74 {
75 HRESULT hr = S_OK;
76 LPWSTR sczValue = NULL;
77 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS, pArgs);
78 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS, pResults);
79 LPCWSTR wzIn = pArgs->wzIn;
80 LPWSTR wzOut = pResults->wzOut;
81 DWORD* pcchOut = &pResults->cchOut;
@@ -85,17 +93,20 @@ static HRESULT BEEngineFormatString(
93 hr = E_INVALIDARG;
94 }
95
96 +LExit:
97 StrSecureZeroFreeString(sczValue);
98 return hr;
99 }
100
101 static HRESULT BEEngineGetVariableNumeric(
102 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
94 - __in BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS* pArgs,
95 - __in BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS* pResults
103 + __in const LPVOID pvArgs,
104 + __inout LPVOID pvResults
105 )
106 {
107 HRESULT hr = S_OK;
108 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS, pArgs);
109 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS, pResults);
110 LPCWSTR wzVariable = pArgs->wzVariable;
111 LONGLONG* pllValue = &pResults->llValue;
112
@@ -108,17 +119,20 @@ static HRESULT BEEngineGetVariableNumeric(
119 hr = E_INVALIDARG;
120 }
121
122 +LExit:
123 return hr;
124 }
125
126 static HRESULT BEEngineGetVariableString(
127 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
116 - __in BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS* pArgs,
117 - __in BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS* pResults
128 + __in const LPVOID pvArgs,
129 + __inout LPVOID pvResults
130 )
131 {
132 HRESULT hr = S_OK;
133 LPWSTR sczValue = NULL;
134 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS, pArgs);
135 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS, pResults);
136 LPCWSTR wzVariable = pArgs->wzVariable;
137 LPWSTR wzValue = pResults->wzValue;
138 DWORD* pcchValue = &pResults->cchValue;
@@ -136,18 +150,21 @@ static HRESULT BEEngineGetVariableString(
150 hr = E_INVALIDARG;
151 }
152
153 +LExit:
154 StrSecureZeroFreeString(sczValue);
155 return hr;
156 }
157
158 static HRESULT BEEngineGetVariableVersion(
159 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
145 - __in BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS* pArgs,
146 - __in BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS* pResults
160 + __in const LPVOID pvArgs,
161 + __inout LPVOID pvResults
162 )
163 {
164 HRESULT hr = S_OK;
165 VERUTIL_VERSION* pVersion = NULL;
166 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS, pArgs);
167 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS, pResults);
168 LPCWSTR wzVariable = pArgs->wzVariable;
169 LPWSTR wzValue = pResults->wzValue;
170 DWORD* pcchValue = &pResults->cchValue;
@@ -165,6 +182,7 @@ static HRESULT BEEngineGetVariableVersion(
182 hr = E_INVALIDARG;
183 }
184
185 +LExit:
186 ReleaseVerutilVersion(pVersion);
187
188 return hr;
@@ -172,12 +190,14 @@ static HRESULT BEEngineGetVariableVersion(
190
191 static HRESULT BEEngineLog(
192 __in BURN_EXTENSION_ENGINE_CONTEXT* /*pContext*/,
175 - __in BUNDLE_EXTENSION_ENGINE_LOG_ARGS* pArgs,
176 - __in BUNDLE_EXTENSION_ENGINE_LOG_RESULTS* /*pResults*/
193 + __in const LPVOID pvArgs,
194 + __inout LPVOID pvResults
195 )
196 {
197 HRESULT hr = S_OK;
198 REPORT_LEVEL rl = REPORT_NONE;
199 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_LOG_ARGS, pArgs);
200 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_LOG_RESULTS, pResults);
201 BUNDLE_EXTENSION_LOG_LEVEL level = pArgs->level;
202 LPCWSTR wzMessage = pArgs->wzMessage;
203
@@ -212,11 +232,13 @@ LExit:
232
233 static HRESULT BEEngineSetVariableNumeric(
234 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
215 - __in const BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS* pArgs,
216 - __in BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS* /*pResults*/
235 + __in const LPVOID pvArgs,
236 + __inout LPVOID pvResults
237 )
238 {
239 HRESULT hr = S_OK;
240 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS, pArgs);
241 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS, pResults);
242 LPCWSTR wzVariable = pArgs->wzVariable;
243 LONGLONG llValue = pArgs->llValue;
244
@@ -237,11 +259,13 @@ LExit:
259
260 static HRESULT BEEngineSetVariableString(
261 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
240 - __in const BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS* pArgs,
241 - __in BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS* /*pResults*/
262 + __in const LPVOID pvArgs,
263 + __inout LPVOID pvResults
264 )
265 {
266 HRESULT hr = S_OK;
267 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS, pArgs);
268 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS, pResults);
269 LPCWSTR wzVariable = pArgs->wzVariable;
270 LPCWSTR wzValue = pArgs->wzValue;
271
@@ -262,14 +286,16 @@ LExit:
286
287 static HRESULT BEEngineSetVariableVersion(
288 __in BURN_EXTENSION_ENGINE_CONTEXT* pContext,
265 - __in const BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS* pArgs,
266 - __in BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS* /*pResults*/
289 + __in const LPVOID pvArgs,
290 + __inout LPVOID pvResults
291 )
292 {
293 HRESULT hr = S_OK;
294 + VERUTIL_VERSION* pVersion = NULL;
295 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS, pArgs);
296 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS, pResults);
297 LPCWSTR wzVariable = pArgs->wzVariable;
298 LPCWSTR wzValue = pArgs->wzValue;
272 - VERUTIL_VERSION* pVersion = NULL;
299
300 if (wzVariable && *wzVariable)
301 {
@@ -296,17 +322,20 @@ LExit:
322
323 static HRESULT BEEngineCompareVersions(
324 __in BURN_EXTENSION_ENGINE_CONTEXT* /*pContext*/,
299 - __in const BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS* pArgs,
300 - __in BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS* pResults
325 + __in const LPVOID pvArgs,
326 + __inout LPVOID pvResults
327 )
328 {
329 HRESULT hr = S_OK;
330 + ValidateMessageArgs(hr, pvArgs, BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS, pArgs);
331 + ValidateMessageResults(hr, pvResults, BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS, pResults);
332 LPCWSTR wzVersion1 = pArgs->wzVersion1;
333 LPCWSTR wzVersion2 = pArgs->wzVersion2;
334 int* pnResult = &pResults->nResult;
335
336 hr = VerCompareStringVersions(wzVersion1, wzVersion2, FALSE, pnResult);
337
338 +LExit:
339 return hr;
340 }
341
@@ -328,37 +357,37 @@ HRESULT WINAPI EngineForExtensionProc(
357 switch (message)
358 {
359 case BUNDLE_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING:
331 - hr = BEEngineEscapeString(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS*>(pvResults));
360 + hr = BEEngineEscapeString(pContext, pvArgs, pvResults);
361 break;
362 case BUNDLE_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION:
334 - hr = BEEngineEvaluateCondition(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS*>(pvResults));
363 + hr = BEEngineEvaluateCondition(pContext, pvArgs, pvResults);
364 break;
365 case BUNDLE_EXTENSION_ENGINE_MESSAGE_FORMATSTRING:
337 - hr = BEEngineFormatString(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS*>(pvResults));
366 + hr = BEEngineFormatString(pContext, pvArgs, pvResults);
367 break;
368 case BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC:
340 - hr = BEEngineGetVariableNumeric(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS*>(pvResults));
369 + hr = BEEngineGetVariableNumeric(pContext, pvArgs, pvResults);
370 break;
371 case BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING:
343 - hr = BEEngineGetVariableString(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS*>(pvResults));
372 + hr = BEEngineGetVariableString(pContext, pvArgs, pvResults);
373 break;
374 case BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION:
346 - hr = BEEngineGetVariableVersion(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS*>(pvResults));
375 + hr = BEEngineGetVariableVersion(pContext, pvArgs, pvResults);
376 break;
377 case BUNDLE_EXTENSION_ENGINE_MESSAGE_LOG:
349 - hr = BEEngineLog(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_LOG_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_LOG_RESULTS*>(pvResults));
378 + hr = BEEngineLog(pContext, pvArgs, pvResults);
379 break;
380 case BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC:
352 - hr = BEEngineSetVariableNumeric(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS*>(pvResults));
381 + hr = BEEngineSetVariableNumeric(pContext, pvArgs, pvResults);
382 break;
383 case BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING:
355 - hr = BEEngineSetVariableString(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS*>(pvResults));
384 + hr = BEEngineSetVariableString(pContext, pvArgs, pvResults);
385 break;
386 case BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION:
358 - hr = BEEngineSetVariableVersion(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS*>(pvResults));
387 + hr = BEEngineSetVariableVersion(pContext, pvArgs, pvResults);
388 break;
389 case BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS:
361 - hr = BEEngineCompareVersions(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS*>(pvResults));
390 + hr = BEEngineCompareVersions(pContext, pvArgs, pvResults);
391 break;
392 default:
393 hr = E_NOTIMPL;
src/engine/burnextension.cpp
+23 -1
@@ -2,6 +2,14 @@
2
3 #include "precomp.h"
4
5 +
6 +static HRESULT SendRequiredBextMessage(
7 + __in BURN_EXTENSION* pExtension,
8 + __in BUNDLE_EXTENSION_MESSAGE message,
9 + __in const LPVOID pvArgs,
10 + __inout LPVOID pvResults
11 + );
12 +
13 // function definitions
14
15 /*******************************************************************
@@ -234,9 +242,23 @@ EXTERN_C BEEAPI BurnExtensionPerformSearch(
242
243 results.cbSize = sizeof(results);
244
237 - hr = pExtension->pfnBurnExtensionProc(BUNDLE_EXTENSION_MESSAGE_SEARCH, &args, &results, pExtension->pvBurnExtensionProcContext);
245 + hr = SendRequiredBextMessage(pExtension, BUNDLE_EXTENSION_MESSAGE_SEARCH, &args, &results);
246 ExitOnFailure(hr, "BundleExtension '%ls' Search '%ls' failed.", pExtension->sczId, wzSearchId);
247
248 LExit:
249 return hr;
250 }
251 +
252 +static HRESULT SendRequiredBextMessage(
253 + __in BURN_EXTENSION* pExtension,
254 + __in BUNDLE_EXTENSION_MESSAGE message,
255 + __in const LPVOID pvArgs,
256 + __inout LPVOID pvResults
257 + )
258 +{
259 + HRESULT hr = S_OK;
260 +
261 + hr = pExtension->pfnBurnExtensionProc(message, pvArgs, pvResults, pExtension->pvBurnExtensionProcContext);
262 +
263 + return hr;
264 +}
src/engine/engine.vcxproj
+2
@@ -51,6 +51,7 @@
51 <ClCompile Include="embedded.cpp" />
52 <ClCompile Include="EngineForApplication.cpp" />
53 <ClCompile Include="EngineForExtension.cpp" />
54 + <ClCompile Include="externalengine.cpp" />
55 <ClCompile Include="cabextract.cpp" />
56 <ClCompile Include="cache.cpp" />
57 <ClCompile Include="condition.cpp" />
@@ -109,6 +110,7 @@
110 <ClInclude Include="EngineForApplication.h" />
111 <ClInclude Include="EngineForExtension.h" />
112 <ClInclude Include="exeengine.h" />
113 + <ClInclude Include="externalengine.h" />
114 <ClInclude Include="inc\engine.h" />
115 <ClInclude Include="logging.h" />
116 <ClInclude Include="manifest.h" />
src/engine/externalengine.cpp new
+30
@@ -0,0 +1,30 @@
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 +
6 +// function definitions
7 +
8 +// TODO: callers need to provide the original size (at the time of first public release) of the struct instead of the current size.
9 +HRESULT WINAPI ExternalEngineValidateMessageParameter(
10 + __in_opt const LPVOID pv,
11 + __in SIZE_T cbSizeOffset,
12 + __in DWORD dwMinimumSize
13 + )
14 +{
15 + HRESULT hr = S_OK;
16 +
17 + if (!pv)
18 + {
19 + ExitFunction1(hr = E_INVALIDARG);
20 + }
21 +
22 + DWORD cbSize = *(DWORD*)((BYTE*)pv + cbSizeOffset);
23 + if (dwMinimumSize < cbSize)
24 + {
25 + ExitFunction1(hr = E_INVALIDARG);
26 + }
27 +
28 +LExit:
29 + return hr;
30 +}
src/engine/externalengine.h new
+22
@@ -0,0 +1,22 @@
1 +#pragma once
2 +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3 +
4 +
5 +#define ValidateMessageParameter(x, pv, type) { x = ExternalEngineValidateMessageParameter(pv, offsetof(type, cbSize), sizeof(type)); if (FAILED(x)) { goto LExit; }}
6 +#define ValidateMessageArgs(x, pv, type, identifier) ValidateMessageParameter(x, pv, type); const type* identifier = reinterpret_cast<type*>(pv); UNREFERENCED_PARAMETER(identifier)
7 +#define ValidateMessageResults(x, pv, type, identifier) ValidateMessageParameter(x, pv, type); type* identifier = reinterpret_cast<type*>(pv); UNREFERENCED_PARAMETER(identifier)
8 +
9 +
10 +#if defined(__cplusplus)
11 +extern "C" {
12 +#endif
13 +
14 +HRESULT WINAPI ExternalEngineValidateMessageParameter(
15 + __in_opt const LPVOID pv,
16 + __in SIZE_T cbSizeOffset,
17 + __in DWORD dwMinimumSize
18 + );
19 +
20 +#if defined(__cplusplus)
21 +}
22 +#endif
src/engine/precomp.h
+1
@@ -100,6 +100,7 @@
100 #include "bitsengine.h"
101 #include "netfxchainer.h"
102
103 +#include "externalengine.h"
104 #include "EngineForApplication.h"
105 #include "EngineForExtension.h"
106 #include "engine.messages.h"
src/engine/userexperience.cpp
+92 -67
@@ -17,6 +17,13 @@ static HRESULT FilterExecuteResult(
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
28 // function definitions
29
@@ -97,7 +104,7 @@ extern "C" HRESULT UserExperienceLoad(
104 args.pCommand = pCommand;
105 args.pfnBootstrapperEngineProc = EngineForApplicationProc;
106 args.pvBootstrapperEngineProcContext = pEngineContext;
100 - args.qwEngineAPIVersion = MAKEQWORDVERSION(2020, 8, 31, 0);
107 + args.qwEngineAPIVersion = MAKEQWORDVERSION(2020, 11, 17, 0);
108
109 results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
110
@@ -308,7 +315,7 @@ EXTERN_C BAAPI UserExperienceOnApplyBegin(
315
316 results.cbSize = sizeof(results);
317
311 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, &args, &results, pUserExperience->pvBAProcContext);
318 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, &args, &results);
319 ExitOnFailure(hr, "BA OnApplyBegin failed.");
320
321 if (results.fCancel)
@@ -339,7 +346,7 @@ EXTERN_C BAAPI UserExperienceOnApplyComplete(
346 results.cbSize = sizeof(results);
347 results.action = *pAction;
348
342 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
349 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, &args, &results);
350 ExitOnFailure(hr, "BA OnApplyComplete failed.");
351
352 *pAction = results.action;
@@ -362,7 +369,7 @@ EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionBegin(
369
370 results.cbSize = sizeof(results);
371
365 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &args, &results, pUserExperience->pvBAProcContext);
372 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &args, &results);
373 ExitOnFailure(hr, "BA OnBeginMsiTransactionBegin failed.");
374
375 if (results.fCancel)
@@ -390,7 +397,7 @@ EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionComplete(
397
398 results.cbSize = sizeof(results);
399
393 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
400 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &args, &results);
401 ExitOnFailure(hr, "BA OnBeginMsiTransactionComplete failed.");
402
403 LExit:
@@ -417,7 +424,7 @@ EXTERN_C BAAPI UserExperienceOnCacheAcquireBegin(
424
425 results.cbSize = sizeof(results);
426
420 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, &args, &results, pUserExperience->pvBAProcContext);
427 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, &args, &results);
428 ExitOnFailure(hr, "BA OnCacheAcquireBegin failed.");
429
430 if (results.fCancel)
@@ -450,7 +457,7 @@ EXTERN_C BAAPI UserExperienceOnCacheAcquireComplete(
457 results.cbSize = sizeof(results);
458 results.action = args.recommendation;
459
453 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
460 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, &args, &results);
461 ExitOnFailure(hr, "BA OnCacheAcquireComplete failed.");
462
463 if (FAILED(hrStatus))
@@ -484,7 +491,7 @@ EXTERN_C BAAPI UserExperienceOnCacheAcquireProgress(
491
492 results.cbSize = sizeof(results);
493
487 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, &args, &results, pUserExperience->pvBAProcContext);
494 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, &args, &results);
495 ExitOnFailure(hr, "BA OnCacheAcquireProgress failed.");
496
497 if (results.fCancel)
@@ -508,7 +515,7 @@ EXTERN_C BAAPI UserExperienceOnCacheBegin(
515
516 results.cbSize = sizeof(results);
517
511 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
518 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, &args, &results);
519 ExitOnFailure(hr, "BA OnCacheBegin failed.");
520
521 if (results.fCancel)
@@ -534,7 +541,7 @@ EXTERN_C BAAPI UserExperienceOnCacheComplete(
541
542 results.cbSize = sizeof(results);
543
537 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
544 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, &args, &results);
545 ExitOnFailure(hr, "BA OnCacheComplete failed.");
546
547 LExit:
@@ -559,7 +566,7 @@ EXTERN_C BAAPI UserExperienceOnCachePackageBegin(
566
567 results.cbSize = sizeof(results);
568
562 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
569 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, &args, &results);
570 ExitOnFailure(hr, "BA OnCachePackageBegin failed.");
571
572 if (results.fCancel)
@@ -590,7 +597,7 @@ EXTERN_C BAAPI UserExperienceOnCachePackageComplete(
597 results.cbSize = sizeof(results);
598 results.action = *pAction;
599
593 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
600 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, &args, &results);
601 ExitOnFailure(hr, "BA OnCachePackageComplete failed.");
602
603 if (FAILED(hrStatus))
@@ -618,7 +625,7 @@ EXTERN_C BAAPI UserExperienceOnCacheVerifyBegin(
625
626 results.cbSize = sizeof(results);
627
621 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, &args, &results, pUserExperience->pvBAProcContext);
628 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, &args, &results);
629 ExitOnFailure(hr, "BA OnCacheVerifyBegin failed.");
630
631 if (results.fCancel)
@@ -651,7 +658,7 @@ EXTERN_C BAAPI UserExperienceOnCacheVerifyComplete(
658 results.cbSize = sizeof(results);
659 results.action = *pAction;
660
654 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
661 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, &args, &results);
662 ExitOnFailure(hr, "BA OnCacheVerifyComplete failed.");
663
664 if (FAILED(hrStatus))
@@ -677,7 +684,7 @@ EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionBegin(
684
685 results.cbSize = sizeof(results);
686
680 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &args, &results, pUserExperience->pvBAProcContext);
687 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &args, &results);
688 ExitOnFailure(hr, "BA OnCommitMsiTransactionBegin failed.");
689
690 if (results.fCancel)
@@ -705,7 +712,7 @@ EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionComplete(
712
713 results.cbSize = sizeof(results);
714
708 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
715 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &args, &results);
716 ExitOnFailure(hr, "BA OnCommitMsiTransactionComplete failed.");
717
718 LExit:
@@ -728,7 +735,7 @@ EXTERN_C BAAPI UserExperienceOnDetectBegin(
735
736 results.cbSize = sizeof(results);
737
731 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, &args, &results, pUserExperience->pvBAProcContext);
738 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, &args, &results);
739 ExitOnFailure(hr, "BA OnDetectBegin failed.");
740
741 if (results.fCancel)
@@ -758,7 +765,7 @@ EXTERN_C BAAPI UserExperienceOnDetectCompatibleMsiPackage(
765
766 results.cbSize = sizeof(results);
767
761 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, &args, &results, pUserExperience->pvBAProcContext);
768 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, &args, &results);
769 ExitOnFailure(hr, "BA OnDetectCompatibleMsiPackage failed.");
770
771 if (results.fCancel)
@@ -784,7 +791,7 @@ EXTERN_C BAAPI UserExperienceOnDetectComplete(
791
792 results.cbSize = sizeof(results);
793
787 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
794 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, &args, &results);
795 ExitOnFailure(hr, "BA OnDetectComplete failed.");
796
797 LExit:
@@ -815,7 +822,7 @@ EXTERN_C BAAPI UserExperienceOnDetectForwardCompatibleBundle(
822 results.cbSize = sizeof(results);
823 results.fIgnoreBundle = *pfIgnoreBundle;
824
818 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &args, &results, pUserExperience->pvBAProcContext);
825 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &args, &results);
826 ExitOnFailure(hr, "BA OnDetectForwardCompatibleBundle failed.");
827
828 if (results.fCancel)
@@ -846,7 +853,7 @@ EXTERN_C BAAPI UserExperienceOnDetectMsiFeature(
853
854 results.cbSize = sizeof(results);
855
849 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, &args, &results, pUserExperience->pvBAProcContext);
856 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, &args, &results);
857 ExitOnFailure(hr, "BA OnDetectMsiFeature failed.");
858
859 if (results.fCancel)
@@ -872,7 +879,7 @@ EXTERN_C BAAPI UserExperienceOnDetectPackageBegin(
879
880 results.cbSize = sizeof(results);
881
875 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
882 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, &args, &results);
883 ExitOnFailure(hr, "BA OnDetectPackageBegin failed.");
884
885 if (results.fCancel)
@@ -902,7 +909,7 @@ EXTERN_C BAAPI UserExperienceOnDetectPackageComplete(
909
910 results.cbSize = sizeof(results);
911
905 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
912 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, &args, &results);
913 ExitOnFailure(hr, "BA OnDetectPackageComplete failed.");
914
915 LExit:
@@ -933,7 +940,7 @@ EXTERN_C BAAPI UserExperienceOnDetectRelatedBundle(
940
941 results.cbSize = sizeof(results);
942
936 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, &args, &results, pUserExperience->pvBAProcContext);
943 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, &args, &results);
944 ExitOnFailure(hr, "BA OnDetectRelatedBundle failed.");
945
946 if (results.fCancel)
@@ -969,7 +976,7 @@ EXTERN_C BAAPI UserExperienceOnDetectRelatedMsiPackage(
976
977 results.cbSize = sizeof(results);
978
972 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, &args, &results, pUserExperience->pvBAProcContext);
979 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, &args, &results);
980 ExitOnFailure(hr, "BA OnDetectRelatedMsiPackage failed.");
981
982 if (results.fCancel)
@@ -999,7 +1006,7 @@ EXTERN_C BAAPI UserExperienceOnDetectTargetMsiPackage(
1006
1007 results.cbSize = sizeof(results);
1008
1002 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTTARGETMSIPACKAGE, &args, &results, pUserExperience->pvBAProcContext);
1009 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTTARGETMSIPACKAGE, &args, &results);
1010 ExitOnFailure(hr, "BA OnDetectTargetMsiPackage failed.");
1011
1012 if (results.fCancel)
@@ -1039,7 +1046,7 @@ EXTERN_C BAAPI UserExperienceOnDetectUpdate(
1046 results.cbSize = sizeof(results);
1047 results.fStopProcessingUpdates = *pfStopProcessingUpdates;
1048
1042 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, &args, &results, pUserExperience->pvBAProcContext);
1049 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, &args, &results);
1050 ExitOnFailure(hr, "BA OnDetectUpdate failed.");
1051
1052 if (results.fCancel)
@@ -1068,7 +1075,7 @@ EXTERN_C BAAPI UserExperienceOnDetectUpdateBegin(
1075 results.cbSize = sizeof(results);
1076 results.fSkip = *pfSkip;
1077
1071 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1078 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, &args, &results);
1079 ExitOnFailure(hr, "BA OnDetectUpdateBegin failed.");
1080
1081 if (results.fCancel)
@@ -1097,7 +1104,7 @@ EXTERN_C BAAPI UserExperienceOnDetectUpdateComplete(
1104 results.cbSize = sizeof(results);
1105 results.fIgnoreError = *pfIgnoreError;
1106
1100 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1107 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, &args, &results);
1108 ExitOnFailure(hr, "BA OnDetectUpdateComplete failed.");
1109
1110 if (FAILED(hrStatus))
@@ -1121,7 +1128,7 @@ EXTERN_C BAAPI UserExperienceOnElevateBegin(
1128
1129 results.cbSize = sizeof(results);
1130
1124 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1131 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, &args, &results);
1132 ExitOnFailure(hr, "BA OnElevateBegin failed.");
1133
1134 if (results.fCancel)
@@ -1147,7 +1154,7 @@ EXTERN_C BAAPI UserExperienceOnElevateComplete(
1154
1155 results.cbSize = sizeof(results);
1156
1150 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1157 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, &args, &results);
1158 ExitOnFailure(hr, "BA OnElevateComplete failed.");
1159
1160 LExit:
@@ -1183,7 +1190,7 @@ EXTERN_C BAAPI UserExperienceOnError(
1190 results.cbSize = sizeof(results);
1191 results.nResult = *pnResult;
1192
1186 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, &args, &results, pUserExperience->pvBAProcContext);
1193 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, &args, &results);
1194 ExitOnFailure(hr, "BA OnError failed.");
1195
1196 *pnResult = results.nResult;
@@ -1206,7 +1213,7 @@ EXTERN_C BAAPI UserExperienceOnExecuteBegin(
1213
1214 results.cbSize = sizeof(results);
1215
1209 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1216 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, &args, &results);
1217 ExitOnFailure(hr, "BA OnExecuteBegin failed.");
1218
1219 if (results.fCancel)
@@ -1232,7 +1239,7 @@ EXTERN_C BAAPI UserExperienceOnExecuteComplete(
1239
1240 results.cbSize = sizeof(results);
1241
1235 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1242 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, &args, &results);
1243 ExitOnFailure(hr, "BA OnExecuteComplete failed.");
1244
1245 LExit:
@@ -1260,7 +1267,7 @@ EXTERN_C BAAPI UserExperienceOnExecuteFilesInUse(
1267 results.cbSize = sizeof(results);
1268 results.nResult = *pnResult;
1269
1263 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, &args, &results, pUserExperience->pvBAProcContext);
1270 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, &args, &results);
1271 ExitOnFailure(hr, "BA OnExecuteFilesInUse failed.");
1272
1273 *pnResult = results.nResult;
@@ -1296,7 +1303,7 @@ EXTERN_C BAAPI UserExperienceOnExecuteMsiMessage(
1303 results.cbSize = sizeof(results);
1304 results.nResult = *pnResult;
1305
1299 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, &args, &results, pUserExperience->pvBAProcContext);
1306 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, &args, &results);
1307 ExitOnFailure(hr, "BA OnExecuteMsiMessage failed.");
1308
1309 *pnResult = results.nResult;
@@ -1327,7 +1334,7 @@ EXTERN_C BAAPI UserExperienceOnExecutePackageBegin(
1334
1335 results.cbSize = sizeof(results);
1336
1330 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1337 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, &args, &results);
1338 ExitOnFailure(hr, "BA OnExecutePackageBegin failed.");
1339
1340 if (results.fCancel)
@@ -1360,7 +1367,7 @@ EXTERN_C BAAPI UserExperienceOnExecutePackageComplete(
1367 results.cbSize = sizeof(results);
1368 results.action = *pAction;
1369
1363 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1370 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, &args, &results);
1371 ExitOnFailure(hr, "BA OnExecutePackageComplete failed.");
1372
1373 *pAction = results.action;
@@ -1385,7 +1392,7 @@ EXTERN_C BAAPI UserExperienceOnExecutePatchTarget(
1392
1393 results.cbSize = sizeof(results);
1394
1388 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, &args, &results, pUserExperience->pvBAProcContext);
1395 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, &args, &results);
1396 ExitOnFailure(hr, "BA OnExecutePatchTarget failed.");
1397
1398 if (results.fCancel)
@@ -1416,7 +1423,7 @@ EXTERN_C BAAPI UserExperienceOnExecuteProgress(
1423
1424 results.cbSize = sizeof(results);
1425
1419 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, &args, &results, pUserExperience->pvBAProcContext);
1426 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, &args, &results);
1427 ExitOnFailure(hr, "BA OnExecuteProgress failed.");
1428
1429 LExit:
@@ -1447,7 +1454,7 @@ EXTERN_C BAAPI UserExperienceOnLaunchApprovedExeBegin(
1454
1455 results.cbSize = sizeof(results);
1456
1450 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1457 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, &args, &results);
1458 ExitOnFailure(hr, "BA OnLaunchApprovedExeBegin failed.");
1459
1460 if (results.fCancel)
@@ -1475,7 +1482,7 @@ EXTERN_C BAAPI UserExperienceOnLaunchApprovedExeComplete(
1482
1483 results.cbSize = sizeof(results);
1484
1478 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1485 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, &args, &results);
1486 ExitOnFailure(hr, "BA OnLaunchApprovedExeComplete failed.");
1487
1488 LExit:
@@ -1494,7 +1501,7 @@ EXTERN_C BAAPI UserExperienceOnPauseAUBegin(
1501
1502 results.cbSize = sizeof(results);
1503
1497 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1504 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, &args, &results);
1505 ExitOnFailure(hr, "BA OnPauseAUBegin failed.");
1506
1507 LExit:
@@ -1515,7 +1522,7 @@ EXTERN_C BAAPI UserExperienceOnPauseAUComplete(
1522
1523 results.cbSize = sizeof(results);
1524
1518 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1525 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, &args, &results);
1526 ExitOnFailure(hr, "BA OnPauseAUComplete failed.");
1527
1528 LExit:
@@ -1536,7 +1543,7 @@ EXTERN_C BAAPI UserExperienceOnPlanBegin(
1543
1544 results.cbSize = sizeof(results);
1545
1539 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1546 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, &args, &results);
1547 ExitOnFailure(hr, "BA OnPlanBegin failed.");
1548
1549 if (results.fCancel)
@@ -1569,7 +1576,7 @@ EXTERN_C BAAPI UserExperienceOnPlanCompatibleMsiPackageBegin(
1576 results.cbSize = sizeof(results);
1577 results.requestedState = *pRequestedState;
1578
1572 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1579 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, &args, &results);
1580 ExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageBegin failed.");
1581
1582 if (results.fCancel)
@@ -1608,7 +1615,7 @@ EXTERN_C BAAPI UserExperienceOnPlanCompatibleMsiPackageComplete(
1615
1616 results.cbSize = sizeof(results);
1617
1611 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1618 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, &args, &results);
1619 ExitOnFailure(hr, "BA OnPlanCompatibleMsiPackageComplete failed.");
1620
1621 LExit:
@@ -1634,7 +1641,7 @@ EXTERN_C BAAPI UserExperienceOnPlanMsiFeature(
1641 results.cbSize = sizeof(results);
1642 results.requestedState = *pRequestedState;
1643
1637 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, &args, &results, pUserExperience->pvBAProcContext);
1644 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, &args, &results);
1645 ExitOnFailure(hr, "BA OnPlanMsiFeature failed.");
1646
1647 if (results.fCancel)
@@ -1661,7 +1668,7 @@ EXTERN_C BAAPI UserExperienceOnPlanComplete(
1668
1669 results.cbSize = sizeof(results);
1670
1664 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1671 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, &args, &results);
1672 ExitOnFailure(hr, "BA OnPlanComplete failed.");
1673
1674 LExit:
@@ -1692,7 +1699,7 @@ EXTERN_C BAAPI UserExperienceOnPlanMsiPackage(
1699 results.uiLevel = *pUiLevel;
1700 results.fDisableExternalUiHandler = *pfDisableExternalUiHandler;
1701
1695 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, &args, &results, pUserExperience->pvBAProcContext);
1702 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, &args, &results);
1703 ExitOnFailure(hr, "BA OnPlanMsiPackage failed.");
1704
1705 if (results.fCancel)
@@ -1724,7 +1731,7 @@ EXTERN_C BAAPI UserExperienceOnPlanPackageBegin(
1731 results.cbSize = sizeof(results);
1732 results.requestedState = *pRequestedState;
1733
1727 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1734 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, &args, &results);
1735 ExitOnFailure(hr, "BA OnPlanPackageBegin failed.");
1736
1737 if (results.fCancel)
@@ -1761,7 +1768,7 @@ EXTERN_C BAAPI UserExperienceOnPlanPackageComplete(
1768
1769 results.cbSize = sizeof(results);
1770
1764 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1771 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, &args, &results);
1772 ExitOnFailure(hr, "BA OnPlanPackageComplete failed.");
1773
1774 LExit:
@@ -1785,7 +1792,7 @@ EXTERN_C BAAPI UserExperienceOnPlanRelatedBundle(
1792 results.cbSize = sizeof(results);
1793 results.requestedState = *pRequestedState;
1794
1788 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, &args, &results, pUserExperience->pvBAProcContext);
1795 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, &args, &results);
1796 ExitOnFailure(hr, "BA OnPlanRelatedBundle failed.");
1797
1798 if (results.fCancel)
@@ -1817,7 +1824,7 @@ EXTERN_C BAAPI UserExperienceOnPlanTargetMsiPackage(
1824 results.cbSize = sizeof(results);
1825 results.requestedState = *pRequestedState;
1826
1820 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANTARGETMSIPACKAGE, &args, &results, pUserExperience->pvBAProcContext);
1827 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANTARGETMSIPACKAGE, &args, &results);
1828 ExitOnFailure(hr, "BA OnPlanTargetMsiPackage failed.");
1829
1830 if (results.fCancel)
@@ -1847,7 +1854,7 @@ EXTERN_C BAAPI UserExperienceOnProgress(
1854
1855 results.cbSize = sizeof(results);
1856
1850 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, &args, &results, pUserExperience->pvBAProcContext);
1857 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, &args, &results);
1858 hr = FilterExecuteResult(pUserExperience, hr, fRollback, results.fCancel, L"OnProgress");
1859
1860 return hr;
@@ -1865,7 +1872,7 @@ EXTERN_C BAAPI UserExperienceOnRegisterBegin(
1872
1873 results.cbSize = sizeof(results);
1874
1868 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1875 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, &args, &results);
1876 ExitOnFailure(hr, "BA OnRegisterBegin failed.");
1877
1878 if (results.fCancel)
@@ -1891,7 +1898,7 @@ EXTERN_C BAAPI UserExperienceOnRegisterComplete(
1898
1899 results.cbSize = sizeof(results);
1900
1894 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1901 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, &args, &results);
1902 ExitOnFailure(hr, "BA OnRegisterComplete failed.");
1903
1904 LExit:
@@ -1921,7 +1928,7 @@ EXTERN_C BAAPI UserExperienceOnResolveSource(
1928 results.cbSize = sizeof(results);
1929 results.action = *pAction;
1930
1924 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONRESOLVESOURCE, &args, &results, pUserExperience->pvBAProcContext);
1931 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONRESOLVESOURCE, &args, &results);
1932 ExitOnFailure(hr, "BA OnResolveSource failed.");
1933
1934 if (results.fCancel)
@@ -1951,7 +1958,7 @@ EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionBegin(
1958
1959 results.cbSize = sizeof(results);
1960
1954 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1961 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &args, &results);
1962 ExitOnFailure(hr, "BA OnRollbackMsiTransactionBegin failed.");
1963
1964 LExit:
@@ -1974,7 +1981,7 @@ EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionComplete(
1981
1982 results.cbSize = sizeof(results);
1983
1977 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1984 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &args, &results);
1985 ExitOnFailure(hr, "BA OnRollbackMsiTransactionComplete failed.");
1986
1987 LExit:
@@ -1995,7 +2002,7 @@ EXTERN_C BAAPI UserExperienceOnShutdown(
2002 results.cbSize = sizeof(results);
2003 results.action = *pAction;
2004
1998 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &args, &results, pUserExperience->pvBAProcContext);
2005 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &args, &results);
2006 ExitOnFailure(hr, "BA OnShutdown failed.");
2007
2008 *pAction = results.action;
@@ -2016,7 +2023,7 @@ EXTERN_C BAAPI UserExperienceOnStartup(
2023
2024 results.cbSize = sizeof(results);
2025
2019 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &args, &results, pUserExperience->pvBAProcContext);
2026 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &args, &results);
2027 ExitOnFailure(hr, "BA OnStartup failed.");
2028
2029 LExit:
@@ -2035,7 +2042,7 @@ EXTERN_C BAAPI UserExperienceOnSystemRestorePointBegin(
2042
2043 results.cbSize = sizeof(results);
2044
2038 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, &args, &results, pUserExperience->pvBAProcContext);
2045 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, &args, &results);
2046 ExitOnFailure(hr, "BA OnSystemRestorePointBegin failed.");
2047
2048 LExit:
@@ -2056,7 +2063,7 @@ EXTERN_C BAAPI UserExperienceOnSystemRestorePointComplete(
2063
2064 results.cbSize = sizeof(results);
2065
2059 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
2066 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, &args, &results);
2067 ExitOnFailure(hr, "BA OnSystemRestorePointComplete failed.");
2068
2069 LExit:
@@ -2079,7 +2086,7 @@ EXTERN_C BAAPI UserExperienceOnSystemShutdown(
2086 results.cbSize = sizeof(results);
2087 results.fCancel = *pfCancel;
2088
2082 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMSHUTDOWN, &args, &results, pUserExperience->pvBAProcContext);
2089 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMSHUTDOWN, &args, &results);
2090 ExitOnFailure(hr, "BA OnSystemShutdown failed.");
2091
2092 *pfCancel = results.fCancel;
@@ -2100,7 +2107,7 @@ EXTERN_C BAAPI UserExperienceOnUnregisterBegin(
2107
2108 results.cbSize = sizeof(results);
2109
2103 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &args, &results, pUserExperience->pvBAProcContext);
2110 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &args, &results);
2111 ExitOnFailure(hr, "BA OnUnregisterBegin failed.");
2112
2113 if (results.fCancel)
@@ -2126,7 +2133,7 @@ EXTERN_C BAAPI UserExperienceOnUnregisterComplete(
2133
2134 results.cbSize = sizeof(results);
2135
2129 - hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
2136 + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, &args, &results);
2137 ExitOnFailure(hr, "BA OnUnregisterComplete failed.");
2138
2139 LExit:
@@ -2389,3 +2396,21 @@ static HRESULT FilterExecuteResult(
2396 LExit:
2397 return hr;
2398 }
2399 +
2400 +static HRESULT SendBAMessage(
2401 + __in BURN_USER_EXPERIENCE* pUserExperience,
2402 + __in BOOTSTRAPPER_APPLICATION_MESSAGE message,
2403 + __in const LPVOID pvArgs,
2404 + __inout LPVOID pvResults
2405 + )
2406 +{
2407 + HRESULT hr = S_OK;
2408 +
2409 + hr = pUserExperience->pfnBAProc(message, pvArgs, pvResults, pUserExperience->pvBAProcContext);
2410 + if (hr == E_NOTIMPL)
2411 + {
2412 + hr = S_OK;
2413 + }
2414 +
2415 + return hr;
2416 +}