windows: use proper constants from updated x/sys

This commit is contained in:
Jason A. Donenfeld
2019-04-13 01:58:53 +02:00
parent 0b77bf78cd
commit e0a8c22aa6
5 changed files with 28 additions and 25 deletions

View File

@@ -114,7 +114,7 @@ func GetInterface(ifname string, hwndParent uintptr) (*Wintun, error) {
// Get the device from the list. Should anything be wrong with this device, continue with next.
deviceData, err := devInfoList.EnumDeviceInfo(index)
if err != nil {
if errWin, ok := err.(syscall.Errno); ok && errWin == 259 /*ERROR_NO_MORE_ITEMS*/ {
if errWin, ok := err.(syscall.Errno); ok && errWin == windows.ERROR_NO_MORE_ITEMS {
break
}
continue
@@ -145,7 +145,7 @@ func GetInterface(ifname string, hwndParent uintptr) (*Wintun, error) {
// Get a driver from the list.
driverData, err := devInfoList.EnumDriverInfo(deviceData, driverType, index)
if err != nil {
if errWin, ok := err.(syscall.Errno); ok && errWin == 259 /*ERROR_NO_MORE_ITEMS*/ {
if errWin, ok := err.(syscall.Errno); ok && errWin == windows.ERROR_NO_MORE_ITEMS {
break
}
// Something is wrong with this driver. Skip it.
@@ -236,7 +236,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err
// Get a driver from the list.
driverData, err := devInfoList.EnumDriverInfo(deviceData, driverType, index)
if err != nil {
if errWin, ok := err.(syscall.Errno); ok && errWin == 259 /*ERROR_NO_MORE_ITEMS*/ {
if errWin, ok := err.(syscall.Errno); ok && errWin == windows.ERROR_NO_MORE_ITEMS {
break
}
// Something is wrong with this driver. Skip it.
@@ -364,7 +364,7 @@ func (wintun *Wintun) DeleteInterface(hwndParent uintptr) (bool, bool, error) {
// Get the device from the list. Should anything be wrong with this device, continue with next.
deviceData, err := devInfoList.EnumDeviceInfo(index)
if err != nil {
if errWin, ok := err.(syscall.Errno); ok && errWin == 259 /*ERROR_NO_MORE_ITEMS*/ {
if errWin, ok := err.(syscall.Errno); ok && errWin == windows.ERROR_NO_MORE_ITEMS {
break
}
continue