return NULL;
}
+PHIDP_REPORT_IDS
+HidClassPDO_GetReportDescriptionByReportID(
+ PHIDP_DEVICE_DESC DeviceDescription,
+ UCHAR ReportID)
+{
+ ULONG Index;
+
+ for (Index = 0; Index < DeviceDescription->ReportIDsLength; Index++)
+ {
+ if (DeviceDescription->ReportIDs[Index].ReportID == ReportID)
+ {
+ //
+ // found report id
+ //
+ return &DeviceDescription->ReportIDs[Index];
+ }
+ }
+
+ //
+ // failed to find report id
+ //
+ DPRINT1("[HIDCLASS] GetReportDescriptionByReportID ReportID %x not found\n", ReportID);
+ ASSERT(FALSE);
+ return NULL;
+}
+
NTSTATUS
HidClassPDO_HandleQueryDeviceId(
IN PDEVICE_OBJECT DeviceObject,
OUT PDEVICE_RELATIONS *OutDeviceRelations)
{
PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
PDEVICE_OBJECT PDODeviceObject;
PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension;
ULONG Index;
//
// first allocate device relations
//
- Length = sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * FDODeviceExtension->Common.DeviceDescription.CollectionDescLength;
- DeviceRelations = ExAllocatePoolWithTag(NonPagedPool, Length, HIDCLASS_TAG);
+ Length = FIELD_OFFSET(DEVICE_RELATIONS, Objects) + sizeof(PDEVICE_OBJECT) * FDODeviceExtension->Common.DeviceDescription.CollectionDescLength;
+ DeviceRelations = ExAllocatePoolWithTag(PagedPool, Length, HIDCLASS_TAG);
if (!DeviceRelations)
{
//
// let's create a PDO for top level collection
//
Index = 0;
- do
+ while (Index < FDODeviceExtension->Common.DeviceDescription.CollectionDescLength)
{
//
// let's create the device object
//
Index++;
- } while(Index < FDODeviceExtension->Common.DeviceDescription.CollectionDescLength);
+ }
//