eg:
SP_DEVICE_INTERFACE_DETAIL_DATA *pDetData = NULL;
DWORD dwDetDataSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA) + 256;
pDetData = (_SP_DEVICE_INTERFACE_DETAIL_DATA_A*) malloc (dwDetDataSize);
pDetData->cbSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA);
bOk = SetupDiGetDeviceInterfaceDetail (hDevInfo, &ifcData, pDetData, dwDetDataSize, NULL, &devdata);
SP_DEVICE_INTERFACE_DETAIL_DATA *pDetData = NULL;
DWORD dwDetDataSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA) + 256;
pDetData = (_SP_DEVICE_INTERFACE_DETAIL_DATA_A*) malloc (dwDetDataSize);
pDetData->cbSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA);
bOk = SetupDiGetDeviceInterfaceDetail (hDevInfo, &ifcData, pDetData, dwDetDataSize, NULL, &devdata);
To copy to clipboard, switch view to plain text mode
pDetData->DevicePath contains VID and PID in string form (eg. VID_xxxx&PID_xxxx), or you can use HidD_GetAttributes function in HID.DLL to extract these to a structure:
typedef struct _HIDD_ATTRIBUTES {
ULONG Size;
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
Bookmarks