Which is the best way to implement Driver managed Queues ?

Hi all

I have some doubt about implementation of Driver managed queues . Right now
I am using a queue created with ‘InitializeListHead’ and attaching IRP’s
with ‘InsertTailList’ command with pIrp->Tail.Overlay.ListEntry as argument
. Is it good to do this way ? Can we use the ListEntry variable in IRP in
any layer where the IRP would be kept pended ? Or Is it possible that
ListEntry variable would be in use by any other layer when it is passed it
down the stack ? Or Is it better not to depend on the variable ListEntry in
the IRP ?

Thanks in advance
srinivasa

You also have “Cancel-Safe IRP Queues” available to you, they are in the DDK
but don’t get used in too many of the samples…yet.

Chris

“Deevi, Srinivasa” wrote in message
news:xxxxx@ntdev…
>
> Hi all
>
> I have some doubt about implementation of Driver managed queues . Right
now
> I am using a queue created with ‘InitializeListHead’ and attaching IRP’s
> with ‘InsertTailList’ command with pIrp->Tail.Overlay.ListEntry as
argument
> . Is it good to do this way ? Can we use the ListEntry variable in IRP in
> any layer where the IRP would be kept pended ? Or Is it possible that
> ListEntry variable would be in use by any other layer when it is passed it
> down the stack ? Or Is it better not to depend on the variable ListEntry
in
> the IRP ?
>
> Thanks in advance
> srinivasa
>
>
>

“Deevi, Srinivasa” wrote in message
news:xxxxx@ntdev…
>
> . Is it good to do this way ? Can we use the ListEntry variable in IRP in
> any layer where the IRP would be kept pended ?
>

Yes. Tail.Overlay.ListEntry is there precisely for this purpose. You may
only use it while you own the IRP in your driver. If you pass the IRP down
the stack and get it back, you should expect the contents of this location
to have changed.

Chris Dore" wrote in message news:xxxxx@ntdev…>
> You also have “Cancel-Safe IRP Queues” available to you, they are in the
DDK
> but don’t get used in too many of the samples…yet.
>

I’d strongly recommend you investigate the use of the IoCsqXxxx functions in
the DDK. They are no more difficult to use than setting up your own queues,
and they can simplify cancel handling enormously. They’re trivial to
implement – There’s an easy to understand sample provided in the ddk
\ddk\src\general\cancel…

Peter
OSR

As an FYI, in the .NET server DDK (its not been released yet), the cancel
safe queues have been enhanced to allow failure of insertion of IRPs into
the queue. This means you can now implement your own version of the StartIo
mechanism. (The failure allows the driver to test if the device is busy or
free and if its free, don’t insert the IRP and issue the IRP to the device).

Nar Ganapathy
Windows Core OS group
This posting is provided “AS IS” with no warranties, and confers no rights.

“Peter Viscarola” wrote in message news:xxxxx@ntdev…
>
>
> “Deevi, Srinivasa” wrote in message
> news:xxxxx@ntdev…
> >
> > . Is it good to do this way ? Can we use the ListEntry variable in IRP
in
> > any layer where the IRP would be kept pended ?
> >
>
> Yes. Tail.Overlay.ListEntry is there precisely for this purpose. You may
> only use it while you own the IRP in your driver. If you pass the IRP
down
> the stack and get it back, you should expect the contents of this location
> to have changed.
>
> Chris Dore" wrote in message news:xxxxx@ntdev…>
> > You also have “Cancel-Safe IRP Queues” available to you, they are in the
> DDK
> > but don’t get used in too many of the samples…yet.
> >
>
> I’d strongly recommend you investigate the use of the IoCsqXxxx functions
in
> the DDK. They are no more difficult to use than setting up your own
queues,
> and they can simplify cancel handling enormously. They’re trivial to
> implement – There’s an easy to understand sample provided in the ddk
> \ddk\src\general\cancel…
>
> Peter
> OSR
>
>
>
>
>