]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
windows: use proper constants from updated x/sys
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 12 Apr 2019 23:58:53 +0000 (01:58 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sat, 13 Apr 2019 00:02:02 +0000 (02:02 +0200)
go.mod
go.sum
tun/wintun/setupapi/setupapi_windows_test.go
tun/wintun/setupapi/zsetupapi_windows_test.go
tun/wintun/wintun_windows.go

diff --git a/go.mod b/go.mod
index 871678024202cc2161fe5cf80806c88bf81bdf5a..98210f9d3c8880d461fb0ccdc3d16689c5c36d0d 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -1,8 +1,10 @@
 module golang.zx2c4.com/wireguard
 
+go 1.12
+
 require (
        github.com/Microsoft/go-winio v0.4.12
-       golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576
-       golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53
-       golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54
+       golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a
+       golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
+       golang.org/x/sys v0.0.0-20190412213103-97732733099d
 )
diff --git a/go.sum b/go.sum
index e47d20f23f88efadc4f225e1d85c778e86fe7ec7..939576985a1480e273d6e88d2c2556223c8aa06a 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -1,11 +1,12 @@
 github.com/Microsoft/go-winio v0.4.12 h1:xAfWHN1IrQ0NJ9TBC0KBZoqLjzDTr1ML+4MywiUOryc=
 github.com/Microsoft/go-winio v0.4.12/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576 h1:aUX/1G2gFSs4AsJJg2cL3HuoRhCSCz733FE5GUSuaT4=
-golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53 h1:kcXqo9vE6fsZY5X5Rd7R1l7fTgnWaDCVmln65REefiE=
-golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a h1:Igim7XhdOpBnWPuYJ70XcNpq8q3BCACtVgNfoJxOV7g=
+golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54 h1:xe1/2UUJRmA9iDglQSlkx8c5n3twv58+K0mPpC2zmhA=
-golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
index 30f36920d3bf6e0ae894e577ab6d1e1a48231c7d..73cad7cd79d77fcef41dd816b8e0fcd4e52fff3a 100644 (file)
@@ -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")
                }
        }
index 09b9195955aa4faa30c0d8b1f5d2f5beab0f0304..915b4273c5c9bcb4741fd65e2130e25b1679f519 100644 (file)
@@ -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")
        }
 }
index 8e09c411b22cb6bbfd43e3b07fb78aaa1756d308..eae283bc2c252defce126b143a0b1269767fcaf1 100644 (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