ScsiPort Filter Driver

Hi,
I am developing a SCSI port filter driver in Win2k.
I want to place the filter driver in between the disk
class driver and SCSI port driver.
Can anybody suggest me how to place it in between the
2 drivers.
Thanks in Advance,
Regards,
Gurpreet


Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

Where do you want your filter device object(s):

  • Above the SCSI port FDO; or
  • Between the SCSI LUN PDO and the disk FDO?

For the former, you want to be in SCSI adapter UpperFilters; your
AddDevice() routine will be invoked with the host adapter’s PDO after
the SCSI miniport has attached its FDO.

For the latter you want to be in disk LowerFilters. Your AddDevice()
will be passed the LUN PDO before the disk driver’s AddDevice().


Dave Cox
Hewlett-Packard Co.
HPSO/SMSO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Gurpreet Anand [mailto:xxxxx@yahoo.com]
Sent: Tuesday, October 10, 2000 10:53 AM
To: NT Developers Interest List
Subject: [ntdev] ScsiPort Filter Driver

Hi,
I am developing a SCSI port filter driver in Win2k.
I want to place the filter driver in between the disk
class driver and SCSI port driver.
Can anybody suggest me how to place it in between the
2 drivers.
Thanks in Advance,
Regards,
Gurpreet


Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

> Where do you want your filter device object(s):

  • Above the SCSI port FDO; or
  • Between the SCSI LUN PDO and the disk FDO?

For the former, you want to be in SCSI adapter UpperFilters; your
AddDevice() routine will be invoked with the host adapter’s PDO after
the SCSI miniport has attached its FDO.

For the latter you want to be in disk LowerFilters. Your AddDevice()
will be passed the LUN PDO before the disk driver’s AddDevice().

If on the other hand you want to filter all scsiport PDOs, not just Disk
PDOs, then a disk lowerfilter will not do it, nor will a scsiport FDO upper
filter. What you want instead is a BUS PDO filter driver, and that is
unfortunately not documented functionality in W2K, although at least one
microsoft device driver (acpi if I recall correctly,) implements it.

Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
WindowsNT Windows 2000 Consulting Services

Yes, it’s very clever. I wish I’d had brains enough to discover a
sample in the DDK instead of reinventing it myself.

But…

  1. He explictly mentioned the disk class driver.
  2. In some hands, a little bit of information can be dangerous.

Dave Cox
Hewlett-Packard Co.
HPSO/SMSO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Tuesday, October 10, 2000 1:08 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ScsiPort Filter Driver

Where do you want your filter device object(s):

  • Above the SCSI port FDO; or
  • Between the SCSI LUN PDO and the disk FDO?

For the former, you want to be in SCSI adapter UpperFilters; your
AddDevice() routine will be invoked with the host adapter’s PDO after
the SCSI miniport has attached its FDO.

For the latter you want to be in disk LowerFilters. Your AddDevice()
will be passed the LUN PDO before the disk driver’s AddDevice().

If on the other hand you want to filter all scsiport PDOs, not just Disk
PDOs, then a disk lowerfilter will not do it, nor will a scsiport FDO upper
filter. What you want instead is a BUS PDO filter driver, and that is
unfortunately not documented functionality in W2K, although at least one
microsoft device driver (acpi if I recall correctly,) implements it.

Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
WindowsNT Windows 2000 Consulting Services


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

As I recall, we discussed doing this in a seminar taught by Jamie Hanrahan.
Either he or Brian Caitlin could probably tell you how. The note that I took
indicates you simply call IoAttachToDeviceStack on the bus drivers PDO. But
that’s been 8 months ago and my notes have gone cold.

Gary

-----Original Message-----
From: COX,DAVID (HP-Roseville,ex1) [mailto:david_cox2@hp.com]
Sent: Tuesday, October 10, 2000 2:40 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ScsiPort Filter Driver

Yes, it’s very clever. I wish I’d had brains enough to discover a
sample in the DDK instead of reinventing it myself.

But…

  1. He explictly mentioned the disk class driver.
  2. In some hands, a little bit of information can be dangerous.

Dave Cox
Hewlett-Packard Co.
HPSO/SMSO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Tuesday, October 10, 2000 1:08 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ScsiPort Filter Driver

Where do you want your filter device object(s):

  • Above the SCSI port FDO; or
  • Between the SCSI LUN PDO and the disk FDO?

For the former, you want to be in SCSI adapter UpperFilters; your
AddDevice() routine will be invoked with the host adapter’s PDO after
the SCSI miniport has attached its FDO.

For the latter you want to be in disk LowerFilters. Your AddDevice()
will be passed the LUN PDO before the disk driver’s AddDevice().

If on the other hand you want to filter all scsiport PDOs, not just Disk
PDOs, then a disk lowerfilter will not do it, nor will a scsiport FDO upper
filter. What you want instead is a BUS PDO filter driver, and that is
unfortunately not documented functionality in W2K, although at least one
microsoft device driver (acpi if I recall correctly,) implements it.

Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
WindowsNT Windows 2000 Consulting Services


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Hi,
Thanks for ur response.
My filter driver is expecting a SCSI port FDO in it
AddDevice(), but I want to know how to installthis
kind of filter driver.
Are there any samples available in the DDK which
explains this kind of thing.
Regards,
Gurpreet
— “COX,DAVID (HP-Roseville,ex1)” <david_cox2>
wrote:
> Where do you want your filter device object(s):
> - Above the SCSI port FDO; or
> - Between the SCSI LUN PDO and the disk FDO?
>
> For the former, you want to be in SCSI adapter
> UpperFilters; your
> AddDevice() routine will be invoked with the host
> adapter’s PDO after
> the SCSI miniport has attached its FDO.
>
> For the latter you want to be in disk LowerFilters.
> Your AddDevice()
> will be passed the LUN PDO before the disk driver’s
> AddDevice().
>
>
-----------------------------------------------------------------------
> Dave Cox
> Hewlett-Packard Co.
> HPSO/SMSO (Santa Barbara)
> https://ecardfile.com/id/Dave+Cox
>
>
> -----Original Message-----
> From: Gurpreet Anand
> [mailto:xxxxx@yahoo.com]
> Sent: Tuesday, October 10, 2000 10:53 AM
> To: NT Developers Interest List
> Subject: [ntdev] ScsiPort Filter Driver
>
>
> Hi,
> I am developing a SCSI port filter driver in Win2k.
> I want to place the filter driver in between the
> disk
> class driver and SCSI port driver.
> Can anybody suggest me how to place it in between
> the
> 2 drivers.
> Thanks in Advance,
> Regards,
> Gurpreet
>
>
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from
> anywhere!
> http://mail.yahoo.com/
>
> —
> You are currently subscribed to ntdev as:
> david_cox2@hp.com
> To unsubscribe send a blank email to
> $subst(‘Email.Unsub’)
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
> $subst(‘Email.Unsub’)
>


Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/</david_cox2>

>

As I recall, we discussed doing this in a seminar taught by Jamie
Hanrahan.
Either he or Brian Caitlin could probably tell you how. The note
that I took
indicates you simply call IoAttachToDeviceStack on the bus
drivers PDO. But
that’s been 8 months ago and my notes have gone cold.

That will do most of what you want but it will not deal with removals
correctly. You have to keep in mind that PDO’s get removed twice, a feature
of the PnP design that is not only FUGLY, but understandably
semi-undocumented. The nearest I could come to how to get a PDO filter to
figure out that it would be a good time to detach itself is to hook the
FastIoInterface for device detach. If anyone else has I better solution I’d
like to know.

Ouch! Well, like I said the notes were stale and congealed.

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Tuesday, October 10, 2000 4:35 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ScsiPort Filter Driver

As I recall, we discussed doing this in a seminar taught by Jamie
Hanrahan.
Either he or Brian Caitlin could probably tell you how. The note
that I took
indicates you simply call IoAttachToDeviceStack on the bus
drivers PDO. But
that’s been 8 months ago and my notes have gone cold.

That will do most of what you want but it will not deal with removals
correctly. You have to keep in mind that PDO’s get removed twice, a feature
of the PnP design that is not only FUGLY, but understandably
semi-undocumented. The nearest I could come to how to get a PDO filter to
figure out that it would be a good time to detach itself is to hook the
FastIoInterface for device detach. If anyone else has I better solution I’d
like to know.


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Go with the flow: track the devnode state based on which IRPs you have
received, including a half-removed state indicating you have received
one remove (or surprise-removal) IRP and are expecting an additional
remove. Detach on receipt of the second remove IRP, but arrange a
completion routine. Delete the filter DO on completion.

Sometimes, such as when a device has been disabled by the user, a device
can be started after it has received a single remove IRP. So you wouldn’t
want to detach after just one remove.

The bus driver may not delete the PDO after the second remove, if it
doesn’t agree that the physical device is gone; but at this point the
devnode is dead. A device stack can’t be built on it again, so you may
be OK not filtering.


Dave Cox
Hewlett-Packard Co.
HPSO/SMSO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Tuesday, October 10, 2000 4:35 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ScsiPort Filter Driver

As I recall, we discussed doing this in a seminar taught by Jamie
Hanrahan.
Either he or Brian Caitlin could probably tell you how. The note
that I took
indicates you simply call IoAttachToDeviceStack on the bus
drivers PDO. But
that’s been 8 months ago and my notes have gone cold.

That will do most of what you want but it will not deal with removals
correctly. You have to keep in mind that PDO’s get removed twice, a feature
of the PnP design that is not only FUGLY, but understandably
semi-undocumented. The nearest I could come to how to get a PDO filter to
figure out that it would be a good time to detach itself is to hook the
FastIoInterface for device detach. If anyone else has I better solution I’d
like to know.


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

> I am developing a SCSI port filter driver in Win2k.

I want to place the filter driver in between the disk
class driver and SCSI port driver.
Can anybody suggest me how to place it in between the
2 drivers.

IIRC you must develop the bus filter for the SCSI class devices.
Or - the UpperFilter for the “SCSI” class, which will filter
MN_QUERY_RELATIONS and attach filter DOs to each SCSIPORT’s PDO.

Max