summaryrefslogtreecommitdiffhomepage
path: root/tun/wintun/setupapi
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-03-22 15:28:33 +0100
committerSimon Rozman <simon@rozman.si>2019-03-22 15:29:14 +0100
commit41c30a72791999aac8973b82224d3d4b9162dd51 (patch)
tree08ed7cae2a4f4722a272d139b2b0b5619ec26a11 /tun/wintun/setupapi
parent4b1db1d39bc6383ed360cfecc7cc9f1dac976dfa (diff)
tun: windows: Adapter devices renamed to WINTUN<LUID Index>
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'tun/wintun/setupapi')
-rw-r--r--tun/wintun/setupapi/setupapi_windows.go29
-rw-r--r--tun/wintun/setupapi/setupapi_windows_test.go5
2 files changed, 0 insertions, 34 deletions
diff --git a/tun/wintun/setupapi/setupapi_windows.go b/tun/wintun/setupapi/setupapi_windows.go
index 486a1ff..71732a4 100644
--- a/tun/wintun/setupapi/setupapi_windows.go
+++ b/tun/wintun/setupapi/setupapi_windows.go
@@ -7,14 +7,12 @@ package setupapi
import (
"encoding/binary"
- "errors"
"fmt"
"syscall"
"unsafe"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/registry"
- "golang.zx2c4.com/wireguard/tun/wintun/guid"
)
//sys setupDiCreateDeviceInfoListEx(classGUID *windows.GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) [failretval==DevInfo(windows.InvalidHandle)] = setupapi.SetupDiCreateDeviceInfoListExW
@@ -236,33 +234,6 @@ func (deviceInfoSet DevInfo) OpenDevRegKey(DeviceInfoData *DevInfoData, Scope DI
return SetupDiOpenDevRegKey(deviceInfoSet, DeviceInfoData, Scope, HwProfile, KeyType, samDesired)
}
-// GetInterfaceID method returns network interface ID.
-func (deviceInfoSet DevInfo) GetInterfaceID(deviceInfoData *DevInfoData) (*windows.GUID, error) {
- // Open HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\<class>\<id> registry key.
- key, err := deviceInfoSet.OpenDevRegKey(deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DRV, registry.READ)
- if err != nil {
- return nil, errors.New("Device-specific registry key open failed: " + err.Error())
- }
- defer key.Close()
-
- // Read the NetCfgInstanceId value.
- value, valueType, err := key.GetStringValue("NetCfgInstanceId")
- if err != nil {
- return nil, errors.New("RegQueryStringValue(\"NetCfgInstanceId\") failed: " + err.Error())
- }
- if valueType != registry.SZ {
- return nil, fmt.Errorf("NetCfgInstanceId registry value is not REG_SZ (expected: %v, provided: %v)", registry.SZ, valueType)
- }
-
- // Convert to windows.GUID.
- ifid, err := guid.FromString(value)
- if err != nil {
- return nil, fmt.Errorf("NetCfgInstanceId registry value is not a GUID (expected: \"{...}\", provided: %q)", value)
- }
-
- return ifid, nil
-}
-
//sys setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetDeviceRegistryPropertyW
// SetupDiGetDeviceRegistryProperty function retrieves a specified Plug and Play device property.
diff --git a/tun/wintun/setupapi/setupapi_windows_test.go b/tun/wintun/setupapi/setupapi_windows_test.go
index c6f4a15..30f3692 100644
--- a/tun/wintun/setupapi/setupapi_windows_test.go
+++ b/tun/wintun/setupapi/setupapi_windows_test.go
@@ -291,11 +291,6 @@ func TestSetupDiOpenDevRegKey(t *testing.T) {
t.Errorf("Error calling SetupDiOpenDevRegKey: %s", err.Error())
}
defer key.Close()
-
- _, err = devInfoList.GetInterfaceID(data)
- if err != nil {
- t.Errorf("Error calling GetInterfaceID: %s", err.Error())
- }
}
}