IoBuildAsynchronousFsdRequest

PIRP
    IoBuildAsynchronousFsdRequest(

        IN ULONG  MajorFunction,
        IN PDEVICE_OBJECT  DeviceObject,
        IN OUT PVOID  Buffer,            /* optional */
        IN ULONG  Length,                /* optional */
        IN PLARGE_INTEGER  StartingOffset,        /* optional */
        IN PIO_STATUS_BLOCK  IoStatusBlock     /* optional */
        );

IoBuildAsynchronousFsdRequest allocates and sets up an IRP to be sent to lower-level drivers.

Parameters

MajorFunction
Specifies the major function code to be set in the IRP, one of IRP_MJ_READ, IRP_MJ_WRITE, IRP_MJ_FLUSH_BUFFERS, or IRP_MJ_SHUTDOWN.
DeviceObject
Points to the next-lower driver’s device object, representing the target device for the read, write, flush, or shutdown operation.
Buffer
Points to a buffer into which data is read or from which data is written. The value of this argument is NULL for flush and shutdown requests.
Length
Specifies the length in bytes of Buffer. The value of this argument is zero for flush and shutdown requests.
StartingOffset
Points to the starting offset on the input/output media. The value of this argument is zero for flush and shutdown requests.
IoStatusBlock
Points to the address of an I/O status block in which the to-be-called driver(s) return final status about the requested operation.

Return Value

IoBuildAsynchronousFsdRequest returns a pointer to an IRP or a NULL pointer if the IRP cannot be allocated.

Comments

Intermediate or highest-level drivers can call IoBuildAsynchronousFsdRequest to set up IRPs for requests sent to lower-level drivers. Such a driver must set its IoCompletion routine in the IRP so the IRP can be deallocated with IoFreeIrp.

The IRP that gets built contains only enough information to get the operation started and to complete the IRP. No other context information is tracked because an asynchronous request is context-independent.

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

An intermediate or highest-level driver also can call IoBuildDeviceIoControlRequest, IoAllocateIrp, or IoBuildSychronousFsdRequest to set up requests it sends to lower-level drivers. Only a highest-level driver can call IoMakeAssociatedIrp.

See Also

IO_STACK_LOCATION, IoAllocateIrp, IoBuildDeviceIoControlRequest, IoBuildSynchronousFsdRequest, IoCallDriver, IoFreeIrp, IoMakeAssociatedIrp, IoSetCompletionRoutine, IRP