阅读:997回复:0
写驱动时,想得到hid设备的属性时却得不到?是IOCTL_HID_GET_COLLECTION_INFORMATION用的不得当么?
代码如下:
HID_COLLECTION_INFORMATION HidCi; IO_STATUS_BLOCK IoStatus; KEVENT event; // Initialise IRP completion event KeInitializeEvent(&event, NotificationEvent, FALSE); // Build Internal IOCTL IRP PIRP Irp = IoBuildDeviceIoControlRequest( IOCTL_HID_GET_COLLECTION_INFORMATION, HidDevice, NULL, 0, // Input buffer &HidCi, sizeof(HidCi), // Output buffer TRUE, &event, &IoStatus); DebugPrint(\"HID attributes: VendorID=%4x, ProductID=%4x, VersionNumber=%4x\", HidCi.VendorID, HidCi.ProductID, HidCi.VersionNumber); // Call the driver and wait for completion if necessary NTSTATUS status = IoCallDriver( HidDevice, Irp); 其中HidDevice是HID设备的句柄。 DebugPrint输出的数据是错误的。为什么? 在驱动中应该怎样做呢? |
|