main
cpp 36 lines 1.16 KB
Raw
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 }