Hello,
I have questions regarding the IRP cheat sheet's SCENARIO 4: QUEUE FOR
LATER, OR FORWARD AND REUSE
http://support.microsoft.com/default.aspx?scid=kb;EN-US;320275

could somebody pls clarify these

thanks
Taha



===================================================
|SCENARIO 4: QUEUE FOR LATER, OR FORWARD AND REUSE|
===================================================

Question 1)
-----------
The comment in DispathRoutine_4 says the following:

//
// You mark the IRP pending if you are intending to --> queue the
IRP <----
// and process it later. If you are intending to forward the IRP
// directly, use one of the methods discussed earlier in this
article.

what is meant by "queue the IRP" over here?


Question 2)
-----------

In the explanation it says:

"
The completion routine can either return
STATUS_CONTINUE_COMPLETION or STATUS_MORE_PROCESSING_REQUIRED.
You return STATUS_MORE_PROCESSING_REQUIRED only if you intend to
reuse the IRP from another thread and
complete it later.
"

what does it mean by "if you intend to reuse the IRP from another
thread and
complete it later"?


Question 3)
-----------

In CompletionRoutine_42 (.....

Here in the comment it sys:

//
// Because you are stopping the completion of the IRP by returning
the
// following status, you must complete the IRP later.


What is meant by "you must complete the IRP later." , later when ,
why and how?

Re: Question on IRP Cheat sheet SCENARIO 4: QUEUE FOR LATER, OR FORWARD AND REUSE by Calvin

Calvin
Tue Aug 17 10:28:00 CDT 2004

See comments inline
> what is meant by "queue the IRP" over here?

You enqueue the IRP and process it later.

BTW, the sample in scenario 4 seems a bit confusing.
It receives an IRP targeted to the device stack and forwards to its lower
driver but it does 'IoCallDriver(TopOfDeviceStack, Irp)'. The IRP shouldn't
be forwarded to the stack top. It really should read 'NextLowerDriver'.
Otherwise, it will run out of stack and lead to unwanted recursion.

> Question 2)
> -----------
>
> In the explanation it says:
>
> "
> The completion routine can either return
> STATUS_CONTINUE_COMPLETION or STATUS_MORE_PROCESSING_REQUIRED.
> You return STATUS_MORE_PROCESSING_REQUIRED only if you intend to
> reuse the IRP from another thread and
> complete it later.
> "
>
> what does it mean by "if you intend to reuse the IRP from another
> thread and
> complete it later"?

By returning SMPR from the completion routine, the IRP won't get
de-allocated so that you can reuse it instead of allocating a new IRP (for
new requests). When you've done with the IRP, you finally completes it from
an arbitary thread, for instance, DPC, or work item. You complete it by
calling IoCompleteRequest on the IRP which you no longer need.

> Question 3)
> -----------
>
> In CompletionRoutine_42 (.....
>
> Here in the comment it sys:
>
> //
> // Because you are stopping the completion of the IRP by returning
> the
> // following status, you must complete the IRP later.
>
>
> What is meant by "you must complete the IRP later." , later when ,
> why and how?

See answer 2).

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



Re: Question on IRP Cheat sheet SCENARIO 4: QUEUE FOR LATER, OR FORWARD AND REUSE by Doron

Doron
Wed Aug 18 01:46:41 CDT 2004

some DDK examples call the device the FDO/filter is attached to
"TopOfDeviceStack" (vs NextLowerDevice). Slightly confusing if you think of
the "true" top of the stack (retrievable via IoGetAttachedDeviceReference)

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Calvin Guan" <cguan@pleasenospam.ati.com> wrote in message
news:%23lwjK7GhEHA.2812@tk2msftngp13.phx.gbl...
> See comments inline
> > what is meant by "queue the IRP" over here?
>
> You enqueue the IRP and process it later.
>
> BTW, the sample in scenario 4 seems a bit confusing.
> It receives an IRP targeted to the device stack and forwards to its lower
> driver but it does 'IoCallDriver(TopOfDeviceStack, Irp)'. The IRP
shouldn't
> be forwarded to the stack top. It really should read 'NextLowerDriver'.
> Otherwise, it will run out of stack and lead to unwanted recursion.
>
> > Question 2)
> > -----------
> >
> > In the explanation it says:
> >
> > "
> > The completion routine can either return
> > STATUS_CONTINUE_COMPLETION or STATUS_MORE_PROCESSING_REQUIRED.
> > You return STATUS_MORE_PROCESSING_REQUIRED only if you intend to
> > reuse the IRP from another thread and
> > complete it later.
> > "
> >
> > what does it mean by "if you intend to reuse the IRP from another
> > thread and
> > complete it later"?
>
> By returning SMPR from the completion routine, the IRP won't get
> de-allocated so that you can reuse it instead of allocating a new IRP (for
> new requests). When you've done with the IRP, you finally completes it
from
> an arbitary thread, for instance, DPC, or work item. You complete it by
> calling IoCompleteRequest on the IRP which you no longer need.
>
> > Question 3)
> > -----------
> >
> > In CompletionRoutine_42 (.....
> >
> > Here in the comment it sys:
> >
> > //
> > // Because you are stopping the completion of the IRP by returning
> > the
> > // following status, you must complete the IRP later.
> >
> >
> > What is meant by "you must complete the IRP later." , later when ,
> > why and how?
>
> See answer 2).
>
> HTH,
> Calvin
> -
> Calvin Guan Software Engineer
> ATI Technologies Inc. www.ati.com
>
>