From 652f09a3044a9871266c3397a25dcd56481487c1 Mon Sep 17 00:00:00 2001 From: Victor Derks Date: Tue, 15 Oct 2024 14:30:55 +0200 Subject: [PATCH] Add custom action to installer to trigger SHChangeNotify SHChangeNotify needs to be called after adding the registry registrations. Wix has no standard support for it (has been requested, but not on the active backlog). Add a custom action DLL that just calls SHChangeNotify. --- netpbm-wic-codec.sln | 14 +++++ setup/installer/Package.wxs | 12 +++- setup/installer/installer.wixproj | 3 +- .../dll_main.cpp | 13 +++++ .../shell-change-notify-custom-action.def | 5 ++ .../shell-change-notify-custom-action.vcxproj | 57 +++++++++++++++++++ ...hange-notify-custom-action.vcxproj.filters | 19 +++++++ test/test.vcxproj | 1 - 8 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 setup/shell-change-notify-custom-action/dll_main.cpp create mode 100644 setup/shell-change-notify-custom-action/shell-change-notify-custom-action.def create mode 100644 setup/shell-change-notify-custom-action/shell-change-notify-custom-action.vcxproj create mode 100644 setup/shell-change-notify-custom-action/shell-change-notify-custom-action.vcxproj.filters diff --git a/netpbm-wic-codec.sln b/netpbm-wic-codec.sln index 4405d84..4d8e1fd 100644 --- a/netpbm-wic-codec.sln +++ b/netpbm-wic-codec.sln @@ -24,6 +24,8 @@ Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "bootstrapper", "setup\boots EndProject Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "installer", "setup\installer\installer.wixproj", "{8A21B212-8135-4499-9E5D-A2B47E88E983}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shell-change-notify-custom-action", "setup\shell-change-notify-custom-action\shell-change-notify-custom-action.vcxproj", "{7409D02B-A48B-4E54-B633-3C81BB3512AB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -94,6 +96,18 @@ Global {8A21B212-8135-4499-9E5D-A2B47E88E983}.Release|x64.Build.0 = Release|x64 {8A21B212-8135-4499-9E5D-A2B47E88E983}.Release|x86.ActiveCfg = Release|x86 {8A21B212-8135-4499-9E5D-A2B47E88E983}.Release|x86.Build.0 = Release|x86 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Debug|ARM64.Build.0 = Debug|ARM64 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Debug|x64.ActiveCfg = Debug|x64 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Debug|x64.Build.0 = Debug|x64 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Debug|x86.ActiveCfg = Debug|Win32 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Debug|x86.Build.0 = Debug|Win32 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Release|ARM64.ActiveCfg = Release|ARM64 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Release|ARM64.Build.0 = Release|ARM64 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Release|x64.ActiveCfg = Release|x64 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Release|x64.Build.0 = Release|x64 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Release|x86.ActiveCfg = Release|Win32 + {7409D02B-A48B-4E54-B633-3C81BB3512AB}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/setup/installer/Package.wxs b/setup/installer/Package.wxs index ea162a7..cad5b30 100644 --- a/setup/installer/Package.wxs +++ b/setup/installer/Package.wxs @@ -7,9 +7,9 @@ - + - + + + + + + + + diff --git a/setup/installer/installer.wixproj b/setup/installer/installer.wixproj index e34e70d..e3469c7 100644 --- a/setup/installer/installer.wixproj +++ b/setup/installer/installer.wixproj @@ -11,10 +11,11 @@ + - + diff --git a/setup/shell-change-notify-custom-action/dll_main.cpp b/setup/shell-change-notify-custom-action/dll_main.cpp new file mode 100644 index 0000000..02b423c --- /dev/null +++ b/setup/shell-change-notify-custom-action/dll_main.cpp @@ -0,0 +1,13 @@ +// Copyright (c) Team CharLS. +// SPDX-License-Identifier: BSD-3-Clause + +#include +#include +#include + +unsigned int __stdcall SHChangeNotifyCustomAction(MSIHANDLE /*install*/) +{ + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr); + + return ERROR_SUCCESS; +} diff --git a/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.def b/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.def new file mode 100644 index 0000000..aee0dce --- /dev/null +++ b/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.def @@ -0,0 +1,5 @@ +; Copyright (c) Team CharLS. +; SPDX-License-Identifier: BSD-3-Clause + +EXPORTS + SHChangeNotifyCustomAction diff --git a/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.vcxproj b/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.vcxproj new file mode 100644 index 0000000..dca56e5 --- /dev/null +++ b/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.vcxproj @@ -0,0 +1,57 @@ + + + + + Debug + ARM64 + + + Debug + Win32 + + + Release + ARM64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {7409d02b-a48b-4e54-b633-3c81bb3512ab} + DynamicLibrary + + + + $(DefaultPlatformToolset) + + + + + shell-change-notify-custom-action.def + + + false + + + + + + + + + + + + \ No newline at end of file diff --git a/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.vcxproj.filters b/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.vcxproj.filters new file mode 100644 index 0000000..f576587 --- /dev/null +++ b/setup/shell-change-notify-custom-action/shell-change-notify-custom-action.vcxproj.filters @@ -0,0 +1,19 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + + + Source Files + + + \ No newline at end of file diff --git a/test/test.vcxproj b/test/test.vcxproj index 1401e84..d581b90 100644 --- a/test/test.vcxproj +++ b/test/test.vcxproj @@ -31,7 +31,6 @@ 17.0 {F2EA965E-98D3-41C6-90D1-3DE4837D1041} Win32Proj - unittest NativeUnitTestProject DynamicLibrary