How to add filter DO on an PDO in a bus filter driver

Discussion in 'Windows Vista Drivers' started by Gary Li, Oct 16, 2005.

  1. Gary Li

    Gary Li Guest

    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
     
    Gary Li, Oct 16, 2005
    #1
    1. Advertisements

  2. One more specific question, should I call ObReference() for my filter DO
    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.
     
    Bill McKenzie, Oct 17, 2005
    #2
    1. Advertisements

  3. I think I should create a filter DO and attach it to each PDO created by the
    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 S. Shatskih, Oct 19, 2005
    #3
  4. Gary Li

    Gary Li Guest

    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
     
    Gary Li, Oct 22, 2005
    #4
  5. Gary Li

    Gary Li Guest

    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
     
    Gary Li, Oct 22, 2005
    #5
  6. This (don't replace PDOs) is something my driver did not do.
    Yes. It attaches to topmost device on existing stack. Not to one specified as
    parameter.
     
    Maxim S. Shatskih, Oct 23, 2005
    #6
  7. Gary Li

    Gary Li Guest

    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
     
    Gary Li, Oct 25, 2005
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.