diff options
Diffstat (limited to 'src/ext/Bal/mbahost/mbahost.cpp')
-rw-r--r-- | src/ext/Bal/mbahost/mbahost.cpp | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/src/ext/Bal/mbahost/mbahost.cpp b/src/ext/Bal/mbahost/mbahost.cpp index 3de77a05..0b89fc58 100644 --- a/src/ext/Bal/mbahost/mbahost.cpp +++ b/src/ext/Bal/mbahost/mbahost.cpp | |||
@@ -24,6 +24,10 @@ static HRESULT GetAppDomain( | |||
24 | static HRESULT LoadModulePaths( | 24 | static HRESULT LoadModulePaths( |
25 | __in MBASTATE* pState | 25 | __in MBASTATE* pState |
26 | ); | 26 | ); |
27 | static HRESULT LoadMbaConfiguration( | ||
28 | __in MBASTATE* pState, | ||
29 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs | ||
30 | ); | ||
27 | static HRESULT CheckSupportedFrameworks( | 31 | static HRESULT CheckSupportedFrameworks( |
28 | __in LPCWSTR wzConfigPath | 32 | __in LPCWSTR wzConfigPath |
29 | ); | 33 | ); |
@@ -96,12 +100,28 @@ extern "C" HRESULT WINAPI BootstrapperApplicationCreate( | |||
96 | 100 | ||
97 | if (!vstate.fInitialized) | 101 | if (!vstate.fInitialized) |
98 | { | 102 | { |
103 | hr = XmlInitialize(); | ||
104 | BalExitOnFailure(hr, "Failed to initialize XML."); | ||
105 | |||
99 | hr = LoadModulePaths(&vstate); | 106 | hr = LoadModulePaths(&vstate); |
100 | BalExitOnFailure(hr, "Failed to load the module paths."); | 107 | BalExitOnFailure(hr, "Failed to load the module paths."); |
101 | 108 | ||
109 | hr = LoadMbaConfiguration(&vstate, pArgs); | ||
110 | BalExitOnFailure(hr, "Failed to get the mba configuration."); | ||
111 | |||
102 | vstate.fInitialized = TRUE; | 112 | vstate.fInitialized = TRUE; |
103 | } | 113 | } |
104 | 114 | ||
115 | if (vstate.prereqData.fAlwaysInstallPrereqs && !vstate.prereqData.fCompleted) | ||
116 | { | ||
117 | BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application since it's configured to always run before loading the runtime."); | ||
118 | |||
119 | hr = CreatePrerequisiteBA(&vstate, pEngine, pArgs, pResults); | ||
120 | BalExitOnFailure(hr, "Failed to create the pre-requisite bootstrapper application."); | ||
121 | |||
122 | ExitFunction(); | ||
123 | } | ||
124 | |||
105 | if (!vstate.fInitializedRuntime) | 125 | if (!vstate.fInitializedRuntime) |
106 | { | 126 | { |
107 | hr = LoadRuntime(&vstate); | 127 | hr = LoadRuntime(&vstate); |
@@ -264,6 +284,35 @@ LExit: | |||
264 | return hr; | 284 | return hr; |
265 | } | 285 | } |
266 | 286 | ||
287 | static HRESULT LoadMbaConfiguration( | ||
288 | __in MBASTATE* pState, | ||
289 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs | ||
290 | ) | ||
291 | { | ||
292 | HRESULT hr = S_OK; | ||
293 | IXMLDOMDocument* pixdManifest = NULL; | ||
294 | IXMLDOMNode* pixnHost = NULL; | ||
295 | BOOL fXmlFound = FALSE; | ||
296 | |||
297 | hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); | ||
298 | BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); | ||
299 | |||
300 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixMbaPrereqOptions", &pixnHost); | ||
301 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find WixMbaPrereqOptions element in bootstrapper application config."); | ||
302 | |||
303 | if (fXmlFound) | ||
304 | { | ||
305 | hr = XmlGetAttributeNumber(pixnHost, L"AlwaysInstallPrereqs", reinterpret_cast<DWORD*>(&pState->prereqData.fAlwaysInstallPrereqs)); | ||
306 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get AlwaysInstallPrereqs value."); | ||
307 | } | ||
308 | |||
309 | LExit: | ||
310 | ReleaseObject(pixnHost); | ||
311 | ReleaseObject(pixdManifest); | ||
312 | |||
313 | return hr; | ||
314 | } | ||
315 | |||
267 | // Checks whether at least one of required supported frameworks is installed via the NETFX registry keys. | 316 | // Checks whether at least one of required supported frameworks is installed via the NETFX registry keys. |
268 | static HRESULT CheckSupportedFrameworks( | 317 | static HRESULT CheckSupportedFrameworks( |
269 | __in LPCWSTR wzConfigPath | 318 | __in LPCWSTR wzConfigPath |
@@ -280,9 +329,6 @@ static HRESULT CheckSupportedFrameworks( | |||
280 | DWORD dwFrameworkInstalled = 0; | 329 | DWORD dwFrameworkInstalled = 0; |
281 | BOOL fUpdatedManifest = FALSE; | 330 | BOOL fUpdatedManifest = FALSE; |
282 | 331 | ||
283 | hr = XmlInitialize(); | ||
284 | ExitOnFailure(hr, "Failed to initialize XML."); | ||
285 | |||
286 | hr = XmlLoadDocumentFromFile(wzConfigPath, &pixdManifest); | 332 | hr = XmlLoadDocumentFromFile(wzConfigPath, &pixdManifest); |
287 | ExitOnFailure(hr, "Failed to load bootstrapper config file from path: %ls", wzConfigPath); | 333 | ExitOnFailure(hr, "Failed to load bootstrapper config file from path: %ls", wzConfigPath); |
288 | 334 | ||
@@ -342,8 +388,6 @@ LExit: | |||
342 | ReleaseObject(pNodeList); | 388 | ReleaseObject(pNodeList); |
343 | ReleaseObject(pixdManifest); | 389 | ReleaseObject(pixdManifest); |
344 | 390 | ||
345 | XmlUninitialize(); | ||
346 | |||
347 | return hr; | 391 | return hr; |
348 | } | 392 | } |
349 | 393 | ||