/* Opens the USB device and obtains its handle, which is needed to obtain a handle to the WinUSB device.  */
static HANDLE UblOpenDevice(LPCGUID InterfaceGuid)
/* Opens the USB device and obtains its handle, which is needed to obtain a handle to the WinUSB device.  */
static HANDLE UblOpenDevice(LPCGUID InterfaceGuid)
{
  HANDLE hDev = NULL;
  char devicePath[MAX_DEVPATH_LENGTH] = { 0 };
  BOOL retVal;
  retVal = UblGetDevicePath(InterfaceGuid, devicePath, sizeof(devicePath));
  if (retVal)
  {
    hDev = CreateFile(devicePath, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE |
                      FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
                      FILE_FLAG_OVERLAPPED, NULL);
  }
  return hDev;
}