IofCallDriver - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdm.h

NTSTATUS IofCallDriver(
  PDEVICE_OBJECT        DeviceObject,
  __drv_aliasesMem PIRP Irp
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdm-iofcalldriver)

Description

[!CAUTION] Call the macro IoCallDriver instead, that macro is a passthrough call to this function.

Sends an IRP to the driver associated with a specified device object.

Parameters

DeviceObject

Pointer to a DEVICE_OBJECT, representing the target device for the requested I/O operation.

Irp

Pointer to the IRP.

Return value

Returns an appropriate NTSTATUS value.

Remarks

The following remarks refer to the wrapper IoCallDriver macro but apply to this function as well, since that macro is a simple passthrough to here.

Before 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 for Windows Server 2003, Windows XP, and Windows 2000 must use PoCallDriver rather than IoCallDriver to pass power IRPs (IRP_MJ_POWER).

For more information, see Calling IoCallDriver vs. Calling PoCallDriver.

See also

IoAllocateIrp

IoBuildAsynchronousFsdRequest

IoBuildDeviceIoControlRequest

IoBuildSynchronousFsdRequest

IoSetCompletionRoutine

PoCallDriver