summaryrefslogtreecommitdiff
path: root/tun/wintun/wintun_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-03 09:34:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-03 09:34:00 +0200
commit81ca08f1b3ebd3d7b893e0bb39cd00e97827e1f7 (patch)
tree21e828e10bc0719aaea21b254c308195b229c09f /tun/wintun/wintun_windows.go
parent2e988467c2c9b7a94369f605bad6b08c70a9df7e (diff)
downloadwireguard-go-81ca08f1b3ebd3d7b893e0bb39cd00e97827e1f7.tar.gz
wireguard-go-81ca08f1b3ebd3d7b893e0bb39cd00e97827e1f7.zip
setupapi: safer aliasing of slice types
Diffstat (limited to '')
-rw-r--r--tun/wintun/wintun_windows.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go
index e1b46a8..69f6eb6 100644
--- a/tun/wintun/wintun_windows.go
+++ b/tun/wintun/wintun_windows.go
@@ -218,11 +218,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err
}
// Set Plug&Play device hardware ID property.
- hwid, err := syscall.UTF16FromString(hardwareID)
- if err != nil {
- return nil, false, err // syscall.UTF16FromString(hardwareID) should never fail: hardwareID is const string without NUL chars.
- }
- err = devInfoList.SetDeviceRegistryProperty(deviceData, setupapi.SPDRP_HARDWAREID, setupapi.UTF16ToBuf(append(hwid, 0)))
+ err = devInfoList.SetDeviceRegistryPropertyString(deviceData, setupapi.SPDRP_HARDWAREID, hardwareID)
if err != nil {
return nil, false, errors.New("SetupDiSetDeviceRegistryProperty(SPDRP_HARDWAREID) failed: " + err.Error())
}