aboutsummaryrefslogtreecommitdiffstats
path: root/tun/wintun/setupapi/types_windows.go
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-02-07 22:23:03 +0100
committerSimon Rozman <simon@rozman.si>2019-02-07 23:49:50 +0100
commit05d25fd1b71aaad8f542999851d472d63b724ae2 (patch)
tree4d9d20b7e5ed80a154d8c522b4338e267c58de84 /tun/wintun/setupapi/types_windows.go
parentsetupapi: Rename SP_DEVINFO_DATA to DevInfoData (diff)
downloadwireguard-go-05d25fd1b71aaad8f542999851d472d63b724ae2.tar.xz
wireguard-go-05d25fd1b71aaad8f542999851d472d63b724ae2.zip
setupapi: Merge _SP_DEVINFO_LIST_DETAIL_DATA and DevInfoListDetailData
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'tun/wintun/setupapi/types_windows.go')
-rw-r--r--tun/wintun/setupapi/types_windows.go27
1 files changed, 13 insertions, 14 deletions
diff --git a/tun/wintun/setupapi/types_windows.go b/tun/wintun/setupapi/types_windows.go
index 23bee25..a37fdec 100644
--- a/tun/wintun/setupapi/types_windows.go
+++ b/tun/wintun/setupapi/types_windows.go
@@ -57,26 +57,25 @@ type DevInfoData struct {
_ uintptr
}
-type _SP_DEVINFO_LIST_DETAIL_DATA struct {
- Size uint32
+// DevInfoListDetailData is a structure for detailed information on a device information set (used for SetupDiGetDeviceInfoListDetail which supercedes the functionality of SetupDiGetDeviceInfoListClass).
+type DevInfoListDetailData struct {
+ size uint32
ClassGUID windows.GUID
RemoteMachineHandle windows.Handle
- RemoteMachineName [SP_MAX_MACHINENAME_LENGTH]uint16
+ remoteMachineName [SP_MAX_MACHINENAME_LENGTH]uint16
}
-func (_data *_SP_DEVINFO_LIST_DETAIL_DATA) toGo() *DevInfoListDetailData {
- return &DevInfoListDetailData{
- ClassGUID: _data.ClassGUID,
- RemoteMachineHandle: _data.RemoteMachineHandle,
- RemoteMachineName: windows.UTF16ToString(_data.RemoteMachineName[:]),
- }
+func (data *DevInfoListDetailData) GetRemoteMachineName() string {
+ return windows.UTF16ToString(data.remoteMachineName[:])
}
-// DevInfoListDetailData is a structure for detailed information on a device information set (used for SetupDiGetDeviceInfoListDetail which supercedes the functionality of SetupDiGetDeviceInfoListClass).
-type DevInfoListDetailData struct {
- ClassGUID windows.GUID
- RemoteMachineHandle windows.Handle
- RemoteMachineName string
+func (data *DevInfoListDetailData) SetRemoteMachineName(remoteMachineName string) error {
+ str, err := syscall.UTF16FromString(remoteMachineName)
+ if err != nil {
+ return err
+ }
+ copy(data.remoteMachineName[:], str)
+ return nil
}
// DI_FUNCTION is function type for device installer