diff options
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 | } | ||