[ros-diffs] [cgutman] 53392: [PNPMGR] - Fix IoReportDetectedDevice to use the caller's driver object

cgutman at svn.reactos.org cgutman at svn.reactos.org
Tue Aug 23 03:57:24 UTC 2011


Author: cgutman
Date: Tue Aug 23 03:57:24 2011
New Revision: 53392

URL: http://svn.reactos.org/svn/reactos?rev=53392&view=rev
Log:
[PNPMGR]
- Fix IoReportDetectedDevice to use the caller's driver object

Modified:
    trunk/reactos/ntoskrnl/include/internal/io.h
    trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
    trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c
    trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c

Modified: trunk/reactos/ntoskrnl/include/internal/io.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/io.h?rev=53392&r1=53391&r2=53392&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] Tue Aug 23 03:57:24 2011
@@ -1022,6 +1022,7 @@
 NTSTATUS
 PnpRootCreateDevice(
     IN PUNICODE_STRING ServiceName,
+    IN OPTIONAL PDRIVER_OBJECT DriverObject,
     OUT PDEVICE_OBJECT *PhysicalDeviceObject,
     OUT OPTIONAL PUNICODE_STRING FullInstancePath
 );

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c?rev=53392&r1=53391&r2=53392&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Tue Aug 23 03:57:24 2011
@@ -690,7 +690,7 @@
       RtlAppendUnicodeStringToString(&FullServiceName, &LegacyPrefix);
       RtlAppendUnicodeStringToString(&FullServiceName, ServiceName1);
 
-      Status = PnpRootCreateDevice(&FullServiceName, &PhysicalDeviceObject, &Node->InstancePath);
+      Status = PnpRootCreateDevice(&FullServiceName, NULL, &PhysicalDeviceObject, &Node->InstancePath);
       if (!NT_SUCCESS(Status))
       {
          DPRINT1("PnpRootCreateDevice() failed with status 0x%08X\n", Status);

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c?rev=53392&r1=53391&r2=53392&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] Tue Aug 23 03:57:24 2011
@@ -202,12 +202,12 @@
     if (DeviceObject && *DeviceObject)
     {
         Pdo = *DeviceObject;
-        DeviceNode = IopGetDeviceNode(*DeviceObject);
     }
     else
     {
         /* Create the PDO */
         Status = PnpRootCreateDevice(&ServiceName,
+                                     DriverObject,
                                      &Pdo,
                                      NULL);
         if (!NT_SUCCESS(Status))
@@ -215,18 +215,18 @@
             DPRINT("PnpRootCreateDevice() failed (Status 0x%08lx)\n", Status);
             return Status;
         }
-
-        /* Create the device node for the new PDO */
-        Status = IopCreateDeviceNode(IopRootDeviceNode,
-                                     Pdo,
-                                     NULL,
-                                     &DeviceNode);
-
-        if (!NT_SUCCESS(Status))
-        {
-            DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
-            return Status;
-        }
+    }
+
+    /* Create the device node for the new PDO */
+    Status = IopCreateDeviceNode(IopRootDeviceNode,
+                                 Pdo,
+                                 NULL,
+                                 &DeviceNode);
+
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
+        return Status;
     }
 
     /* We don't call AddDevice for devices reported this way */

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c?rev=53392&r1=53391&r2=53392&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Tue Aug 23 03:57:24 2011
@@ -130,6 +130,7 @@
 NTSTATUS
 PnpRootCreateDevice(
     IN PUNICODE_STRING ServiceName,
+    IN OPTIONAL PDRIVER_OBJECT DriverObject,
     OUT PDEVICE_OBJECT *PhysicalDeviceObject,
     OUT OPTIONAL PUNICODE_STRING FullInstancePath)
 {
@@ -271,7 +272,7 @@
 
     /* Initialize a device object */
     Status = IoCreateDevice(
-        PnpRootDeviceObject->DriverObject,
+        DriverObject ? DriverObject : PnpRootDeviceObject->DriverObject,
         sizeof(PNPROOT_PDO_DEVICE_EXTENSION),
         NULL,
         FILE_DEVICE_CONTROLLER,




More information about the Ros-diffs mailing list