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?



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?

Re: question from IRP Cheat Sheet 1 ==> Scenario 2 ) Forward and Wait by Calvin

Calvin
Tue Aug 17 09:38:17 CDT 2004

> 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?

It means the lower driver had returned STATUS_PENDING from its dispatch
routine.

> i) What control flow will the call to IoCompleteRequest initiate?

It just resumes the IRP completion since the completion routine has returned
SMPR. I'd recommend Walter's WDM book which has a detailed description on
how this works. Before his book, I have to reverse engineer the
IoCompleteRequest to get my filter driver right.

> ii) To whom will the "return status;" statement give control

Return to the guy who called IoCallDriver to the driver.

HTH,
Calvin
-
Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com



Re: question from IRP Cheat Sheet 1 ==> Scenario 2 ) Forward and by Steve

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