summaryrefslogtreecommitdiff
path: root/setupapi/setupapi_windows.go
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-02-05 14:03:28 +0100
committerSimon Rozman <simon@rozman.si>2019-02-05 14:03:28 +0100
commit7b636380e50f257e7f1b98b6b5829a24166e2000 (patch)
tree3b0509d0548c8d911dc7d97b8af9b57e33f314c0 /setupapi/setupapi_windows.go
parent99a3b628e9f2405a4acaa84c7a8fb74cfa6bbe6e (diff)
downloadwireguard-go-7b636380e50f257e7f1b98b6b5829a24166e2000.tar.gz
wireguard-go-7b636380e50f257e7f1b98b6b5829a24166e2000.zip
setupapi: Move Go<>Windows struct marshaling to types_windows.go
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'setupapi/setupapi_windows.go')
-rw-r--r--setupapi/setupapi_windows.go31
1 files changed, 4 insertions, 27 deletions
diff --git a/setupapi/setupapi_windows.go b/setupapi/setupapi_windows.go
index 0a833ed..750a81b 100644
--- a/setupapi/setupapi_windows.go
+++ b/setupapi/setupapi_windows.go
@@ -41,11 +41,7 @@ func SetupDiGetDeviceInfoListDetail(DeviceInfoSet DevInfo) (DeviceInfoSetDetailD
return
}
- return &DevInfoListDetailData{
- ClassGUID: _data.ClassGUID,
- RemoteMachineHandle: _data.RemoteMachineHandle,
- RemoteMachineName: windows.UTF16ToString(_data.RemoteMachineName[:]),
- }, nil
+ return _data.toGo(), nil
}
// GetDeviceInfoListDetail method retrieves information associated with a device information set including the class GUID, remote computer handle, and remote computer name.
@@ -247,15 +243,7 @@ func SetupDiGetDeviceInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEV
return
}
- return &DevInstallParams{
- Flags: _data.Flags,
- FlagsEx: _data.FlagsEx,
- hwndParent: _data.hwndParent,
- InstallMsgHandler: _data.InstallMsgHandler,
- InstallMsgHandlerContext: _data.InstallMsgHandlerContext,
- FileQueue: _data.FileQueue,
- DriverPath: windows.UTF16ToString(_data.DriverPath[:]),
- }, nil
+ return _data.toGo(), nil
}
// GetDeviceInstallParams method retrieves device installation parameters for a device information set or a particular device information element.
@@ -275,23 +263,12 @@ func (DeviceInfoSet DevInfo) GetClassInstallParams(DeviceInfoData *SP_DEVINFO_DA
// SetupDiSetDeviceInstallParams function sets device installation parameters for a device information set or a particular device information element.
func SetupDiSetDeviceInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA, DeviceInstallParams *DevInstallParams) (err error) {
- _data := _SP_DEVINSTALL_PARAMS{
- Flags: DeviceInstallParams.Flags,
- FlagsEx: DeviceInstallParams.FlagsEx,
- hwndParent: DeviceInstallParams.hwndParent,
- InstallMsgHandler: DeviceInstallParams.InstallMsgHandler,
- InstallMsgHandlerContext: DeviceInstallParams.InstallMsgHandlerContext,
- FileQueue: DeviceInstallParams.FileQueue,
- }
- _data.Size = uint32(unsafe.Sizeof(_data))
-
- driverPathUTF16, err := syscall.UTF16FromString(DeviceInstallParams.DriverPath)
+ _data, err := DeviceInstallParams.toWindows()
if err != nil {
return
}
- copy(_data.DriverPath[:], driverPathUTF16)
- return setupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &_data)
+ return setupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, _data)
}
// SetDeviceInstallParams member sets device installation parameters for a device information set or a particular device information element.