From ff659159e041bf6c083e6b7fcb9b726065a9dd73 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 3 May 2021 09:55:22 -0700 Subject: Move Util.wixext into ext --- src/ext/Util/ca/CheckReboot.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/ext/Util/ca/CheckReboot.cpp (limited to 'src/ext/Util/ca/CheckReboot.cpp') 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 @@ +// 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. + +#include "precomp.h" + + +/******************************************************************** +WixCheckRebootRequired - entry point for WixCheckRebootRequired Custom Action + + called as Type 1 CustomAction (binary DLL) from Windows Installer + in InstallExecuteSequence after InstallFinalize +********************************************************************/ +extern "C" UINT __stdcall WixCheckRebootRequired( + __in MSIHANDLE hInstall + ) +{ + HRESULT hr = S_OK; + DWORD er = ERROR_SUCCESS; + + hr = WcaInitialize(hInstall, "WixCheckRebootRequired"); + ExitOnFailure(hr, "failed to initialize"); + + if (WcaDidDeferredActionRequireReboot()) + { + WcaLog(LOGMSG_STANDARD, "Reboot required by deferred CustomAction."); + + er = ::MsiSetMode(hInstall, MSIRUNMODE_REBOOTATEND, TRUE); + hr = HRESULT_FROM_WIN32(er); + ExitOnFailure(hr, "Failed to schedule reboot."); + } + +LExit: + + if (FAILED(hr)) + er = ERROR_INSTALL_FAILURE; + return WcaFinalize(er); +} -- cgit v1.2.3-55-g6feb