diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-08-03 15:43:06 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-08-04 10:03:57 -0500 |
commit | 25ae58ec05bec0b97038e98eec9582209c1f9583 (patch) | |
tree | eb85e74e23980608774d8d8e18bd6767d4c91d0d | |
parent | c50e82c27b7f33b9024a04ec7ad7d4301bc7f7ca (diff) | |
download | wix-25ae58ec05bec0b97038e98eec9582209c1f9583.tar.gz wix-25ae58ec05bec0b97038e98eec9582209c1f9583.tar.bz2 wix-25ae58ec05bec0b97038e98eec9582209c1f9583.zip |
Require clean room switch to be first argument and catch embedded switch specified with other modes in the clean room process.
-rw-r--r-- | src/burn/engine/core.cpp | 22 | ||||
-rw-r--r-- | src/burn/engine/core.h | 1 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index d8e2454d..94aaf204 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -1521,7 +1521,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1521 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify the elevated name, token and parent process id."); | 1521 | ExitOnRootFailure(hr = E_INVALIDARG, "Must specify the elevated name, token and parent process id."); |
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | if (BURN_MODE_UNTRUSTED != pInternalCommand->mode) | 1524 | if (BURN_MODE_UNKNOWN != pInternalCommand->mode) |
1525 | { | 1525 | { |
1526 | fInvalidCommandLine = TRUE; | 1526 | fInvalidCommandLine = TRUE; |
1527 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); | 1527 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); |
@@ -1543,7 +1543,13 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1543 | } | 1543 | } |
1544 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM), BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM))) | 1544 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM), BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM))) |
1545 | { | 1545 | { |
1546 | if (BURN_MODE_UNTRUSTED == pInternalCommand->mode) | 1546 | if (0 != i) |
1547 | { | ||
1548 | fInvalidCommandLine = TRUE; | ||
1549 | TraceLog(E_INVALIDARG, "Clean room command-line switch must be first argument on command-line."); | ||
1550 | } | ||
1551 | |||
1552 | if (BURN_MODE_UNKNOWN == pInternalCommand->mode) | ||
1547 | { | 1553 | { |
1548 | pInternalCommand->mode = BURN_MODE_NORMAL; | 1554 | pInternalCommand->mode = BURN_MODE_NORMAL; |
1549 | } | 1555 | } |
@@ -1579,8 +1585,9 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1579 | 1585 | ||
1580 | switch (pInternalCommand->mode) | 1586 | switch (pInternalCommand->mode) |
1581 | { | 1587 | { |
1582 | case BURN_MODE_UNTRUSTED: | 1588 | case BURN_MODE_UNKNOWN: |
1583 | // Leave mode as UNTRUSTED to launch the clean room process. | 1589 | // Set mode to UNTRUSTED to ensure multiple modes weren't specified. |
1590 | pInternalCommand->mode = BURN_MODE_UNTRUSTED; | ||
1584 | break; | 1591 | break; |
1585 | case BURN_MODE_NORMAL: | 1592 | case BURN_MODE_NORMAL: |
1586 | // The initialization code already assumes that the | 1593 | // The initialization code already assumes that the |
@@ -1647,7 +1654,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1647 | } | 1654 | } |
1648 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, BURN_COMMANDLINE_SWITCH_RUNONCE, -1)) | 1655 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, BURN_COMMANDLINE_SWITCH_RUNONCE, -1)) |
1649 | { | 1656 | { |
1650 | if (BURN_MODE_UNTRUSTED != pInternalCommand->mode) | 1657 | if (BURN_MODE_UNKNOWN != pInternalCommand->mode) |
1651 | { | 1658 | { |
1652 | fInvalidCommandLine = TRUE; | 1659 | fInvalidCommandLine = TRUE; |
1653 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); | 1660 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); |
@@ -1797,6 +1804,11 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1797 | pCommand->display = BOOTSTRAPPER_DISPLAY_FULL; | 1804 | pCommand->display = BOOTSTRAPPER_DISPLAY_FULL; |
1798 | } | 1805 | } |
1799 | 1806 | ||
1807 | if (BURN_MODE_UNKNOWN == pInternalCommand->mode) | ||
1808 | { | ||
1809 | pInternalCommand->mode = BURN_MODE_UNTRUSTED; | ||
1810 | } | ||
1811 | |||
1800 | LExit: | 1812 | LExit: |
1801 | if (fInvalidCommandLine) | 1813 | if (fInvalidCommandLine) |
1802 | { | 1814 | { |
diff --git a/src/burn/engine/core.h b/src/burn/engine/core.h index fb6c0668..ccc33ba4 100644 --- a/src/burn/engine/core.h +++ b/src/burn/engine/core.h | |||
@@ -62,6 +62,7 @@ const LPCWSTR BURN_BUNDLE_LAST_USED_SOURCE = L"WixBundleLastUsedSource"; | |||
62 | 62 | ||
63 | enum BURN_MODE | 63 | enum BURN_MODE |
64 | { | 64 | { |
65 | BURN_MODE_UNKNOWN, | ||
65 | BURN_MODE_UNTRUSTED, | 66 | BURN_MODE_UNTRUSTED, |
66 | BURN_MODE_NORMAL, | 67 | BURN_MODE_NORMAL, |
67 | BURN_MODE_ELEVATED, | 68 | BURN_MODE_ELEVATED, |