aboutsummaryrefslogtreecommitdiffstats
path: root/tun/wintun/wintun_windows.go
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-05-11 06:21:02 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-11 17:14:37 +0200
commit6c1b66802f533f4b6ebad72147e1fd6fe11c6cd7 (patch)
tree6f5f3be5dd60ba6a0da04ce27f04b1f6c8356b69 /tun/wintun/wintun_windows.go
parentwintun: call HrRenameConnection in another thread (diff)
downloadwireguard-go-6c1b66802f533f4b6ebad72147e1fd6fe11c6cd7.tar.xz
wireguard-go-6c1b66802f533f4b6ebad72147e1fd6fe11c6cd7.zip
wintun: registry: revise value reading
- Make getStringValueRetry() reusable for reading any value type. This merges code from GetIntegerValueWait(). - expandString() >> toString() and extend to support REG_MULTI_SZ (to return first value of REG_MULTI_SZ). Furthermore, doing our own UTF-16 to UTF-8 conversion works around a bug in windows/registry's GetStringValue() non-zero terminated string handling. - Provide toInteger() analogous to toString() - GetStringValueWait() tolerates and reads REG_MULTI_SZ too now. It returns REG_MULTI_SZ[0], making GetFirstStringValueWait() redundant. Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to '')
-rw-r--r--tun/wintun/wintun_windows.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go
index 4dfc0bc..2e32f64 100644
--- a/tun/wintun/wintun_windows.go
+++ b/tun/wintun/wintun_windows.go
@@ -342,7 +342,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err
wintun.GetTcpipAdapterRegKeyName(), registry.QUERY_VALUE|registry.NOTIFY,
waitForRegistryTimeout)
if err == nil {
- _, err = registryEx.GetFirstStringValueWait(key, "IpConfig", waitForRegistryTimeout)
+ _, err = registryEx.GetStringValueWait(key, "IpConfig", waitForRegistryTimeout)
key.Close()
}
}