]> git.ipfire.org Git - thirdparty/openvpn.git/commit
openvpnserv: Fix writing messages to the event log
authorLev Stipakov <lev@openvpn.net>
Wed, 17 Sep 2025 09:05:48 +0000 (11:05 +0200)
committerGert Doering <gert@greenie.muc.de>
Wed, 17 Sep 2025 16:16:54 +0000 (18:16 +0200)
commit06919a60ae61d6d88546b23b52092f742599a8ae
tree6f80b558b3d0f07a51ff41b6586049771296c64c
parent168792766dedc2dab41347fa394fc244c73247e8
openvpnserv: Fix writing messages to the event log

There are two problems with the current implementation:

 - due to the code bug, we never display actual error message
corresponding to the Windows error code. We use
FORMAT_MESSAGE_ALLOCATE_BUFFER, in which case we must pass
a pointer to the LPTSTR, not the LPTSTR itself.

 - The error is not displayed in the "General" tab, which is very confusing.
One needs to go to the "Details" tab to see what is wrong.

This commit solves both problems. We now display a proper error
message in addition to the text provided by the service ("what went wrong").
While on it, remove trailing symbols ín a safer way.

To display the message in "General" tab, we create a registered message file
(openvpnservmsg.dll), which contains message template. Note that this requires
changes to the installer - we need to install the new DLL and
add a registry entry.

GitHub: https://github.com/OpenVPN/openvpn/issues/842

Change-Id: I423c9880def0eb479abb72bef2e8034a73cf5905
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1188
Message-Id: <20250917090557.25414-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59234559/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpnserv/CMakeLists.txt
src/openvpnserv/common.c
src/openvpnserv/eventmsg.mc [new file with mode: 0644]