How to install a filter driver like pnpdtest.exe in wdk?

I found that in wdk 6000 tools, the pnpdtest.exe install the pnpfiltr.sys without inf file. How does it do that? Does it use the way that directly adding the entries in regestry? If it is, then i think it improper, for we are always told use the inf file to install the driver, but itself don’t abide, especially in vista platform.

Please just use the documented installation methods. Having wasted a day removing a root kit from my wife’s computer, a day I will never get back, I’d prefer that there were fewer rotten software abominations in the world, not more of them.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-292962-
xxxxx@lists.osr.com] On Behalf Of activism@163.com
Sent: Monday, July 09, 2007 4:09 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to install a filter driver like pnpdtest.exe in
wdk?

I found that in wdk 6000 tools, the pnpdtest.exe install the
pnpfiltr.sys without inf file. How does it do that? Does it use the way
that directly adding the entries in regestry? If it is, then i think it
improper, for we are always told use the inf file to install the
driver, but itself don’t abide, especially in vista platform.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Mark Roddy:
I can understand your feeling, as a developer, we should tend to to contribute, not to produce malsoftware, isn’t it?
How can i reach somebody in microsoft who develop the driver for 1394bus and sbp2port for vista platform( the device work well on early platform)? I really need the support from them. Email, forum, blog, any way that can be replied will be ok, i can’t find a effective way to fix the problem(our driver was pending by lower driver and the completion routine for the irp never gets invoked) we encountered for almost two weeks. help,help…

If you really need questions answered, pay for a support incident or use one
from your MSDN subscription.


David J. Craig
Engineer, Sr. Staff Software Systems
Broadcom Corporation

wrote in message news:xxxxx@ntdev…
Mark Roddy:
I can understand your feeling, as a developer, we should tend to to
contribute, not to produce malsoftware, isn’t it?
How can i reach somebody in microsoft who develop the driver for 1394bus and
sbp2port for vista platform( the device work well on early platform)? I
really need the support from them. Email, forum, blog, any way that can be
replied will be ok, i can’t find a effective way to fix the problem(our
driver was pending by lower driver and the completion routine for the irp
never gets invoked) we encountered for almost two weeks. help,help…

The proper way to install a device is to use an INF file. PNPDTEST is not an
installation tool, it is a developer testing tool. As a developer testing
tool, it can do things that are acceptable for developers but would not be
acceptable to end users. Installing a device by INF file ensures that the
system will perform a registry snapshot (at least on newer Windows OSes) to
roll back the driver installation so the end user won’t end up with a
non-functional device or machine. Kernel driver developers are expected to
have methods to recover their own machines in the event that they install a
driver that does not work and the machine boots to a blue screen. End users
in general do not know how to recover from blue screens and this could
result in them having to reinstall Windows or roll back to an old registry
backup (if they have one) that does not have their current settings. If a
user needs to reinstall Windows but they have lost their Windows CD (not all
that uncommon), they could be unable to make their machine work again at
all. They will NOT be happy about that!

Drivers *can* be installed by just adding entries to the registry, but that
is not an approved method because it doesn’t protect the end user machine
from faults the way that installing a driver from an INF file does.

wrote in message news:xxxxx@ntdev…
>I found that in wdk 6000 tools, the pnpdtest.exe install the pnpfiltr.sys
>without inf file. How does it do that? Does it use the way that directly
>adding the entries in regestry? If it is, then i think it improper, for we
>are always told use the inf file to install the driver, but itself don’t
>abide, especially in vista platform.
>

Matthew Carter wrote:

The proper way to install a device is to use an INF file.

Actually, not in this case. There is no (documented and approved) way to *add* device filters using INF files. INF supports installing filters and devices *at the same time*, it also supports adding *class* filters, but not *adding* devices filters after the device is already installed.

So the proper way is to use the SetupApi. I guess that’s what pnpfiltr does (and not modifying the registry directly).

wrote in message news:xxxxx@ntdev…
> Matthew Carter wrote:
>
>> The proper way to install a device is to use an INF file.
>
> Actually, not in this case. There is no (documented and approved) way to
> add device filters using INF files. INF supports installing filters and
> devices at the same time, it also supports adding class filters, but
> not adding devices filters after the device is already installed.
>
> So the proper way is to use the SetupApi. I guess that’s what pnpfiltr
> does (and not modifying the registry directly).
>

What in the world are you talking about? There are samples in the WDK to
add filters, I saw my first explaination of this almost 10 years ago!!!


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

Don Burn wrote:

wrote in message news:xxxxx@ntdev…
>> Matthew Carter wrote:
>>
>>> The proper way to install a device is to use an INF file.
>>
>> Actually, not in this case. There is no (documented and approved) way to
>> add device filters using INF files. INF supports installing filters and
>> devices at the same time, it also supports adding class filters, but
>> not adding devices filters after the device is already installed.
>>
>> So the proper way is to use the SetupApi. I guess that’s what pnpfiltr
>
> What in the world are you talking about? There are samples in the WDK to
> add filters, I saw my first explaination of this almost 10 years ago!!!

Can you point to a sample ? The only samples I see are class filter samples, or Toaster where the filter and function dirvers are close coupled, and then the original INF file is available and can be included.

Since I do a lot with storage the one that immediately comes to mind is
diskperf. There is an INF you right click to install it and go. I’ve
successfully modified it to for specific devices, or for other types of
devices.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> Don Burn wrote:
>
>> wrote in message news:xxxxx@ntdev…
>>> Matthew Carter wrote:
>>>
>>>> The proper way to install a device is to use an INF file.
>>>
>>> Actually, not in this case. There is no (documented and approved) way
>>> to
>>> add device filters using INF files. INF supports installing filters
>>> and
>>> devices at the same time, it also supports adding class filters,
>>> but
>>> not adding devices filters after the device is already installed.
>>>
>>> So the proper way is to use the SetupApi. I guess that’s what pnpfiltr
>>
>> What in the world are you talking about? There are samples in the WDK
>> to
>> add filters, I saw my first explaination of this almost 10 years
>> ago!!!
>
> Can you point to a sample ? The only samples I see are class filter
> samples, or Toaster where the filter and function dirvers are close
> coupled, and then the original INF file is available and can be included.
>
>

It looks to me that diskperf installs a class filter for the DiskDrive class
and not a device filter. My understanding of a device filter is that it
filters a specific PNP device.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of Don Burn
Sent: Monday, July 09, 2007 7:23 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to install a filter driver like pnpdtest.exe in wdk?

Since I do a lot with storage the one that immediately comes to mind is
diskperf. There is an INF you right click to install it and go. I’ve
successfully modified it to for specific devices, or for other types of
devices.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> Don Burn wrote:
>
>> wrote in message news:xxxxx@ntdev…
>>> Matthew Carter wrote:
>>>
>>>> The proper way to install a device is to use an INF file.
>>>
>>> Actually, not in this case. There is no (documented and approved) way
>>> to
>>> add device filters using INF files. INF supports installing filters
>>> and
>>> devices at the same time, it also supports adding class filters,
>>> but
>>> not adding devices filters after the device is already installed.
>>>
>>> So the proper way is to use the SetupApi. I guess that’s what pnpfiltr
>>
>> What in the world are you talking about? There are samples in the WDK
>> to
>> add filters, I saw my first explaination of this almost 10 years
>> ago!!!
>
> Can you point to a sample ? The only samples I see are class filter
> samples, or Toaster where the filter and function dirvers are close
> coupled, and then the original INF file is available and can be included.
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Don Burn wrote:

Since I do a lot with storage the one that immediately comes to mind is
diskperf. There is an INF you right click to install it and go. I’ve
successfully modified it to for specific devices, or for other types of
devices.

Don,

The diskperf INF in the WDK is a class filter installation file, not a device specific one. So it can’t count as a WDK sample for adding device specific filters.

The problem of device specific filters, is that there is no generic way to locate and reference a device, or device node in the INF file (Class filters can easily reference the class guid). Using diskperf as a sample, how you reference a specific disk or volume in the INF file that is not tied to a specific installation (other than building the INF file on-the-fly)?

Don Burn:
->There is an INF you right click to install it and go.
Yes, you can add a class filter driver use inf file like the above, i have tried installing in vista platform. meanwhile, i install the device filter driver for my device, but you can’t use the way on the device(not the class)thah has been installed. As we all know,device filter driver need you at last add the entry in Enum key, isn’t it? In vista platform, this can’t not be done easily(though i can use the update menu in device manager for my device filter driver using inf file, but i can’t do it for other device that system supplies driver for them).

David J. Craig:
->If you really need questions answered, pay for a support incident or use one
->from your MSDN subscription.
Thanks the way you suggestion. But is there any way that developers can communicate with the microsoft corresponding developers? After all, this is an unusual problem which i guess there is something related to sbp2port.sys wrong.

Ma LiJun wrote:

As we all know,device filter driver need you at last add the entry in
Enum key, isn’t it? In vista platform, this can’t not be done easily …

Why do you care where the key is located, or how it is protected? Do *not* modify the registry manually, use the setupapi. Check the addfilter sample in the WDK.

Ijor:
->Why do you care where the key is located, or how it is protected? Do *not*
->modify the registry manually, use the setupapi. Check the addfilter sample in
->the WDK.
Because i cound’t install the device filter driver like the class filter driver, use the inf file, i could install class filter driver easily, it just need add the regestry entry by inf section( use the right click on inf file to install the filter), but the way can’t be use in device filter driver, i means the section in inf file for the device filter driver can’t be add to the regestry while the class filter can.

The essence of what you are saying is correct, but installing a device with
the SetupApi functions *still* requires an INF file. You copy the files and
install the services using SetupApi functions like
SetupInstallFilesFromInfSection and SetupInstallServicesFromInfSection and
those functions still require an INF file and still will prompt the user if
the driver is not signed. If you are adding a device filter and not
installing the device it is going to filter then your custom installation
application will enumerate the devices in the device class using the SetupDi
functions, then you update the filter registry keys safely using
(UpperFilters or LowerFilters) with SetupDiGetDeviceRegistryProperty and
DiSetupDiSetDeviceRegistryProperty for each device. An example of such a
custom installation program that performs the latter part of this operation
(the part after the install of the service and copying of the files – that
utility assumes the driver service is already installed from an INF) is in
src\storage\filters\addfilter. If you edit the INF file in
src\storage\filters\diskperf by removing the AddReg part from from
[DefaultInstall.NT], then it will only install the driver service and you
can use addfilter to actually apply the filter to a device. As it comes in
the box, that inf file installs diskperf as a class upper filter and you
don’t need a custom installation application at all to do that.

Basically what you will be doing is the same as in this MSDN article on
installing a Class Filter, except since you are replacing step 3 with
get/set device registry property as outlined above and demonstrated in the
addfilter application…

http://msdn2.microsoft.com/en-us/library/ms791322.aspx

wrote in message news:xxxxx@ntdev…
> Matthew Carter wrote:
>
>> The proper way to install a device is to use an INF file.
>
> Actually, not in this case. There is no (documented and approved) way to
> add device filters using INF files. INF supports installing filters and
> devices at the same time, it also supports adding class filters, but
> not adding devices filters after the device is already installed.
>
> So the proper way is to use the SetupApi. I guess that’s what pnpfiltr
> does (and not modifying the registry directly).
>
>

> " functions, then you update the filter registry keys safely using

(UpperFilters or LowerFilters) with SetupDiGetDeviceRegistryProperty and

Err… This sentence was a mess. It should read more like this:

functions, then you update the filter registry keys (UpperFilters or
LowerFilters) safely with SetupDiGetDeviceRegistryProperty and

Matthew Carter wrote:

The essence of what you are saying is correct, but installing a device with
the SetupApi functions *still* requires an INF file. You copy the files and
install the services using SetupApi functions like
SetupInstallFilesFromInfSection and SetupInstallServicesFromInfSection and
those functions still require an INF file and still will prompt the user if
the driver is not signed. If you are adding a device filter and not
installing the device it is going to filter then your custom installation
application will enumerate the devices in the device class using the SetupDi
functions, then you update the filter registry keys safely …

I agree. I might have missed your point (or you might have missed the OP point). The OP question was about how to add a filter driver without using an INF file, trying to avoid modifying the registry directly. So I assume(d) that the point was about how to configure filter entries for a device, and not about how to copy the actual filter driver (or install the filter service). I assumed that because you don’t actually need to touch the registry at all for copying the driver file (you do need for installing the service, but you can install the filter without creating a filter service).

Honestly, and after his last post, I’m now totally lost about what the OP is trying to do (since he now seems to be trying to use an INF file!).

Both, i first tried to install with inf file, just as i said above, when installing device filter driver, i failed, then i try to find the way installing device filter driver without inf file.

What you need to do is to understand why your attempts to install using
inf files failed, rather than just give up on it and start hacking away.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of activism@163.com
Sent: Tuesday, July 10, 2007 2:34 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How to install a filter driver like pnpdtest.exe in
wdk?

Both, i first tried to install with inf file, just as i said above, when
installing device filter driver, i failed, then i try to find the way
installing device filter driver without inf file.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

>driver (or install the filter service). I assumed that because you don’t

actually need to touch the registry at all for copying the driver file (you
do need for installing the service, but you can install the filter without
creating a filter service).

I don’t believe Windows has any way to load a PnP or legacy driver at all
without a driver service in the registry, so I don’t think you can install a
filter or any other driver without a service. As far as I know the lowest
level of driver activation exposed by the OS is ZwLoadDriver and that takes
the path of a driver service registry key, not a file path as its argument.

The approved method of installing the service and its .sys file is through
the INF file mechanism, either alone or, if the installation requirements
are complex, with the assistance of SetupApi calls either accomplished by an
INF with a custom coinstaller (right click the INF and select install to
install) or custom installation application (run the executable to install
instead of clicking the INF).