diff options
author | Simon Rozman <simon@rozman.si> | 2019-02-04 11:40:44 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-02-05 12:59:42 +0100 |
commit | 38c7acd70f408e63a70ff45f01d0a22f2c4ac2c7 (patch) | |
tree | 4a0f705cd834b3445c934db1714537c1ee795322 /setupapi/setupapi_windows.go | |
parent | 20f1512b7c5bdc0fc0b7aaf53fa9d6eba8f7d0a6 (diff) | |
download | wireguard-go-38c7acd70f408e63a70ff45f01d0a22f2c4ac2c7.tar.gz wireguard-go-38c7acd70f408e63a70ff45f01d0a22f2c4ac2c7.zip |
Simplify SetupDiEnumDeviceInfo() synopsis
The SetupDiEnumDeviceInfo() now returns a SP_DEVINFO_DATA rather than
taking it on input to fill it on return.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'setupapi/setupapi_windows.go')
-rw-r--r-- | setupapi/setupapi_windows.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/setupapi/setupapi_windows.go b/setupapi/setupapi_windows.go index 67793b2..95c5ba6 100644 --- a/setupapi/setupapi_windows.go +++ b/setupapi/setupapi_windows.go @@ -122,9 +122,11 @@ func SetupDiGetDeviceInfoListDetail(DeviceInfoSet DevInfo) (data *DevInfoListDet } // SetupDiEnumDeviceInfo function returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set. -func SetupDiEnumDeviceInfo(DeviceInfoSet DevInfo, MemberIndex int, data *SP_DEVINFO_DATA) error { - data.Size = uint32(unsafe.Sizeof(*data)) - return setupDiEnumDeviceInfo(DeviceInfoSet, uint32(MemberIndex), data) +func SetupDiEnumDeviceInfo(DeviceInfoSet DevInfo, MemberIndex int) (DeviceInfoData *SP_DEVINFO_DATA, err error) { + data := SP_DEVINFO_DATA{} + data.Size = uint32(unsafe.Sizeof(data)) + + return &data, setupDiEnumDeviceInfo(DeviceInfoSet, uint32(MemberIndex), &data) } // SetupDiOpenDevRegKey function opens a registry key for device-specific configuration information. |