summaryrefslogtreecommitdiffhomepage
path: root/tun/wintun
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-02-07 18:49:21 +0100
committerSimon Rozman <simon@rozman.si>2019-02-07 18:59:34 +0100
commitf7276ed522dd31ef427ec939ed2dc3af32071974 (patch)
tree04b76f53f05287711f18e0839bdb8d10b7a9ae5f /tun/wintun
parentc4b43e35a772305858e610d879c2b9d47f4d9866 (diff)
wintun: Implement TODO in TestSetupDiGetDeviceRegistryProperty()
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'tun/wintun')
-rw-r--r--tun/wintun/setupapi/setupapi_windows_test.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/tun/wintun/setupapi/setupapi_windows_test.go b/tun/wintun/setupapi/setupapi_windows_test.go
index e6b00c9..16d2603 100644
--- a/tun/wintun/setupapi/setupapi_windows_test.go
+++ b/tun/wintun/setupapi/setupapi_windows_test.go
@@ -10,6 +10,7 @@ import (
"syscall"
"testing"
+ "git.zx2c4.com/wireguard-go/tun/wintun/guid"
"golang.org/x/sys/windows"
)
@@ -302,9 +303,16 @@ func TestSetupDiGetDeviceRegistryProperty(t *testing.T) {
val, err = devInfoList.GetDeviceRegistryProperty(data, SPDRP_CLASSGUID)
if err != nil {
t.Errorf("Error calling SetupDiGetDeviceRegistryProperty(SPDRP_CLASSGUID): %s", err.Error())
- } /* TODO: Parse GUID string: else if classGUID, ok := val.(string); !ok || parseGUID(classGUID) != deviceClassNetGUID {
- t.Errorf("SetupDiGetDeviceRegistryProperty(SPDRP_CLASSGUID) should return %x", deviceClassNetGUID)
- }*/
+ } else if valStr, ok := val.(string); !ok {
+ t.Errorf("SetupDiGetDeviceRegistryProperty(SPDRP_CLASSGUID) should return string")
+ } else {
+ classGUID, err := guid.FromString(valStr)
+ if err != nil {
+ t.Errorf("Error parsing GUID returned by SetupDiGetDeviceRegistryProperty(SPDRP_CLASSGUID): %s", err.Error())
+ } else if *classGUID != deviceClassNetGUID {
+ t.Errorf("SetupDiGetDeviceRegistryProperty(SPDRP_CLASSGUID) should return %x", deviceClassNetGUID)
+ }
+ }
val, err = devInfoList.GetDeviceRegistryProperty(data, SPDRP_COMPATIBLEIDS)
if err != nil {