title: How do you get the raw descriptor data from a USB HID device in Windows?
body: <p>How do you get the raw descriptor data from a HID device in Windows?</p>
  
  <p>Background:</p>
  
  <p>I need to get the Manufacturer, Product Name, and Serial Number from a HID device in Windows. I'm using hid.dll to access the devices using the <a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff538865(v=vs.85).aspx" rel="nofollow noreferrer">functions seen here</a>. My question is very similar <a href="https://stackoverflow.com/questions/22611445/how-do-i-get-the-vendor-and-product-strings-in-case-of-a-hid-device-on-windows">to this one</a>. I am able to get the manufacturer string and product string from SOME HID devices, but most fail to return this data with HidD_GetManufacturerString returning false. However, I KNOW these devices do have the string information in their descriptors because I am able to see it <a href="http://www.uwe-sieber.de/usbtreeview_e.html" rel="nofollow noreferrer">using USBTreeView</a>.</p>
  
  <p>The interesting thing is, even for the devices that do return manufacturer and product names, the values I'm getting through hid.dll are very different from the values I see using the above tool which gets the raw data from the USB device.</p>
  
  <p>For example, an Xbox 360 controller:</p>
  
  <pre><code>Via USB Tree View:
  Device Description       : Xbox 360 Controller for Windows
  Language 0x0409          : "©Microsoft Corporation"
  iProduct                 : 0x02
  Language 0x0409          : "Controller"
  iSerialNumber            : 0x03
  Language 0x0409          : "0843806"
  
  Via hid.dll using HidD_GetManufacturerString, HidD_GetProductString, and HidD_GetSerialNumberString:
  Description              : HID-compliant game controller
  Product                  : Controller (XBOX 360 Controller for Windows)
  Manufacturer             : FAILS
  Serial Number            : FAILS
  </code></pre>
  
  <p>WinUSB is unable to open these devices at all to retrieve this data as they do not use the winusb.sys driver.</p>
  
  <p>1) I don't understand why the values returned by the HidD functions do not match the values in the USB descriptor.
  2) I can't find any way to access the raw USB descriptor data for a HID device because I cannot access them with WinUSB.</p>
  
  <hr>
  
  <p>Edit 1:</p>
  
  <p>Okay, so I've learned a bit more about HID. It seems the data I'm getting through hid.dll is driver-specified data, not data coming from the USB device. HID can apply to devices on transports other than USB as well. So that's fine. Ultimately, what I really want to know is how can I get the USB device when I have the HID device and what API do I use for that. Besides WinUSB which doesn't work, the only thing I can find are kernel-level functions IOCTL. I don't know if that's suitable for a normal, non admin application.</p>