Add a MSI custom actions to close and relaunch OpenVPN GUI
PATCH 1/1 Add a MSI custom actions to close and relaunch OpenVPN GUI
This custom actions are used by MSI setup to close OpenVPN GUI before performing an upgrade and relaunch it afterwards.
--- src/openvpnmsica/Makefile.am | 2 +- src/openvpnmsica/openvpnmsica.c | 102 ++++++++++++++++++++++++++++++++ src/openvpnmsica/openvpnmsica.h | 25 ++++++++ 3 files changed, 128 insertions(+), 1 deletion(-)
src/openvpnmsica/Makefile.am +1 -1
@@ -41,7 +41,7 @@ libopenvpnmsica_la_CFLAGS = \ -municode -D_UNICODE \ -UNTDDI_VERSION -U_WIN32_WINNT \ -D_WIN32_WINNT=_WIN32_WINNT_VISTA -libopenvpnmsica_la_LDFLAGS = -ladvapi32 -lole32 -lmsi -lsetupapi -liphlpapi -lshlwapi -lversion -no-undefined -avoid-version +libopenvpnmsica_la_LDFLAGS = -ladvapi32 -lole32 -lmsi -lsetupapi -liphlpapi -lshell32 -lshlwapi -lversion -no-undefined -avoid-version endif libopenvpnmsica_la_SOURCES = \
src/openvpnmsica/openvpnmsica.c +102 -0
120 lines not on this page · raw message
src/openvpnmsica/openvpnmsica.h +25 -0
@@ -91,6 +91,31 @@ DLLEXP_DECL UINT __stdcall FindTAPInterfaces(_In_ MSIHANDLE hInstall); +/** +* Find OpenVPN GUI window and send it a WM_CLOSE message. +* +* @param hInstall Handle to the installation provided to the DLL custom action +* +* @return ERROR_SUCCESS on success; An error code otherwise +* See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx +*/ +DLLEXP_DECL UINT __stdcall +CloseOpenVPNGUI(_In_ MSIHANDLE hInstall); + + +/** +* Launches OpenVPN GUI. It's path is obtained by expanding the `[#bin.openvpn_gui.exe]` +* therefore, its Id field in File table must be "bin.openvpn_gui.exe". +* +* @param hInstall Handle to the installation provided to the DLL custom action +* +* @return ERROR_SUCCESS on success; An error code otherwise +* See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx +*/ +DLLEXP_DECL UINT __stdcall +StartOpenVPNGUI(_In_ MSIHANDLE hInstall); + +/** * Evaluate the TAPInterface table of the MSI package database and prepare a list of TAP * interfaces to install/remove.
Signature · 1 line
2.19.0.windows.1
Acked-by Gert Doering <[email protected]...>
Looks reasonable (the big picture "how does the installer know if there is a GUI in the first place? does it ask?" is missing, but I assume this is in the WiX pieces). Test compiled on Ubuntu 16.04/mingw.
Your patch has been applied to the master branch.
commit 597972bcc3124964df3ccc484df4c0efa6ec0dbc
Author: Simon Rozman Date: Tue Nov 27 01:28:08 2018 +0100
Add a MSI custom actions to close and relaunch OpenVPN GUI
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg17959.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering