Hi (if walter is there:)),
I was going through walter's Book in the section "Why Completion Routines
Call IoMarkIrpPending" it reads -
>>>
But notice that the driver that called IoMarkIrpPending only managed to set
SL_PENDING_RETURNED in its own stack location. The drivers above it actually
returned STATUS_PENDING, but they didn't call IoMarkIrpPending on their own
behalf because they didn't know they'd end up returning STATUS_PENDING as
proxies for the guy at the bottom of the stack. Sorting this out is where the
boilerplate code in the completion routine comes in, as follows. As
IoCompleteRequest walks up the I/O stack, it pauses at each level to set the
IRP's PendingReturned flag to the value of the current stack's
SL_PENDING_RETURNED flag. If there's no completion routine at this level, it
then sets the next higher stack's SL_PENDING_RETURNED if PendingReturned is
set and repeats its loop. It doesn't change SL_PENDING_RETURNED if
PendingReturned is clear. In this way, SL_PENDING_RETURNED gets propagated
from the bottom to the top of the stack, and the IRP's PendingReturned flag
ends up TRUE if any of the drivers ever called IoMarkIrpPending.
>>>
if i understand it correctly if SL_PENDING_RETURNED set means that
STATUS_PENDING was returned by one of the driver, and then it helps IO
manager in deciding that an APC is needed or not during completion.
What if in a 3 driver stack driver no 2 marks IRP pending ? in that case
the the top driver dispatch routines returns STATUS_PENDING and in IO
Completion propogates SL_PENDING_RETURNED it using boiler plate
if (Irp->PendingReturned)
IoMarkIrpPending(Irp);
does that also mean that an APC will not be scheduled for that thread ?
I belive if the the Top level Stack location has Pending Set then the APC
will be skipped and if not then it will scheduled.
if there is no APC scheduled then by which means the buffers will be copied
to the user space ?
Could anybody shed some light ?
Regards
Subodh