Tech Support > Microsoft Windows > Drivers > How to add filter DO on an PDO in a bus filter driver
How to add filter DO on an PDO in a bus filter driver
Posted by Gary Li on October 16th, 2005


I have an upper bus filter driver, and the filter DO was created and attached
to the bus FDO without any problem.
But my primary interest is to filter the PDOs created by bus driver. The
filter DO above the bus FDO cannot see the IRPs to those PDOs.
I think I should create a filter DO and attach it to each PDO created by the
bus driver, but I am not sure where to attach my filter DO to the bus created
PDO.
Normally, AddDevice() is the place to create my filter DO and attach to the
driver stack, but when the bus PDO is indicated in query device relation, my
AddDevice() will not be called for those PDOs.
I tried to create my filter DO and attach to the driver stack in the
completion routine for bus FDO query device relation. Most of the PnP IRPs
work well, and the upper fucntion driver is loaded as well, but the
underlying bus driver failed with STATUS_INVALID_DEVICE_REQUEST during
handling IRP_MN_START_DEVICE.
I ran out of thoughts for reasons of this failure.

Anyone may shed any light ? Should I attach to bus created PDO in different
place ?
One more specific question, should I call ObReference() for my filter DO
when I created it in the completion routine for the query device relations,
as in the case for regular PDO creaation ?

Thanks

-Gary



Posted by Bill McKenzie on October 17th, 2005


No, because this is not a PDO and it is not reported to the PnP manager via
the query device relations IRP.

This should work like any other filter at that point.

Well, that is a pretty good clue as to where things are going wrong. How is
your filter handling StartDevice?

Bill M.

"Gary Li" <garyli@verizon.net> wrote in message
news:956281AB-55CC-4E02-A3C5-20B35A9C5726@microsoft.com...


Posted by Maxim S. Shatskih on October 19th, 2005


In MN_QUERY_RELATIONS/BusRelations path up. Do not replace the relations
pointers - they must still point to the real PDOs. Just attach your FiDOs to
them.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com



Posted by Gary Li on October 22nd, 2005


My driver just passes down the START_DEVICE irp and marks the local device
state as started. I found the returned error with my completion routine for
that irp.

-Gary

"Bill McKenzie" wrote:

Posted by Gary Li on October 22nd, 2005


This (don't replace PDOs) is something my driver did not do.
If I don't replace PDOs, how can my driver callbacks get called ?
Will IoAttachDeviceToDeviceStack() put my FiDO into device stack and my
DriverObject into the original PDOs ?

-Gary

"Maxim S. Shatskih" wrote:

Posted by Maxim S. Shatskih on October 22nd, 2005


Yes. It attaches to topmost device on existing stack. Not to one specified as
parameter.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com



Posted by Gary Li on October 25th, 2005


Thank you very much.
It is working perfectly now by following your suggestion, indicating just
original PDO from usb hub, but attach my local Filter DO to the PDO stack.

-Gary Li

"Maxim S. Shatskih" wrote: