Browse code

Adapt to RegGetValue brokenness in Windows 7

- 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>

Selva Nair authored on 2018/02/21 14:38:30
Showing 1 changed files
... ...
@@ -59,7 +59,7 @@ openvpn_sntprintf(LPTSTR str, size_t size, LPCTSTR format, ...)
59 59
 static DWORD
60 60
 GetRegString(HKEY key, LPCTSTR value, LPTSTR data, DWORD size, LPCTSTR default_value)
61 61
 {
62
-    LONG status = RegGetValue(key, NULL, value, RRF_RT_REG_SZ|RRF_RT_REG_EXPAND_SZ,
62
+    LONG status = RegGetValue(key, NULL, value, RRF_RT_REG_SZ,
63 63
                               NULL, (LPBYTE) data, &size);
64 64
 
65 65
     if (status == ERROR_FILE_NOT_FOUND && default_value)