diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-07-01 09:30:10 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-07-02 12:50:09 -0500 |
| commit | 9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2 (patch) | |
| tree | ea2a05de5a8a1dfcb2af8e9e3805fe015729f66a /src/burn/engine | |
| parent | 8cbfc326cccf8d9b3b63cb6f752fc770f7dee0fc (diff) | |
| download | wix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.tar.gz wix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.tar.bz2 wix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.zip | |
Add bundle option for command line variables to always be uppercase.
Fixes #3777
Diffstat (limited to 'src/burn/engine')
| -rw-r--r-- | src/burn/engine/core.cpp | 9 | ||||
| -rw-r--r-- | src/burn/engine/variable.cpp | 28 | ||||
| -rw-r--r-- | src/burn/engine/variable.h | 7 |
3 files changed, 43 insertions, 1 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index ca613dc5..8b97952c 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
| @@ -1699,7 +1699,14 @@ static HRESULT GetSanitizedCommandLine( | |||
| 1699 | const wchar_t* pwc = wcschr(argv[i], L'='); | 1699 | const wchar_t* pwc = wcschr(argv[i], L'='); |
| 1700 | if (pwc) | 1700 | if (pwc) |
| 1701 | { | 1701 | { |
| 1702 | hr = StrAllocString(&sczVariableName, argv[i], pwc - argv[i]); | 1702 | if (BURN_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE == pVariables->commandLineType) |
| 1703 | { | ||
| 1704 | hr = StrAllocStringToUpperInvariant(&sczVariableName, argv[i], pwc - argv[i]); | ||
| 1705 | } | ||
| 1706 | else | ||
| 1707 | { | ||
| 1708 | hr = StrAllocString(&sczVariableName, argv[i], pwc - argv[i]); | ||
| 1709 | } | ||
| 1703 | ExitOnFailure(hr, "Failed to copy variable name."); | 1710 | ExitOnFailure(hr, "Failed to copy variable name."); |
| 1704 | 1711 | ||
| 1705 | hr = VariableIsHidden(pVariables, sczVariableName, &fHidden); | 1712 | hr = VariableIsHidden(pVariables, sczVariableName, &fHidden); |
diff --git a/src/burn/engine/variable.cpp b/src/burn/engine/variable.cpp index 6f818ff3..e2b1f1f2 100644 --- a/src/burn/engine/variable.cpp +++ b/src/burn/engine/variable.cpp | |||
| @@ -294,6 +294,7 @@ extern "C" HRESULT VariablesParseFromXml( | |||
| 294 | ) | 294 | ) |
| 295 | { | 295 | { |
| 296 | HRESULT hr = S_OK; | 296 | HRESULT hr = S_OK; |
| 297 | IXMLDOMNode* pixnCommandLine = NULL; | ||
| 297 | IXMLDOMNodeList* pixnNodes = NULL; | 298 | IXMLDOMNodeList* pixnNodes = NULL; |
| 298 | IXMLDOMNode* pixnNode = NULL; | 299 | IXMLDOMNode* pixnNode = NULL; |
| 299 | DWORD cNodes = 0; | 300 | DWORD cNodes = 0; |
| @@ -307,6 +308,32 @@ extern "C" HRESULT VariablesParseFromXml( | |||
| 307 | 308 | ||
| 308 | ::EnterCriticalSection(&pVariables->csAccess); | 309 | ::EnterCriticalSection(&pVariables->csAccess); |
| 309 | 310 | ||
| 311 | // select registration node | ||
| 312 | hr = XmlSelectSingleNode(pixnBundle, L"CommandLine", &pixnCommandLine); | ||
| 313 | if (S_FALSE == hr) | ||
| 314 | { | ||
| 315 | hr = E_NOTFOUND; | ||
| 316 | } | ||
| 317 | ExitOnFailure(hr, "Failed to select CommandLine node."); | ||
| 318 | |||
| 319 | // @Variables | ||
| 320 | hr = XmlGetAttributeEx(pixnCommandLine, L"Variables", &scz); | ||
| 321 | ExitOnFailure(hr, "Failed to get CommandLine/@Variables."); | ||
| 322 | |||
| 323 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"upperCase", -1)) | ||
| 324 | { | ||
| 325 | pVariables->commandLineType = BURN_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE; | ||
| 326 | } | ||
| 327 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"caseSensitive", -1)) | ||
| 328 | { | ||
| 329 | pVariables->commandLineType = BURN_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE; | ||
| 330 | } | ||
| 331 | else | ||
| 332 | { | ||
| 333 | hr = E_INVALIDARG; | ||
| 334 | ExitOnFailure(hr, "Invalid value for CommandLine/@Variables: %ls", scz); | ||
| 335 | } | ||
| 336 | |||
| 310 | // select variable nodes | 337 | // select variable nodes |
| 311 | hr = XmlSelectNodes(pixnBundle, L"Variable", &pixnNodes); | 338 | hr = XmlSelectNodes(pixnBundle, L"Variable", &pixnNodes); |
| 312 | ExitOnFailure(hr, "Failed to select variable nodes."); | 339 | ExitOnFailure(hr, "Failed to select variable nodes."); |
| @@ -434,6 +461,7 @@ extern "C" HRESULT VariablesParseFromXml( | |||
| 434 | LExit: | 461 | LExit: |
| 435 | ::LeaveCriticalSection(&pVariables->csAccess); | 462 | ::LeaveCriticalSection(&pVariables->csAccess); |
| 436 | 463 | ||
| 464 | ReleaseObject(pixnCommandLine); | ||
| 437 | ReleaseObject(pixnNodes); | 465 | ReleaseObject(pixnNodes); |
| 438 | ReleaseObject(pixnNode); | 466 | ReleaseObject(pixnNode); |
| 439 | ReleaseStr(scz); | 467 | ReleaseStr(scz); |
diff --git a/src/burn/engine/variable.h b/src/burn/engine/variable.h index a38c9daa..9ed86ca7 100644 --- a/src/burn/engine/variable.h +++ b/src/burn/engine/variable.h | |||
| @@ -25,6 +25,12 @@ typedef HRESULT (*PFN_INITIALIZEVARIABLE)( | |||
| 25 | 25 | ||
| 26 | // constants | 26 | // constants |
| 27 | 27 | ||
| 28 | enum BURN_VARIABLE_COMMAND_LINE_TYPE | ||
| 29 | { | ||
| 30 | BURN_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE, | ||
| 31 | BURN_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE, | ||
| 32 | }; | ||
| 33 | |||
| 28 | enum BURN_VARIABLE_INTERNAL_TYPE | 34 | enum BURN_VARIABLE_INTERNAL_TYPE |
| 29 | { | 35 | { |
| 30 | BURN_VARIABLE_INTERNAL_TYPE_NORMAL, // the BA can set this variable. | 36 | BURN_VARIABLE_INTERNAL_TYPE_NORMAL, // the BA can set this variable. |
| @@ -54,6 +60,7 @@ typedef struct _BURN_VARIABLES | |||
| 54 | DWORD dwMaxVariables; | 60 | DWORD dwMaxVariables; |
| 55 | DWORD cVariables; | 61 | DWORD cVariables; |
| 56 | BURN_VARIABLE* rgVariables; | 62 | BURN_VARIABLE* rgVariables; |
| 63 | BURN_VARIABLE_COMMAND_LINE_TYPE commandLineType; | ||
| 57 | } BURN_VARIABLES; | 64 | } BURN_VARIABLES; |
| 58 | 65 | ||
| 59 | 66 | ||
