模仿USBCCGP对USB复合设备功能分析打印输出
2021-11-16
172
0
源代码如下:
VOID
DumpFunctionDescriptor(
IN PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor,
IN ULONG FunctionDescriptorCount)
{
ULONG Index, SubIndex;
DPRINT("FunctionCount %lu\n", FunctionDescriptorCount);
for (Index = 0; Index < FunctionDescriptorCount; Index++)
{
DPRINT("Function %lu\n", Index);
DPRINT("FunctionNumber %lu\n", FunctionDescriptor[Index].FunctionNumber);
DPRINT("HardwareId %S\n", FunctionDescriptor[Index].HardwareId.Buffer);
DPRINT("CompatibleId %S\n", FunctionDescriptor[Index].CompatibleId.Buffer);
DPRINT("FunctionDescription %wZ\n", &FunctionDescriptor[Index].FunctionDescription);
DPRINT("NumInterfaces %lu\n", FunctionDescriptor[Index].NumberOfInterfaces);
for (SubIndex = 0; SubIndex < FunctionDescriptor[Index].NumberOfInterfaces; SubIndex++)
{
DPRINT(" Index %lu Interface %p\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]);
DPRINT(" Index %lu Interface InterfaceNumber %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceNumber);
DPRINT(" Index %lu Interface Alternate %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bAlternateSetting);
DPRINT(" Index %lu bLength %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bLength);
DPRINT(" Index %lu bDescriptorType %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bDescriptorType);
DPRINT(" Index %lu bInterfaceNumber %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceNumber);
DPRINT(" Index %lu bAlternateSetting %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bAlternateSetting);
DPRINT(" Index %lu bNumEndpoints %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bNumEndpoints);
DPRINT(" Index %lu bInterfaceClass %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceClass);
DPRINT(" Index %lu bInterfaceSubClass %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceSubClass);
DPRINT(" Index %lu bInterfaceProtocol %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceProtocol);
DPRINT(" Index %lu iInterface %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->iInterface);
}
}
}
打印输出结果如下:
3: kd> p
FunctionCount 2
Function 0
FunctionNumber 0
HardwareId USB\VID_1539&PID_0100&Rev_0409&MI_00
CompatibleId USB\Class_03&SubClass_00&Prot_ff
FunctionDescription xxx
NumInterfaces 1
Index 0 Interface FFFFDF0869505149
Index 0 Interface InterfaceNumber 0
Index 0 Interface Alternate 0
Index 0 bLength 9
Index 0 bDescriptorType 4
Index 0 bInterfaceNumber 0
Index 0 bAlternateSetting 0
Index 0 bNumEndpoints 2
Index 0 bInterfaceClass 3
Index 0 bInterfaceSubClass 0
Index 0 bInterfaceProtocol ff
Index 0 iInterface 8
Function 1
FunctionNumber 1
HardwareId USB\VID_1539&PID_0100&Rev_0409&MI_01
CompatibleId USB\Class_0e&SubClass_03&Prot_00
FunctionDescription xxx
NumInterfaces 2
Index 0 Interface FFFFDF0869505171
Index 0 Interface InterfaceNumber 1
Index 0 Interface Alternate 0
Index 0 bLength 9
Index 0 bDescriptorType 4
Index 0 bInterfaceNumber 1
Index 0 bAlternateSetting 0
Index 0 bNumEndpoints 1
Index 0 bInterfaceClass e
Index 0 bInterfaceSubClass 1
Index 0 bInterfaceProtocol 0
Index 0 iInterface a
Index 1 Interface FFFFDF08695051D5
Index 1 Interface InterfaceNumber 2
Index 1 Interface Alternate 0
Index 1 bLength 9
Index 1 bDescriptorType 4
Index 1 bInterfaceNumber 2
Index 1 bAlternateSetting 0
Index 1 bNumEndpoints 1
Index 1 bInterfaceClass e
Index 1 bInterfaceSubClass 2
Index 1 bInterfaceProtocol 0
Index 1 iInterface b
HID人机交互QQ群:564808376
UAC音频QQ群:218581009
UVC相机QQ群:331552032
BOT&UASP大容量存储QQ群:258159197
STC-USB单片机QQ群:315457461
USB技术交流QQ群2:580684376
USB技术交流QQ群:952873936