diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-09-02 16:12:26 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-09-03 15:29:26 -0500 |
| commit | 7728e34e48a4fdb710ecc92dd8dca833bff3993f (patch) | |
| tree | 83d9a6a5068985670dc47121d400fc7c491c23ec /src/burn/engine/core.cpp | |
| parent | eea6121f388197435529922b3cb13d3631afb9a8 (diff) | |
| download | wix-7728e34e48a4fdb710ecc92dd8dca833bff3993f.tar.gz wix-7728e34e48a4fdb710ecc92dd8dca833bff3993f.tar.bz2 wix-7728e34e48a4fdb710ecc92dd8dca833bff3993f.zip | |
Use elevated engine to make the restart request when it is available.
Fixes 6145
Diffstat (limited to 'src/burn/engine/core.cpp')
| -rw-r--r-- | src/burn/engine/core.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 3c1ed117..c8dce17b 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
| @@ -2028,6 +2028,48 @@ extern "C" HRESULT DAPI CoreWaitForProcCompletion( | |||
| 2028 | return vpfnProcWaitForCompletion(hProcess, dwTimeout, pdwReturnCode); | 2028 | return vpfnProcWaitForCompletion(hProcess, dwTimeout, pdwReturnCode); |
| 2029 | } | 2029 | } |
| 2030 | 2030 | ||
| 2031 | extern "C" HRESULT DAPI CoreCloseElevatedLoggingThread( | ||
| 2032 | __in BURN_ENGINE_STATE* pEngineState | ||
| 2033 | ) | ||
| 2034 | { | ||
| 2035 | HRESULT hr = S_OK; | ||
| 2036 | |||
| 2037 | if (INVALID_HANDLE_VALUE == pEngineState->elevatedLoggingContext.hThread) | ||
| 2038 | { | ||
| 2039 | ExitFunction(); | ||
| 2040 | } | ||
| 2041 | |||
| 2042 | if (!::SetEvent(pEngineState->elevatedLoggingContext.hFinishedEvent)) | ||
| 2043 | { | ||
| 2044 | ExitWithLastError(hr, "Failed to set log finished event."); | ||
| 2045 | } | ||
| 2046 | |||
| 2047 | hr = AppWaitForSingleObject(pEngineState->elevatedLoggingContext.hThread, 5 * 60 * 1000); // TODO: is 5 minutes good? | ||
| 2048 | ExitOnFailure(hr, "Failed to wait for elevated logging thread."); | ||
| 2049 | |||
| 2050 | LExit: | ||
| 2051 | return hr; | ||
| 2052 | } | ||
| 2053 | |||
| 2054 | extern "C" HRESULT DAPI CoreWaitForUnelevatedLoggingThread( | ||
| 2055 | __in HANDLE hUnelevatedLoggingThread | ||
| 2056 | ) | ||
| 2057 | { | ||
| 2058 | HRESULT hr = S_OK; | ||
| 2059 | |||
| 2060 | if (INVALID_HANDLE_VALUE == hUnelevatedLoggingThread) | ||
| 2061 | { | ||
| 2062 | ExitFunction(); | ||
| 2063 | } | ||
| 2064 | |||
| 2065 | // Give the thread 15 seconds to exit. | ||
| 2066 | hr = AppWaitForSingleObject(hUnelevatedLoggingThread, 15 * 1000); | ||
| 2067 | ExitOnFailure(hr, "Failed to wait for unelevated logging thread."); | ||
| 2068 | |||
| 2069 | LExit: | ||
| 2070 | return hr; | ||
| 2071 | } | ||
| 2072 | |||
| 2031 | // internal helper functions | 2073 | // internal helper functions |
| 2032 | 2074 | ||
| 2033 | static HRESULT AppendEscapedArgumentToCommandLine( | 2075 | static HRESULT AppendEscapedArgumentToCommandLine( |
