Re: PendingReturned and a subsidiary IRP

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



A subsidiary IRP belongs to the creator. Normally you will not allow the
IOManager to handle it when it shows back up in your completion routine. If
you use one of the functions other than IoAllocateIrp(), this rule does not
apply. If you use a block of memory to function as an IRP, you sure don't
want the IOManager to do final processing on it. You might do this if you
need an IRP when you are being called at an IRQL higher than PASSIVE_LEVEL.
Some drivers in the storage stack have this problem.

P.S. Do not use associated IRPs unless you are a FSD.

<BubbaGump> wrote in message
news:piphm2pn258dpbok19dvj1bkovuh41qpl0@xxxxxxxxxx
On Mon, 20 Nov 2006 17:00:07 -0500, BubbaGump <> wrote:

Right?

I should clarify something here.

I'm not asking if this is a common practice. I know it's not listed
in the current IRP-handling scenarios in Walt Oney's book or in MS
support, but while I was looking through the DDK samples one day I
noticed something interesting and surprising that got me thinking
about this. I saw a completion routine for an IRP that was sent
synchronously checking the PendingReturned not for what I'd thought
was its usual purpose of deciding whether to call IoMarkIrpPending for
an asynchronous IRP but instead for deciding whether to set the event
on which the routine that sent the IRP was waiting. It's a
performance optimization (although I'm guessing it's a small one).

Anyway, that's what made me curious. I wonder what other uses could
be invented for the PendingReturned flag, and this technique with a
subsidiary IRP is the first one that came to mind.



.



Relevant Pages

  • Re: asynchronous usb driver
    ... When you set a completion routine on the IRP, the I/O manager will call it ... So rather than sending a request to the lower device and waiting for it to ... driver completes the outstanding request your completion routine is invoked. ...
    (microsoft.public.development.device.drivers)
  • Re: a question in MS sample code about PoRequestPowerIrp
    ... the po completion routine will not run. ... In the follow piece of code, it seems the "irpContext" be ExFreePool two ... safe for your device to power down." ... // If there is not already a WW IRP pending, ...
    (microsoft.public.development.device.drivers)
  • Re: Dispatch and Completion routine synchronisation
    ... becuase irp is now an invalid pointer as you have completed it. ... You should enable driver verifier on your driver as well, it can find many of these common mistakes. ... In a dispatch routine, I set a completion routine and then forward the ... at the moment my completion routine is tiny and looks a little like ...
    (microsoft.public.development.device.drivers)
  • Re: Dispatch and Completion routine synchronisation
    ... changing code now... ... becuase irp is now an invalid pointer as you have completed it. ... You should enable driver verifier on your driver as well, it can find many of these common mistakes. ... at the moment my completion routine is tiny and looks a little like ...
    (microsoft.public.development.device.drivers)
  • Re: Actions upon receiving Syestem Power Set IRP
    ... ideally you request the d0 irp in the po completion routine, ... on vista, only one power irp can be active in the entire stack at once which means that if you request a d0 irp in the dx io completion routine, it will not arrive until you complete the dx irp. ...
    (microsoft.public.development.device.drivers)