diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-05-03 09:55:22 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-05-03 09:55:22 -0700 |
| commit | ff659159e041bf6c083e6b7fcb9b726065a9dd73 (patch) | |
| tree | ea95bf3d3e031edcee65de33b9e6954178be669c /src/ext/Util/ca/CheckReboot.cpp | |
| parent | 8a8a25695351ee542f08886a9d0957c78c6af366 (diff) | |
| download | wix-ff659159e041bf6c083e6b7fcb9b726065a9dd73.tar.gz wix-ff659159e041bf6c083e6b7fcb9b726065a9dd73.tar.bz2 wix-ff659159e041bf6c083e6b7fcb9b726065a9dd73.zip | |
Move Util.wixext into ext
Diffstat (limited to 'src/ext/Util/ca/CheckReboot.cpp')
| -rw-r--r-- | src/ext/Util/ca/CheckReboot.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ext/Util/ca/CheckReboot.cpp b/src/ext/Util/ca/CheckReboot.cpp new file mode 100644 index 00000000..ce056411 --- /dev/null +++ b/src/ext/Util/ca/CheckReboot.cpp | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | |||
| 6 | /******************************************************************** | ||
| 7 | WixCheckRebootRequired - entry point for WixCheckRebootRequired Custom Action | ||
| 8 | |||
| 9 | called as Type 1 CustomAction (binary DLL) from Windows Installer | ||
| 10 | in InstallExecuteSequence after InstallFinalize | ||
| 11 | ********************************************************************/ | ||
| 12 | extern "C" UINT __stdcall WixCheckRebootRequired( | ||
| 13 | __in MSIHANDLE hInstall | ||
| 14 | ) | ||
| 15 | { | ||
| 16 | HRESULT hr = S_OK; | ||
| 17 | DWORD er = ERROR_SUCCESS; | ||
| 18 | |||
| 19 | hr = WcaInitialize(hInstall, "WixCheckRebootRequired"); | ||
| 20 | ExitOnFailure(hr, "failed to initialize"); | ||
| 21 | |||
| 22 | if (WcaDidDeferredActionRequireReboot()) | ||
| 23 | { | ||
| 24 | WcaLog(LOGMSG_STANDARD, "Reboot required by deferred CustomAction."); | ||
| 25 | |||
| 26 | er = ::MsiSetMode(hInstall, MSIRUNMODE_REBOOTATEND, TRUE); | ||
| 27 | hr = HRESULT_FROM_WIN32(er); | ||
| 28 | ExitOnFailure(hr, "Failed to schedule reboot."); | ||
| 29 | } | ||
| 30 | |||
| 31 | LExit: | ||
| 32 | |||
| 33 | if (FAILED(hr)) | ||
| 34 | er = ERROR_INSTALL_FAILURE; | ||
| 35 | return WcaFinalize(er); | ||
| 36 | } | ||
