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

Discussion in 'Windows Vista Drivers' started by M Taha Masood, Aug 17, 2004.

  1. 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?
     
    M Taha Masood, Aug 17, 2004
    #1
    1. Advertisements

  2. M Taha Masood

    Calvin Guan Guest

    See comments inline
    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.
    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.
    See answer 2).

    HTH,
    Calvin
    -
    Calvin Guan Software Engineer
    ATI Technologies Inc. www.ati.com
     
    Calvin Guan, Aug 17, 2004
    #2
    1. Advertisements

  3. 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
     
    Doron Holan [MS], Aug 18, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.