Previous Next

IoCallDriver

The IoCallDriver routine sends an IRP to the driver associated with a specified device object.

NTSTATUS 
  IoCallDriver(
    IN PDEVICE_OBJECT  DeviceObject,
    IN OUT PIRP  Irp
    );

Parameters

DeviceObject
Pointer to a device object, representing the target device for the requested I/O operation.
Irp
Pointer to the IRP.

Return Value

IoCallDriver returns the NTSTATUS value that a lower driver set in the I/O status block for the given request, or STATUS_PENDING if the request was queued for additional processing.

Headers

Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.

Comments

Before a calling IoCallDriver, the calling driver must set up the I/O stack location in the IRP for the target driver. For more information, see Passing IRPs Down the Driver Stack.

IoCallDriver assigns the DeviceObject input parameter to the DeviceObject member of the IO_STACK_LOCATION structure for the driver being called.

An IRP passed in a call to IoCallDriver becomes inaccessible to the higher-level driver, unless the higher-level driver has called IoSetCompletionRoutine to set up an IoCompletion routine for the IRP. If it has, the IRP input to the IoCompletion routine has its I/O status block set by the lower drivers, and all lower-level drivers’ I/O stack locations are filled with zeros.

Drivers must not use IoCallDriver to pass power IRPs (IRP_MJ_POWER). Use PoCallDriver instead.

Callers of IoCallDriver must be running at IRQL <= DISPATCH_LEVEL.

See Also

IoAllocateIrp, IoBuildAsynchronousFsdRequest, IoBuildDeviceIoControlRequest, IoBuildSynchronousFsdRequest, IoSetCompletionRoutine, PoCallDriver