X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=drivers%2Fhid%2Fhidclass%2Fpdo.c;h=f629ebd411f1cbe7a09c629cff77e4f57449e4db;hp=876712e7af93721125ee105c196803cb97d9e99e;hb=501116b68f1da4e380f5630672b0fe099f22ab55;hpb=42040abadcb352795ff9fc68f7caf5fc6cff14f6 diff --git a/drivers/hid/hidclass/pdo.c b/drivers/hid/hidclass/pdo.c index 876712e7af9..f629ebd411f 100644 --- a/drivers/hid/hidclass/pdo.c +++ b/drivers/hid/hidclass/pdo.c @@ -67,6 +67,32 @@ HidClassPDO_GetReportDescription( 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, @@ -636,7 +662,7 @@ HidClassPDO_CreatePDO( OUT PDEVICE_RELATIONS *OutDeviceRelations) { PHIDCLASS_FDO_EXTENSION FDODeviceExtension; - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS; PDEVICE_OBJECT PDODeviceObject; PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension; ULONG Index; @@ -652,8 +678,8 @@ HidClassPDO_CreatePDO( // // 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) { // @@ -671,7 +697,7 @@ HidClassPDO_CreatePDO( // let's create a PDO for top level collection // Index = 0; - do + while (Index < FDODeviceExtension->Common.DeviceDescription.CollectionDescLength) { // // let's create the device object @@ -742,7 +768,7 @@ HidClassPDO_CreatePDO( // Index++; - } while(Index < FDODeviceExtension->Common.DeviceDescription.CollectionDescLength); + } //