diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-13 13:49:57 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-14 11:12:31 -0500 |
| commit | 7d56566b7c51c49ded526466dfae6af9e1709040 (patch) | |
| tree | bda62f4cdd8c7318542d8f0ed20901cb41e1a271 /src/ext | |
| parent | 031991f32f059b64374e6d257cbe573304dd577f (diff) | |
| download | wix-7d56566b7c51c49ded526466dfae6af9e1709040.tar.gz wix-7d56566b7c51c49ded526466dfae6af9e1709040.tar.bz2 wix-7d56566b7c51c49ded526466dfae6af9e1709040.zip | |
Update balutil and Bal.wixext to use more concise Exit* macros.
Diffstat (limited to 'src/ext')
| -rw-r--r-- | src/ext/Bal/dnchost/dnchost.cpp | 27 | ||||
| -rw-r--r-- | src/ext/Bal/mbahost/mbahost.cpp | 18 | ||||
| -rw-r--r-- | src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp | 78 |
3 files changed, 44 insertions, 79 deletions
diff --git a/src/ext/Bal/dnchost/dnchost.cpp b/src/ext/Bal/dnchost/dnchost.cpp index dcc9fa56..644ba30e 100644 --- a/src/ext/Bal/dnchost/dnchost.cpp +++ b/src/ext/Bal/dnchost/dnchost.cpp | |||
| @@ -168,21 +168,16 @@ static HRESULT LoadDncConfiguration( | |||
| 168 | IXMLDOMNode* pixnHost = NULL; | 168 | IXMLDOMNode* pixnHost = NULL; |
| 169 | LPWSTR sczPayloadName = NULL; | 169 | LPWSTR sczPayloadName = NULL; |
| 170 | DWORD dwBool = 0; | 170 | DWORD dwBool = 0; |
| 171 | BOOL fXmlFound = FALSE; | ||
| 171 | 172 | ||
| 172 | hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); | 173 | hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); |
| 173 | BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); | 174 | BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); |
| 174 | 175 | ||
| 175 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFactoryAssembly", &pixnHost); | 176 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFactoryAssembly", &pixnHost); |
| 176 | BalExitOnFailure(hr, "Failed to get WixBalBAFactoryAssembly element."); | 177 | BalExitOnRequiredXmlQueryFailure(hr, "Failed to get WixBalBAFactoryAssembly element."); |
| 177 | |||
| 178 | if (S_FALSE == hr) | ||
| 179 | { | ||
| 180 | hr = E_NOTFOUND; | ||
| 181 | BalExitOnRootFailure(hr, "Failed to find WixBalBAFactoryAssembly element in bootstrapper application config."); | ||
| 182 | } | ||
| 183 | 178 | ||
| 184 | hr = XmlGetAttributeEx(pixnHost, L"FilePath", &sczPayloadName); | 179 | hr = XmlGetAttributeEx(pixnHost, L"FilePath", &sczPayloadName); |
| 185 | BalExitOnFailure(hr, "Failed to get WixBalBAFactoryAssembly/@FilePath."); | 180 | BalExitOnRequiredXmlQueryFailure(hr, "Failed to get WixBalBAFactoryAssembly/@FilePath."); |
| 186 | 181 | ||
| 187 | hr = PathConcat(pArgs->pCommand->wzBootstrapperWorkingFolder, sczPayloadName, &pState->sczBaFactoryAssemblyPath); | 182 | hr = PathConcat(pArgs->pCommand->wzBootstrapperWorkingFolder, sczPayloadName, &pState->sczBaFactoryAssemblyPath); |
| 188 | BalExitOnFailure(hr, "Failed to create BaFactoryAssemblyPath."); | 183 | BalExitOnFailure(hr, "Failed to create BaFactoryAssemblyPath."); |
| @@ -212,22 +207,20 @@ static HRESULT LoadDncConfiguration( | |||
| 212 | pState->type = DNCHOSTTYPE_FDD; | 207 | pState->type = DNCHOSTTYPE_FDD; |
| 213 | 208 | ||
| 214 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixDncOptions", &pixnHost); | 209 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixDncOptions", &pixnHost); |
| 215 | if (S_FALSE == hr) | 210 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find WixDncOptions element in bootstrapper application config."); |
| 211 | |||
| 212 | if (!fXmlFound) | ||
| 216 | { | 213 | { |
| 217 | ExitFunction1(hr = S_OK); | 214 | ExitFunction(); |
| 218 | } | 215 | } |
| 219 | BalExitOnFailure(hr, "Failed to find WixDncOptions element in bootstrapper application config."); | ||
| 220 | 216 | ||
| 221 | hr = XmlGetAttributeNumber(pixnHost, L"SelfContainedDeployment", &dwBool); | 217 | hr = XmlGetAttributeNumber(pixnHost, L"SelfContainedDeployment", &dwBool); |
| 222 | if (S_FALSE == hr) | 218 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SelfContainedDeployment value."); |
| 223 | { | 219 | |
| 224 | hr = S_OK; | 220 | if (fXmlFound && dwBool) |
| 225 | } | ||
| 226 | else if (SUCCEEDED(hr) && dwBool) | ||
| 227 | { | 221 | { |
| 228 | pState->type = DNCHOSTTYPE_SCD; | 222 | pState->type = DNCHOSTTYPE_SCD; |
| 229 | } | 223 | } |
| 230 | BalExitOnFailure(hr, "Failed to get SelfContainedDeployment value."); | ||
| 231 | 224 | ||
| 232 | LExit: | 225 | LExit: |
| 233 | ReleaseStr(sczPayloadName); | 226 | ReleaseStr(sczPayloadName); |
diff --git a/src/ext/Bal/mbahost/mbahost.cpp b/src/ext/Bal/mbahost/mbahost.cpp index 735f9f21..a9585389 100644 --- a/src/ext/Bal/mbahost/mbahost.cpp +++ b/src/ext/Bal/mbahost/mbahost.cpp | |||
| @@ -290,7 +290,7 @@ static HRESULT CheckSupportedFrameworks( | |||
| 290 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | 290 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) |
| 291 | { | 291 | { |
| 292 | hr = XmlGetAttributeEx(pNode, L"version", &sczSupportedFrameworkVersion); | 292 | hr = XmlGetAttributeEx(pNode, L"version", &sczSupportedFrameworkVersion); |
| 293 | ExitOnFailure(hr, "Failed to get supportedFramework/@version."); | 293 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get supportedFramework/@version."); |
| 294 | 294 | ||
| 295 | hr = StrAllocFormatted(&sczFrameworkRegistryKey, L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\%ls", sczSupportedFrameworkVersion); | 295 | hr = StrAllocFormatted(&sczFrameworkRegistryKey, L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\%ls", sczSupportedFrameworkVersion); |
| 296 | ExitOnFailure(hr, "Failed to allocate path to supported framework Install registry key."); | 296 | ExitOnFailure(hr, "Failed to allocate path to supported framework Install registry key."); |
| @@ -351,27 +351,23 @@ static HRESULT UpdateSupportedRuntime( | |||
| 351 | LPWSTR sczSupportedRuntimeVersion = NULL; | 351 | LPWSTR sczSupportedRuntimeVersion = NULL; |
| 352 | IXMLDOMNode* pixnStartup = NULL; | 352 | IXMLDOMNode* pixnStartup = NULL; |
| 353 | IXMLDOMNode* pixnSupportedRuntime = NULL; | 353 | IXMLDOMNode* pixnSupportedRuntime = NULL; |
| 354 | BOOL fXmlFound = FALSE; | ||
| 354 | 355 | ||
| 355 | *pfUpdatedManifest = FALSE; | 356 | *pfUpdatedManifest = FALSE; |
| 356 | 357 | ||
| 357 | // If the runtime version attribute is not specified, don't update the manifest. | 358 | // If the runtime version attribute is not specified, don't update the manifest. |
| 358 | hr = XmlGetAttributeEx(pixnSupportedFramework, L"runtimeVersion", &sczSupportedRuntimeVersion); | 359 | hr = XmlGetAttributeEx(pixnSupportedFramework, L"runtimeVersion", &sczSupportedRuntimeVersion); |
| 359 | if (E_NOTFOUND == hr) | 360 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get supportedFramework/@runtimeVersion."); |
| 361 | |||
| 362 | if (!fXmlFound) | ||
| 360 | { | 363 | { |
| 361 | ExitFunction1(hr = S_OK); | 364 | ExitFunction(); |
| 362 | } | 365 | } |
| 363 | ExitOnFailure(hr, "Failed to get supportedFramework/@runtimeVersion."); | ||
| 364 | 366 | ||
| 365 | // Get the startup element. Fail if we can't find it since it'll be necessary to load the | 367 | // Get the startup element. Fail if we can't find it since it'll be necessary to load the |
| 366 | // correct runtime. | 368 | // correct runtime. |
| 367 | hr = XmlSelectSingleNode(pixdManifest, L"/configuration/startup", &pixnStartup); | 369 | hr = XmlSelectSingleNode(pixdManifest, L"/configuration/startup", &pixnStartup); |
| 368 | ExitOnFailure(hr, "Failed to get startup element."); | 370 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get startup element."); |
| 369 | |||
| 370 | if (S_FALSE == hr) | ||
| 371 | { | ||
| 372 | hr = E_NOTFOUND; | ||
| 373 | ExitOnRootFailure(hr, "Failed to find startup element in bootstrapper application config."); | ||
| 374 | } | ||
| 375 | 371 | ||
| 376 | // Remove any pre-existing supported runtimes because they'll just get in the way and create our new one. | 372 | // Remove any pre-existing supported runtimes because they'll just get in the way and create our new one. |
| 377 | hr = XmlRemoveChildren(pixnStartup, L"supportedRuntime"); | 373 | hr = XmlRemoveChildren(pixnStartup, L"supportedRuntime"); |
diff --git a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp index c89d12c4..dd00a563 100644 --- a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp +++ b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp | |||
| @@ -2603,95 +2603,70 @@ private: | |||
| 2603 | HRESULT hr = S_OK; | 2603 | HRESULT hr = S_OK; |
| 2604 | IXMLDOMNode* pNode = NULL; | 2604 | IXMLDOMNode* pNode = NULL; |
| 2605 | DWORD dwBool = 0; | 2605 | DWORD dwBool = 0; |
| 2606 | BOOL fXmlFound = FALSE; | ||
| 2606 | 2607 | ||
| 2607 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaInformation", &pNode); | 2608 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaInformation", &pNode); |
| 2608 | if (S_FALSE == hr) | 2609 | BalExitOnRequiredXmlQueryFailure(hr, "BootstrapperApplication.xml manifest is missing wixstdba information."); |
| 2609 | { | ||
| 2610 | hr = E_INVALIDARG; | ||
| 2611 | } | ||
| 2612 | BalExitOnFailure(hr, "BootstrapperApplication.xml manifest is missing wixstdba information."); | ||
| 2613 | 2610 | ||
| 2614 | hr = XmlGetAttributeEx(pNode, L"LicenseFile", &m_sczLicenseFile); | 2611 | hr = XmlGetAttributeEx(pNode, L"LicenseFile", &m_sczLicenseFile); |
| 2615 | if (E_NOTFOUND == hr) | 2612 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get license file."); |
| 2616 | { | ||
| 2617 | hr = S_OK; | ||
| 2618 | } | ||
| 2619 | BalExitOnFailure(hr, "Failed to get license file."); | ||
| 2620 | 2613 | ||
| 2621 | hr = XmlGetAttributeEx(pNode, L"LicenseUrl", &m_sczLicenseUrl); | 2614 | hr = XmlGetAttributeEx(pNode, L"LicenseUrl", &m_sczLicenseUrl); |
| 2622 | if (E_NOTFOUND == hr) | 2615 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get license URL."); |
| 2623 | { | ||
| 2624 | hr = S_OK; | ||
| 2625 | } | ||
| 2626 | BalExitOnFailure(hr, "Failed to get license URL."); | ||
| 2627 | 2616 | ||
| 2628 | ReleaseObject(pNode); | 2617 | ReleaseObject(pNode); |
| 2629 | 2618 | ||
| 2630 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaOptions", &pNode); | 2619 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaOptions", &pNode); |
| 2631 | if (S_FALSE == hr) | 2620 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read wixstdba options from BootstrapperApplication.xml manifest."); |
| 2621 | |||
| 2622 | if (!fXmlFound) | ||
| 2632 | { | 2623 | { |
| 2633 | ExitFunction1(hr = S_OK); | 2624 | ExitFunction(); |
| 2634 | } | 2625 | } |
| 2635 | BalExitOnFailure(hr, "Failed to read wixstdba options from BootstrapperApplication.xml manifest."); | ||
| 2636 | 2626 | ||
| 2637 | hr = XmlGetAttributeNumber(pNode, L"SuppressOptionsUI", &dwBool); | 2627 | hr = XmlGetAttributeNumber(pNode, L"SuppressOptionsUI", &dwBool); |
| 2638 | if (S_FALSE == hr) | 2628 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressOptionsUI value."); |
| 2639 | { | 2629 | |
| 2640 | hr = S_OK; | 2630 | if (fXmlFound && dwBool) |
| 2641 | } | ||
| 2642 | else if (SUCCEEDED(hr) && dwBool) | ||
| 2643 | { | 2631 | { |
| 2644 | hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI, 1); | 2632 | hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI, 1); |
| 2645 | BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI); | 2633 | BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI); |
| 2646 | } | 2634 | } |
| 2647 | BalExitOnFailure(hr, "Failed to get SuppressOptionsUI value."); | ||
| 2648 | 2635 | ||
| 2649 | dwBool = 0; | 2636 | dwBool = 0; |
| 2650 | hr = XmlGetAttributeNumber(pNode, L"SuppressDowngradeFailure", &dwBool); | 2637 | hr = XmlGetAttributeNumber(pNode, L"SuppressDowngradeFailure", &dwBool); |
| 2651 | if (S_FALSE == hr) | 2638 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressDowngradeFailure value."); |
| 2652 | { | 2639 | |
| 2653 | hr = S_OK; | 2640 | if (fXmlFound) |
| 2654 | } | ||
| 2655 | else if (SUCCEEDED(hr)) | ||
| 2656 | { | 2641 | { |
| 2657 | m_fSuppressDowngradeFailure = 0 < dwBool; | 2642 | m_fSuppressDowngradeFailure = 0 < dwBool; |
| 2658 | } | 2643 | } |
| 2659 | BalExitOnFailure(hr, "Failed to get SuppressDowngradeFailure value."); | ||
| 2660 | 2644 | ||
| 2661 | dwBool = 0; | 2645 | dwBool = 0; |
| 2662 | hr = XmlGetAttributeNumber(pNode, L"SuppressRepair", &dwBool); | 2646 | hr = XmlGetAttributeNumber(pNode, L"SuppressRepair", &dwBool); |
| 2663 | if (S_FALSE == hr) | 2647 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressRepair value."); |
| 2664 | { | 2648 | |
| 2665 | hr = S_OK; | 2649 | if (fXmlFound) |
| 2666 | } | ||
| 2667 | else if (SUCCEEDED(hr)) | ||
| 2668 | { | 2650 | { |
| 2669 | m_fSuppressRepair = 0 < dwBool; | 2651 | m_fSuppressRepair = 0 < dwBool; |
| 2670 | } | 2652 | } |
| 2671 | BalExitOnFailure(hr, "Failed to get SuppressRepair value."); | ||
| 2672 | 2653 | ||
| 2673 | hr = XmlGetAttributeNumber(pNode, L"ShowVersion", &dwBool); | 2654 | hr = XmlGetAttributeNumber(pNode, L"ShowVersion", &dwBool); |
| 2674 | if (S_FALSE == hr) | 2655 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get ShowVersion value."); |
| 2675 | { | 2656 | |
| 2676 | hr = S_OK; | 2657 | if (fXmlFound && dwBool) |
| 2677 | } | ||
| 2678 | else if (SUCCEEDED(hr) && dwBool) | ||
| 2679 | { | 2658 | { |
| 2680 | hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SHOW_VERSION, 1); | 2659 | hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SHOW_VERSION, 1); |
| 2681 | BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SHOW_VERSION); | 2660 | BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SHOW_VERSION); |
| 2682 | } | 2661 | } |
| 2683 | BalExitOnFailure(hr, "Failed to get ShowVersion value."); | ||
| 2684 | 2662 | ||
| 2685 | hr = XmlGetAttributeNumber(pNode, L"SupportCacheOnly", &dwBool); | 2663 | hr = XmlGetAttributeNumber(pNode, L"SupportCacheOnly", &dwBool); |
| 2686 | if (S_FALSE == hr) | 2664 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SupportCacheOnly value."); |
| 2687 | { | 2665 | |
| 2688 | hr = S_OK; | 2666 | if (fXmlFound) |
| 2689 | } | ||
| 2690 | else if (SUCCEEDED(hr)) | ||
| 2691 | { | 2667 | { |
| 2692 | m_fSupportCacheOnly = 0 < dwBool; | 2668 | m_fSupportCacheOnly = 0 < dwBool; |
| 2693 | } | 2669 | } |
| 2694 | BalExitOnFailure(hr, "Failed to get SupportCacheOnly value."); | ||
| 2695 | 2670 | ||
| 2696 | LExit: | 2671 | LExit: |
| 2697 | ReleaseObject(pNode); | 2672 | ReleaseObject(pNode); |
| @@ -4149,17 +4124,18 @@ LExit: | |||
| 4149 | LPWSTR sczBafPath = NULL; | 4124 | LPWSTR sczBafPath = NULL; |
| 4150 | BA_FUNCTIONS_CREATE_ARGS bafCreateArgs = { }; | 4125 | BA_FUNCTIONS_CREATE_ARGS bafCreateArgs = { }; |
| 4151 | BA_FUNCTIONS_CREATE_RESULTS bafCreateResults = { }; | 4126 | BA_FUNCTIONS_CREATE_RESULTS bafCreateResults = { }; |
| 4127 | BOOL fXmlFound = FALSE; | ||
| 4152 | 4128 | ||
| 4153 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFunctions", &pBAFunctionsNode); | 4129 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFunctions", &pBAFunctionsNode); |
| 4154 | BalExitOnFailure(hr, "Failed to read WixBalBAFunctions node from BootstrapperApplicationData.xml."); | 4130 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read WixBalBAFunctions node from BootstrapperApplicationData.xml."); |
| 4155 | 4131 | ||
| 4156 | if (S_FALSE == hr) | 4132 | if (!fXmlFound) |
| 4157 | { | 4133 | { |
| 4158 | ExitFunction(); | 4134 | ExitFunction(); |
| 4159 | } | 4135 | } |
| 4160 | 4136 | ||
| 4161 | hr = XmlGetAttributeEx(pBAFunctionsNode, L"FilePath", &sczBafName); | 4137 | hr = XmlGetAttributeEx(pBAFunctionsNode, L"FilePath", &sczBafName); |
| 4162 | BalExitOnFailure(hr, "Failed to get BAFunctions FilePath."); | 4138 | BalExitOnRequiredXmlQueryFailure(hr, "Failed to get BAFunctions FilePath."); |
| 4163 | 4139 | ||
| 4164 | hr = PathRelativeToModule(&sczBafPath, sczBafName, m_hModule); | 4140 | hr = PathRelativeToModule(&sczBafPath, sczBafName, m_hModule); |
| 4165 | BalExitOnFailure(hr, "Failed to get path to BAFunctions DLL."); | 4141 | BalExitOnFailure(hr, "Failed to get path to BAFunctions DLL."); |
