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/BroadcastSettingChange.cpp | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/ext/Util/ca/BroadcastSettingChange.cpp (limited to 'src/ext/Util/ca/BroadcastSettingChange.cpp') diff --git a/src/ext/Util/ca/BroadcastSettingChange.cpp b/src/ext/Util/ca/BroadcastSettingChange.cpp new file mode 100644 index 00000000..2e153ad3 --- /dev/null +++ b/src/ext/Util/ca/BroadcastSettingChange.cpp @@ -0,0 +1,45 @@ +// 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" + + +/******************************************************************** +WixBroadcastSettingChange + + Send WM_SETTINGCHANGE message to all top-level windows indicating + that unspecified settings have changed. +********************************************************************/ +extern "C" UINT __stdcall WixBroadcastSettingChange( + __in MSIHANDLE hInstall + ) +{ + HRESULT hr = WcaInitialize(hInstall, "WixBroadcastSettingChange"); + ExitOnFailure(hr, "failed to initialize WixBroadcastSettingChange"); + + // best effort; ignore failures + ::SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, NULL, SMTO_ABORTIFHUNG, 1000, NULL); + +LExit: + return WcaFinalize(ERROR_SUCCESS); +} + + +/******************************************************************** +WixBroadcastEnvironmentChange + + Send WM_SETTINGCHANGE message to all top-level windows indicating + that environment variables have changed. +********************************************************************/ +extern "C" UINT __stdcall WixBroadcastEnvironmentChange( + __in MSIHANDLE hInstall + ) +{ + HRESULT hr = WcaInitialize(hInstall, "WixBroadcastEnvironmentChange"); + ExitOnFailure(hr, "failed to initialize WixBroadcastEnvironmentChange"); + + // best effort; ignore failures + ::SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, reinterpret_cast(L"Environment"), SMTO_ABORTIFHUNG, 1000, NULL); + +LExit: + return WcaFinalize(ERROR_SUCCESS); +} -- cgit v1.2.3-55-g6feb