diff options
author | Simon Rozman <simon@rozman.si> | 2019-02-01 11:39:57 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-02-05 12:59:42 +0100 |
commit | 45959c116aae4c81e0be7bec8ab21d2f715caddf (patch) | |
tree | d2fa7c436463ca1366a7330924055c3483456b82 /setupapi/zsetupapi_windows.go | |
parent | d41bc015ccc06feedd21c0a87b0a44a02b74d530 (diff) |
Add support for setupapi.SetupDiGetDeviceInfoListDetail()
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'setupapi/zsetupapi_windows.go')
-rw-r--r-- | setupapi/zsetupapi_windows.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/setupapi/zsetupapi_windows.go b/setupapi/zsetupapi_windows.go index bce8c08..47f5464 100644 --- a/setupapi/zsetupapi_windows.go +++ b/setupapi/zsetupapi_windows.go @@ -39,12 +39,13 @@ func errnoErr(e syscall.Errno) error { var ( modsetupapi = windows.NewLazySystemDLL("setupapi.dll") - procSetupDiGetClassDevsExW = modsetupapi.NewProc("SetupDiGetClassDevsExW") - procSetupDiDestroyDeviceInfoList = modsetupapi.NewProc("SetupDiDestroyDeviceInfoList") + procSetupDiGetClassDevsExW = modsetupapi.NewProc("SetupDiGetClassDevsExW") + procSetupDiDestroyDeviceInfoList = modsetupapi.NewProc("SetupDiDestroyDeviceInfoList") + procSetupDiGetDeviceInfoListDetailW = modsetupapi.NewProc("SetupDiGetDeviceInfoListDetailW") ) -func setupDiGetClassDevsEx(ClassGuid *windows.GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, DeviceInfoSet DevInfo, MachineName *uint16, reserved uintptr) (handle DevInfo, err error) { - r0, _, e1 := syscall.Syscall9(procSetupDiGetClassDevsExW.Addr(), 7, uintptr(unsafe.Pointer(ClassGuid)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(DeviceInfoSet), uintptr(unsafe.Pointer(MachineName)), uintptr(reserved), 0, 0) +func setupDiGetClassDevsEx(ClassGUID *windows.GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, DeviceInfoSet DevInfo, MachineName *uint16, reserved uintptr) (handle DevInfo, err error) { + r0, _, e1 := syscall.Syscall9(procSetupDiGetClassDevsExW.Addr(), 7, uintptr(unsafe.Pointer(ClassGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(DeviceInfoSet), uintptr(unsafe.Pointer(MachineName)), uintptr(reserved), 0, 0) handle = DevInfo(r0) if handle == DevInfo(windows.InvalidHandle) { if e1 != 0 { @@ -67,3 +68,15 @@ func SetupDiDestroyDeviceInfoList(DeviceInfoSet DevInfo) (err error) { } return } + +func setupDiGetDeviceInfoListDetail(DeviceInfoSet DevInfo, DeviceInfoSetDetailData *SP_DEVINFO_LIST_DETAIL_DATA) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInfoListDetailW.Addr(), 2, uintptr(DeviceInfoSet), uintptr(unsafe.Pointer(DeviceInfoSetDetailData)), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} |