{
NTSTATUS Status;
IO_STACK_LOCATION Stack = {0};
- IO_STATUS_BLOCK IoStatusBlock;
PDEVICE_RELATIONS DeviceRelations;
PDEVICE_OBJECT DeviceObject = NULL;
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);