INFO: IoMarkIrpPending(Irp) vs. IoStatus.Status=STATUS_PENDINGLast reviewed: February 6, 1998Article ID: Q180589 |
The information in this article applies to:
SUMMARYThis article explains the difference between IoMarkIrpPending(Irp), IoStatus.Status=STATUS_PENDING, and return STATUS_PENDING.
MORE INFORMATIONTo see exactly what IoMarkIrpPending does, look at the following definition in NTDDK.H:
// VOID
// IoMarkIrpPending(
// IN OUT PIRP Irp
// )
//
// Routine Description:
//
// This routine marks the specified I/O Request Packet (IRP) to indicate
// that an initial status of STATUS_PENDING was returned to the caller.
// This is used so that I/O completion can determine whether or not to
// fully complete the I/O operation requested by the packet.
//
// Arguments:
//
// Irp - Pointer to the I/O Request Packet to be marked pending.
//
// Return Value:
//
// None.
//
//--
#define IoMarkIrpPending( Irp ) ( \
IoGetCurrentIrpStackLocation( (Irp) )->Control |=
SL_PENDING_RETURNED )
There is never any reason to store STATUS_PENDING in Irp->IoStatus.Status
because Irp->IoStatus.Status is filled in with the "final" status of the
IRP just before calling IoCompleteRequest. None of the code paths look at
Irp->IoStatus.Status until IoCompleteRequest is called. Therefore, there is
no reason to set Irp->IoStatus.Status to any value before IoCompleteRequest
is called. Conversely, STATUS_PENDING is never an appropriate value for Irp-
>IoStatus.Status when IoCompleteRequest is called.
STATUS_PENDING is the proper return value from any dispatch routine that has not called IoCompleteRequest on the IRP or not passed the IRP to a lower-layer driver. This type of routine must also call IoMarkIrpPending for the IRP. Keywords : NTDDKKMode Version : WINNT:4.0 Platform : winnt Issue type : kbinfo |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |