IoFreeIrp function (wdm.h)

The IoFreeIrp routine releases a caller-allocated IRP from the caller's IoCompletion routine.

Syntax

void IoFreeIrp(
  [in] PIRP Irp
);

Parameters

[in] Irp

Pointer to the IRP that is to be released.

Return value

None

Remarks

This routine is the reciprocal to IoAllocateIrp or IoBuildAsynchronousFsdRequest. The released IRP must have been allocated by the caller.

This routine also releases an IRP allocated with IoMakeAssociatedIrp in which the caller set up its IoCompletion routine that returns STATUS_MORE_PROCESSING_REQUIRED for the associated IRP.

IoFreeIrp does not free any MDLs that might be attached to the IRP. The driver that frees the IRP must explicitly free these MDLs. In addition, if the physical pages that are described by an MDL are locked, the driver must unlock the pages before it frees the MDL. However, the driver does not need to explicitly unmap these pages. Instead, IoFreeMdl automatically unmaps the pages when it frees the MDL. For a code example that shows how to free an MDL chain, see Using MDLs.

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), IoAllocateFree(wdm), IoBuildDeviceControlNoFree(wdm), IoBuildFsdFree(wdm), IoBuildSynchronousFsdRequestNoFree(wdm), IoFreeIrp(storport)

See also

IoAllocateIrp

IoBuildAsynchronousFsdRequest

IoCompletion

IoMakeAssociatedIrp

IoSetCompletionRoutine