How to find the target device for a class filter driver

Discussion in 'Windows Vista Drivers' started by the veloper, Aug 19, 2003.

  1. the veloper

    the veloper Guest

    for the type of SRBs. I can see a whole bunch of SCSIOP_READ and
    SCSIOP_WRITE when running the Check Disk tool on the drive that is not
    the primary master.

    But how can I tell which device the SRB is directed to if if it a
    DiskDrive class filter driver. I have many devices that belong to the
    DiskDrive class and I only want to care about SRBs directed to only
    one of my hard drives.

    I looked at the SRB's PathId, TargetId, and Lun and they are always
    I tried getting info using IOCTL_STORAGE_GET_DEVICE_NUMBER but I get

    The ReferenceCount field in the DEVICE_OBJECT struct is always 0.

    I can see under the registy that I have 3 instances of the driver

    BTW, my driver is based on DiskPerf from the 2000 DDK.
    the veloper, Aug 19, 2003
    1. Advertisements

  2. the veloper

    the veloper Guest

    Great! ... So this would work if I have an upper filter class driver.
    How would I do it for a lower filter driver or for a bus driver if
    IOCTL_STORAGE_* are only implemented by the class drivers.
    the veloper, Aug 20, 2003
    1. Advertisements

  3. the veloper

    heinz baer Guest

    IOCTL_SCSI_GET_ADDRESS should be handled by the bus driver

    As long as you are talking WDM, you are ok. Note this is something
    that has changed and under NT 4, the class driver handled
    IOCTL_SCSI_GET_ADDRESS so you would have to send this ioctl to the top
    of the stack in that instance.
    Not only is it "possible", it's just a simple call to
    IoGetAttachedDeviceReference. I think it is a bad idea to bypass
    filter drivers. When you make filters above or below you blind to
    IRP's originating in your driver, the filters won't be able to achieve
    what they are trying to do like performance measurements, logging,
    synchronization, or any other value add. I would hope in the future
    driver verifier is enhanced to fail drivers that get a private IOCTL
    from a user mode app and in turn send something straight to the PDO
    for instance.
    heinz baer, Aug 21, 2003
    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.