Steve
Tue Aug 17 09:53:28 CDT 2004
M Taha Masood wrote:
> Hello,
> I have questions regarding the IRP cheat sheet's Scenario 2 , Forward
> and Wait.
>
http://support.microsoft.com/default.aspx?scid=kb;EN-US;320275
>
> could somebody pls clarify these
>
> thanks
> Taha
>
> Question 1 )
> ------------
>
> in DispatchRoutine_2 ( ...
> if (status == STATUS_PENDING) {
>
> does this return value of STATUS_PENDING mean that the completion
> routine of some lower level driver
> would have returned STATUS_MORE_PROCESSING_REQUIRED?
No, it means the dispatch routine returned STATUS_PENDING.
>
> Question 2)
> -----------
>
> in DispatchRoutine_2 ( ...
> IoCompleteRequest (Irp, IO_NO_INCREMENT);
> return status;
>
> i) What control flow will the call to IoCompleteRequest initiate?
> ii) To whom will the "return status;" statement give control
>
> How are i) and ii) above inter-related?
This will return to the caller; it could be the IO manager or it could
(indirectly) be a higher-level driver.
STATUS_MORE_PROCESSING_REQUIRED is a value that is returned by
completion routines, not dispatch routines. Typically, if a driver must
pass an IRP down to another driver via IoCallDriver(), it will set a
completion routine so it can do any post-processing it needs to do.
That completion routine can return either
STATUS_MORE_PROCESSING_REQUIRED, meaning that you are not yet ready to
call IoCompleteRequest(), or STATUS_CONTINUE_COMPLETION, meaning that
you are done with the IRP and the IO manager can continue calling
completion routines above you. Note that if you return MORE_PROCESSING,
you have to manually re-initiate completion at some point.
Walter Oney's WDM book has as good of a reference on IRP completion as
I've seen; re-read it until it makes sense. Also, read the DDK docs on
completing an IRP, and look at some samples. Finally, if you can find a
powerpoint presentation by Adrian Oney in the WinHEC docs from a couple
of years ago about IRP completion, that has a really fantastic
description of the IoMarkIrpPending() protocol.
-sd