From a79ce0b907676e50332139b4c4a8acb5d22a4b46 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 29 Apr 2020 19:32:42 +1000 Subject: Add support for FDD in DotNetCoreBootstrapperApplicationHost. --- src/dnchost/dnchost.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/dnchost/dnchost.cpp') 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( BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application factory."); } - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading .NET Core SCD bootstrapper application."); + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading .NET Core %ls bootstrapper application.", DNCHOSTTYPE_FDD == vstate.type ? L"FDD" : L"SCD"); hr = vstate.pAppFactory->Create(pArgs, pResults); BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application."); } else // fallback to the prerequisite BA. { - hrHostInitialization = E_DNCHOST_SCD_RUNTIME_FAILURE; - BalLogError(hr, "The self-contained .NET Core runtime failed to load. This is an unrecoverable error."); + if (DNCHOSTTYPE_SCD == vstate.type) + { + hrHostInitialization = E_DNCHOST_SCD_RUNTIME_FAILURE; + BalLogError(hr, "The self-contained .NET Core runtime failed to load. This is an unrecoverable error."); + } + else + { + hrHostInitialization = S_OK; + } BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x%08x.", hr); hr = CreatePrerequisiteBA(hrHostInitialization, pEngine, vstate.sczAppBase, pArgs, pResults); @@ -166,6 +173,7 @@ static HRESULT LoadDncConfiguration( LPWSTR sczPayloadId = NULL; LPWSTR sczPayloadXPath = NULL; LPWSTR sczPayloadName = NULL; + DWORD dwBool = 0; hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); @@ -220,6 +228,26 @@ static HRESULT LoadDncConfiguration( hr = StrAllocConcat(&pState->sczBaFactoryRuntimeConfigPath, L".runtimeconfig.json", 0); BalExitOnFailure(hr, "Failed to concat extension to runtime config path."); + pState->type = DNCHOSTTYPE_FDD; + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixDncOptions", &pixnHost); + if (S_FALSE == hr) + { + ExitFunction1(hr = S_OK); + } + BalExitOnFailure(hr, "Failed to find WixDncOptions element in bootstrapper application config."); + + hr = XmlGetAttributeNumber(pixnHost, L"SelfContainedDeployment", &dwBool); + if (S_FALSE == hr) + { + hr = S_OK; + } + else if (SUCCEEDED(hr) && dwBool) + { + pState->type = DNCHOSTTYPE_SCD; + } + BalExitOnFailure(hr, "Failed to get SelfContainedDeployment value."); + LExit: ReleaseStr(sczPayloadName); ReleaseObject(pixnPayload); -- cgit v1.2.3-55-g6feb