wintun: Implement TODO in TestSetupDiGetDeviceRegistryProperty()

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-02-07 18:49:21 +01:00
parent c4b43e35a7
commit f7276ed522

View file

@ -10,6 +10,7 @@ import (
"syscall" "syscall"
"testing" "testing"
"git.zx2c4.com/wireguard-go/tun/wintun/guid"
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )
@ -302,9 +303,16 @@ func TestSetupDiGetDeviceRegistryProperty(t *testing.T) {
val, err = devInfoList.GetDeviceRegistryProperty(data, SPDRP_CLASSGUID) val, err = devInfoList.GetDeviceRegistryProperty(data, SPDRP_CLASSGUID)
if err != nil { if err != nil {
t.Errorf("Error calling SetupDiGetDeviceRegistryProperty(SPDRP_CLASSGUID): %s", err.Error()) t.Errorf("Error calling SetupDiGetDeviceRegistryProperty(SPDRP_CLASSGUID): %s", err.Error())
} /* TODO: Parse GUID string: else if classGUID, ok := val.(string); !ok || parseGUID(classGUID) != 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) t.Errorf("SetupDiGetDeviceRegistryProperty(SPDRP_CLASSGUID) should return %x", deviceClassNetGUID)
}*/ }
}
val, err = devInfoList.GetDeviceRegistryProperty(data, SPDRP_COMPATIBLEIDS) val, err = devInfoList.GetDeviceRegistryProperty(data, SPDRP_COMPATIBLEIDS)
if err != nil { if err != nil {