Thinking Out Loud

Here are a set of what I believe to be facts:

  1. Device stacks are always built from the bottom up.
  2. IoAttachDeviceToDeviceStack can only add drivers to the top of the
    stack being built.
  3. IoAttachDeviceToDeviceStack is called during AddDevice handling.

From those facts, can I not assert that AddDevice calls for a single
stack must be serialized, and in this exact order: lower filters,
function driver, upper filters?

And given that, isn’t it very easy to use a single driver as both a
lower and upper filter, and determine which is which at AddDevice time?
I can keep a collection in the driver context, and have AddDevice check
to see whether the PhysicalDeviceObject is present in the collection.
If it’s not there, then I am the lower filter, and I add the PDO to the
collection. If it’s already there, then I am the upper filter.

Right?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Send a IRP_MN_QUERY_INTERFACE for your own GUID down and intercept it. So can also establish communication at the same time.

>> 3. IoAttachDeviceToDeviceStack is called during AddDevice handling.

It can also be called on the completion path of QDR/BusRelations by a bus filter. lmk if I’m not correct.

Yes but that would not violate the assumptions. As far as Tim’s driver
is concerned the operations are as he describes.
Mark Roddy

On Thu, Mar 31, 2011 at 9:17 PM, wrote:
>>> 3. IoAttachDeviceToDeviceStack is called during AddDevice handling.
>
> It can also be called on the completion path of QDR/BusRelations by a bus filter. lmk if I’m not correct.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

xxxxx@broadcom.com wrote:

Send a IRP_MN_QUERY_INTERFACE for your own GUID down and intercept it. So can also establish communication at the same time.

That’s a much more reliable scheme. Good hint.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.