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 | |
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')
-rw-r--r-- | src/api/burn/balutil/balcondition.cpp | 4 | ||||
-rw-r--r-- | src/api/burn/balutil/balinfo.cpp | 105 | ||||
-rw-r--r-- | src/api/burn/balutil/inc/balutil.h | 4 | ||||
-rw-r--r-- | src/api/burn/bextutil/bextutil.cpp | 2 | ||||
-rw-r--r-- | src/api/burn/bextutil/inc/bextutil.h | 4 | ||||
-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 |
8 files changed, 85 insertions, 157 deletions
diff --git a/src/api/burn/balutil/balcondition.cpp b/src/api/burn/balutil/balcondition.cpp index 8b05508f..00a46e05 100644 --- a/src/api/burn/balutil/balcondition.cpp +++ b/src/api/burn/balutil/balcondition.cpp | |||
@@ -35,10 +35,10 @@ DAPI_(HRESULT) BalConditionsParseFromXml( | |||
35 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | 35 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) |
36 | { | 36 | { |
37 | hr = XmlGetAttributeEx(pNode, L"Condition", &prgConditions[iCondition].sczCondition); | 37 | hr = XmlGetAttributeEx(pNode, L"Condition", &prgConditions[iCondition].sczCondition); |
38 | ExitOnFailure(hr, "Failed to get condition for condition."); | 38 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get condition for condition."); |
39 | 39 | ||
40 | hr = XmlGetAttributeEx(pNode, L"Message", &prgConditions[iCondition].sczMessage); | 40 | hr = XmlGetAttributeEx(pNode, L"Message", &prgConditions[iCondition].sczMessage); |
41 | ExitOnFailure(hr, "Failed to get message for condition."); | 41 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get message for condition."); |
42 | 42 | ||
43 | if (pWixLoc && prgConditions[iCondition].sczMessage && *prgConditions[iCondition].sczMessage) | 43 | if (pWixLoc && prgConditions[iCondition].sczMessage && *prgConditions[iCondition].sczMessage) |
44 | { | 44 | { |
diff --git a/src/api/burn/balutil/balinfo.cpp b/src/api/burn/balutil/balinfo.cpp index 29e453f6..5832281f 100644 --- a/src/api/burn/balutil/balinfo.cpp +++ b/src/api/burn/balutil/balinfo.cpp | |||
@@ -123,29 +123,21 @@ DAPI_(HRESULT) BalInfoParseFromXml( | |||
123 | { | 123 | { |
124 | HRESULT hr = S_OK; | 124 | HRESULT hr = S_OK; |
125 | IXMLDOMNode* pNode = NULL; | 125 | IXMLDOMNode* pNode = NULL; |
126 | BOOL fXmlFound = FALSE; | ||
126 | 127 | ||
127 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBundleProperties", &pNode); | 128 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBundleProperties", &pNode); |
128 | ExitOnFailure(hr, "Failed to select bundle information."); | 129 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to select bundle information."); |
129 | 130 | ||
130 | if (S_OK == hr) | 131 | if (fXmlFound) |
131 | { | 132 | { |
132 | hr = XmlGetYesNoAttribute(pNode, L"PerMachine", &pBundle->fPerMachine); | 133 | hr = XmlGetYesNoAttribute(pNode, L"PerMachine", &pBundle->fPerMachine); |
133 | if (E_NOTFOUND != hr) | 134 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read bundle information per-machine."); |
134 | { | ||
135 | ExitOnFailure(hr, "Failed to read bundle information per-machine."); | ||
136 | } | ||
137 | 135 | ||
138 | hr = XmlGetAttributeEx(pNode, L"DisplayName", &pBundle->sczName); | 136 | hr = XmlGetAttributeEx(pNode, L"DisplayName", &pBundle->sczName); |
139 | if (E_NOTFOUND != hr) | 137 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read bundle information display name."); |
140 | { | ||
141 | ExitOnFailure(hr, "Failed to read bundle information display name."); | ||
142 | } | ||
143 | 138 | ||
144 | hr = XmlGetAttributeEx(pNode, L"LogPathVariable", &pBundle->sczLogVariable); | 139 | hr = XmlGetAttributeEx(pNode, L"LogPathVariable", &pBundle->sczLogVariable); |
145 | if (E_NOTFOUND != hr) | 140 | BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read bundle information log path variable."); |
146 | { | ||
147 | ExitOnFailure(hr, "Failed to read bundle information log path variable."); | ||
148 | } | ||
149 | } | 141 | } |
150 | 142 | ||
151 | hr = ParseOverridableVariablesFromXml(&pBundle->overridableVariables, pixdManifest); | 143 | hr = ParseOverridableVariablesFromXml(&pBundle->overridableVariables, pixdManifest); |
@@ -192,7 +184,7 @@ DAPI_(HRESULT) BalInfoAddRelatedBundleAsPackage( | |||
192 | break; | 184 | break; |
193 | 185 | ||
194 | default: | 186 | default: |
195 | ExitOnFailure(hr = E_INVALIDARG, "Unknown related bundle type: %u", relationType); | 187 | ExitWithRootFailure(hr, E_INVALIDARG, "Unknown related bundle type: %u", relationType); |
196 | } | 188 | } |
197 | 189 | ||
198 | // Check to see if the bundle is already in the list of packages. | 190 | // Check to see if the bundle is already in the list of packages. |
@@ -403,6 +395,7 @@ static HRESULT ParsePackagesFromXml( | |||
403 | BAL_INFO_PACKAGE* prgPackages = NULL; | 395 | BAL_INFO_PACKAGE* prgPackages = NULL; |
404 | DWORD cPackages = 0; | 396 | DWORD cPackages = 0; |
405 | LPWSTR scz = NULL; | 397 | LPWSTR scz = NULL; |
398 | BOOL fXmlFound = FALSE; | ||
406 | 399 | ||
407 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixPackageProperties", &pNodeList); | 400 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixPackageProperties", &pNodeList); |
408 | ExitOnFailure(hr, "Failed to select all packages."); | 401 | ExitOnFailure(hr, "Failed to select all packages."); |
@@ -417,22 +410,16 @@ static HRESULT ParsePackagesFromXml( | |||
417 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | 410 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) |
418 | { | 411 | { |
419 | hr = XmlGetAttributeEx(pNode, L"Package", &prgPackages[iPackage].sczId); | 412 | hr = XmlGetAttributeEx(pNode, L"Package", &prgPackages[iPackage].sczId); |
420 | ExitOnFailure(hr, "Failed to get package identifier for package."); | 413 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get package identifier for package."); |
421 | 414 | ||
422 | hr = XmlGetAttributeEx(pNode, L"DisplayName", &prgPackages[iPackage].sczDisplayName); | 415 | hr = XmlGetAttributeEx(pNode, L"DisplayName", &prgPackages[iPackage].sczDisplayName); |
423 | if (E_NOTFOUND != hr) | 416 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get display name for package."); |
424 | { | ||
425 | ExitOnFailure(hr, "Failed to get display name for package."); | ||
426 | } | ||
427 | 417 | ||
428 | hr = XmlGetAttributeEx(pNode, L"Description", &prgPackages[iPackage].sczDescription); | 418 | hr = XmlGetAttributeEx(pNode, L"Description", &prgPackages[iPackage].sczDescription); |
429 | if (E_NOTFOUND != hr) | 419 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get description for package."); |
430 | { | ||
431 | ExitOnFailure(hr, "Failed to get description for package."); | ||
432 | } | ||
433 | 420 | ||
434 | hr = XmlGetAttributeEx(pNode, L"PackageType", &scz); | 421 | hr = XmlGetAttributeEx(pNode, L"PackageType", &scz); |
435 | ExitOnFailure(hr, "Failed to get package type for package."); | 422 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get package type for package."); |
436 | 423 | ||
437 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, L"Bundle", -1, scz, -1)) | 424 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, L"Bundle", -1, scz, -1)) |
438 | { | 425 | { |
@@ -456,43 +443,28 @@ static HRESULT ParsePackagesFromXml( | |||
456 | } | 443 | } |
457 | 444 | ||
458 | hr = XmlGetYesNoAttribute(pNode, L"Permanent", &prgPackages[iPackage].fPermanent); | 445 | hr = XmlGetYesNoAttribute(pNode, L"Permanent", &prgPackages[iPackage].fPermanent); |
459 | ExitOnFailure(hr, "Failed to get permanent setting for package."); | 446 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get permanent setting for package."); |
460 | 447 | ||
461 | hr = XmlGetYesNoAttribute(pNode, L"Vital", &prgPackages[iPackage].fVital); | 448 | hr = XmlGetYesNoAttribute(pNode, L"Vital", &prgPackages[iPackage].fVital); |
462 | ExitOnFailure(hr, "Failed to get vital setting for package."); | 449 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get vital setting for package."); |
463 | 450 | ||
464 | hr = XmlGetAttributeEx(pNode, L"ProductCode", &prgPackages[iPackage].sczProductCode); | 451 | hr = XmlGetAttributeEx(pNode, L"ProductCode", &prgPackages[iPackage].sczProductCode); |
465 | if (E_NOTFOUND != hr) | 452 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get product code for package."); |
466 | { | ||
467 | ExitOnFailure(hr, "Failed to get product code for package."); | ||
468 | } | ||
469 | 453 | ||
470 | hr = XmlGetAttributeEx(pNode, L"UpgradeCode", &prgPackages[iPackage].sczUpgradeCode); | 454 | hr = XmlGetAttributeEx(pNode, L"UpgradeCode", &prgPackages[iPackage].sczUpgradeCode); |
471 | if (E_NOTFOUND != hr) | 455 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get upgrade code for package."); |
472 | { | ||
473 | ExitOnFailure(hr, "Failed to get upgrade code for package."); | ||
474 | } | ||
475 | 456 | ||
476 | hr = XmlGetAttributeEx(pNode, L"Version", &prgPackages[iPackage].sczVersion); | 457 | hr = XmlGetAttributeEx(pNode, L"Version", &prgPackages[iPackage].sczVersion); |
477 | if (E_NOTFOUND != hr) | 458 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get version for package."); |
478 | { | ||
479 | ExitOnFailure(hr, "Failed to get version for package."); | ||
480 | } | ||
481 | 459 | ||
482 | hr = XmlGetAttributeEx(pNode, L"InstallCondition", &prgPackages[iPackage].sczInstallCondition); | 460 | hr = XmlGetAttributeEx(pNode, L"InstallCondition", &prgPackages[iPackage].sczInstallCondition); |
483 | if (E_NOTFOUND != hr) | 461 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get install condition for package."); |
484 | { | ||
485 | ExitOnFailure(hr, "Failed to get install condition for package."); | ||
486 | } | ||
487 | 462 | ||
488 | hr = XmlGetAttributeEx(pNode, L"RepairCondition", &prgPackages[iPackage].sczRepairCondition); | 463 | hr = XmlGetAttributeEx(pNode, L"RepairCondition", &prgPackages[iPackage].sczRepairCondition); |
489 | if (E_NOTFOUND != hr) | 464 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get repair condition for package."); |
490 | { | ||
491 | ExitOnFailure(hr, "Failed to get repair condition for package."); | ||
492 | } | ||
493 | 465 | ||
494 | hr = XmlGetAttributeEx(pNode, L"Cache", &scz); | 466 | hr = XmlGetAttributeEx(pNode, L"Cache", &scz); |
495 | ExitOnFailure(hr, "Failed to get cache type for package."); | 467 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get cache type for package."); |
496 | 468 | ||
497 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, scz, -1, L"remove", -1)) | 469 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, scz, -1, L"remove", -1)) |
498 | { | 470 | { |
@@ -541,6 +513,7 @@ static HRESULT ParseBalPackageInfoFromXml( | |||
541 | IXMLDOMNode* pNode = NULL; | 513 | IXMLDOMNode* pNode = NULL; |
542 | LPWSTR scz = NULL; | 514 | LPWSTR scz = NULL; |
543 | BAL_INFO_PACKAGE* pPackage = NULL; | 515 | BAL_INFO_PACKAGE* pPackage = NULL; |
516 | BOOL fXmlFound = FALSE; | ||
544 | 517 | ||
545 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixBalPackageInfo", &pNodeList); | 518 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixBalPackageInfo", &pNodeList); |
546 | ExitOnFailure(hr, "Failed to select all packages."); | 519 | ExitOnFailure(hr, "Failed to select all packages."); |
@@ -548,16 +521,13 @@ static HRESULT ParseBalPackageInfoFromXml( | |||
548 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | 521 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) |
549 | { | 522 | { |
550 | hr = XmlGetAttributeEx(pNode, L"PackageId", &scz); | 523 | hr = XmlGetAttributeEx(pNode, L"PackageId", &scz); |
551 | ExitOnFailure(hr, "Failed to get package identifier for WixBalPackageInfo."); | 524 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get package identifier for WixBalPackageInfo."); |
552 | 525 | ||
553 | hr = BalInfoFindPackageById(pPackages, scz, &pPackage); | 526 | hr = BalInfoFindPackageById(pPackages, scz, &pPackage); |
554 | ExitOnFailure(hr, "Failed to find package specified in WixBalPackageInfo: %ls", scz); | 527 | ExitOnFailure(hr, "Failed to find package specified in WixBalPackageInfo: %ls", scz); |
555 | 528 | ||
556 | hr = XmlGetAttributeEx(pNode, L"DisplayInternalUICondition", &pPackage->sczDisplayInternalUICondition); | 529 | hr = XmlGetAttributeEx(pNode, L"DisplayInternalUICondition", &pPackage->sczDisplayInternalUICondition); |
557 | if (E_NOTFOUND != hr) | 530 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get DisplayInternalUICondition setting for package."); |
558 | { | ||
559 | ExitOnFailure(hr, "Failed to get DisplayInternalUICondition setting for package."); | ||
560 | } | ||
561 | 531 | ||
562 | ReleaseNullObject(pNode); | 532 | ReleaseNullObject(pNode); |
563 | } | 533 | } |
@@ -569,7 +539,7 @@ static HRESULT ParseBalPackageInfoFromXml( | |||
569 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | 539 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) |
570 | { | 540 | { |
571 | hr = XmlGetAttributeEx(pNode, L"PackageId", &scz); | 541 | hr = XmlGetAttributeEx(pNode, L"PackageId", &scz); |
572 | ExitOnFailure(hr, "Failed to get package identifier for WixMbaPrereqInformation."); | 542 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get package identifier for WixMbaPrereqInformation."); |
573 | 543 | ||
574 | hr = BalInfoFindPackageById(pPackages, scz, &pPackage); | 544 | hr = BalInfoFindPackageById(pPackages, scz, &pPackage); |
575 | ExitOnFailure(hr, "Failed to find package specified in WixMbaPrereqInformation: %ls", scz); | 545 | ExitOnFailure(hr, "Failed to find package specified in WixMbaPrereqInformation: %ls", scz); |
@@ -577,16 +547,10 @@ static HRESULT ParseBalPackageInfoFromXml( | |||
577 | pPackage->fPrereqPackage = TRUE; | 547 | pPackage->fPrereqPackage = TRUE; |
578 | 548 | ||
579 | hr = XmlGetAttributeEx(pNode, L"LicenseFile", &pPackage->sczPrereqLicenseFile); | 549 | hr = XmlGetAttributeEx(pNode, L"LicenseFile", &pPackage->sczPrereqLicenseFile); |
580 | if (E_NOTFOUND != hr) | 550 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get LicenseFile setting for prereq package."); |
581 | { | ||
582 | ExitOnFailure(hr, "Failed to get LicenseFile setting for prereq package."); | ||
583 | } | ||
584 | 551 | ||
585 | hr = XmlGetAttributeEx(pNode, L"LicenseUrl", &pPackage->sczPrereqLicenseUrl); | 552 | hr = XmlGetAttributeEx(pNode, L"LicenseUrl", &pPackage->sczPrereqLicenseUrl); |
586 | if (E_NOTFOUND != hr) | 553 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get LicenseUrl setting for prereq package."); |
587 | { | ||
588 | ExitOnFailure(hr, "Failed to get LicenseUrl setting for prereq package."); | ||
589 | } | ||
590 | 554 | ||
591 | ReleaseNullObject(pNode); | 555 | ReleaseNullObject(pNode); |
592 | } | 556 | } |
@@ -619,15 +583,11 @@ static HRESULT ParseOverridableVariablesFromXml( | |||
619 | BAL_INFO_OVERRIDABLE_VARIABLE* pOverridableVariable = NULL; | 583 | BAL_INFO_OVERRIDABLE_VARIABLE* pOverridableVariable = NULL; |
620 | 584 | ||
621 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/CommandLine", &pCommandLineNode); | 585 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/CommandLine", &pCommandLineNode); |
622 | if (S_FALSE == hr) | 586 | ExitOnRequiredXmlQueryFailure(hr, "Failed to select command line information."); |
623 | { | ||
624 | hr = E_NOTFOUND; | ||
625 | } | ||
626 | ExitOnFailure(hr, "Failed to select command line information."); | ||
627 | 587 | ||
628 | // @Variables | 588 | // @Variables |
629 | hr = XmlGetAttributeEx(pCommandLineNode, L"Variables", &scz); | 589 | hr = XmlGetAttributeEx(pCommandLineNode, L"Variables", &scz); |
630 | ExitOnFailure(hr, "Failed to get command line variable type."); | 590 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get command line variable type."); |
631 | 591 | ||
632 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"upperCase", -1)) | 592 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"upperCase", -1)) |
633 | { | 593 | { |
@@ -639,16 +599,11 @@ static HRESULT ParseOverridableVariablesFromXml( | |||
639 | } | 599 | } |
640 | else | 600 | else |
641 | { | 601 | { |
642 | hr = E_INVALIDARG; | 602 | ExitWithRootFailure(hr, E_INVALIDARG, "Invalid value for CommandLine/@Variables: %ls", scz); |
643 | ExitOnFailure(hr, "Invalid value for CommandLine/@Variables: %ls", scz); | ||
644 | } | 603 | } |
645 | 604 | ||
646 | // Get the list of variables users can override on the command line. | 605 | // Get the list of variables users can override on the command line. |
647 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixStdbaOverridableVariable", &pNodes); | 606 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixStdbaOverridableVariable", &pNodes); |
648 | if (S_FALSE == hr) | ||
649 | { | ||
650 | ExitFunction1(hr = S_OK); | ||
651 | } | ||
652 | ExitOnFailure(hr, "Failed to select overridable variable nodes."); | 607 | ExitOnFailure(hr, "Failed to select overridable variable nodes."); |
653 | 608 | ||
654 | hr = pNodes->get_length(reinterpret_cast<long*>(&pOverridableVariables->cVariables)); | 609 | hr = pNodes->get_length(reinterpret_cast<long*>(&pOverridableVariables->cVariables)); |
@@ -671,7 +626,7 @@ static HRESULT ParseOverridableVariablesFromXml( | |||
671 | 626 | ||
672 | // @Name | 627 | // @Name |
673 | hr = XmlGetAttributeEx(pNode, L"Name", &pOverridableVariable->sczName); | 628 | hr = XmlGetAttributeEx(pNode, L"Name", &pOverridableVariable->sczName); |
674 | ExitOnFailure(hr, "Failed to get name for overridable variable."); | 629 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get name for overridable variable."); |
675 | 630 | ||
676 | hr = DictAddValue(pOverridableVariables->sdVariables, pOverridableVariable); | 631 | hr = DictAddValue(pOverridableVariables->sdVariables, pOverridableVariable); |
677 | ExitOnFailure(hr, "Failed to add \"%ls\" to the string dictionary.", pOverridableVariable->sczName); | 632 | ExitOnFailure(hr, "Failed to add \"%ls\" to the string dictionary.", pOverridableVariable->sczName); |
diff --git a/src/api/burn/balutil/inc/balutil.h b/src/api/burn/balutil/inc/balutil.h index 0c47301a..2e370db7 100644 --- a/src/api/burn/balutil/inc/balutil.h +++ b/src/api/burn/balutil/inc/balutil.h | |||
@@ -16,6 +16,8 @@ extern "C" { | |||
16 | #define BalExitOnNullSource(d, p, x, e, f, ...) if (NULL == p) { x = e; BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | 16 | #define BalExitOnNullSource(d, p, x, e, f, ...) if (NULL == p) { x = e; BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } |
17 | #define BalExitOnNullWithLastErrorSource(d, p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | 17 | #define BalExitOnNullWithLastErrorSource(d, p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } |
18 | #define BalExitWithLastErrorSource(d, x, f, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | 18 | #define BalExitWithLastErrorSource(d, x, f, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } |
19 | #define BalExitOnOptionalXmlQueryFailureSource(d, x, b, f, ...) { { if (S_FALSE == x || E_NOTFOUND == x) { b = FALSE; x = S_OK; } else { b = SUCCEEDED(x); } }; BalExitOnRootFailureSource(d, x, f, __VA_ARGS__); } | ||
20 | #define BalExitOnRequiredXmlQueryFailureSource(d, x, f, ...) { if (S_FALSE == x) { x = E_NOTFOUND; } BalExitOnRootFailureSource(d, x, f, __VA_ARGS__); } | ||
19 | 21 | ||
20 | #define BalExitOnFailure(x, f, ...) BalExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | 22 | #define BalExitOnFailure(x, f, ...) BalExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) |
21 | #define BalExitOnRootFailure(x, f, ...) BalExitOnRootFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | 23 | #define BalExitOnRootFailure(x, f, ...) BalExitOnRootFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) |
@@ -24,6 +26,8 @@ extern "C" { | |||
24 | #define BalExitOnNull(p, x, e, f, ...) BalExitOnNullSource(DUTIL_SOURCE_DEFAULT, p, x, e, f, __VA_ARGS__) | 26 | #define BalExitOnNull(p, x, e, f, ...) BalExitOnNullSource(DUTIL_SOURCE_DEFAULT, p, x, e, f, __VA_ARGS__) |
25 | #define BalExitOnNullWithLastError(p, x, f, ...) BalExitOnNullWithLastErrorSource(DUTIL_SOURCE_DEFAULT, p, x, f, __VA_ARGS__) | 27 | #define BalExitOnNullWithLastError(p, x, f, ...) BalExitOnNullWithLastErrorSource(DUTIL_SOURCE_DEFAULT, p, x, f, __VA_ARGS__) |
26 | #define BalExitWithLastError(x, f, ...) BalExitWithLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | 28 | #define BalExitWithLastError(x, f, ...) BalExitWithLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) |
29 | #define BalExitOnOptionalXmlQueryFailure(x, b, f, ...) BalExitOnOptionalXmlQueryFailureSource(DUTIL_SOURCE_DEFAULT, x, b, f, __VA_ARGS__) | ||
30 | #define BalExitOnRequiredXmlQueryFailure(x, f, ...) BalExitOnRequiredXmlQueryFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
27 | 31 | ||
28 | #ifndef FACILITY_WIX | 32 | #ifndef FACILITY_WIX |
29 | #define FACILITY_WIX 500 | 33 | #define FACILITY_WIX 500 |
diff --git a/src/api/burn/bextutil/bextutil.cpp b/src/api/burn/bextutil/bextutil.cpp index 4b22d502..b2e689c3 100644 --- a/src/api/burn/bextutil/bextutil.cpp +++ b/src/api/burn/bextutil/bextutil.cpp | |||
@@ -85,7 +85,7 @@ DAPI_(HRESULT) BextGetBundleExtensionDataNode( | |||
85 | 85 | ||
86 | // @Id | 86 | // @Id |
87 | hr = XmlGetAttributeEx(pixnNode, L"Id", &sczId); | 87 | hr = XmlGetAttributeEx(pixnNode, L"Id", &sczId); |
88 | ExitOnFailure(hr, "Failed to get @Id."); | 88 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Id."); |
89 | 89 | ||
90 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczId, -1, wzExtensionId, -1)) | 90 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczId, -1, wzExtensionId, -1)) |
91 | { | 91 | { |
diff --git a/src/api/burn/bextutil/inc/bextutil.h b/src/api/burn/bextutil/inc/bextutil.h index facaf2e8..e3edff01 100644 --- a/src/api/burn/bextutil/inc/bextutil.h +++ b/src/api/burn/bextutil/inc/bextutil.h | |||
@@ -16,6 +16,8 @@ extern "C" { | |||
16 | #define BextExitOnNullSource(d, p, x, e, f, ...) if (NULL == p) { x = e; BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | 16 | #define BextExitOnNullSource(d, p, x, e, f, ...) if (NULL == p) { x = e; BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } |
17 | #define BextExitOnNullWithLastErrorSource(d, p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | 17 | #define BextExitOnNullWithLastErrorSource(d, p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } |
18 | #define BextExitWithLastErrorSource(d, x, f, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | 18 | #define BextExitWithLastErrorSource(d, x, f, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } |
19 | #define BextExitOnOptionalXmlQueryFailureSource(d, x, b, f, ...) { { if (S_FALSE == x || E_NOTFOUND == x) { b = FALSE; x = S_OK; } else { b = SUCCEEDED(x); } }; BextExitOnRootFailureSource(d, x, f, __VA_ARGS__); } | ||
20 | #define BextExitOnRequiredXmlQueryFailureSource(d, x, f, ...) { if (S_FALSE == x) { x = E_NOTFOUND; } BextExitOnRootFailureSource(d, x, f, __VA_ARGS__); } | ||
19 | 21 | ||
20 | #define BextExitOnFailure(x, f, ...) BextExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | 22 | #define BextExitOnFailure(x, f, ...) BextExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) |
21 | #define BextExitOnRootFailure(x, f, ...) BextExitOnRootFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | 23 | #define BextExitOnRootFailure(x, f, ...) BextExitOnRootFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) |
@@ -24,6 +26,8 @@ extern "C" { | |||
24 | #define BextExitOnNull(p, x, e, f, ...) BextExitOnNullSource(DUTIL_SOURCE_DEFAULT, p, x, e, f, __VA_ARGS__) | 26 | #define BextExitOnNull(p, x, e, f, ...) BextExitOnNullSource(DUTIL_SOURCE_DEFAULT, p, x, e, f, __VA_ARGS__) |
25 | #define BextExitOnNullWithLastError(p, x, f, ...) BextExitOnNullWithLastErrorSource(DUTIL_SOURCE_DEFAULT, p, x, f, __VA_ARGS__) | 27 | #define BextExitOnNullWithLastError(p, x, f, ...) BextExitOnNullWithLastErrorSource(DUTIL_SOURCE_DEFAULT, p, x, f, __VA_ARGS__) |
26 | #define BextExitWithLastError(x, f, ...) BextExitWithLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | 28 | #define BextExitWithLastError(x, f, ...) BextExitWithLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) |
29 | #define BextExitOnOptionalXmlQueryFailure(x, b, f, ...) BextExitOnOptionalXmlQueryFailureSource(DUTIL_SOURCE_DEFAULT, x, b, f, __VA_ARGS__) | ||
30 | #define BextExitOnRequiredXmlQueryFailure(x, f, ...) BextExitOnRequiredXmlQueryFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
27 | 31 | ||
28 | const LPCWSTR BUNDLE_EXTENSION_MANIFEST_FILENAME = L"BundleExtensionData.xml"; | 32 | const LPCWSTR BUNDLE_EXTENSION_MANIFEST_FILENAME = L"BundleExtensionData.xml"; |
29 | 33 | ||
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."); |