diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-08-03 15:43:30 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-08-04 10:03:57 -0500 |
commit | 75d645c6aec0df0e02bd3aaf2fe2571d83316d4c (patch) | |
tree | 6ff150562e5c2a208de8fa38aadac4e72b8ab6a7 /src/burn/engine/elevation.cpp | |
parent | 25ae58ec05bec0b97038e98eec9582209c1f9583 (diff) | |
download | wix-75d645c6aec0df0e02bd3aaf2fe2571d83316d4c.tar.gz wix-75d645c6aec0df0e02bd3aaf2fe2571d83316d4c.tar.bz2 wix-75d645c6aec0df0e02bd3aaf2fe2571d83316d4c.zip |
Remove unelevation code since clean room changes made it unreachable.
Diffstat (limited to 'src/burn/engine/elevation.cpp')
-rw-r--r-- | src/burn/engine/elevation.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/burn/engine/elevation.cpp b/src/burn/engine/elevation.cpp index 03674f0b..c229fa58 100644 --- a/src/burn/engine/elevation.cpp +++ b/src/burn/engine/elevation.cpp | |||
@@ -100,6 +100,16 @@ typedef struct _BURN_ELEVATION_CHILD_MESSAGE_CONTEXT | |||
100 | 100 | ||
101 | // internal function declarations | 101 | // internal function declarations |
102 | 102 | ||
103 | /******************************************************************* | ||
104 | LaunchElevatedProcess - Called from the per-user process to create | ||
105 | the per-machine process and set up the | ||
106 | communication pipe. | ||
107 | |||
108 | *******************************************************************/ | ||
109 | static HRESULT LaunchElevatedProcess( | ||
110 | __in BURN_ENGINE_STATE* pEngineState, | ||
111 | __in_opt HWND hwndParent | ||
112 | ); | ||
103 | static DWORD WINAPI ElevatedChildCacheThreadProc( | 113 | static DWORD WINAPI ElevatedChildCacheThreadProc( |
104 | __in LPVOID lpThreadParameter | 114 | __in LPVOID lpThreadParameter |
105 | ); | 115 | ); |
@@ -367,7 +377,7 @@ extern "C" HRESULT ElevationElevate( | |||
367 | nResult = IDOK; | 377 | nResult = IDOK; |
368 | 378 | ||
369 | // Create the elevated process and if successful, wait for it to connect. | 379 | // Create the elevated process and if successful, wait for it to connect. |
370 | hr = PipeLaunchChildProcess(pEngineState->sczBundleEngineWorkingPath, &pEngineState->companionConnection, TRUE, hwndParent); | 380 | hr = LaunchElevatedProcess(pEngineState, hwndParent); |
371 | if (SUCCEEDED(hr)) | 381 | if (SUCCEEDED(hr)) |
372 | { | 382 | { |
373 | LogId(REPORT_STANDARD, MSG_LAUNCH_ELEVATED_ENGINE_SUCCESS); | 383 | LogId(REPORT_STANDARD, MSG_LAUNCH_ELEVATED_ENGINE_SUCCESS); |
@@ -1371,6 +1381,36 @@ LExit: | |||
1371 | 1381 | ||
1372 | // internal function definitions | 1382 | // internal function definitions |
1373 | 1383 | ||
1384 | static HRESULT LaunchElevatedProcess( | ||
1385 | __in BURN_ENGINE_STATE* pEngineState, | ||
1386 | __in_opt HWND hwndParent | ||
1387 | ) | ||
1388 | { | ||
1389 | HRESULT hr = S_OK; | ||
1390 | DWORD dwCurrentProcessId = ::GetCurrentProcessId(); | ||
1391 | LPWSTR sczParameters = NULL; | ||
1392 | HANDLE hProcess = NULL; | ||
1393 | BURN_PIPE_CONNECTION* pConnection = &pEngineState->companionConnection; | ||
1394 | |||
1395 | hr = StrAllocFormatted(&sczParameters, L"-q -%ls %ls %ls %u", BURN_COMMANDLINE_SWITCH_ELEVATED, pConnection->sczName, pConnection->sczSecret, dwCurrentProcessId); | ||
1396 | ExitOnFailure(hr, "Failed to allocate parameters for elevated process."); | ||
1397 | |||
1398 | // Since ShellExecuteEx doesn't support passing inherited handles, don't bother with CoreAppendFileHandleSelfToCommandLine. | ||
1399 | // We could fallback to using ::DuplicateHandle to inject the file handle later if necessary. | ||
1400 | hr = ShelExec(pEngineState->sczBundleEngineWorkingPath, sczParameters, L"runas", NULL, SW_SHOWNA, hwndParent, &hProcess); | ||
1401 | ExitOnFailure(hr, "Failed to launch elevated child process: %ls", pEngineState->sczBundleEngineWorkingPath); | ||
1402 | |||
1403 | pConnection->dwProcessId = ::GetProcessId(hProcess); | ||
1404 | pConnection->hProcess = hProcess; | ||
1405 | hProcess = NULL; | ||
1406 | |||
1407 | LExit: | ||
1408 | ReleaseHandle(hProcess); | ||
1409 | ReleaseStr(sczParameters); | ||
1410 | |||
1411 | return hr; | ||
1412 | } | ||
1413 | |||
1374 | static DWORD WINAPI ElevatedChildCacheThreadProc( | 1414 | static DWORD WINAPI ElevatedChildCacheThreadProc( |
1375 | __in LPVOID lpThreadParameter | 1415 | __in LPVOID lpThreadParameter |
1376 | ) | 1416 | ) |