diff options
Diffstat (limited to 'src/burn/engine')
-rw-r--r-- | src/burn/engine/core.cpp | 12 | ||||
-rw-r--r-- | src/burn/engine/variable.cpp | 51 | ||||
-rw-r--r-- | src/burn/engine/variable.h | 11 |
3 files changed, 33 insertions, 41 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 93b9c002..c443e0c8 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -2203,18 +2203,10 @@ static HRESULT GetSanitizedCommandLine( | |||
2203 | const wchar_t* pwc = wcschr(argv[i], L'='); | 2203 | const wchar_t* pwc = wcschr(argv[i], L'='); |
2204 | if (pwc) | 2204 | if (pwc) |
2205 | { | 2205 | { |
2206 | if (BURN_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE == pVariables->commandLineType) | 2206 | hr = StrAllocString(&sczVariableName, argv[i], pwc - argv[i]); |
2207 | { | ||
2208 | hr = StrAllocStringToUpperInvariant(&sczVariableName, argv[i], pwc - argv[i]); | ||
2209 | } | ||
2210 | else | ||
2211 | { | ||
2212 | hr = StrAllocString(&sczVariableName, argv[i], pwc - argv[i]); | ||
2213 | } | ||
2214 | ExitOnFailure(hr, "Failed to copy variable name."); | 2207 | ExitOnFailure(hr, "Failed to copy variable name."); |
2215 | 2208 | ||
2216 | hr = VariableIsHidden(pVariables, sczVariableName, &fHidden); | 2209 | fHidden = VariableIsHiddenCommandLine(pVariables, sczVariableName); |
2217 | ExitOnFailure(hr, "Failed to determine whether variable is hidden."); | ||
2218 | 2210 | ||
2219 | if (fHidden) | 2211 | if (fHidden) |
2220 | { | 2212 | { |
diff --git a/src/burn/engine/variable.cpp b/src/burn/engine/variable.cpp index 3947e29e..9b6fecaf 100644 --- a/src/burn/engine/variable.cpp +++ b/src/burn/engine/variable.cpp | |||
@@ -342,7 +342,6 @@ extern "C" HRESULT VariablesParseFromXml( | |||
342 | { | 342 | { |
343 | HRESULT hr = S_OK; | 343 | HRESULT hr = S_OK; |
344 | BOOL fXmlFound = FALSE; | 344 | BOOL fXmlFound = FALSE; |
345 | IXMLDOMNode* pixnCommandLine = NULL; | ||
346 | IXMLDOMNodeList* pixnNodes = NULL; | 345 | IXMLDOMNodeList* pixnNodes = NULL; |
347 | IXMLDOMNode* pixnNode = NULL; | 346 | IXMLDOMNode* pixnNode = NULL; |
348 | DWORD cNodes = 0; | 347 | DWORD cNodes = 0; |
@@ -356,27 +355,6 @@ extern "C" HRESULT VariablesParseFromXml( | |||
356 | 355 | ||
357 | ::EnterCriticalSection(&pVariables->csAccess); | 356 | ::EnterCriticalSection(&pVariables->csAccess); |
358 | 357 | ||
359 | // select command-line node | ||
360 | hr = XmlSelectSingleNode(pixnBundle, L"CommandLine", &pixnCommandLine); | ||
361 | ExitOnRequiredXmlQueryFailure(hr, "Failed to select CommandLine node."); | ||
362 | |||
363 | // @Variables | ||
364 | hr = XmlGetAttributeEx(pixnCommandLine, L"Variables", &scz); | ||
365 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get CommandLine/@Variables."); | ||
366 | |||
367 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"upperCase", -1)) | ||
368 | { | ||
369 | pVariables->commandLineType = BURN_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE; | ||
370 | } | ||
371 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"caseSensitive", -1)) | ||
372 | { | ||
373 | pVariables->commandLineType = BURN_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE; | ||
374 | } | ||
375 | else | ||
376 | { | ||
377 | ExitWithRootFailure(hr, E_INVALIDARG, "Invalid value for CommandLine/@Variables: %ls", scz); | ||
378 | } | ||
379 | |||
380 | // select variable nodes | 358 | // select variable nodes |
381 | hr = XmlSelectNodes(pixnBundle, L"Variable", &pixnNodes); | 359 | hr = XmlSelectNodes(pixnBundle, L"Variable", &pixnNodes); |
382 | ExitOnFailure(hr, "Failed to select variable nodes."); | 360 | ExitOnFailure(hr, "Failed to select variable nodes."); |
@@ -507,7 +485,6 @@ extern "C" HRESULT VariablesParseFromXml( | |||
507 | LExit: | 485 | LExit: |
508 | ::LeaveCriticalSection(&pVariables->csAccess); | 486 | ::LeaveCriticalSection(&pVariables->csAccess); |
509 | 487 | ||
510 | ReleaseObject(pixnCommandLine); | ||
511 | ReleaseObject(pixnNodes); | 488 | ReleaseObject(pixnNodes); |
512 | ReleaseObject(pixnNode); | 489 | ReleaseObject(pixnNode); |
513 | ReleaseStr(scz); | 490 | ReleaseStr(scz); |
@@ -1150,6 +1127,32 @@ LExit: | |||
1150 | return hr; | 1127 | return hr; |
1151 | } | 1128 | } |
1152 | 1129 | ||
1130 | extern "C" BOOL VariableIsHiddenCommandLine( | ||
1131 | __in BURN_VARIABLES* pVariables, | ||
1132 | __in_z LPCWSTR wzVariable | ||
1133 | ) | ||
1134 | { | ||
1135 | BURN_VARIABLE* pVariable = NULL; | ||
1136 | BOOL fHidden = FALSE; | ||
1137 | |||
1138 | ::EnterCriticalSection(&pVariables->csAccess); | ||
1139 | |||
1140 | for (DWORD i = 0; i < pVariables->cVariables; ++i) | ||
1141 | { | ||
1142 | pVariable = pVariables->rgVariables + i; | ||
1143 | |||
1144 | if (pVariable->fHidden && CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, pVariable->sczName, -1, wzVariable, -1)) | ||
1145 | { | ||
1146 | fHidden = TRUE; | ||
1147 | break; | ||
1148 | } | ||
1149 | } | ||
1150 | |||
1151 | ::LeaveCriticalSection(&pVariables->csAccess); | ||
1152 | |||
1153 | return fHidden; | ||
1154 | } | ||
1155 | |||
1153 | 1156 | ||
1154 | // internal function definitions | 1157 | // internal function definitions |
1155 | 1158 | ||
@@ -1587,7 +1590,7 @@ static HRESULT InsertUserVariable( | |||
1587 | 1590 | ||
1588 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, wzVariable, 3, L"Wix", 3)) | 1591 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, wzVariable, 3, L"Wix", 3)) |
1589 | { | 1592 | { |
1590 | ExitWithRootFailure(hr, E_INVALIDARG, "Attempted to insert variable with reserved prefix: %ls", wzVariable); | 1593 | ExitWithRootFailure(hr, E_INVALIDARG, "Attempted to insert variable with reserved prefix: %ls", wzVariable); |
1591 | } | 1594 | } |
1592 | 1595 | ||
1593 | hr = InsertVariable(pVariables, wzVariable, iPosition); | 1596 | hr = InsertVariable(pVariables, wzVariable, iPosition); |
diff --git a/src/burn/engine/variable.h b/src/burn/engine/variable.h index f8d3e1e2..309d7ab9 100644 --- a/src/burn/engine/variable.h +++ b/src/burn/engine/variable.h | |||
@@ -26,12 +26,6 @@ typedef HRESULT (*PFN_INITIALIZEVARIABLE)( | |||
26 | 26 | ||
27 | // constants | 27 | // constants |
28 | 28 | ||
29 | enum BURN_VARIABLE_COMMAND_LINE_TYPE | ||
30 | { | ||
31 | BURN_VARIABLE_COMMAND_LINE_TYPE_UPPER_CASE, | ||
32 | BURN_VARIABLE_COMMAND_LINE_TYPE_CASE_SENSITIVE, | ||
33 | }; | ||
34 | |||
35 | enum BURN_VARIABLE_INTERNAL_TYPE | 29 | enum BURN_VARIABLE_INTERNAL_TYPE |
36 | { | 30 | { |
37 | BURN_VARIABLE_INTERNAL_TYPE_NORMAL, // the BA can set this variable. | 31 | BURN_VARIABLE_INTERNAL_TYPE_NORMAL, // the BA can set this variable. |
@@ -61,7 +55,6 @@ typedef struct _BURN_VARIABLES | |||
61 | DWORD dwMaxVariables; | 55 | DWORD dwMaxVariables; |
62 | DWORD cVariables; | 56 | DWORD cVariables; |
63 | BURN_VARIABLE* rgVariables; | 57 | BURN_VARIABLE* rgVariables; |
64 | BURN_VARIABLE_COMMAND_LINE_TYPE commandLineType; | ||
65 | } BURN_VARIABLES; | 58 | } BURN_VARIABLES; |
66 | 59 | ||
67 | 60 | ||
@@ -187,6 +180,10 @@ HRESULT VariableIsHidden( | |||
187 | __in_z LPCWSTR wzVariable, | 180 | __in_z LPCWSTR wzVariable, |
188 | __out BOOL* pfHidden | 181 | __out BOOL* pfHidden |
189 | ); | 182 | ); |
183 | BOOL VariableIsHiddenCommandLine( | ||
184 | __in BURN_VARIABLES* pVariables, | ||
185 | __in_z LPCWSTR wzVariable | ||
186 | ); | ||
190 | 187 | ||
191 | #if defined(__cplusplus) | 188 | #if defined(__cplusplus) |
192 | } | 189 | } |