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/types_windows.go | |
parent | Finish support for setupapi.SetupDiGetClassDevsEx() (diff) | |
download | wireguard-go-45959c116aae4c81e0be7bec8ab21d2f715caddf.tar.xz wireguard-go-45959c116aae4c81e0be7bec8ab21d2f715caddf.zip |
Add support for setupapi.SetupDiGetDeviceInfoListDetail()
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'setupapi/types_windows.go')
-rw-r--r-- | setupapi/types_windows.go | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/setupapi/types_windows.go b/setupapi/types_windows.go new file mode 100644 index 0000000..bf7d67b --- /dev/null +++ b/setupapi/types_windows.go @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: MIT + * + * Copyright (C) 2019 WireGuard LLC. All Rights Reserved. + */ + +package setupapi + +import ( + "golang.org/x/sys/windows" +) + +type DIGCF uint32 + +const ( + DIGCF_DEFAULT DIGCF = 0x00000001 // only valid with DIGCF_DEVICEINTERFACE + DIGCF_PRESENT DIGCF = 0x00000002 + DIGCF_ALLCLASSES DIGCF = 0x00000004 + DIGCF_PROFILE DIGCF = 0x00000008 + DIGCF_DEVICEINTERFACE DIGCF = 0x00000010 +) + +type DevInfo windows.Handle + +// SetupDiDestroyDeviceInfoList function deletes a device information set and frees all associated memory. +func (h DevInfo) Close() error { + if h != DevInfo(windows.InvalidHandle) { + return SetupDiDestroyDeviceInfoList(h) + } + + return nil +} + +const ( + // SP_MAX_MACHINENAME_LENGTH defines maximum length of a machine name in the format expected by ConfigMgr32 CM_Connect_Machine (i.e., "\\\\MachineName\0"). + SP_MAX_MACHINENAME_LENGTH = windows.MAX_PATH + 3 +) + +// SP_DEVINFO_LIST_DETAIL_DATA is a structure for detailed information on a device information set (used for SetupDiGetDeviceInfoListDetail which supercedes the functionality of SetupDiGetDeviceInfoListClass). +type SP_DEVINFO_LIST_DETAIL_DATA struct { + Size uint32 + ClassGUID windows.GUID + RemoteMachineHandle windows.Handle + RemoteMachineName [SP_MAX_MACHINENAME_LENGTH]uint16 +} + +// 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 +} |