Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
msi: Add WM_SETTINGCHANGE broadcast on InstallFinalize
Fix: #603
  • Loading branch information
mathiask88 committed Jan 26, 2015
commit 2c52f0598d0b4263e3b5e1e660e865dcf703f681
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "stdafx.h"

UINT __stdcall BroadcastPathUpdate(MSIHANDLE hInstall) {
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;

hr = WcaInitialize(hInstall, "BroadcastPathUpdateCustomAction");
ExitOnFailure(hr, "Failed to initialize");

WcaLog(LOGMSG_STANDARD, "Initialized.");

SendMessageTimeout(HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)L"Environment",
SMTO_ABORTIFHUNG,
5000,
NULL);

LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}


// DllMain - Initialize and cleanup WiX custom action utils.
extern "C" BOOL WINAPI DllMain(__in HINSTANCE hInst,
__in ULONG ulReason,
__in LPVOID) {
switch (ulReason) {
case DLL_PROCESS_ATTACH:
WcaGlobalInitialize(hInst);
break;

case DLL_PROCESS_DETACH:
WcaGlobalFinalize();
break;
}

return TRUE;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LIBRARY "BroadcastPathUpdateCustomAction"

EXPORTS

BroadcastPathUpdate
8 changes: 8 additions & 0 deletions tools/msvs/BroadcastPathUpdateCustomAction/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// BroadcastPathUpdateCustomAction.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
17 changes: 17 additions & 0 deletions tools/msvs/BroadcastPathUpdateCustomAction/stdafx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include "targetver.h"

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#include <strsafe.h>
#include <msiquery.h>

// WiX Header Files:
#include <wcautil.h>
24 changes: 24 additions & 0 deletions tools/msvs/BroadcastPathUpdateCustomAction/targetver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.

// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Specifies that the minimum required platform is Windows 2000.
#define WINVER 0x0500 // Change this to the appropriate value to target other versions of Windows.
#endif

#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows 2000.
#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target other versions of Windows.
#endif

#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 5.0.
#define _WIN32_IE 0x0500 // Change this to the appropriate value to target other versions of IE.
#endif

#ifndef _WIN32_MSI // Specifies that the minimum required MSI version is MSI 3.1
#define _WIN32_MSI 310 // Change this to the appropriate value to target other versions of MSI.
#endif
16 changes: 14 additions & 2 deletions tools/msvs/msi/nodemsi.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "nodemsi", "nodemsi.wixproj", "{1D808FF0-B5A9-4BE9-859D-B334B6F48BE2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BroadcastPathUpdateCustomAction", "..\BroadcastPathUpdateCustomAction\BroadcastPathUpdateCustomAction.vcxproj", "{B70585F8-DAB7-40FA-9904-13CF53A73A06}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -19,6 +23,14 @@ Global
{1D808FF0-B5A9-4BE9-859D-B334B6F48BE2}.Release|x64.Build.0 = Release|x64
{1D808FF0-B5A9-4BE9-859D-B334B6F48BE2}.Release|x86.ActiveCfg = Release|x86
{1D808FF0-B5A9-4BE9-859D-B334B6F48BE2}.Release|x86.Build.0 = Release|x86
{B70585F8-DAB7-40FA-9904-13CF53A73A06}.Debug|x64.ActiveCfg = Debug|Win32
{B70585F8-DAB7-40FA-9904-13CF53A73A06}.Debug|x64.Build.0 = Debug|Win32
{B70585F8-DAB7-40FA-9904-13CF53A73A06}.Debug|x86.ActiveCfg = Debug|Win32
{B70585F8-DAB7-40FA-9904-13CF53A73A06}.Debug|x86.Build.0 = Debug|Win32
{B70585F8-DAB7-40FA-9904-13CF53A73A06}.Release|x64.ActiveCfg = Release|Win32
{B70585F8-DAB7-40FA-9904-13CF53A73A06}.Release|x64.Build.0 = Release|Win32
{B70585F8-DAB7-40FA-9904-13CF53A73A06}.Release|x86.ActiveCfg = Release|Win32
{B70585F8-DAB7-40FA-9904-13CF53A73A06}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
12 changes: 11 additions & 1 deletion tools/msvs/msi/nodemsi.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@
<ItemGroup>
<EmbeddedResource Include="WixUI_en-us.wxl" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BroadcastPathUpdateCustomAction\BroadcastPathUpdateCustomAction.vcxproj">
<Name>BroadcastPathUpdateCustomAction</Name>
<Project>{b70585f8-dab7-40fa-9904-13cf53a73a06}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<Target Name="BeforeBuild">
<HeatDirectory ToolPath="$(WixToolPath)" Directory="..\..\..\deps\npm" PreprocessorVariable="var.NpmSourceDir" DirectoryRefId="NodeModulesFolder" ComponentGroupName="NpmSourceFiles" GenerateGuidsNow="true" SuppressFragments="false" OutputFile="..\..\..\npm.wxs" RunAsSeparateProcess="true">
Expand All @@ -65,4 +75,4 @@
<PostBuildEvent>move "!(TargetPath)" "$(TargetDir)\$(TargetFileName)"
move "!(TargetPdbPath)" "$(TargetDir)\$(TargetPdbName)"</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
10 changes: 10 additions & 0 deletions tools/msvs/msi/product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,20 @@
Execute="deferred"
Return="check" />

<Binary Id='BroadcastPathUpdateCustomAction'
SourceFile='$(var.BroadcastPathUpdateCustomAction.TargetDir)$(var.BroadcastPathUpdateCustomAction.TargetName).dll' />

<CustomAction Id="BroadcastPathUpdate"
BinaryKey="BroadcastPathUpdateCustomAction"
DllEntry="BroadcastPathUpdate"
Execute="immediate"
Return="check" />

<InstallExecuteSequence>
<Custom Action="LinkNodeExeToIojsExe" After="InstallFiles">
$NodeAlias = 3
</Custom>
<Custom Action='BroadcastPathUpdate' After='InstallFinalize'/>
</InstallExecuteSequence>

<UI Id="NodeInstallUI">
Expand Down