diff options
Diffstat (limited to 'src/burn/engine/engine.cpp')
-rw-r--r-- | src/burn/engine/engine.cpp | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp index 8b4a296b..0ce2de6d 100644 --- a/src/burn/engine/engine.cpp +++ b/src/burn/engine/engine.cpp | |||
@@ -462,31 +462,19 @@ static HRESULT RunUntrusted( | |||
462 | hr = CoreCreateCleanRoomCommandLine(&sczParameters, pEngineState, wzCleanRoomBundlePath, sczCurrentProcessPath, &hFileAttached, &hFileSelf); | 462 | hr = CoreCreateCleanRoomCommandLine(&sczParameters, pEngineState, wzCleanRoomBundlePath, sczCurrentProcessPath, &hFileAttached, &hFileSelf); |
463 | ExitOnFailure(hr, "Failed to create clean room command-line."); | 463 | ExitOnFailure(hr, "Failed to create clean room command-line."); |
464 | 464 | ||
465 | #ifdef ENABLE_UNELEVATE | 465 | hr = StrAllocFormattedSecure(&sczFullCommandLine, L"\"%ls\" %ls", wzCleanRoomBundlePath, sczParameters); |
466 | // TODO: Pass file handle to unelevated process if this ever gets reenabled. | 466 | ExitOnFailure(hr, "Failed to allocate full command-line."); |
467 | if (!pEngineState->internalCommand.fDisableUnelevate) | ||
468 | { | ||
469 | // Try to launch unelevated and if that fails for any reason, we'll launch our process normally (even though that may make it elevated). | ||
470 | hr = ProcExecuteAsInteractiveUser(wzCleanRoomBundlePath, sczParameters, &hProcess); | ||
471 | } | ||
472 | #endif | ||
473 | 467 | ||
474 | if (!hProcess) | 468 | si.cb = sizeof(si); |
469 | si.wShowWindow = static_cast<WORD>(pEngineState->command.nCmdShow); | ||
470 | if (!::CreateProcessW(wzCleanRoomBundlePath, sczFullCommandLine, NULL, NULL, TRUE, 0, 0, NULL, &si, &pi)) | ||
475 | { | 471 | { |
476 | hr = StrAllocFormattedSecure(&sczFullCommandLine, L"\"%ls\" %ls", wzCleanRoomBundlePath, sczParameters); | 472 | ExitWithLastError(hr, "Failed to launch clean room process: %ls", sczFullCommandLine); |
477 | ExitOnFailure(hr, "Failed to allocate full command-line."); | ||
478 | |||
479 | si.cb = sizeof(si); | ||
480 | si.wShowWindow = static_cast<WORD>(pEngineState->command.nCmdShow); | ||
481 | if (!::CreateProcessW(wzCleanRoomBundlePath, sczFullCommandLine, NULL, NULL, TRUE, 0, 0, NULL, &si, &pi)) | ||
482 | { | ||
483 | ExitWithLastError(hr, "Failed to launch clean room process: %ls", sczFullCommandLine); | ||
484 | } | ||
485 | |||
486 | hProcess = pi.hProcess; | ||
487 | pi.hProcess = NULL; | ||
488 | } | 473 | } |
489 | 474 | ||
475 | hProcess = pi.hProcess; | ||
476 | pi.hProcess = NULL; | ||
477 | |||
490 | hr = ProcWaitForCompletion(hProcess, INFINITE, &pEngineState->userExperience.dwExitCode); | 478 | hr = ProcWaitForCompletion(hProcess, INFINITE, &pEngineState->userExperience.dwExitCode); |
491 | ExitOnFailure(hr, "Failed to wait for clean room process: %ls", wzCleanRoomBundlePath); | 479 | ExitOnFailure(hr, "Failed to wait for clean room process: %ls", wzCleanRoomBundlePath); |
492 | 480 | ||