Install PCI Bus Upper Filter Driver

Hi Guys,

i have developed a PCI Bus Filter Driver. but i do not know to how to install it?

i gone through DDK help and did what it said. but i think i am missing something.

can someone tell how to do this? how can i know that my driver loaded sucessfully as PCI bus filter driver on pci.sys ?

Do you need to get this WHQL signed? If so you need an inf file,
otherwise you just add your service key for your driver and your
driver as an UpperFilter for the class. See the filters samples in the
storage portion of the WDK, (e.g.
C:\WinDDK\7600.16385.0\src\storage\filters\addfilter).

You can do this with an inf file and as far as I am concerned, the
path of least resistance is to also create a root enumerated virtual
device controlled by your driver, install that using a standard pnp
inf file, and while there, add your driver as the upper filter for the
class of interest. Then go whql the virtual device.

Mark Roddy

On Fri, Aug 21, 2009 at 3:18 PM, wrote:
> Hi Guys,
>
> i have developed a PCI Bus Filter Driver. but i do not know to how to install it?
>
> i gone through DDK help and did what it said. but ?i think i am missing something.
>
> can someone tell how to do this? how can i know that my driver loaded sucessfully as ?PCI bus filter driver on pci.sys ?
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

thanks mark for your reply.but i do not need of WHQL. i want to filter every pci device on my system.

i do not wanna install for specific type. do you have any sample inf or registry entiry snapshot for pci bus filter driver?

I believe you should looked at Windows Registry key for System class - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E97D-E325-11CE-BFC1-08002BE10318}. Under this key you could find an entry for PCI bus device. For example in my PC it is - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E97D-E325-11CE-BFC1-08002BE10318}\0009. “DriverDesc” is PCI bus. You could add a value UpperFilter with your driver.

Igor Sharovar

The filter samples show you how to install a filter. Look at the
diskperf.inf file. Or see Igor message in this thread.

Mark Roddy

On Fri, Aug 21, 2009 at 4:09 PM, wrote:
> thanks mark for your reply.but i do not need of WHQL. i want to filter every pci device on my system.
>
> i do not wanna install for specific type. do you have any sample inf or registry entiry snapshot for pci bus filter driver?
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

HI Igor Sharovar

so you meant to say that i should add an entry UpperFilters to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E97D-E325-11CE-BFC1-08002BE10318}\0018(in my machine)
and assign value my filter driver name. then i should add some entries to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services regarding my filter driver. one more thing should i specify loadordergroup as “PnP Filter” for this filter driver?

xxxxx@gmail.com wrote:

so you meant to say that i should add an entry UpperFilters to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E97D-E325-11CE-BFC1-08002BE10318}\0018(in my machine) and assign value my filter driver name.

No, that won’t work. That’s a single device entry, but that’s not where
the system looks for device filters. To be a class filter, you’d have
to add to UpperFilters in {4D36E97D-…}, not in one of the subkeys.
However, that means you will load for EVERY system-class device. You
would have to check the device ID in your AddDevice routine to see
whether it was one that you wanted to filter. My system has 43 such
devices, so you’re going to be loaded a LOT.

I don’t think you have told us what you are actually trying to
accomplish. Being an upper filter to the PCI bus is not terribly
useful, because the vast majority of PCI drivers don’t pass any IRPs
down. They’re doing I/O directly to their memory spaces and I/O ports.

then i should add some entries to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services regarding my filter driver.

You will clearly need to do that.

one more thing should i specify loadordergroup as “PnP Filter” for this filter driver?

Load order is irrelevant for filter drivers. You load when the driver
you are filtering loads.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

The best way is to install an UpperFilter under entry for particular class but there is not a class for PCI bus.
Create an entry for your driver in \Services and try to set up an a value UpperFilter in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E97D-E325-11CE-BFC 1-08002BE10318}\0018(in your machine). But I could not tell you what kind of driver it should be - class filter driver or device filter. You should try both.
I would specify loadordergroup in your filter as PCI bus driver has - “Boot Bus Extender”.

Igor Sharovar

hi tim

i want to access PCI configuration space for each and every pci device.

and microsoft says that if you wan to do this then you must have pci bus filter driver.

then after i can user IRP_MN_QUERYINTEFACE and read /wrtie pci configuration space.

still i am confused how to install this driver? you are saying that in my machine total 38 entries in …{4D36E97D-E325-11CE-BFC 1-08002BE10318} so i have to add upperfilters entiry in 38 entires? or i can add value in {4D36E97D-E325-11CE-BFC 1-08002BE10318} ?

>No, that won’t work. That’s a single device entry, but that’s not where the system looks for device >filters. To be a class filter, you’d have to add to UpperFilters in {4D36E97D-…}, not in one of the >subkeys.
I agree with you Tim. But problem is that PCI Bus driver does not have a separate entry. Could OP install his filter as device filter driver?

Igor Sharovar

I did a PCI bus filter for a client about a year ago, I had no luck with the
per device filtering and in the end made it a class filter, that in
AddDevice used IoGetDeviceProperty to get the DevicePropertyHardwareID of
the PDO and only attached to PCI bus devices.

The OP should remember that the PCI bus driver will instantiate PDO’s for
just about any device type, so you have to monitor
IRP_MJ_PNP/IRP_MN_QUERY_DEVICE_RELATIONS and attach to the PDO’s as they are
instantiated.


Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

<igor.sharovar> wrote in message news:xxxxx@ntdev…
> >No, that won’t work. That’s a single device entry, but that’s not where
> >the system looks for device >filters. To be a class filter, you’d have to
> >add to UpperFilters in {4D36E97D-…}, not in one of the >subkeys.
> I agree with you Tim. But problem is that PCI Bus driver does not have a
> separate entry. Could OP install his filter as device filter driver?
>
> Igor Sharovar
>
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4357 (20090821)

>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

Information from ESET NOD32 Antivirus, version of virus signature database 4357 (20090821)

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com</igor.sharovar>

igor.sharovar@hp.com wrote:

The best way is to install an UpperFilter under entry for particular class but there is not a class for PCI bus.
Create an entry for your driver in \Services and try to set up an a value UpperFilter in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E97D-E325-11CE-BFC1-08002BE10318}\0018(in your machine). But I could not tell you what kind of driver it should be - class filter driver or device filter. You should try both.

Igor, this is simply incorrect. The difference between a class filter
and a device filter is strictly where you put the registry entry. There
is no difference between the implementation of the two.

Class filters are registered in the keys directly under
CurrentControlSet\Class (such as
Class{4D36E97D-E325-11CE-BFC1-08002BE10318}). The subkeys under THOSE
keys (like 0018) are just specific devices within that class, and the
system does not look for UpperFilters or LowerFilters values in those
keys. Device filters are registered in the keys under
CurrentControlSet\Enum.

I would specify loadordergroup in your filter as PCI bus driver has - “Boot Bus Extender”.

Load order is not used for filter drivers. In fact, load order is not
used for PnP drivers at all (unless there are weird exceptions I’m
missing). A PnP driver is loaded when a device ID that it supports
appears. No sooner, no later.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

In my experience, THAT’s not true. If you instantiate a device filter, you do so for a given DEVICE instance. If a new device instance of the same type is added in future, the filter will not be attached.

OTOH, if you instantiate a CLASS filter, you do so for all devices in the CLASS. Thus, any new devices that are added in the filtered device class wind-up having the filter instantiated.

Peter
OSR

thanks peter but still i am not able to install filter driver for pci bus. i did for system device class but i do not know how to do for only pci bus? is there any registry entry?

No there is not a registry entry, you have to use IoGetDeviceProperty to get
the DevicePropertyHardwareID as I posted earlier. The strings you shold
look for are \ACPI\PNP0A08 or \ACPI\PNP0A03 or *PNP0A08 or *PNP0A03 if it is
one of those it is the PCI bus as far as I know. Do this in AddDevice and
only attach if it one of these.


Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

wrote in message news:xxxxx@ntdev…
> thanks peter but still i am not able to install filter driver for pci bus.
> i did for system device class but i do not know how to do for only pci
> bus? is there any registry entry?
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4358 (20090822)

>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

Information from ESET NOD32 Antivirus, version of virus signature database 4358 (20090822)

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

>Igor, this is simply incorrect. The difference between a class filter and a device filter is strictly where >you put the registry entry. There is no difference between the implementation of the two.
Tim,
I mean not implementation of filter driver but binaries for class filter driver and device filter drivers.
For example,the toaster filter samples contains two different directories. One for class filter and the second for device filter. Despite on fact that both types of filter use the same source code they have different definitions options in their SOURCE files. I unintentionally install built device filter for DISK class and it did not work. Only when I installed built class filter I got the working filter.

Igor Sharovar

Don Burn wrote:

No there is not a registry entry, you have to use IoGetDeviceProperty to get
the DevicePropertyHardwareID as I posted earlier. The strings you shold
look for are \ACPI\PNP0A08 or \ACPI\PNP0A03 or *PNP0A08 or *PNP0A03 if it is
one of those it is the PCI bus as far as I know. Do this in AddDevice and
only attach if it one of these.

Yes, I am using this approach in my driver set. It works fine and I
think this is more scalable if I want to filter another device class.

thanks
wayne

Yes this approach works.

Mark Roddy

On Mon, Aug 24, 2009 at 6:14 AM, Wayne Gong wrote:
> Don Burn wrote:
>>
>> No there is not a registry entry, you have to use IoGetDeviceProperty to
>> get the DevicePropertyHardwareID as I posted earlier. ?The strings you shold
>> look for are \ACPI\PNP0A08 or \ACPI\PNP0A03 or *PNP0A08 or *PNP0A03 if it is
>> one of those it is the PCI bus as far as I know. ? Do this in AddDevice and
>> only attach if it one of these.
>
> Yes, I am using this approach in my driver set. It works fine and I think
> this is more scalable if I want to filter another device class.
>
> thanks
> wayne
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

thanks guys now i am able to install PCI Bus upper filter driver for pic bus.

but when i call CreateFile Api to get handle of PCI Bus Upper Filter Driver, it returns me INVALID_FILE_HANDLE and irp tracking toll shows me :NO_SUCH_DEVICE 0x890000.

is my request blocked by drivers who sit on my driver?

xxxxx@gmail.com wrote:

thanks guys now i am able to install PCI Bus upper filter driver for pic bus.

but when i call CreateFile Api to get handle of PCI Bus Upper Filter Driver, it returns me INVALID_FILE_HANDLE and irp tracking toll shows me :NO_SUCH_DEVICE 0x890000.

is my request blocked by drivers who sit on my driver?

What file name did you pass in the CreateFile call?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.