]> git.ipfire.org Git - thirdparty/wireguard-go.git/commit
wintun: registry: revise value reading
authorSimon Rozman <simon@rozman.si>
Sat, 11 May 2019 04:21:02 +0000 (06:21 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sat, 11 May 2019 15:14:37 +0000 (17:14 +0200)
commit6c1b66802f533f4b6ebad72147e1fd6fe11c6cd7
tree6f5f3be5dd60ba6a0da04ce27f04b1f6c8356b69
parent5669ed326f1a1c535c1251f07a31323ec3c60ef1
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>
tun/wintun/registry/registry_windows.go
tun/wintun/wintun_windows.go