-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
win,msi: broadcast WM_SETTINGCHANGE after install
Backport 668bde8 from io.js. Original commit message follows: In theory the msi should broadcast a 'WM_SETTINGCHANGE' message to all windows after modifying the PATH environment variable. This ensures that the new PATH is visible to other processes without restarting windows (although it's still necessary to close and reopen active console windows). Unfortunately, the broadcast doesn't always happen, for unknown reasons. That's why this patch adds a custom action that unconditionally broadcasts a WM_SETTINGCHANGE message. Bug: #603 PR: #613 Reviewed-by: Bert Belder <bertbelder@gmail.com> (cherry picked from commit 668bde8) --Node.js commmit metadata-- PR-URL: nodejs/node-v0.x-archive#25100 Reviewed-By: Julien Gilli <julien.gilli@joyent.com> Fixes: nodejs/node-v0.x-archive#4356
- Loading branch information
1 parent
ad9947e
commit e7c84f8
Showing
7 changed files
with
258 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
|
||
#include <windows.h> | ||
#include <msiquery.h> | ||
#include <wcautil.h> | ||
|
||
|
||
UINT WINAPI BroadcastEnvironmentUpdate(MSIHANDLE hInstall) { | ||
HRESULT hr = S_OK; | ||
UINT er = ERROR_SUCCESS; | ||
|
||
hr = WcaInitialize(hInstall, "BroadcastEnvironmentUpdate"); | ||
ExitOnFailure(hr, "Failed to initialize"); | ||
|
||
SendMessageTimeoutW(HWND_BROADCAST, | ||
WM_SETTINGCHANGE, | ||
0, | ||
(LPARAM) L"Environment", | ||
SMTO_ABORTIFHUNG, | ||
5000, | ||
NULL); | ||
|
||
LExit: | ||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; | ||
return WcaFinalize(er); | ||
} | ||
|
||
|
||
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ulReason, VOID* dummy) { | ||
switch (ulReason) { | ||
case DLL_PROCESS_ATTACH: | ||
WcaGlobalInitialize(hInst); | ||
break; | ||
|
||
case DLL_PROCESS_DETACH: | ||
WcaGlobalFinalize(); | ||
break; | ||
} | ||
|
||
return TRUE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
LIBRARY "custom_actions" | ||
|
||
EXPORTS | ||
BroadcastEnvironmentUpdate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{B70585F8-DAB7-40FA-9904-13CF53A73A06}</ProjectGuid> | ||
<RootNamespace>BroadcastPathUpdateCustomAction</RootNamespace> | ||
<Keyword>Win32Proj</Keyword> | ||
<ProjectName>custom_actions</ProjectName> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<PlatformToolset>v120</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<PlatformToolset>v120</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<PlatformToolset>v120</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<PlatformToolset>v120</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup> | ||
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<Optimization>Disabled</Optimization> | ||
<AdditionalIncludeDirectories>$(WIX)sdk\VS2013\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<AdditionalLibraryDirectories>$(WIX)sdk\VS2013\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<SubSystem>Windows</SubSystem> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<Optimization>Disabled</Optimization> | ||
<AdditionalIncludeDirectories>$(WIX)sdk\VS2013\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<AdditionalLibraryDirectories>$(WIX)sdk\VS2013\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<SubSystem>Windows</SubSystem> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<Optimization>MaxSpeed</Optimization> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<AdditionalIncludeDirectories>$(WIX)sdk\VS2013\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<WarningLevel>Level3</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<PrecompiledHeaderFile> | ||
</PrecompiledHeaderFile> | ||
<PrecompiledHeaderOutputFile> | ||
</PrecompiledHeaderOutputFile> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<AdditionalLibraryDirectories>$(WIX)sdk\VS2013\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<SubSystem>Windows</SubSystem> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<Optimization>MaxSpeed</Optimization> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<AdditionalIncludeDirectories>$(WIX)sdk\VS2013\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<WarningLevel>Level3</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<PrecompiledHeaderFile> | ||
</PrecompiledHeaderFile> | ||
<PrecompiledHeaderOutputFile> | ||
</PrecompiledHeaderOutputFile> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<AdditionalLibraryDirectories>$(WIX)sdk\VS2013\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<SubSystem>Windows</SubSystem> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="custom_actions.c"> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="custom_actions.def" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters