K
koushi007
Hi
I am trying to get the device descriptor of a storage device in order
to extract the vendor ID and Product ID. In the actual program the
handle for the device is obtained through another module which gets
the handle for the user specified mass storage device.
I had tried to get USB_DEVICE_DESCRIPTOR, DEVICE_DESCRIPTOR using
IOCTL_GET_USB_DESCRIPTOR and ICOTL_GET_DEVICE_DESCRIPTOR. however both
the Device IO functions exit with the error "The request is not
supported".
Can some one please help me out in getting the Vendor ID and Product
ID of a storage device?
Thanks and Regards
Sundaram
PS: The portion of the code I have attached
//DEVICE_DESCRIPTOR
bResult = DeviceIoControl(hDevice,
IOCTL_GET_DEVICE_DESCRIPTOR,
DevDescriptor, sizeof(*DevDescriptor),
DevDescriptor, sizeof(*DevDescriptor),
&lpBytesReturned,
(LPOVERLAPPED) NULL);
CloseHandle(hDevice);
//USB_DEVICE_DESCRIPTOR
ScanDesc.DescriptorType = USB_STRING_DESCRIPTOR_TYPE;
ScanDesc.Index = 4;
ScanDesc.LanguageId = 0;
DevDescriptor->bDescriptorType = USB_STRING_DESCRIPTOR_TYPE;
bResult = DeviceIoControl(hDevice,
IOCTL_GET_USB_DESCRIPTOR,
&ScanDesc, sizeof(ScanDesc),
DevDescriptor, sizeof(*DevDescriptor),
&lpBytesReturned,
(LPOVERLAPPED) NULL);
I am trying to get the device descriptor of a storage device in order
to extract the vendor ID and Product ID. In the actual program the
handle for the device is obtained through another module which gets
the handle for the user specified mass storage device.
I had tried to get USB_DEVICE_DESCRIPTOR, DEVICE_DESCRIPTOR using
IOCTL_GET_USB_DESCRIPTOR and ICOTL_GET_DEVICE_DESCRIPTOR. however both
the Device IO functions exit with the error "The request is not
supported".
Can some one please help me out in getting the Vendor ID and Product
ID of a storage device?
Thanks and Regards
Sundaram
PS: The portion of the code I have attached
//DEVICE_DESCRIPTOR
bResult = DeviceIoControl(hDevice,
IOCTL_GET_DEVICE_DESCRIPTOR,
DevDescriptor, sizeof(*DevDescriptor),
DevDescriptor, sizeof(*DevDescriptor),
&lpBytesReturned,
(LPOVERLAPPED) NULL);
CloseHandle(hDevice);
//USB_DEVICE_DESCRIPTOR
ScanDesc.DescriptorType = USB_STRING_DESCRIPTOR_TYPE;
ScanDesc.Index = 4;
ScanDesc.LanguageId = 0;
DevDescriptor->bDescriptorType = USB_STRING_DESCRIPTOR_TYPE;
bResult = DeviceIoControl(hDevice,
IOCTL_GET_USB_DESCRIPTOR,
&ScanDesc, sizeof(ScanDesc),
DevDescriptor, sizeof(*DevDescriptor),
&lpBytesReturned,
(LPOVERLAPPED) NULL);