The IoMarkIrpPending routine marks the specified IRP, indicating that a driver's dispatch routine subsequently returned STATUS_PENDING because further processing is required by other driver routines.
void IoMarkIrpPending( PIRP Irp );
Pointer to the IRP to be marked as pending.
Unless the driver's dispatch routine completes the IRP (by calling IoCompleteRequest) or passes the IRP on to lower drivers, it must call IoMarkIrpPending with the IRP. Otherwise, the I/O manager attempts to complete the IRP as soon as the dispatch routine returns control.
After calling IoMarkIrpPending, the dispatch routine must return STATUS_PENDING, even if some routine completes the IRP (by calling IoCompleteRequest) before the dispatch routine that called IoMarkIrpPending returns.
If a driver queues incoming IRPs, it should call IoMarkIrpPending before it queues each IRP. Otherwise, an IRP could be dequeued, completed by another driver routine, and freed by the system before the call to IoMarkIrpPending occurs, thereby causing a crash.
If a driver sets an IoCompletion routine for an IRP and then passes the IRP down to a lower driver, the IoCompletion routine should check the IRP->PendingReturned flag. If the flag is set, the IoCompletion routine must call IoMarkIrpPending with the IRP. (IoCompletion routines do not return STATUS_PENDING, however. For more information, see Implementing an IoCompletion Routine.)
If your driver calls IoSkipCurrentIrpStackLocation, be careful not to modify the IO_STACK_LOCATION structure in a way that could unintentionally affect the lower driver or the system's behavior with respect to that driver. In particular, your driver should not modify the IO_STACK_LOCATION structure's Parameters union, and should not call IoMarkIrpPending.
|Minimum supported client||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||CompleteRequestStatusCheck, CompletionEventChecking, IrpCancelField, LowerDriverReturn, MarkDevicePower, MarkingInterlockedQueuedIrps, MarkingQueuedIrps, MarkIrpPending, MarkIrpPending2, MarkPower, MarkPowerDown, MarkQueryRelations, MarkStartDevice, PendedCompletedRequest3|