aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/variable.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-09-09 16:03:29 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-09-09 21:14:27 -0500
commita1307cd4e76a89598c53cb68309358a7012db553 (patch)
treef79cf181b49f0b754afcd4ec25487bf2b284d45e /src/burn/engine/variable.cpp
parentf61479585d865372645cb18c982aa708dd975da3 (diff)
downloadwix-a1307cd4e76a89598c53cb68309358a7012db553.tar.gz
wix-a1307cd4e76a89598c53cb68309358a7012db553.tar.bz2
wix-a1307cd4e76a89598c53cb68309358a7012db553.zip
Move `Bundle/@CommandLineVariables` into Bal.wixext.
Implements 6858
Diffstat (limited to 'src/burn/engine/variable.cpp')
-rw-r--r--src/burn/engine/variable.cpp51
1 files changed, 27 insertions, 24 deletions
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(
507LExit: 485LExit:
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
1130extern "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);