IoInitializeIrp

VOID
IoInitializeIrp(

IN OUT PIRP Irp,
IN USHORT PacketSize,
IN CCHAR StackSize
);

IoInitializeIrp initializes a given IRP that was allocated by the caller.

Parameters

Irp

Points to the IRP to be initialized.

PacketSize

Specifies the size in bytes of the IRP.

StackSize

Specifies the number of stack locations in the IRP.

Comments

If a driver calls IoAllocateIrp, it also must call IoInitializeIrp with the same StackSize value and the pointer returned by IoAllocateIrp.

If the driver associates an MDL with the IRP it allocated, the driver is responsible for releasing the MDL when the IRP is completed.

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

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

See Also

IoAllocateIrp, IoAllocateMdl, IoBuildPartialMdl, IoFreeIrp, IoFreeMdl, IoSetNextIrpStackLocation, IoSizeOfIrp, IRP