IoCallDriver is a macro:
#define IoCallDriver(a,b) \ IofCallDriver(a,b)
Apparently, IofCallDriver () is used ();
The IofCallDriver () code is as follows:
NTSTATUSFASTCALLIofCallDriver( IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp ){ if (pIofCallDriver != NULL) { // // This routine will either jump immediately to IovCallDriver or // IoPerfCallDriver. // return pIofCallDriver(DeviceObject, Irp, _ReturnAddress()); } return IopfCallDriver(DeviceObject, Irp);}
PIofCallDriver seems to be (defined in the header file)
extern PIO_CALL_DRIVER pIofCallDriver;
PIO_CALL_DRIVER is a function pointer.
typedefNTSTATUS(FASTCALL *PIO_CALL_DRIVER) ( IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp, IN PVOID ReturnAddress );
IopfCallDriver
NTSTATUSFORCEINLINEIopfCallDriver (IN PDEVICE_OBJECT DeviceObject, in out pirp)/* ++ Routine Description: This routine is invoked to pass an I/O Request Packet (Irp) to another driver at its dispatch routine. arguments: DeviceObject-Pointer to device object to which the IRP shoshould be passed. irp-Pointer to IRP for request. return Value: Return status from driver's dispatch routine. -- */{PIO_STACK_LOCATION irpSp; PDRIVER_OBJECT driverObject; NTSTATUS status; // Ensure that this is really an I/O Request Packet. // ASSERT (Irp-> Type = IO_TYPE_IRP); // Update the IRP stack to point to the next location.
// The larger the array label of the visible Irp indicates the higher the top-layer device // Irp-> CurrentLocation --; if (Irp-> CurrentLocation <= 0) {KiBugCheck3 (NO_MORE_IRP_STACK_LOCATIONS, (ULONG_PTR) irp, 0, 0);} irpSp = IoGetNextIrpStackLocation (Irp); Irp-> Tail. overlay. currentStackLocation = irpSp; // Save a pointer to the device object for this request so that it can // be used later in completion. // irpSp-> DeviceObject = DeviceObject; // Invoke the driver at its dispatch routine entry point. // driverObject = DeviceObject-> DriverObject; // Prevent the driver from unloading. // call status = driverObject-> MajorFunction [irpSp-> MajorFunction] (DeviceObject, Irp); return status ;}