summaryrefslogtreecommitdiffhomepage
path: root/tun/wintun/wintun_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-08-28 08:39:26 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2019-08-28 08:39:26 -0600
commitda28a3e9f3abc3e117a777452ba887090fd0ad98 (patch)
treef329168a2fb5a69de06b2786ecba40ae829ee157 /tun/wintun/wintun_windows.go
parent3bf3322b2c5b27aca852b12c3fabb2ce91d6f445 (diff)
wintun: give better errors when ndis interface listing fails
Diffstat (limited to 'tun/wintun/wintun_windows.go')
-rw-r--r--tun/wintun/wintun_windows.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go
index bae1089..b558fd6 100644
--- a/tun/wintun/wintun_windows.go
+++ b/tun/wintun/wintun_windows.go
@@ -687,11 +687,11 @@ func (wintun *Wintun) deviceData() (setupapi.DevInfo, *setupapi.DevInfoData, err
func (wintun *Wintun) AdapterHandle() (windows.Handle, error) {
interfaces, err := setupapi.CM_Get_Device_Interface_List(wintun.devInstanceID, &deviceInterfaceNetGUID, setupapi.CM_GET_DEVICE_INTERFACE_LIST_PRESENT)
if err != nil {
- return windows.InvalidHandle, err
+ return windows.InvalidHandle, fmt.Errorf("Error listing NDIS interfaces: %v", err)
}
handle, err := windows.CreateFile(windows.StringToUTF16Ptr(interfaces[0]), windows.GENERIC_READ|windows.GENERIC_WRITE, windows.FILE_SHARE_READ|windows.FILE_SHARE_WRITE|windows.FILE_SHARE_DELETE, nil, windows.OPEN_EXISTING, 0, 0)
if err != nil {
- return windows.InvalidHandle, fmt.Errorf("Open NDIS device failed: %v", err)
+ return windows.InvalidHandle, fmt.Errorf("Error opening NDIS device: %v", err)
}
return handle, nil
}