none
How to attach a filter driver to lower or in middle of the stack? RRS feed

  • Question

  • Hi,

    As I know, a filter driver attaches to the top of the stack. I am writing a SCSI filter driver and should attach to lower end or in the middle of the stack.

    But I am not sure how to do this. "IoAttachDeviceToDeviceStack" will attach to the top of the stack. 

    Please help me.

    Thanks,

    Pankaj

    Wednesday, January 9, 2013 5:18 AM

Answers

  • You can be below the fdo by installing yourself as a device lower filter in the device stack. You still call IoAttachDeviceToDeviceStack, but you are calling it as the stack is being built so you are the top of the stack at that moment until you return from AddDevice and the next device (fdo, upper filter, etc) attaches in their AddDevice routine. You can't insert yourself lower in the stack outside of pnp.

    which SCSI device are you trying to filter? If it is a pci SCSI adapter a lower filter will buy you nothing because you won't see the fdo touching the hardware because it is direct acccess, not irp based


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, January 9, 2013 5:28 AM

All replies

  • You can be below the fdo by installing yourself as a device lower filter in the device stack. You still call IoAttachDeviceToDeviceStack, but you are calling it as the stack is being built so you are the top of the stack at that moment until you return from AddDevice and the next device (fdo, upper filter, etc) attaches in their AddDevice routine. You can't insert yourself lower in the stack outside of pnp.

    which SCSI device are you trying to filter? If it is a pci SCSI adapter a lower filter will buy you nothing because you won't see the fdo touching the hardware because it is direct acccess, not irp based


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, January 9, 2013 5:28 AM
  • Hi,

    I will filter SCSI requests going down to physical/logical disks. How can I install my driver as lower filter?

    Also, if I do not know the target device name, how to get the name/pointer/object to so that it can be used in IoAttachDeviceToDeviceStack?

    Is it like, i will get the (target) physical device pointer/object from IO manager, when it will call addDevice?

    Wednesday, January 9, 2013 7:13 AM
  • you don't need to know the name of the target device, that is the whole point registering as a pnp lower filter. the pdo is passed to your adddevice routine. you need an inf and install your driver as a lower filter. you can look at the toaster sample for how to write an inf that installs a lower filter. i would match against the "GenDisk" hardware ID since you said you want to filter disks. as lower filter, you would be placed below disk.sys


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, January 9, 2013 7:18 AM
  • Thank you very much Doron... 
    Thursday, January 10, 2013 5:51 AM