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/Bal/wixstdba | |
| 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/Bal/wixstdba')
| -rw-r--r-- | src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp | 78 |
1 files changed, 27 insertions, 51 deletions
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."); |
