summaryrefslogtreecommitdiff
path: root/src/burn/engine/engine.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-08-03 15:41:53 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-08-04 10:03:57 -0500
commit9ae1c04d5fa02ac020885cdad7c592f7bb43d83e (patch)
tree2832850289c8b703fa39e5d1c97666331e2310b1 /src/burn/engine/engine.cpp
parentce8acddf52bde840571535c3dfd56a2371d80684 (diff)
downloadwix-9ae1c04d5fa02ac020885cdad7c592f7bb43d83e.tar.gz
wix-9ae1c04d5fa02ac020885cdad7c592f7bb43d83e.tar.bz2
wix-9ae1c04d5fa02ac020885cdad7c592f7bb43d83e.zip
Parse most of Burn command line parameters into BURN_ENGINE_COMMAND.
Diffstat (limited to 'src/burn/engine/engine.cpp')
-rw-r--r--src/burn/engine/engine.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp
index 66eee27e..e65600b5 100644
--- a/src/burn/engine/engine.cpp
+++ b/src/burn/engine/engine.cpp
@@ -113,7 +113,7 @@ extern "C" HRESULT EngineRun(
113 LogSetLevel(REPORT_VERBOSE, FALSE); // FALSE means don't write an additional text line to the log saying the level changed 113 LogSetLevel(REPORT_VERBOSE, FALSE); // FALSE means don't write an additional text line to the log saying the level changed
114#endif 114#endif
115 115
116 hr = AppParseCommandLine(wzCommandLine, &engineState.argc, &engineState.argv); 116 hr = AppParseCommandLine(wzCommandLine, &engineState.internalCommand.argc, &engineState.internalCommand.argv);
117 ExitOnFailure(hr, "Failed to parse command line."); 117 ExitOnFailure(hr, "Failed to parse command line.");
118 118
119 hr = InitializeEngineState(&engineState, hEngineFile); 119 hr = InitializeEngineState(&engineState, hEngineFile);
@@ -121,7 +121,7 @@ extern "C" HRESULT EngineRun(
121 121
122 engineState.command.nCmdShow = nCmdShow; 122 engineState.command.nCmdShow = nCmdShow;
123 123
124 if (BURN_MODE_ELEVATED != engineState.mode && BOOTSTRAPPER_DISPLAY_NONE < engineState.command.display && !engineState.command.hwndSplashScreen) 124 if (BURN_MODE_ELEVATED != engineState.internalCommand.mode && BOOTSTRAPPER_DISPLAY_NONE < engineState.command.display && !engineState.command.hwndSplashScreen)
125 { 125 {
126 SplashScreenCreate(hInstance, NULL, &engineState.command.hwndSplashScreen); 126 SplashScreenCreate(hInstance, NULL, &engineState.command.hwndSplashScreen);
127 } 127 }
@@ -192,7 +192,7 @@ extern "C" HRESULT EngineRun(
192 ExitOnFailure(hr, "Failed to initialize core."); 192 ExitOnFailure(hr, "Failed to initialize core.");
193 193
194 // Select run mode. 194 // Select run mode.
195 switch (engineState.mode) 195 switch (engineState.internalCommand.mode)
196 { 196 {
197 case BURN_MODE_UNTRUSTED: 197 case BURN_MODE_UNTRUSTED:
198 hr = RunUntrusted(wzCommandLine, &engineState); 198 hr = RunUntrusted(wzCommandLine, &engineState);
@@ -328,7 +328,7 @@ static HRESULT InitializeEngineState(
328 HANDLE hSectionFile = hEngineFile; 328 HANDLE hSectionFile = hEngineFile;
329 HANDLE hSourceEngineFile = INVALID_HANDLE_VALUE; 329 HANDLE hSourceEngineFile = INVALID_HANDLE_VALUE;
330 330
331 pEngineState->automaticUpdates = BURN_AU_PAUSE_ACTION_IFELEVATED; 331 pEngineState->internalCommand.automaticUpdates = BURN_AU_PAUSE_ACTION_IFELEVATED;
332 pEngineState->dwElevatedLoggingTlsId = TLS_OUT_OF_INDEXES; 332 pEngineState->dwElevatedLoggingTlsId = TLS_OUT_OF_INDEXES;
333 ::InitializeCriticalSection(&pEngineState->userExperience.csEngineActive); 333 ::InitializeCriticalSection(&pEngineState->userExperience.csEngineActive);
334 PipeConnectionInitialize(&pEngineState->companionConnection); 334 PipeConnectionInitialize(&pEngineState->companionConnection);
@@ -338,7 +338,7 @@ static HRESULT InitializeEngineState(
338 ProcElevated(::GetCurrentProcess(), &pEngineState->internalCommand.fInitiallyElevated); 338 ProcElevated(::GetCurrentProcess(), &pEngineState->internalCommand.fInitiallyElevated);
339 339
340 // Parse command line. 340 // Parse command line.
341 hr = CoreParseCommandLine(pEngineState->argc, pEngineState->argv, &pEngineState->command, &pEngineState->companionConnection, &pEngineState->embeddedConnection, &pEngineState->mode, &pEngineState->automaticUpdates, &pEngineState->fDisableSystemRestore, &pEngineState->internalCommand.sczSourceProcessPath, &pEngineState->internalCommand.sczOriginalSource, &hSectionFile, &hSourceEngineFile, &pEngineState->fDisableUnelevate, &pEngineState->log.dwAttributes, &pEngineState->log.sczPath, &pEngineState->internalCommand.sczActiveParent, &pEngineState->internalCommand.sczIgnoreDependencies, &pEngineState->registration.sczAncestors, &pEngineState->fInvalidCommandLine, &pEngineState->cUnknownArgs, &pEngineState->rgUnknownArgs); 341 hr = CoreParseCommandLine(&pEngineState->internalCommand, &pEngineState->command, &pEngineState->companionConnection, &pEngineState->embeddedConnection, &hSectionFile, &hSourceEngineFile);
342 ExitOnFailure(hr, "Fatal error while parsing command line."); 342 ExitOnFailure(hr, "Fatal error while parsing command line.");
343 343
344 hr = SectionInitialize(&pEngineState->section, hSectionFile, hSourceEngineFile); 344 hr = SectionInitialize(&pEngineState->section, hSectionFile, hSourceEngineFile);
@@ -355,12 +355,12 @@ static void UninitializeEngineState(
355 __in BURN_ENGINE_STATE* pEngineState 355 __in BURN_ENGINE_STATE* pEngineState
356 ) 356 )
357{ 357{
358 if (pEngineState->argv) 358 if (pEngineState->internalCommand.argv)
359 { 359 {
360 AppFreeCommandLineArgs(pEngineState->argv); 360 AppFreeCommandLineArgs(pEngineState->internalCommand.argv);
361 } 361 }
362 362
363 ReleaseMem(pEngineState->rgUnknownArgs); 363 ReleaseMem(pEngineState->internalCommand.rgUnknownArgs);
364 364
365 PipeConnectionUninitialize(&pEngineState->embeddedConnection); 365 PipeConnectionUninitialize(&pEngineState->embeddedConnection);
366 PipeConnectionUninitialize(&pEngineState->companionConnection); 366 PipeConnectionUninitialize(&pEngineState->companionConnection);
@@ -390,7 +390,9 @@ static void UninitializeEngineState(
390 ReleaseStr(pEngineState->command.wzCommandLine); 390 ReleaseStr(pEngineState->command.wzCommandLine);
391 391
392 ReleaseStr(pEngineState->internalCommand.sczActiveParent); 392 ReleaseStr(pEngineState->internalCommand.sczActiveParent);
393 ReleaseStr(pEngineState->internalCommand.sczAncestors);
393 ReleaseStr(pEngineState->internalCommand.sczIgnoreDependencies); 394 ReleaseStr(pEngineState->internalCommand.sczIgnoreDependencies);
395 ReleaseStr(pEngineState->internalCommand.sczLogFile);
394 ReleaseStr(pEngineState->internalCommand.sczOriginalSource); 396 ReleaseStr(pEngineState->internalCommand.sczOriginalSource);
395 ReleaseStr(pEngineState->internalCommand.sczSourceProcessPath); 397 ReleaseStr(pEngineState->internalCommand.sczSourceProcessPath);
396 398
@@ -469,7 +471,7 @@ static HRESULT RunUntrusted(
469 471
470#ifdef ENABLE_UNELEVATE 472#ifdef ENABLE_UNELEVATE
471 // TODO: Pass file handle to unelevated process if this ever gets reenabled. 473 // TODO: Pass file handle to unelevated process if this ever gets reenabled.
472 if (!pEngineState->fDisableUnelevate) 474 if (!pEngineState->internalCommand.fDisableUnelevate)
473 { 475 {
474 // Try to launch unelevated and if that fails for any reason, we'll launch our process normally (even though that may make it elevated). 476 // Try to launch unelevated and if that fails for any reason, we'll launch our process normally (even though that may make it elevated).
475 hr = ProcExecuteAsInteractiveUser(wzCleanRoomBundlePath, sczParameters, &hProcess); 477 hr = ProcExecuteAsInteractiveUser(wzCleanRoomBundlePath, sczParameters, &hProcess);
@@ -522,7 +524,7 @@ static HRESULT RunNormal(
522 BURN_EXTENSION_ENGINE_CONTEXT extensionEngineContext = { }; 524 BURN_EXTENSION_ENGINE_CONTEXT extensionEngineContext = { };
523 525
524 // Initialize logging. 526 // Initialize logging.
525 hr = LoggingOpen(&pEngineState->log, &pEngineState->variables, pEngineState->command.display, pEngineState->registration.sczDisplayName); 527 hr = LoggingOpen(&pEngineState->log, &pEngineState->internalCommand, &pEngineState->command, &pEngineState->variables, pEngineState->registration.sczDisplayName);
526 ExitOnFailure(hr, "Failed to open log."); 528 ExitOnFailure(hr, "Failed to open log.");
527 529
528 // Ensure we're on a supported operating system. 530 // Ensure we're on a supported operating system.
@@ -694,9 +696,6 @@ static HRESULT RunEmbedded(
694{ 696{
695 HRESULT hr = S_OK; 697 HRESULT hr = S_OK;
696 698
697 // Disable system restore since the parent bundle may have done it.
698 pEngineState->fDisableSystemRestore = TRUE;
699
700 // Connect to parent process. 699 // Connect to parent process.
701 hr = PipeChildConnect(&pEngineState->embeddedConnection, FALSE); 700 hr = PipeChildConnect(&pEngineState->embeddedConnection, FALSE);
702 ExitOnFailure(hr, "Failed to connect to parent of embedded process."); 701 ExitOnFailure(hr, "Failed to connect to parent of embedded process.");