diff options
Diffstat (limited to 'src/api/burn/balutil')
-rw-r--r-- | src/api/burn/balutil/balinfo.cpp | 47 | ||||
-rw-r--r-- | src/api/burn/balutil/inc/balinfo.h | 2 |
2 files changed, 24 insertions, 25 deletions
diff --git a/src/api/burn/balutil/balinfo.cpp b/src/api/burn/balutil/balinfo.cpp index 52a7f911..751ba4f1 100644 --- a/src/api/burn/balutil/balinfo.cpp +++ b/src/api/burn/balutil/balinfo.cpp | |||
@@ -348,7 +348,6 @@ DAPI_(HRESULT) BalSetOverridableVariablesFromEngine( | |||
348 | ) | 348 | ) |
349 | { | 349 | { |
350 | HRESULT hr = S_OK; | 350 | HRESULT hr = S_OK; |
351 | LPWSTR sczKey = NULL; | ||
352 | BAL_INFO_OVERRIDABLE_VARIABLE* pOverridableVariable = NULL; | 351 | BAL_INFO_OVERRIDABLE_VARIABLE* pOverridableVariable = NULL; |
353 | 352 | ||
354 | for (DWORD i = 0; i < pCommand->cVariables; ++i) | 353 | for (DWORD i = 0; i < pCommand->cVariables; ++i) |
@@ -356,14 +355,6 @@ DAPI_(HRESULT) BalSetOverridableVariablesFromEngine( | |||
356 | LPCWSTR wzVariableName = pCommand->rgVariableNames[i]; | 355 | LPCWSTR wzVariableName = pCommand->rgVariableNames[i]; |
357 | LPCWSTR wzVariableValue = pCommand->rgVariableValues[i]; | 356 | LPCWSTR wzVariableValue = pCommand->rgVariableValues[i]; |
358 | 357 | ||
359 | if (BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE == pOverridableVariables->commandLineType) | ||
360 | { | ||
361 | hr = StrAllocStringToUpperInvariant(&sczKey, wzVariableName, 0); | ||
362 | ExitOnFailure(hr, "Failed to upper case variable name."); | ||
363 | |||
364 | wzVariableName = sczKey; | ||
365 | } | ||
366 | |||
367 | hr = DictGetValue(pOverridableVariables->sdVariables, wzVariableName, reinterpret_cast<void**>(&pOverridableVariable)); | 358 | hr = DictGetValue(pOverridableVariables->sdVariables, wzVariableName, reinterpret_cast<void**>(&pOverridableVariable)); |
368 | if (E_NOTFOUND == hr) | 359 | if (E_NOTFOUND == hr) |
369 | { | 360 | { |
@@ -378,8 +369,6 @@ DAPI_(HRESULT) BalSetOverridableVariablesFromEngine( | |||
378 | } | 369 | } |
379 | 370 | ||
380 | LExit: | 371 | LExit: |
381 | ReleaseStr(sczKey); | ||
382 | |||
383 | return hr; | 372 | return hr; |
384 | } | 373 | } |
385 | 374 | ||
@@ -604,29 +593,37 @@ static HRESULT ParseOverridableVariablesFromXml( | |||
604 | { | 593 | { |
605 | HRESULT hr = S_OK; | 594 | HRESULT hr = S_OK; |
606 | IXMLDOMNode* pCommandLineNode = NULL; | 595 | IXMLDOMNode* pCommandLineNode = NULL; |
596 | BOOL fXmlFound = FALSE; | ||
607 | LPWSTR scz = NULL; | 597 | LPWSTR scz = NULL; |
608 | IXMLDOMNode* pNode = NULL; | 598 | IXMLDOMNode* pNode = NULL; |
609 | IXMLDOMNodeList* pNodes = NULL; | 599 | IXMLDOMNodeList* pNodes = NULL; |
610 | BAL_INFO_OVERRIDABLE_VARIABLE* pOverridableVariable = NULL; | 600 | BAL_INFO_OVERRIDABLE_VARIABLE* pOverridableVariable = NULL; |
611 | 601 | ||
612 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/CommandLine", &pCommandLineNode); | 602 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaCommandLine", &pCommandLineNode); |
613 | ExitOnRequiredXmlQueryFailure(hr, "Failed to select command line information."); | 603 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to select command line information."); |
614 | |||
615 | // @Variables | ||
616 | hr = XmlGetAttributeEx(pCommandLineNode, L"Variables", &scz); | ||
617 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get command line variable type."); | ||
618 | 604 | ||
619 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"upperCase", -1)) | 605 | if (!fXmlFound) |
620 | { | ||
621 | pOverridableVariables->commandLineType = BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE; | ||
622 | } | ||
623 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"caseSensitive", -1)) | ||
624 | { | 606 | { |
625 | pOverridableVariables->commandLineType = BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE; | 607 | pOverridableVariables->commandLineType = BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE; |
626 | } | 608 | } |
627 | else | 609 | else |
628 | { | 610 | { |
629 | ExitWithRootFailure(hr, E_INVALIDARG, "Invalid value for CommandLine/@Variables: %ls", scz); | 611 | // @Variables |
612 | hr = XmlGetAttributeEx(pCommandLineNode, L"VariableType", &scz); | ||
613 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get command line variable type."); | ||
614 | |||
615 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"caseInsensitive", -1)) | ||
616 | { | ||
617 | pOverridableVariables->commandLineType = BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_CASE_INSENSITIVE; | ||
618 | } | ||
619 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"caseSensitive", -1)) | ||
620 | { | ||
621 | pOverridableVariables->commandLineType = BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE; | ||
622 | } | ||
623 | else | ||
624 | { | ||
625 | ExitWithRootFailure(hr, E_INVALIDARG, "Invalid value for CommandLine/@Variables: %ls", scz); | ||
626 | } | ||
630 | } | 627 | } |
631 | 628 | ||
632 | // Get the list of variables users can override on the command line. | 629 | // Get the list of variables users can override on the command line. |
@@ -638,7 +635,9 @@ static HRESULT ParseOverridableVariablesFromXml( | |||
638 | 635 | ||
639 | if (pOverridableVariables->cVariables) | 636 | if (pOverridableVariables->cVariables) |
640 | { | 637 | { |
641 | hr = DictCreateWithEmbeddedKey(&pOverridableVariables->sdVariables, pOverridableVariables->cVariables, reinterpret_cast<void**>(&pOverridableVariables->rgVariables), offsetof(BAL_INFO_OVERRIDABLE_VARIABLE, sczName), DICT_FLAG_NONE); | 638 | DICT_FLAG dfFlags = BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_CASE_INSENSITIVE == pOverridableVariables->commandLineType ? DICT_FLAG_CASEINSENSITIVE : DICT_FLAG_NONE; |
639 | |||
640 | hr = DictCreateWithEmbeddedKey(&pOverridableVariables->sdVariables, pOverridableVariables->cVariables, reinterpret_cast<void**>(&pOverridableVariables->rgVariables), offsetof(BAL_INFO_OVERRIDABLE_VARIABLE, sczName), dfFlags); | ||
642 | ExitOnFailure(hr, "Failed to create the overridable variables string dictionary."); | 641 | ExitOnFailure(hr, "Failed to create the overridable variables string dictionary."); |
643 | 642 | ||
644 | hr = MemAllocArray(reinterpret_cast<LPVOID*>(&pOverridableVariables->rgVariables), sizeof(pOverridableVariable), pOverridableVariables->cVariables); | 643 | hr = MemAllocArray(reinterpret_cast<LPVOID*>(&pOverridableVariables->rgVariables), sizeof(pOverridableVariable), pOverridableVariables->cVariables); |
diff --git a/src/api/burn/balutil/inc/balinfo.h b/src/api/burn/balutil/inc/balinfo.h index 818ff5ef..3ef3a61a 100644 --- a/src/api/burn/balutil/inc/balinfo.h +++ b/src/api/burn/balutil/inc/balinfo.h | |||
@@ -40,8 +40,8 @@ typedef enum _BAL_INFO_RESTART | |||
40 | 40 | ||
41 | typedef enum _BAL_INFO_VARIABLE_COMMAND_LINE_TYPE | 41 | typedef enum _BAL_INFO_VARIABLE_COMMAND_LINE_TYPE |
42 | { | 42 | { |
43 | BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE, | ||
44 | BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE, | 43 | BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE, |
44 | BAL_INFO_VARIABLE_COMMAND_LINE_TYPE_CASE_INSENSITIVE, | ||
45 | } BAL_INFO_VARIABLE_COMMAND_LINE_TYPE; | 45 | } BAL_INFO_VARIABLE_COMMAND_LINE_TYPE; |
46 | 46 | ||
47 | 47 | ||