[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / io / iomgr / device.c
index 7434970..88e5ba4 100644 (file)
@@ -25,6 +25,24 @@ extern LIST_ENTRY IopTapeFsListHead;
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
+VOID
+NTAPI
+IopReadyDeviceObjects(IN PDRIVER_OBJECT Driver)
+{
+    PDEVICE_OBJECT DeviceObject;
+    PAGED_CODE();
+
+    /* Set the driver as initialized */
+    Driver->Flags |= DRVO_INITIALIZED;
+    DeviceObject = Driver->DeviceObject;
+    while (DeviceObject)
+    {
+        /* Set every device as initialized too */
+        DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
+        DeviceObject = DeviceObject->NextDevice;
+    }
+}
+
 VOID
 NTAPI
 IopDeleteDevice(IN PVOID ObjectBody)
@@ -653,7 +671,6 @@ IopGetRelatedTargetDevice(IN PFILE_OBJECT FileObject,
 {
     NTSTATUS Status;
     IO_STACK_LOCATION Stack = {0};
-    IO_STATUS_BLOCK IoStatusBlock;
     PDEVICE_RELATIONS DeviceRelations;
     PDEVICE_OBJECT DeviceObject = NULL;
 
@@ -664,19 +681,17 @@ IopGetRelatedTargetDevice(IN PFILE_OBJECT FileObject,
     if (!DeviceObject) return STATUS_NO_SUCH_DEVICE;
 
     /* Define input parameters */
+    Stack.MajorFunction = IRP_MJ_PNP;
+    Stack.MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
     Stack.Parameters.QueryDeviceRelations.Type = TargetDeviceRelation;
     Stack.FileObject = FileObject;
 
     /* Call the driver to query all relations (IRP_MJ_PNP) */
-    Status = IopInitiatePnpIrp(DeviceObject,
-                               &IoStatusBlock,
-                               IRP_MN_QUERY_DEVICE_RELATIONS,
-                               &Stack);
+    Status = IopSynchronousCall(DeviceObject,
+                                &Stack,
+                                (PVOID)&DeviceRelations);
     if (!NT_SUCCESS(Status)) return Status;
 
-    /* Get returned pointer to DEVICE_RELATIONS */
-    DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
-
     /* Make sure it's not NULL and contains only one object */
     ASSERT(DeviceRelations);
     ASSERT(DeviceRelations->Count == 1);