Strip _stdcall suffixes (@nn) for 32-bit builds
PATCH 1/1 Strip _stdcall suffixes (@nn) for 32-bit builds
This makes DLL exported function names consistent between 32 and 64-bit builds.
--- src/openvpnmsica/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
src/openvpnmsica/Makefile.am +3 -2
@@ -2,7 +2,7 @@ # openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages # # Copyright (C) 2002-2018 OpenVPN Inc <[email protected]...> -# Copyright (C) 2018 Simon Rozman <[email protected]...> +# Copyright (C) 2018-2019 Simon Rozman <[email protected]...> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2
@@ -40,7 +40,8 @@ lib_LTLIBRARIES = libopenvpnmsica.la libopenvpnmsica_la_CFLAGS = \ -municode -D_UNICODE \ -UNTDDI_VERSION -U_WIN32_WINNT \ - -D_WIN32_WINNT=_WIN32_WINNT_VISTA + -D_WIN32_WINNT=_WIN32_WINNT_VISTA \ + -Wl,--kill-at libopenvpnmsica_la_LDFLAGS = -ladvapi32 -lole32 -lmsi -lsetupapi -liphlpapi -lshell32 -lshlwapi -lversion -no-undefined -avoid-version endif
Signature · 1 line
2.19.0.windows.1
You really do not like this calling convention, do you? ;-) - learned something new today, what "-Wl,--kill-at" does... (while the original round of stdcall discussion was MSVC, here's the mingw variant)
Your patch has been applied to the master branch.
commit f9f1605194281a6103d889298d4f303f94bc9d96
Author: Simon Rozman Date: Wed Jan 2 00:35:47 2019 +0100
Strip _stdcall suffixes (@nn) for 32-bit builds
Signed-off-by: Simon Rozman <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg18077.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hi,
Quoted 3 lines
You really do not like this calling convention, do you? ;-) - learned something new today, what "-Wl,--kill-at" does... (while the original round of stdcall discussion was MSVC, here's the mingw variant)
If I was importing this library into a C/C++ project, I wouldn't mind function name decorations at all.
However, DLL exported functions are authored in MSI package by name. Having a different name for i386 and x64 platforms would require "#ifdefs" in WiX XML files.
I'll explain this in the developer documentation but briefly I can explain it here already: Consider the openvpnmsica.dll as a collection of functions (aka "Custom Actions") the MSI installer calls to perform tasks that are not implemented by stock MSI actions.
Some functions are completely stand-alone. FindSystemInfo() and FindTAPInterfaces() are sequenced in the MSI package to execute early. They perform some tests MSI is too limited to do itself, and set various MSI properties accordingly. Later, those MSI properties are used to form conditions in MSI. Like which version of driver to install, should OpenVPNServ be selected to install or not, etc. The CloseOpenVPNGUI() and StartOpenVPNGUI() do just what they say immediately when called.
Then there are other functions that form an <evaluation, execute, commit, rollback> tuple. The <EvaluateTAPInterfaces(), ProcessDeferredAction(), ProcessDeferredAction(), ProcessDeferredAction()> is an example of those. They are sequenced in the MSI package like this:
1. EvaluateTAPInterfaces() executes in the first pass. It runs in the current user context and it doesn't touch computer in any way. Well, it just prepares a list of TAP-interface-related operations to be executed and saves it in a temporary file. The list contains operations like: "install TAP interface X", "delete TAP interface X", "rename TAP interface X>Y", "delete file X", etc. Operations are implemented in msica_op.h/.c.
2. ProcessDeferredAction() runs in the so called deferred MSI execution pass run by Windows Installer service as the SYSTEM user. It loads the list of operations from the temporary file and executes them one by one.
Let's look at a sample operation "delete file X". Normally, this operation does not really delete the file X. It renames it to Y instead, while adding "delete file Y" to a separate commit list tail, and inserting "move file Y>X" to a rollback list head. Unless MSI rollback is explicitly disabled - in this case it just deletes the file immediately and doesn't touch commit/rollback lists.
After all operations on the list are executed, the newly created commit and rollback operation lists are saved to separate temporary files.
3. Should the installation succeed, the MSI calls all deferred commit
actions: This time, the ProcessDeferredAction() is called with the commit list filename as the action parameter.
Should the installation fail, the MSI calls all deferred rollback actions in reverse order: This time, the ProcessDeferredAction() would be called with the rollback list filename as the action parameter.
Since execution, commit and rollback list files are of the same syntax, the same ProcessDeferredAction() function is reused. The only detail worth noting is that when ProcessDeferredAction() detects it is run in the commit/rollback pass it disables the MSI rollback: this makes all sequenced operations execute immediately and no longer bother with commit/rollback lists.
Wow, this made a nice text to start the developer documentation of MSI setup. If it was understandable enough. :)
Regards,
Simon
Hi,
never replied to this one...
On Sun, Jan 20, 2019 at 02:54:01PM +0000, Simon Rozman wrote:
[..]
Quoted 2 lines
Wow, this made a nice text to start the developer documentation of MSI setup. If it was understandable enough. :)
It was understandable and matched what I had to guess out of reading quite a bit of code ;-) - so, yes, good start!
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...PATCH 1/1 Add developer notes URL for openvpnmsica.dll
In reply to Gert DoeringThis patch follows Gert's recommendations from [openvpn-devel].
Message-ID: <[email protected]...>
--- src/openvpnmsica/dllmain.c | 1 + src/openvpnmsica/msica_op.c | 1 + src/openvpnmsica/msica_op.h | 1 + src/openvpnmsica/msiex.c | 1 + src/openvpnmsica/msiex.h | 1 + src/openvpnmsica/openvpnmsica.c | 1 + src/openvpnmsica/openvpnmsica.h | 1 + 7 files changed, 7 insertions(+)
src/openvpnmsica/dllmain.c +1 -0
@@ -1,5 +1,6 @@/* * openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages +* https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA * * Copyright (C) 2018 Simon Rozman <[email protected]...> *
src/openvpnmsica/msica_op.c +1 -0
@@ -1,5 +1,6 @@/* * openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages +* https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA * * Copyright (C) 2018 Simon Rozman <[email protected]...> *
src/openvpnmsica/msica_op.h +1 -0
@@ -1,5 +1,6 @@/* * openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages +* https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA * * Copyright (C) 2018 Simon Rozman <[email protected]...> *
src/openvpnmsica/msiex.c +1 -0
@@ -1,5 +1,6 @@/* * openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages +* https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA * * Copyright (C) 2018 Simon Rozman <[email protected]...> *
src/openvpnmsica/msiex.h +1 -0
@@ -1,5 +1,6 @@/* * openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages +* https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA * * Copyright (C) 2018 Simon Rozman <[email protected]...> *
src/openvpnmsica/openvpnmsica.c +1 -0
@@ -1,5 +1,6 @@/* * openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages +* https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA * * Copyright (C) 2018 Simon Rozman <[email protected]...> *
src/openvpnmsica/openvpnmsica.h +1 -0
@@ -1,5 +1,6 @@/* * openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages +* https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA * * Copyright (C) 2018 Simon Rozman <[email protected]...> *
Signature · 1 line
2.19.0.windows.1
[Openvpn-devel] [PATCH applied] Re: Add developer notes URL for openvpnmsica.dll
Trivial change, but very useful :-) - thanks.
Your patch has been applied to the master branch.
commit 5a05352f0ae06d2f79072fdc86370f279ed84074
Author: Simon Rozman Date: Sun Feb 24 19:55:00 2019 +0100
Add developer notes URL for openvpnmsica.dll
Signed-off-by: Simon Rozman <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg18235.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering