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

Re: How to add filter DO on an PDO in a bus filter driver by Bill

Bill
Mon Oct 17 13:27:50 CDT 2005

> 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 ?

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.

> 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.

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...
>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
>
>
>



Re: How to add filter DO on an PDO in a bus filter driver by Maxim

Maxim
Tue Oct 18 19:18:40 CDT 2005

> 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.

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



Re: How to add filter DO on an PDO in a bus filter driver by garyli

garyli
Sat Oct 22 17:51:02 CDT 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:

> > 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 ?
>
> 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.
>
> > 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.
>
> 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...
> >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
> >
> >
> >
>
>
>

Re: How to add filter DO on an PDO in a bus filter driver by garyli

garyli
Sat Oct 22 17:56:01 CDT 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:

> > 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.
>
> 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
>
>
>

Re: How to add filter DO on an PDO in a bus filter driver by Maxim

Maxim
Sat Oct 22 18:03:10 CDT 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 ?

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



Re: How to add filter DO on an PDO in a bus filter driver by garyli

garyli
Mon Oct 24 19:02:02 CDT 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:

> > 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 ?
>
> 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
>
>
>