title: I want to enumerate devices via Ctypes,conversion problem
body: <p>I want to use Ctypes to enumerate the device, the following examples are C++ language I am not very good at converting, the following code is half of what I wrote</p>
  <p>My question is how to conversion this</p>
  <pre><code>//Enumerate through all devices in Set
  DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
  for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i,
      &amp;DeviceInfoData);i++)
  </code></pre>
  <p><a href="https://social.msdn.microsoft.com/forums/windowsdesktop/en-US/43ab4902-75b9-4c5c-9b54-4567c825539f/how-to-enumerate-hardware-devices-by-using-setupdi?forum=vcgeneral" rel="nofollow noreferrer">https://social.msdn.microsoft.com/forums/windowsdesktop/en-US/43ab4902-75b9-4c5c-9b54-4567c825539f/how-to-enumerate-hardware-devices-by-using-setupdi?forum=vcgeneral</a></p>
  <pre><code>import ctypes as ct
  from ctypes import wintypes as w
  
  SetupAPI = ct.WinDLL('SetupAPI')
  
  SetupAPI.SetupDiGetClassDevsW.argtypes = w.LPVOID,w.PWCHAR,w.HWND,w.DWORD
  SetupAPI.SetupDiGetClassDevsW.restype = w.HANDLE
  SetupAPI.SetupDiEnumDeviceInfo.argtypes = w.HANDLE,w.DWORD,w.HANDLE
  SetupAPI.SetupDiEnumDeviceInfo.restype = w.BOOLEAN 
  
  DIGCF_DEFAULT         =  0x00000001  
  DIGCF_PRESENT         =  0x00000002
  DIGCF_ALLCLASSES      =  0x00000004
  DIGCF_PROFILE         =  0x00000008
  DIGCF_DEVICEINTERFACE =  0x00000010
  
  ClassGuid = None
  Enumerator = None
  hwndParent = None
  Flags = DIGCF_PRESENT | DIGCF_ALLCLASSES
  
  DeviceInfoSet = None
  MemberIndex = None
  DeviceInfoData = None
  
  class SP_DEVINFO_DATA(ct.Structure):
      _fields_ = [
                  ('cbSize',w.DWORD),
                  ('ClassGuid',w.LPVOID),
                  ('DevInst',w.DWORD),
                  ('Reserved',w.ULONG),
                  ]
  
  SP_DEVINFO_DATA = SP_DEVINFO_DATA()
  
  hDevInfo = SetupAPI.SetupDiGetClassDevsW(
                                          ClassGuid,
                                          Enumerator,
                                          hwndParent,
                                          Flags
                                          )
  
  
  SP_DEVINFO_DATA.cbSize = ct.sizeof(SP_DEVINFO_DATA)
  
  DeviceInfoSet = hex(hDevInfo)
  MemberIndex = 1
  DeviceInfoData = ct.byref(SP_DEVINFO_DATA)
  
  SetupDiEnumDeviceInfo = SetupAPI.SetupDiEnumDeviceInfo(
                                DeviceInfoSet,
                                MemberIndex,
                                DeviceInfoData
                                )
  
  print(SetupDiEnumDeviceInfo)
  </code></pre>