IoInitializeIrp function (wdm.h)

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

Syntax

void IoInitializeIrp(
  [in, out] PIRP   Irp,
  [in]      USHORT PacketSize,
  [in]      CCHAR  StackSize
);

Parameters

[in, out] Irp

Pointer to the IRP to be initialized.

[in] PacketSize

Specifies the size in bytes of the IRP.

[in] StackSize

Specifies the number of stack locations in the IRP.

Return value

None

Remarks

Drivers use IoInitializeIrp to initialize IRPs the driver allocated as raw memory. Do not use IoInitializeIrp to initialize an IRP allocated by IoAllocateIrp. IoAllocateIrp automatically initializes the members of the IRP.

Drivers can use IoInitializeIrp to reinitialize an IRP for reuse only under certain circumstances. See Reusing IRPs for details.

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.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), IoReuseIrp(wdm)

See also

IRP

IoAllocateIrp

IoAllocateMdl

IoBuildPartialMdl

IoFreeIrp

IoFreeMdl

IoReuseIrp

IoSetNextIrpStackLocation

IoSizeOfIrp