diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-29 19:32:42 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-29 19:53:29 +1000 |
commit | a79ce0b907676e50332139b4c4a8acb5d22a4b46 (patch) | |
tree | eff9680cd53166f0f73934e02dfe5112384838f1 /src/dnchost | |
parent | b7faab06259d3afdc3205024a0004ace72157cbe (diff) | |
download | wix-a79ce0b907676e50332139b4c4a8acb5d22a4b46.tar.gz wix-a79ce0b907676e50332139b4c4a8acb5d22a4b46.tar.bz2 wix-a79ce0b907676e50332139b4c4a8acb5d22a4b46.zip |
Add support for FDD in DotNetCoreBootstrapperApplicationHost.
Diffstat (limited to 'src/dnchost')
-rw-r--r-- | src/dnchost/dnchost.cpp | 34 | ||||
-rw-r--r-- | src/dnchost/dnchost.h | 8 |
2 files changed, 39 insertions, 3 deletions
diff --git a/src/dnchost/dnchost.cpp b/src/dnchost/dnchost.cpp index 0fad58c1..503537c0 100644 --- a/src/dnchost/dnchost.cpp +++ b/src/dnchost/dnchost.cpp | |||
@@ -97,15 +97,22 @@ extern "C" HRESULT WINAPI BootstrapperApplicationCreate( | |||
97 | BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application factory."); | 97 | BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application factory."); |
98 | } | 98 | } |
99 | 99 | ||
100 | BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading .NET Core SCD bootstrapper application."); | 100 | BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading .NET Core %ls bootstrapper application.", DNCHOSTTYPE_FDD == vstate.type ? L"FDD" : L"SCD"); |
101 | 101 | ||
102 | hr = vstate.pAppFactory->Create(pArgs, pResults); | 102 | hr = vstate.pAppFactory->Create(pArgs, pResults); |
103 | BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application."); | 103 | BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application."); |
104 | } | 104 | } |
105 | else // fallback to the prerequisite BA. | 105 | else // fallback to the prerequisite BA. |
106 | { | 106 | { |
107 | hrHostInitialization = E_DNCHOST_SCD_RUNTIME_FAILURE; | 107 | if (DNCHOSTTYPE_SCD == vstate.type) |
108 | BalLogError(hr, "The self-contained .NET Core runtime failed to load. This is an unrecoverable error."); | 108 | { |
109 | hrHostInitialization = E_DNCHOST_SCD_RUNTIME_FAILURE; | ||
110 | BalLogError(hr, "The self-contained .NET Core runtime failed to load. This is an unrecoverable error."); | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | hrHostInitialization = S_OK; | ||
115 | } | ||
109 | BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x%08x.", hr); | 116 | BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x%08x.", hr); |
110 | 117 | ||
111 | hr = CreatePrerequisiteBA(hrHostInitialization, pEngine, vstate.sczAppBase, pArgs, pResults); | 118 | hr = CreatePrerequisiteBA(hrHostInitialization, pEngine, vstate.sczAppBase, pArgs, pResults); |
@@ -166,6 +173,7 @@ static HRESULT LoadDncConfiguration( | |||
166 | LPWSTR sczPayloadId = NULL; | 173 | LPWSTR sczPayloadId = NULL; |
167 | LPWSTR sczPayloadXPath = NULL; | 174 | LPWSTR sczPayloadXPath = NULL; |
168 | LPWSTR sczPayloadName = NULL; | 175 | LPWSTR sczPayloadName = NULL; |
176 | DWORD dwBool = 0; | ||
169 | 177 | ||
170 | hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); | 178 | hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); |
171 | BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); | 179 | BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); |
@@ -220,6 +228,26 @@ static HRESULT LoadDncConfiguration( | |||
220 | hr = StrAllocConcat(&pState->sczBaFactoryRuntimeConfigPath, L".runtimeconfig.json", 0); | 228 | hr = StrAllocConcat(&pState->sczBaFactoryRuntimeConfigPath, L".runtimeconfig.json", 0); |
221 | BalExitOnFailure(hr, "Failed to concat extension to runtime config path."); | 229 | BalExitOnFailure(hr, "Failed to concat extension to runtime config path."); |
222 | 230 | ||
231 | pState->type = DNCHOSTTYPE_FDD; | ||
232 | |||
233 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixDncOptions", &pixnHost); | ||
234 | if (S_FALSE == hr) | ||
235 | { | ||
236 | ExitFunction1(hr = S_OK); | ||
237 | } | ||
238 | BalExitOnFailure(hr, "Failed to find WixDncOptions element in bootstrapper application config."); | ||
239 | |||
240 | hr = XmlGetAttributeNumber(pixnHost, L"SelfContainedDeployment", &dwBool); | ||
241 | if (S_FALSE == hr) | ||
242 | { | ||
243 | hr = S_OK; | ||
244 | } | ||
245 | else if (SUCCEEDED(hr) && dwBool) | ||
246 | { | ||
247 | pState->type = DNCHOSTTYPE_SCD; | ||
248 | } | ||
249 | BalExitOnFailure(hr, "Failed to get SelfContainedDeployment value."); | ||
250 | |||
223 | LExit: | 251 | LExit: |
224 | ReleaseStr(sczPayloadName); | 252 | ReleaseStr(sczPayloadName); |
225 | ReleaseObject(pixnPayload); | 253 | ReleaseObject(pixnPayload); |
diff --git a/src/dnchost/dnchost.h b/src/dnchost/dnchost.h index 40c506fc..22fd8f5e 100644 --- a/src/dnchost/dnchost.h +++ b/src/dnchost/dnchost.h | |||
@@ -2,6 +2,13 @@ | |||
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
3 | 3 | ||
4 | 4 | ||
5 | enum DNCHOSTTYPE | ||
6 | { | ||
7 | DNCHOSTTYPE_UNKNOWN, | ||
8 | DNCHOSTTYPE_FDD, | ||
9 | DNCHOSTTYPE_SCD, | ||
10 | }; | ||
11 | |||
5 | extern "C" typedef HRESULT(WINAPI* PFN_DNCPREQ_BOOTSTRAPPER_APPLICATION_CREATE)( | 12 | extern "C" typedef HRESULT(WINAPI* PFN_DNCPREQ_BOOTSTRAPPER_APPLICATION_CREATE)( |
6 | __in HRESULT hrHostInitialization, | 13 | __in HRESULT hrHostInitialization, |
7 | __in IBootstrapperEngine* pEngine, | 14 | __in IBootstrapperEngine* pEngine, |
@@ -21,6 +28,7 @@ struct DNCSTATE | |||
21 | LPWSTR sczBaFactoryAssemblyPath; | 28 | LPWSTR sczBaFactoryAssemblyPath; |
22 | LPWSTR sczBaFactoryDepsJsonPath; | 29 | LPWSTR sczBaFactoryDepsJsonPath; |
23 | LPWSTR sczBaFactoryRuntimeConfigPath; | 30 | LPWSTR sczBaFactoryRuntimeConfigPath; |
31 | DNCHOSTTYPE type; | ||
24 | HOSTFXR_STATE hostfxrState; | 32 | HOSTFXR_STATE hostfxrState; |
25 | IBootstrapperApplicationFactory* pAppFactory; | 33 | IBootstrapperApplicationFactory* pAppFactory; |
26 | HMODULE hMbapreqModule; | 34 | HMODULE hMbapreqModule; |