Windows Driver Kit: Human Input Devices
HidD_GetProductString
The HidD_GetProductString routine returns the embedded string of a top-level collection that identifies the manufacturer's product.
BOOLEAN
HidD_GetProductString(
IN HANDLE HidDeviceObject,
OUT PVOID Buffer,
IN ULONG BufferLength
);
Parameters
- HidDeviceObject
- Specifies an open handle to a top-level collection.
- Buffer
- Pointer to a caller-allocated buffer that the routine uses to return the requested product string. The routine returns a NULL-terminated wide character string.
- BufferLength
- Specifies the length, in bytes, of a caller-allocated buffer provided at Buffer. If the buffer is not large enough to return the entire NULL-terminated embedded string, the routine returns nothing in the buffer.
Return Value
HidD_GetProductString returns TRUE if it successfully returns the entire NULL-terminated embedded string. Otherwise, the routine returns FALSE.
Comments
Only user-mode applications can call HidD_GetProductString. Kernel-mode drivers can use an IOCTL_HID_GET_PRODUCT_STRING request.
The maximum possible number of characters in an embedded string is device specific. For USB devices, the maximum string length is 126 wide characters (not including the terminating NULL character).
The iProduct member of a USB_DEVICE_DESCRIPTOR structure for a particular interface is set by the USB common class generic parent driver based on the following rules:
- If the iInterface member of the USB_INTERFACE_DESCRIPTOR structure for the interface is nonzero, the iProduct member of the USB_DEVICE_DESCRIPTOR structure for the interface is set to the iInterface member of the USB_INTERFACE_DESCRIPTOR structure.
- If the interface is grouped by a USB interface association descriptor, and the iFunction member of the interface association descriptor for the interface is nonzero, the iProduct member of the USB_DEVICE_DESCRIPTOR structure for the interface is set to the iFunction member of the interface association descriptor.
For more information, see HID Concepts, HID Collections, and Operating HID Collections.
Requirements
Versions: The HidD_GetProductString function is available in Windows 2000 and later versions of Windows.
Headers: Declared in Hidsdi.h. Include Hidsdi.h.
Library: Contained in Hid.lib. Link to Hid.lib.
See Also
HidD_GetIndexedString, HidD_GetPhysicalDescriptor, HidD_GetSerialNumberString, IOCTL_HID_GET_INDEXED_STRING, IOCTL_HID_GET_MANUFACTURER_STRING, IOCTL_HID_GET_PRODUCT_STRING, IOCTL_HID_GET_SERIALNUMBER_STRING