KMDF Filter Driver installer how-to?

Hi!

I’m a bit confused about the whole KMDF filter driver installation process. There is a great article on the OSR site that talks about the basics of writing a KMDF filter driver, but it sort of hand-waives the whole installation procedure. It is possible to do with just a .inf, or does one need the whole coinstaller stuff one sees in the Toaster kmdf filter example? I’d like to do a class filter driver, but if the install is too onerous I could just do a regular filter driver on a specific device to start with. Where can I find out about such things (docs, examples, etc.) and how would you approach such a thing? Simple is good in this instance…

PS I’m not talking at least right now about specific types such as networks - I know NDIS has its own whole filter installation mumbo-jumbo (and old examples to show how). I’m just looking for something that would work for maybe a webcam to start.

Thanks!

Steve

xxxxx@aol.com wrote:

I’m a bit confused about the whole KMDF filter driver installation process. There is a great article on the OSR site that talks about the basics of writing a KMDF filter driver, but it sort of hand-waives the whole installation procedure. It is possible to do with just a .inf, or does one need the whole coinstaller stuff one sees in the Toaster kmdf filter example? I’d like to do a class filter driver, but if the install is too onerous I could just do a regular filter driver on a specific device to start with. Where can I find out about such things (docs, examples, etc.) and how would you approach such a thing?

The answer is multiple choice.

Installing a filter driver by itself is not a PnP operation, so you
don’t need an INF. All you need is to copy the sys file, create a
service, and add the service name to the UpperFilters or LowerFilters
registry entry for your class or device. That can actually be done with
a batch file, although most folks use a simple install app.

It is possible to install a class filter using an INF with a
[DefaultInstall] section, which is really nothing more than an oddly
spelled batch file. You can do that because the registry key for a
class is fixed, so you can embed that in the INF.

You can’t use an INF for a device filter, because you need to tweak the
Enum registry key, and that varies. So, you’d need an app.

All of that only applies if you don’t need the co-installers. That
means a WDM driver, or a KMDF driver where you KNOW you will not need to
upgrade KMDF (e.g., you target Win 7 minimum and build with KMDF 1.9).
But if there’s a chance you might need to upgrade (for example, you need
to target XP), then you have to use a small installer app that creates a
fake INF file and invokes the co-installer.

The app isn’t complicated – couple hundred lines of boilerplate. You
copy the file(s), create a fake INF, call the “pre-install” co-installer
entry point, create the service, call the “post-install” co-installer
entry point, call SetupDi to open your target device’s registry key, and
tweak the UpperFilters/LowerFilters entry.

PS I’m not talking at least right now about specific types such as networks - I know NDIS has its own whole filter installation mumbo-jumbo (and old examples to show how). I’m just looking for something that would work for maybe a webcam to start.

Filtering a webcam is not necessarily simple. The top-edge of a webcam
driver is the Kernel Streaming interface, which communicates through a
small set of ioctls. In particular, identifying the current format of a
KS stream is non-trivial.


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