https://git.reactos.org/?p=reactos.git;a=commitdiff;h=87b74f290153179742ee588e9e1b234cc90a75e5

commit 87b74f290153179742ee588e9e1b234cc90a75e5
Author:     Hervé Poussineau <[email protected]>
AuthorDate: Thu Oct 7 21:36:24 2021 +0200
Commit:     Hervé Poussineau <[email protected]>
CommitDate: Thu Oct 14 23:39:31 2021 +0200

    [VIDEOPRT] Correctly report legacy resources in 
IRP_MN_FILTER_RESOURCE_REQUIREMENTS
    
    It was broken since first commit 25eae4b9164de7d7cab433bb21c810113241dfab 
(r54237)
    
    CORE-17789
---
 win32ss/drivers/videoprt/dispatch.c |  8 ++++----
 win32ss/drivers/videoprt/resource.c | 12 +++++++-----
 win32ss/drivers/videoprt/videoprt.h |  1 +
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/win32ss/drivers/videoprt/dispatch.c 
b/win32ss/drivers/videoprt/dispatch.c
index 77339574f40..f80abe8c4f7 100644
--- a/win32ss/drivers/videoprt/dispatch.c
+++ b/win32ss/drivers/videoprt/dispatch.c
@@ -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;
 
diff --git a/win32ss/drivers/videoprt/resource.c 
b/win32ss/drivers/videoprt/resource.c
index 7f44ea0dab3..cd85c9feb43 100644
--- a/win32ss/drivers/videoprt/resource.c
+++ b/win32ss/drivers/videoprt/resource.c
@@ -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;
         }
diff --git a/win32ss/drivers/videoprt/videoprt.h 
b/win32ss/drivers/videoprt/videoprt.h
index 6ff90e2dd2a..61363fafadc 100644
--- a/win32ss/drivers/videoprt/videoprt.h
+++ b/win32ss/drivers/videoprt/videoprt.h
@@ -234,6 +234,7 @@ IntVideoPortSetupInterrupt(
 NTSTATUS NTAPI
 IntVideoPortFilterResourceRequirements(
    IN PDEVICE_OBJECT DeviceObject,
+   IN PIO_STACK_LOCATION IrpStack,
    IN PIRP Irp);
 
 NTSTATUS NTAPI

Reply via email to