main
h 161 lines 5.34 KB
Raw
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 #define BAAPI HRESULT __stdcall
5
6 #if defined(__cplusplus)
7 extern "C" {
8 #endif
9
10
11 // constants
12
13 const DWORD BURN_MB_RETRYTRYAGAIN = 0x10;
14 const DWORD64 BOOTSTRAPPER_APPLICATION_API_VERSION = MAKEQWORDVERSION(2024, 1, 1, 0);
15
16
17 // structs
18
19 typedef struct _BURN_USER_EXPERIENCE
20 {
21 BURN_PAYLOADS payloads;
22
23 BURN_PAYLOAD* pPrimaryExePayload;
24 BURN_PAYLOAD* pSecondaryExePayload;
25
26 //HMODULE hUXModule;
27 //PFN_BOOTSTRAPPER_APPLICATION_PROC pfnBAProc;
28 //LPVOID pvBAProcContext;
29 HANDLE hBAProcess;
30 PIPE_RPC_HANDLE hBARpcPipe;
31 BAENGINE_CONTEXT* pEngineContext;
32
33 LPWSTR sczTempDirectory;
34
35 CRITICAL_SECTION csEngineActive; // Changing the engine active state in the user experience must be
36 // syncronized through this critical section.
37 // Note: The engine must never do a UX callback while in this critical section.
38
39 BOOL fEngineActive; // Indicates that the engine is currently active with one of the execution
40 // steps (detect, plan, apply), and cannot accept requests from the UX.
41 // This flag should be cleared by the engine prior to UX callbacks that
42 // allow altering of the engine state.
43
44 HRESULT hrApplyError; // Tracks if an error occurs during apply that requires the cache or
45 // execute threads to bail.
46
47 HWND hwndApply; // The window handle provided at the beginning of Apply(). Only valid
48 // during apply.
49
50 HWND hwndDetect; // The window handle provided at the beginning of Detect(). Only valid
51 // during Detect.
52
53 DWORD dwExitCode; // Exit code returned by the user experience for the engine overall.
54 } BURN_USER_EXPERIENCE;
55
56
57 // functions
58
59 /*******************************************************************
60 BootstrapperApplicationParseFromXml - parses the bootstrapper application
61 data embedded in the bundle.
62
63 *******************************************************************/
64 HRESULT BootstrapperApplicationParseFromXml(
65 __in BURN_USER_EXPERIENCE* pUserExperience,
66 __in IXMLDOMNode* pixnBundle
67 );
68
69 /*******************************************************************
70 BootstrapperApplicationUninitialize - uninitializes the bootstrapper
71 application data.
72
73 *******************************************************************/
74 void BootstrapperApplicationUninitialize(
75 __in BURN_USER_EXPERIENCE* pUserExperience
76 );
77
78 /*******************************************************************
79 BootstrapperApplicationStart - starts the bootstrapper application
80 process and creates the bootstrapper application in it.
81
82 *******************************************************************/
83 HRESULT BootstrapperApplicationStart(
84 __in BURN_ENGINE_STATE* pEngineState,
85 __in BOOL fSecondary
86 );
87
88 /*******************************************************************
89 BootstrapperApplicationStop - destroys the bootstrapper application
90 in the bootstrapper application process, disconnects and waits
91 for the process to exit.
92
93 *******************************************************************/
94 HRESULT BootstrapperApplicationStop(
95 __in BURN_USER_EXPERIENCE* pUserExperience,
96 __inout BOOL* pfReload
97 );
98
99 int BootstrapperApplicationCheckExecuteResult(
100 __in BURN_USER_EXPERIENCE* pUserExperience,
101 __in BOOL fRollback,
102 __in DWORD dwAllowedResults,
103 __in int nResult
104 );
105
106 HRESULT BootstrapperApplicationInterpretExecuteResult(
107 __in BURN_USER_EXPERIENCE* pUserExperience,
108 __in BOOL fRollback,
109 __in DWORD dwAllowedResults,
110 __in int nResult
111 );
112
113 HRESULT BootstrapperApplicationEnsureWorkingFolder(
114 __in BOOL fElevated,
115 __in BURN_CACHE* pCache,
116 __deref_out_z LPWSTR* psczUserExperienceWorkingFolder
117 );
118
119 HRESULT BootstrapperApplicationRemove(
120 __in BURN_USER_EXPERIENCE* pUserExperience
121 );
122
123 int BootstrapperApplicationSendError(
124 __in BURN_USER_EXPERIENCE* pUserExperience,
125 __in BOOTSTRAPPER_ERROR_TYPE errorType,
126 __in_z_opt LPCWSTR wzPackageId,
127 __in HRESULT hrCode,
128 __in_z_opt LPCWSTR wzError,
129 __in DWORD uiFlags,
130 __in int nRecommendation
131 );
132
133 void BootstrapperApplicationActivateEngine(
134 __in BURN_USER_EXPERIENCE* pUserExperience
135 );
136
137 void BootstrapperApplicationDeactivateEngine(
138 __in BURN_USER_EXPERIENCE* pUserExperience
139 );
140
141 /********************************************************************
142 BootstrapperApplicationEnsureEngineInactive - Verifies the engine is inactive.
143 The caller MUST enter the csActive critical section before calling.
144
145 *********************************************************************/
146 HRESULT BootstrapperApplicationEnsureEngineInactive(
147 __in BURN_USER_EXPERIENCE* pUserExperience
148 );
149
150 void BootstrapperApplicationExecuteReset(
151 __in BURN_USER_EXPERIENCE* pUserExperience
152 );
153
154 void BootstrapperApplicationExecutePhaseComplete(
155 __in BURN_USER_EXPERIENCE* pUserExperience,
156 __in HRESULT hrResult
157 );
158
159 #if defined(__cplusplus)
160 }
161 #endif