[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / io / iomgr / device.c
index ec6de6c..88e5ba4 100644 (file)
@@ -671,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;
 
@@ -682,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);