aboutsummaryrefslogtreecommitdiff
path: root/src/burn
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-05-03 15:26:07 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-05-04 10:05:21 -0500
commite3671abae2f22c3ad7d205aa743bed73ff55e512 (patch)
treeb8d8e84e5d71f21e02c89a0da7a819e7a2078e50 /src/burn
parent5b04bce6567855325810bc4e6bcd2f6e05b329c7 (diff)
downloadwix-e3671abae2f22c3ad7d205aa743bed73ff55e512.tar.gz
wix-e3671abae2f22c3ad7d205aa743bed73ff55e512.tar.bz2
wix-e3671abae2f22c3ad7d205aa743bed73ff55e512.zip
Allow burn.runonce with burn.clean.room and create runonce log.
Diffstat (limited to 'src/burn')
-rw-r--r--src/burn/engine/core.cpp9
-rw-r--r--src/burn/engine/engine.cpp12
-rw-r--r--src/burn/engine/logging.cpp12
3 files changed, 25 insertions, 8 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp
index be8c011f..ec996c4c 100644
--- a/src/burn/engine/core.cpp
+++ b/src/burn/engine/core.cpp
@@ -1753,13 +1753,16 @@ extern "C" HRESULT CoreParseCommandLine(
1753 } 1753 }
1754 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, BURN_COMMANDLINE_SWITCH_RUNONCE, -1)) 1754 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, BURN_COMMANDLINE_SWITCH_RUNONCE, -1))
1755 { 1755 {
1756 if (BURN_MODE_UNKNOWN != pInternalCommand->mode) 1756 switch (pInternalCommand->mode)
1757 { 1757 {
1758 case BURN_MODE_UNKNOWN: __fallthrough;
1759 case BURN_MODE_NORMAL:
1760 pInternalCommand->mode = BURN_MODE_RUNONCE;
1761 break;
1762 default:
1758 fInvalidCommandLine = TRUE; 1763 fInvalidCommandLine = TRUE;
1759 TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); 1764 TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided.");
1760 } 1765 }
1761
1762 pInternalCommand->mode = BURN_MODE_RUNONCE;
1763 } 1766 }
1764 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES), BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES, lstrlenW(BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES))) 1767 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES), BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES, lstrlenW(BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES)))
1765 { 1768 {
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp
index 9b94552b..821626f8 100644
--- a/src/burn/engine/engine.cpp
+++ b/src/burn/engine/engine.cpp
@@ -33,7 +33,7 @@ static HRESULT RunEmbedded(
33 __in BURN_ENGINE_STATE* pEngineState 33 __in BURN_ENGINE_STATE* pEngineState
34 ); 34 );
35static HRESULT RunRunOnce( 35static HRESULT RunRunOnce(
36 __in const BURN_REGISTRATION* pRegistration, 36 __in BURN_ENGINE_STATE* pEngineState,
37 __in int nCmdShow 37 __in int nCmdShow
38 ); 38 );
39static HRESULT RunApplication( 39static HRESULT RunApplication(
@@ -221,7 +221,7 @@ extern "C" HRESULT EngineRun(
221 break; 221 break;
222 222
223 case BURN_MODE_RUNONCE: 223 case BURN_MODE_RUNONCE:
224 hr = RunRunOnce(&engineState.registration, nCmdShow); 224 hr = RunRunOnce(&engineState, nCmdShow);
225 ExitOnFailure(hr, "Failed to run RunOnce mode."); 225 ExitOnFailure(hr, "Failed to run RunOnce mode.");
226 break; 226 break;
227 227
@@ -703,7 +703,7 @@ LExit:
703} 703}
704 704
705static HRESULT RunRunOnce( 705static HRESULT RunRunOnce(
706 __in const BURN_REGISTRATION* pRegistration, 706 __in BURN_ENGINE_STATE* pEngineState,
707 __in int nCmdShow 707 __in int nCmdShow
708 ) 708 )
709{ 709{
@@ -712,7 +712,11 @@ static HRESULT RunRunOnce(
712 LPWSTR sczBurnPath = NULL; 712 LPWSTR sczBurnPath = NULL;
713 HANDLE hProcess = NULL; 713 HANDLE hProcess = NULL;
714 714
715 hr = RegistrationGetResumeCommandLine(pRegistration, &sczNewCommandLine); 715 // Initialize logging.
716 hr = LoggingOpen(&pEngineState->log, &pEngineState->internalCommand, &pEngineState->command, &pEngineState->variables, pEngineState->registration.sczDisplayName);
717 ExitOnFailure(hr, "Failed to open run once log.");
718
719 hr = RegistrationGetResumeCommandLine(&pEngineState->registration, &sczNewCommandLine);
716 ExitOnFailure(hr, "Unable to get resume command line from the registry"); 720 ExitOnFailure(hr, "Unable to get resume command line from the registry");
717 721
718 // and re-launch 722 // and re-launch
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp
index 0b510f3d..1b2bec1f 100644
--- a/src/burn/engine/logging.cpp
+++ b/src/burn/engine/logging.cpp
@@ -39,7 +39,17 @@ extern "C" HRESULT LoggingOpen(
39 HRESULT hr = S_OK; 39 HRESULT hr = S_OK;
40 LPWSTR sczLoggingBaseFolder = NULL; 40 LPWSTR sczLoggingBaseFolder = NULL;
41 LPWSTR sczPrefixFormatted = NULL; 41 LPWSTR sczPrefixFormatted = NULL;
42 LPCWSTR wzPostfix = BURN_MODE_UNTRUSTED == pInternalCommand->mode ? L".cleanroom" : NULL; 42 LPCWSTR wzPostfix = NULL;
43
44 switch (pInternalCommand->mode)
45 {
46 case BURN_MODE_UNTRUSTED:
47 wzPostfix = L".cleanroom";
48 break;
49 case BURN_MODE_RUNONCE:
50 wzPostfix = L".runonce";
51 break;
52 }
43 53
44 hr = InitializeLogging(pLog, pInternalCommand); 54 hr = InitializeLogging(pLog, pInternalCommand);
45 ExitOnFailure(hr, "Failed to initialize logging."); 55 ExitOnFailure(hr, "Failed to initialize logging.");