[VIDEOPRT] Correctly report legacy resources in IRP_MN_FILTER_RESOURCE_REQUIREMENTS

It was broken since first commit 25eae4b916 (r54237)

CORE-17789
This commit is contained in:
Hervé Poussineau 2021-10-07 21:36:24 +02:00
parent 951dc66c66
commit 87b74f2901
3 changed files with 12 additions and 9 deletions

View file

@ -1028,11 +1028,11 @@ IntVideoPortDispatchFdoPnp(
break;
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
Status = IntVideoPortForwardIrpAndWait(DeviceObject, Irp);
if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
Status = IntVideoPortFilterResourceRequirements(DeviceObject, Irp);
/* Call lower drivers, and ignore result (that's probably STATUS_NOT_SUPPORTED) */
(VOID)IntVideoPortForwardIrpAndWait(DeviceObject, Irp);
/* Now, fill resource requirements list */
Status = IntVideoPortFilterResourceRequirements(DeviceObject, IrpSp, Irp);
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
break;

View file

@ -76,6 +76,7 @@ IntVideoPortGetLegacyResources(
NTSTATUS NTAPI
IntVideoPortFilterResourceRequirements(
IN PDEVICE_OBJECT DeviceObject,
IN PIO_STACK_LOCATION IrpStack,
IN PIRP Irp)
{
PDRIVER_OBJECT DriverObject;
@ -83,7 +84,8 @@ IntVideoPortFilterResourceRequirements(
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
PVIDEO_ACCESS_RANGE AccessRanges;
ULONG AccessRangeCount, ListSize, i;
PIO_RESOURCE_REQUIREMENTS_LIST ResList, OldResList = (PVOID)Irp->IoStatus.Information;
PIO_RESOURCE_REQUIREMENTS_LIST ResList;
PIO_RESOURCE_REQUIREMENTS_LIST OldResList = IrpStack->Parameters.FilterResourceRequirements.IoResourceRequirementList;
PIO_RESOURCE_DESCRIPTOR CurrentDescriptor;
NTSTATUS Status;
@ -163,8 +165,8 @@ IntVideoPortFilterResourceRequirements(
if (CurrentDescriptor->Type == CmResourceTypePort)
{
CurrentDescriptor->u.Port.Length = AccessRanges[i].RangeLength;
CurrentDescriptor->u.Port.MinimumAddress =
CurrentDescriptor->u.Port.MaximumAddress = AccessRanges[i].RangeStart;
CurrentDescriptor->u.Port.MinimumAddress = AccessRanges[i].RangeStart;
CurrentDescriptor->u.Port.MaximumAddress.QuadPart = AccessRanges[i].RangeStart.QuadPart + AccessRanges[i].RangeLength - 1;
CurrentDescriptor->u.Port.Alignment = 1;
if (AccessRanges[i].RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
CurrentDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
@ -174,8 +176,8 @@ IntVideoPortFilterResourceRequirements(
else
{
CurrentDescriptor->u.Memory.Length = AccessRanges[i].RangeLength;
CurrentDescriptor->u.Memory.MinimumAddress =
CurrentDescriptor->u.Memory.MaximumAddress = AccessRanges[i].RangeStart;
CurrentDescriptor->u.Memory.MinimumAddress = AccessRanges[i].RangeStart;
CurrentDescriptor->u.Memory.MaximumAddress.QuadPart = AccessRanges[i].RangeStart.QuadPart + AccessRanges[i].RangeLength - 1;
CurrentDescriptor->u.Memory.Alignment = 1;
CurrentDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
}

View file

@ -234,6 +234,7 @@ IntVideoPortSetupInterrupt(
NTSTATUS NTAPI
IntVideoPortFilterResourceRequirements(
IN PDEVICE_OBJECT DeviceObject,
IN PIO_STACK_LOCATION IrpStack,
IN PIRP Irp);
NTSTATUS NTAPI