]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Adapt to RegGetValue brokenness in Windows 7
authorSelva Nair <selva.nair@gmail.com>
Wed, 21 Feb 2018 05:38:30 +0000 (00:38 -0500)
committerGert Doering <gert@greenie.muc.de>
Wed, 21 Feb 2018 18:09:33 +0000 (19:09 +0100)
- RegGetValue with flags = RRF_RT_REG_SZ|RRF_RT_REG_EXPAND_SZ
  fails in Windows 7 with an "invalid parameter" error.
  Fix by using RRF_RT_REG_SZ alone.

Note: This is not a regression as in no released version did the
service support expandable strings (ones with embedded %FOO%) in
the registry. However, the GUI does expand such strings. The two
can be made consistent by explicitly expanding the strings -- that
is left for a future patch.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1519191510-3826-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16513.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7de0ee4f6f6f44fab48717e4cc2073ff4e8580f6)

src/openvpnserv/common.c

index 6c29f57990af7ff78365a206d24dcaae365a3773..dc47666d3e94a5cc9ce1cb851c1a7f4e8b3773bd 100644 (file)
@@ -59,7 +59,7 @@ openvpn_sntprintf(LPTSTR str, size_t size, LPCTSTR format, ...)
 static DWORD
 GetRegString(HKEY key, LPCTSTR value, LPTSTR data, DWORD size, LPCTSTR default_value)
 {
-    LONG status = RegGetValue(key, NULL, value, RRF_RT_REG_SZ|RRF_RT_REG_EXPAND_SZ,
+    LONG status = RegGetValue(key, NULL, value, RRF_RT_REG_SZ,
                               NULL, (LPBYTE) data, &size);
 
     if (status == ERROR_FILE_NOT_FOUND && default_value)