diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-06-07 12:13:45 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-06-09 13:47:53 -0500 |
commit | 9f360945ce3703677701b12267a42334bbe7dca1 (patch) | |
tree | 18afcfb2afd29c55dba86a9511f5d283fec3f047 | |
parent | 1d3bd04d4aca82979b08a955dc0bf61eb80f2e66 (diff) | |
download | wix-9f360945ce3703677701b12267a42334bbe7dca1.tar.gz wix-9f360945ce3703677701b12267a42334bbe7dca1.tar.bz2 wix-9f360945ce3703677701b12267a42334bbe7dca1.zip |
Try to log Burn command line even if it was invalid.
-rw-r--r-- | src/burn/engine/core.cpp | 94 | ||||
-rw-r--r-- | src/burn/engine/core.h | 1 | ||||
-rw-r--r-- | src/burn/engine/engine.cpp | 42 | ||||
-rw-r--r-- | src/burn/engine/engine.mc | 7 | ||||
-rw-r--r-- | src/burn/engine/inc/burnsources.h | 1 | ||||
-rw-r--r-- | src/burn/engine/platform.h | 2 |
6 files changed, 111 insertions, 36 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index aab49cb7..478aa692 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -32,7 +32,8 @@ static HRESULT ParseCommandLine( | |||
32 | __out_z LPWSTR* psczActiveParent, | 32 | __out_z LPWSTR* psczActiveParent, |
33 | __out_z LPWSTR* psczIgnoreDependencies, | 33 | __out_z LPWSTR* psczIgnoreDependencies, |
34 | __out_z LPWSTR* psczAncestors, | 34 | __out_z LPWSTR* psczAncestors, |
35 | __out_z LPWSTR* psczSanitizedCommandLine | 35 | __out_z LPWSTR* psczSanitizedCommandLine, |
36 | __inout BOOL* pfInvalidCommandLine | ||
36 | ); | 37 | ); |
37 | static HRESULT ParsePipeConnection( | 38 | static HRESULT ParsePipeConnection( |
38 | __in_ecount(3) LPWSTR* rgArgs, | 39 | __in_ecount(3) LPWSTR* rgArgs, |
@@ -103,11 +104,19 @@ extern "C" HRESULT CoreInitialize( | |||
103 | ExitOnFailure(hr, "Failed to initialize containers."); | 104 | ExitOnFailure(hr, "Failed to initialize containers."); |
104 | 105 | ||
105 | // Parse command line. | 106 | // Parse command line. |
106 | hr = ParseCommandLine(pEngineState->argc, pEngineState->argv, &pEngineState->command, &pEngineState->companionConnection, &pEngineState->embeddedConnection, &pEngineState->variables, &pEngineState->mode, &pEngineState->automaticUpdates, &pEngineState->fDisableSystemRestore, &sczSourceProcessPath, &sczOriginalSource, &pEngineState->fDisableUnelevate, &pEngineState->log.dwAttributes, &pEngineState->log.sczPath, &pEngineState->registration.sczActiveParent, &pEngineState->sczIgnoreDependencies, &pEngineState->registration.sczAncestors, &sczSanitizedCommandLine); | 107 | hr = ParseCommandLine(pEngineState->argc, pEngineState->argv, &pEngineState->command, &pEngineState->companionConnection, &pEngineState->embeddedConnection, &pEngineState->variables, &pEngineState->mode, &pEngineState->automaticUpdates, &pEngineState->fDisableSystemRestore, &sczSourceProcessPath, &sczOriginalSource, &pEngineState->fDisableUnelevate, &pEngineState->log.dwAttributes, &pEngineState->log.sczPath, &pEngineState->registration.sczActiveParent, &pEngineState->sczIgnoreDependencies, &pEngineState->registration.sczAncestors, &sczSanitizedCommandLine, &pEngineState->fInvalidCommandLine); |
107 | ExitOnFailure(hr, "Failed to parse command line."); | 108 | ExitOnFailure(hr, "Fatal error while parsing command line."); |
108 | 109 | ||
109 | LogId(REPORT_STANDARD, MSG_BURN_COMMAND_LINE, sczSanitizedCommandLine ? sczSanitizedCommandLine : L""); | 110 | LogId(REPORT_STANDARD, MSG_BURN_COMMAND_LINE, sczSanitizedCommandLine ? sczSanitizedCommandLine : L""); |
110 | 111 | ||
112 | // The command line wasn't logged immediately so that hidden variables set on the command line can be obscured in the log. | ||
113 | // This delay creates issues when troubleshooting parsing errors because the original command line is not in the log. | ||
114 | // The code does its best to process the entire command line and keep track if the command line was invalid so that it can log the sanitized command line before erroring out. | ||
115 | if (pEngineState->fInvalidCommandLine) | ||
116 | { | ||
117 | LogExitOnRootFailure(hr = E_INVALIDARG, MSG_FAILED_PARSE_COMMAND_LINE, "Failed to parse command line."); | ||
118 | } | ||
119 | |||
111 | hr = CoreInitializeConstants(pEngineState); | 120 | hr = CoreInitializeConstants(pEngineState); |
112 | ExitOnFailure(hr, "Failed to initialize contants."); | 121 | ExitOnFailure(hr, "Failed to initialize contants."); |
113 | 122 | ||
@@ -1188,7 +1197,8 @@ static HRESULT ParseCommandLine( | |||
1188 | __out_z LPWSTR* psczActiveParent, | 1197 | __out_z LPWSTR* psczActiveParent, |
1189 | __out_z LPWSTR* psczIgnoreDependencies, | 1198 | __out_z LPWSTR* psczIgnoreDependencies, |
1190 | __out_z LPWSTR* psczAncestors, | 1199 | __out_z LPWSTR* psczAncestors, |
1191 | __out_z LPWSTR* psczSanitizedCommandLine | 1200 | __out_z LPWSTR* psczSanitizedCommandLine, |
1201 | __inout BOOL* pfInvalidCommandLine | ||
1192 | ) | 1202 | ) |
1193 | { | 1203 | { |
1194 | HRESULT hr = S_OK; | 1204 | HRESULT hr = S_OK; |
@@ -1197,6 +1207,7 @@ static HRESULT ParseCommandLine( | |||
1197 | LPWSTR sczCommandLine = NULL; | 1207 | LPWSTR sczCommandLine = NULL; |
1198 | LPWSTR sczSanitizedArgument = NULL; | 1208 | LPWSTR sczSanitizedArgument = NULL; |
1199 | LPWSTR sczVariableName = NULL; | 1209 | LPWSTR sczVariableName = NULL; |
1210 | BOOL fInvalidCommandLine = FALSE; | ||
1200 | 1211 | ||
1201 | for (int i = 0; i < argc; ++i) | 1212 | for (int i = 0; i < argc; ++i) |
1202 | { | 1213 | { |
@@ -1219,6 +1230,7 @@ static HRESULT ParseCommandLine( | |||
1219 | 1230 | ||
1220 | if (i + 1 >= argc) | 1231 | if (i + 1 >= argc) |
1221 | { | 1232 | { |
1233 | fInvalidCommandLine = TRUE; | ||
1222 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify a path for log."); | 1234 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify a path for log."); |
1223 | } | 1235 | } |
1224 | 1236 | ||
@@ -1331,6 +1343,7 @@ static HRESULT ParseCommandLine( | |||
1331 | { | 1343 | { |
1332 | if (i + 1 >= argc) | 1344 | if (i + 1 >= argc) |
1333 | { | 1345 | { |
1346 | fInvalidCommandLine = TRUE; | ||
1334 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify a path for original source."); | 1347 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify a path for original source."); |
1335 | } | 1348 | } |
1336 | 1349 | ||
@@ -1342,6 +1355,7 @@ static HRESULT ParseCommandLine( | |||
1342 | { | 1355 | { |
1343 | if (i + 1 >= argc) | 1356 | if (i + 1 >= argc) |
1344 | { | 1357 | { |
1358 | fInvalidCommandLine = TRUE; | ||
1345 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify a value for parent."); | 1359 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify a value for parent."); |
1346 | } | 1360 | } |
1347 | 1361 | ||
@@ -1359,6 +1373,7 @@ static HRESULT ParseCommandLine( | |||
1359 | { | 1373 | { |
1360 | if (i + 1 >= argc) | 1374 | if (i + 1 >= argc) |
1361 | { | 1375 | { |
1376 | fInvalidCommandLine = TRUE; | ||
1362 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify a path for append log."); | 1377 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify a path for append log."); |
1363 | } | 1378 | } |
1364 | 1379 | ||
@@ -1373,12 +1388,14 @@ static HRESULT ParseCommandLine( | |||
1373 | { | 1388 | { |
1374 | if (i + 3 >= argc) | 1389 | if (i + 3 >= argc) |
1375 | { | 1390 | { |
1391 | fInvalidCommandLine = TRUE; | ||
1376 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify the elevated name, token and parent process id."); | 1392 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify the elevated name, token and parent process id."); |
1377 | } | 1393 | } |
1378 | 1394 | ||
1379 | if (BURN_MODE_UNTRUSTED != *pMode) | 1395 | if (BURN_MODE_UNTRUSTED != *pMode) |
1380 | { | 1396 | { |
1381 | ExitOnRootFailure(hr = E_INVALIDARG, "Multiple mode command-line switches were provided."); | 1397 | fInvalidCommandLine = TRUE; |
1398 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); | ||
1382 | } | 1399 | } |
1383 | 1400 | ||
1384 | *pMode = BURN_MODE_ELEVATED; | 1401 | *pMode = BURN_MODE_ELEVATED; |
@@ -1386,7 +1403,12 @@ static HRESULT ParseCommandLine( | |||
1386 | ++i; | 1403 | ++i; |
1387 | 1404 | ||
1388 | hr = ParsePipeConnection(argv + i, pCompanionConnection); | 1405 | hr = ParsePipeConnection(argv + i, pCompanionConnection); |
1389 | ExitOnFailure(hr, "Failed to parse elevated connection."); | 1406 | if (FAILED(hr)) |
1407 | { | ||
1408 | fInvalidCommandLine = TRUE; | ||
1409 | TraceLog(hr, "Failed to parse elevated connection."); | ||
1410 | hr = S_OK; | ||
1411 | } | ||
1390 | 1412 | ||
1391 | i += 2; | 1413 | i += 2; |
1392 | } | 1414 | } |
@@ -1396,23 +1418,28 @@ static HRESULT ParseCommandLine( | |||
1396 | LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM)]; | 1418 | LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM)]; |
1397 | if (L'=' != wzParam[0] || L'\0' == wzParam[1]) | 1419 | if (L'=' != wzParam[0] || L'\0' == wzParam[1]) |
1398 | { | 1420 | { |
1399 | ExitOnRootFailure(hr = E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); | 1421 | fInvalidCommandLine = TRUE; |
1422 | TraceLog(E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); | ||
1423 | } | ||
1424 | else | ||
1425 | { | ||
1426 | *pMode = BURN_MODE_NORMAL; | ||
1427 | |||
1428 | hr = StrAllocString(psczSourceProcessPath, wzParam + 1, 0); | ||
1429 | ExitOnFailure(hr, "Failed to copy source process path."); | ||
1400 | } | 1430 | } |
1401 | 1431 | ||
1402 | if (BURN_MODE_UNTRUSTED != *pMode) | 1432 | if (BURN_MODE_UNTRUSTED != *pMode) |
1403 | { | 1433 | { |
1404 | ExitOnRootFailure(hr = E_INVALIDARG, "Multiple mode command-line switches were provided."); | 1434 | fInvalidCommandLine = TRUE; |
1435 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); | ||
1405 | } | 1436 | } |
1406 | |||
1407 | *pMode = BURN_MODE_NORMAL; | ||
1408 | |||
1409 | hr = StrAllocString(psczSourceProcessPath, wzParam + 1, 0); | ||
1410 | ExitOnFailure(hr, "Failed to copy source process path."); | ||
1411 | } | 1437 | } |
1412 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, BURN_COMMANDLINE_SWITCH_EMBEDDED, -1)) | 1438 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, BURN_COMMANDLINE_SWITCH_EMBEDDED, -1)) |
1413 | { | 1439 | { |
1414 | if (i + 3 >= argc) | 1440 | if (i + 3 >= argc) |
1415 | { | 1441 | { |
1442 | fInvalidCommandLine = TRUE; | ||
1416 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify the embedded name, token and parent process id."); | 1443 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify the embedded name, token and parent process id."); |
1417 | } | 1444 | } |
1418 | 1445 | ||
@@ -1428,13 +1455,19 @@ static HRESULT ParseCommandLine( | |||
1428 | *pMode = BURN_MODE_EMBEDDED; | 1455 | *pMode = BURN_MODE_EMBEDDED; |
1429 | break; | 1456 | break; |
1430 | default: | 1457 | default: |
1458 | fInvalidCommandLine = TRUE; | ||
1431 | ExitOnRootFailure(hr = E_INVALIDARG, "Multiple mode command-line switches were provided."); | 1459 | ExitOnRootFailure(hr = E_INVALIDARG, "Multiple mode command-line switches were provided."); |
1432 | } | 1460 | } |
1433 | 1461 | ||
1434 | ++i; | 1462 | ++i; |
1435 | 1463 | ||
1436 | hr = ParsePipeConnection(argv + i, pEmbeddedConnection); | 1464 | hr = ParsePipeConnection(argv + i, pEmbeddedConnection); |
1437 | ExitOnFailure(hr, "Failed to parse embedded connection."); | 1465 | if (FAILED(hr)) |
1466 | { | ||
1467 | fInvalidCommandLine = TRUE; | ||
1468 | TraceLog(hr, "Failed to parse embedded connection."); | ||
1469 | hr = S_OK; | ||
1470 | } | ||
1438 | 1471 | ||
1439 | i += 2; | 1472 | i += 2; |
1440 | } | 1473 | } |
@@ -1480,7 +1513,8 @@ static HRESULT ParseCommandLine( | |||
1480 | { | 1513 | { |
1481 | if (BURN_MODE_UNTRUSTED != *pMode) | 1514 | if (BURN_MODE_UNTRUSTED != *pMode) |
1482 | { | 1515 | { |
1483 | ExitOnRootFailure(hr = E_INVALIDARG, "Multiple mode command-line switches were provided."); | 1516 | fInvalidCommandLine = TRUE; |
1517 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); | ||
1484 | } | 1518 | } |
1485 | 1519 | ||
1486 | *pMode = BURN_MODE_RUNONCE; | 1520 | *pMode = BURN_MODE_RUNONCE; |
@@ -1491,11 +1525,14 @@ static HRESULT ParseCommandLine( | |||
1491 | LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES)]; | 1525 | LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES)]; |
1492 | if (L'=' != wzParam[0] || L'\0' == wzParam[1]) | 1526 | if (L'=' != wzParam[0] || L'\0' == wzParam[1]) |
1493 | { | 1527 | { |
1494 | ExitOnRootFailure(hr = E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES); | 1528 | fInvalidCommandLine = TRUE; |
1529 | TraceLog(E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES); | ||
1530 | } | ||
1531 | else | ||
1532 | { | ||
1533 | hr = StrAllocString(psczIgnoreDependencies, &wzParam[1], 0); | ||
1534 | ExitOnFailure(hr, "Failed to allocate the list of dependencies to ignore."); | ||
1495 | } | 1535 | } |
1496 | |||
1497 | hr = StrAllocString(psczIgnoreDependencies, &wzParam[1], 0); | ||
1498 | ExitOnFailure(hr, "Failed to allocate the list of dependencies to ignore."); | ||
1499 | } | 1536 | } |
1500 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_ANCESTORS), BURN_COMMANDLINE_SWITCH_ANCESTORS, lstrlenW(BURN_COMMANDLINE_SWITCH_ANCESTORS))) | 1537 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_ANCESTORS), BURN_COMMANDLINE_SWITCH_ANCESTORS, lstrlenW(BURN_COMMANDLINE_SWITCH_ANCESTORS))) |
1501 | { | 1538 | { |
@@ -1503,11 +1540,14 @@ static HRESULT ParseCommandLine( | |||
1503 | LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_ANCESTORS)]; | 1540 | LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_ANCESTORS)]; |
1504 | if (L'=' != wzParam[0] || L'\0' == wzParam[1]) | 1541 | if (L'=' != wzParam[0] || L'\0' == wzParam[1]) |
1505 | { | 1542 | { |
1506 | ExitOnRootFailure(hr = E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_ANCESTORS); | 1543 | fInvalidCommandLine = TRUE; |
1544 | TraceLog(hr = E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_ANCESTORS); | ||
1545 | } | ||
1546 | else | ||
1547 | { | ||
1548 | hr = StrAllocString(psczAncestors, &wzParam[1], 0); | ||
1549 | ExitOnFailure(hr, "Failed to allocate the list of ancestors."); | ||
1507 | } | 1550 | } |
1508 | |||
1509 | hr = StrAllocString(psczAncestors, &wzParam[1], 0); | ||
1510 | ExitOnFailure(hr, "Failed to allocate the list of ancestors."); | ||
1511 | } | 1551 | } |
1512 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED), BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED, lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED))) | 1552 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED), BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED, lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED))) |
1513 | { | 1553 | { |
@@ -1591,6 +1631,12 @@ static HRESULT ParseCommandLine( | |||
1591 | } | 1631 | } |
1592 | 1632 | ||
1593 | LExit: | 1633 | LExit: |
1634 | if (fInvalidCommandLine) | ||
1635 | { | ||
1636 | hr = S_OK; | ||
1637 | *pfInvalidCommandLine = TRUE; | ||
1638 | } | ||
1639 | |||
1594 | ReleaseStr(sczVariableName); | 1640 | ReleaseStr(sczVariableName); |
1595 | ReleaseStr(sczSanitizedArgument); | 1641 | ReleaseStr(sczSanitizedArgument); |
1596 | ReleaseStr(sczCommandLine); | 1642 | ReleaseStr(sczCommandLine); |
diff --git a/src/burn/engine/core.h b/src/burn/engine/core.h index 3a28188b..7e9d99bb 100644 --- a/src/burn/engine/core.h +++ b/src/burn/engine/core.h | |||
@@ -133,6 +133,7 @@ typedef struct _BURN_ENGINE_STATE | |||
133 | 133 | ||
134 | int argc; | 134 | int argc; |
135 | LPWSTR* argv; | 135 | LPWSTR* argv; |
136 | BOOL fInvalidCommandLine; | ||
136 | } BURN_ENGINE_STATE; | 137 | } BURN_ENGINE_STATE; |
137 | 138 | ||
138 | typedef struct _BURN_APPLY_CONTEXT | 139 | typedef struct _BURN_APPLY_CONTEXT |
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp index 8f024e98..f9dd2184 100644 --- a/src/burn/engine/engine.cpp +++ b/src/burn/engine/engine.cpp | |||
@@ -341,26 +341,44 @@ static HRESULT InitializeEngineState( | |||
341 | wzParam = &pEngineState->argv[i][2 + lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED)]; | 341 | wzParam = &pEngineState->argv[i][2 + lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED)]; |
342 | if (L'=' != wzParam[-1] || L'\0' == wzParam[0]) | 342 | if (L'=' != wzParam[-1] || L'\0' == wzParam[0]) |
343 | { | 343 | { |
344 | ExitOnRootFailure(hr = E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED); | 344 | pEngineState->fInvalidCommandLine = TRUE; |
345 | TraceLog(E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED); | ||
346 | } | ||
347 | else | ||
348 | { | ||
349 | hr = StrStringToUInt64(wzParam, 0, &qw); | ||
350 | if (FAILED(hr)) | ||
351 | { | ||
352 | TraceLog(hr, "Failed to parse file handle: '%ls'", wzParam); | ||
353 | hr = S_OK; | ||
354 | } | ||
355 | else | ||
356 | { | ||
357 | hSourceEngineFile = (HANDLE)qw; | ||
358 | } | ||
345 | } | 359 | } |
346 | |||
347 | hr = StrStringToUInt64(wzParam, 0, &qw); | ||
348 | ExitOnFailure(hr, "Failed to parse file handle: '%ls'", (wzParam)); | ||
349 | |||
350 | hSourceEngineFile = (HANDLE)qw; | ||
351 | } | 360 | } |
352 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &pEngineState->argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF), BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF, lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF))) | 361 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &pEngineState->argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF), BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF, lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF))) |
353 | { | 362 | { |
354 | wzParam = &pEngineState->argv[i][2 + lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF)]; | 363 | wzParam = &pEngineState->argv[i][2 + lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF)]; |
355 | if (L'=' != wzParam[-1] || L'\0' == wzParam[0]) | 364 | if (L'=' != wzParam[-1] || L'\0' == wzParam[0]) |
356 | { | 365 | { |
357 | ExitOnRootFailure(hr = E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF); | 366 | pEngineState->fInvalidCommandLine = TRUE; |
367 | TraceLog(E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF); | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | hr = StrStringToUInt64(wzParam, 0, &qw); | ||
372 | if (FAILED(hr)) | ||
373 | { | ||
374 | TraceLog(hr, "Failed to parse file handle: '%ls'", wzParam); | ||
375 | hr = S_OK; | ||
376 | } | ||
377 | else | ||
378 | { | ||
379 | hSectionFile = (HANDLE)qw; | ||
380 | } | ||
358 | } | 381 | } |
359 | |||
360 | hr = StrStringToUInt64(wzParam, 0, &qw); | ||
361 | ExitOnFailure(hr, "Failed to parse file handle: '%ls'", (wzParam)); | ||
362 | |||
363 | hSectionFile = (HANDLE)qw; | ||
364 | } | 382 | } |
365 | } | 383 | } |
366 | } | 384 | } |
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc index ad9d676f..77590223 100644 --- a/src/burn/engine/engine.mc +++ b/src/burn/engine/engine.mc | |||
@@ -128,6 +128,13 @@ Language=English | |||
128 | Bootstrapper application opted out of any engine behavior to automatically uninstall the bundle during shutdown. | 128 | Bootstrapper application opted out of any engine behavior to automatically uninstall the bundle during shutdown. |
129 | . | 129 | . |
130 | 130 | ||
131 | MessageId=15 | ||
132 | Severity=Error | ||
133 | SymbolicName=MSG_FAILED_PARSE_COMMAND_LINE | ||
134 | Language=English | ||
135 | Failed to parse command line. | ||
136 | . | ||
137 | |||
131 | MessageId=51 | 138 | MessageId=51 |
132 | Severity=Error | 139 | Severity=Error |
133 | SymbolicName=MSG_FAILED_PARSE_CONDITION | 140 | SymbolicName=MSG_FAILED_PARSE_CONDITION |
diff --git a/src/burn/engine/inc/burnsources.h b/src/burn/engine/inc/burnsources.h index bff79ed5..482dc81e 100644 --- a/src/burn/engine/inc/burnsources.h +++ b/src/burn/engine/inc/burnsources.h | |||
@@ -2,3 +2,4 @@ | |||
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
3 | 3 | ||
4 | #define DUTIL_SOURCE_DEFAULT DUTIL_SOURCE_EXTERNAL | 4 | #define DUTIL_SOURCE_DEFAULT DUTIL_SOURCE_EXTERNAL |
5 | #define BURN_SOURCE_DEFAULT DUTIL_SOURCE_DEFAULT | ||
diff --git a/src/burn/engine/platform.h b/src/burn/engine/platform.h index 3681f248..876b02c2 100644 --- a/src/burn/engine/platform.h +++ b/src/burn/engine/platform.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
3 | 3 | ||
4 | #define TraceLog(x, s, ...) ExitTraceSource(BURN_SOURCE_DEFAULT, x, s, __VA_ARGS__) | ||
5 | |||
4 | 6 | ||
5 | #if defined(__cplusplus) | 7 | #if defined(__cplusplus) |
6 | extern "C" { | 8 | extern "C" { |