diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-13 01:58:53 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-13 02:02:02 +0200 |
commit | e0a8c22aa64d6a606cb03e3fd09eaa3e62a2f7c9 (patch) | |
tree | 1a1c1d8bd027367ae3efb23f88ef3333e5b5e689 /tun/wintun/setupapi | |
parent | 0b77bf78cda24582688325cf3197866b60aed69e (diff) |
windows: use proper constants from updated x/sys
Diffstat (limited to 'tun/wintun/setupapi')
-rw-r--r-- | tun/wintun/setupapi/setupapi_windows_test.go | 22 | ||||
-rw-r--r-- | tun/wintun/setupapi/zsetupapi_windows_test.go | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/tun/wintun/setupapi/setupapi_windows_test.go b/tun/wintun/setupapi/setupapi_windows_test.go index 30f3692..73cad7c 100644 --- a/tun/wintun/setupapi/setupapi_windows_test.go +++ b/tun/wintun/setupapi/setupapi_windows_test.go @@ -131,7 +131,7 @@ func TestSetupDiEnumDeviceInfo(t *testing.T) { for i := 0; true; i++ { data, err := devInfoList.EnumDeviceInfo(i) 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 @@ -153,7 +153,7 @@ func TestDevInfo_BuildDriverInfoList(t *testing.T) { for i := 0; true; i++ { deviceData, err := devInfoList.EnumDeviceInfo(i) 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 @@ -170,7 +170,7 @@ func TestDevInfo_BuildDriverInfoList(t *testing.T) { for j := 0; true; j++ { driverData, err := devInfoList.EnumDriverInfo(deviceData, driverType, j) 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 @@ -264,7 +264,7 @@ func TestSetupDiGetClassDevsEx(t *testing.T) { devInfoList.Close() t.Errorf("SetupDiGetClassDevsEx(nil, ...) should fail") } else { - if errWin, ok := err.(syscall.Errno); !ok || errWin != 87 /*ERROR_INVALID_PARAMETER*/ { + if errWin, ok := err.(syscall.Errno); !ok || errWin != windows.ERROR_INVALID_PARAMETER { t.Errorf("SetupDiGetClassDevsEx(nil, ...) should fail with ERROR_INVALID_PARAMETER") } } @@ -280,7 +280,7 @@ func TestSetupDiOpenDevRegKey(t *testing.T) { for i := 0; true; i++ { data, err := devInfoList.EnumDeviceInfo(i) 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 @@ -304,7 +304,7 @@ func TestSetupDiGetDeviceRegistryProperty(t *testing.T) { for i := 0; true; i++ { data, err := devInfoList.EnumDeviceInfo(i) 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 @@ -334,7 +334,7 @@ func TestSetupDiGetDeviceRegistryProperty(t *testing.T) { val, err = devInfoList.GetDeviceRegistryProperty(data, SPDRP_COMPATIBLEIDS) if err != nil { // Some devices have no SPDRP_COMPATIBLEIDS. - if errWin, ok := err.(syscall.Errno); !ok || errWin != 13 /*windows.ERROR_INVALID_DATA*/ { + if errWin, ok := err.(syscall.Errno); !ok || errWin != windows.ERROR_INVALID_DATA { t.Errorf("Error calling SetupDiGetDeviceRegistryProperty(SPDRP_COMPATIBLEIDS): %s", err.Error()) } } @@ -361,7 +361,7 @@ func TestSetupDiGetDeviceInstallParams(t *testing.T) { for i := 0; true; i++ { data, err := devInfoList.EnumDeviceInfo(i) 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 @@ -399,7 +399,7 @@ func TestSetupDiClassNameFromGuidEx(t *testing.T) { if err == nil { t.Errorf("SetupDiClassNameFromGuidEx(nil) should fail") } else { - if errWin, ok := err.(syscall.Errno); !ok || errWin != 1784 /*ERROR_INVALID_USER_BUFFER*/ { + if errWin, ok := err.(syscall.Errno); !ok || errWin != windows.ERROR_INVALID_USER_BUFFER { t.Errorf("SetupDiClassNameFromGuidEx(nil) should fail with ERROR_INVALID_USER_BUFFER") } } @@ -440,7 +440,7 @@ func TestSetupDiGetSelectedDevice(t *testing.T) { for i := 0; true; i++ { data, err := devInfoList.EnumDeviceInfo(i) 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 @@ -463,7 +463,7 @@ func TestSetupDiGetSelectedDevice(t *testing.T) { if err == nil { t.Errorf("SetupDiSetSelectedDevice(nil) should fail") } else { - if errWin, ok := err.(syscall.Errno); !ok || errWin != 87 /*ERROR_INVALID_PARAMETER*/ { + if errWin, ok := err.(syscall.Errno); !ok || errWin != windows.ERROR_INVALID_PARAMETER { t.Errorf("SetupDiSetSelectedDevice(nil) should fail with ERROR_INVALID_USER_BUFFER") } } diff --git a/tun/wintun/setupapi/zsetupapi_windows_test.go b/tun/wintun/setupapi/zsetupapi_windows_test.go index 09b9195..915b427 100644 --- a/tun/wintun/setupapi/zsetupapi_windows_test.go +++ b/tun/wintun/setupapi/zsetupapi_windows_test.go @@ -14,7 +14,7 @@ import ( func TestSetupDiDestroyDeviceInfoList(t *testing.T) { err := SetupDiDestroyDeviceInfoList(DevInfo(windows.InvalidHandle)) - if errWin, ok := err.(syscall.Errno); !ok || errWin != 6 /*ERROR_INVALID_HANDLE*/ { + if errWin, ok := err.(syscall.Errno); !ok || errWin != windows.ERROR_INVALID_HANDLE { t.Errorf("SetupDiDestroyDeviceInfoList(nil, ...) should fail with ERROR_INVALID_HANDLE") } } |