Installing a filter driver in the field

Hi All,

Forgive me if this is a common question. I have created a lower filter driver for the USB Audio class driver to allow us to send vendor command directly to the hub. I have the driver working and it runs perfectly for me when I install it using the usual right click update driver in device manager, but I need to be able to have our customers install this in the field on OSes from Win7 up to Win10 (Yes, it does run on all of them) and it has the proper signatures. What I have not done before is create a driver installer. I am looking for some advice on what tools to use for this. Should I roll my own using the setup api? or use a tool like InstallShield or Wix? This also needs to be installed as part of an app suite that will utilize the filter if that makes a difference.

tia,
DJ Sisolak

DJ Sisolak wrote:

Forgive me if this is a common question. I have created a lower filter
driver for the USB Audio class driver to allow us to send vendor
command directly to the hub. I have the driver working and it runs
perfectly for me when I install it using the usual right click update
driver in device manager, but I need to be able to have our customers
install this in the field on OSes from Win7 up to Win10 (Yes, it does
run on all of them) and it has the proper signatures. What I have not
done before is create a driver installer. I am looking for some advice
on what tools to use for this. Should I roll my own using the setup
api? or use a tool like InstallShield or Wix? This also needs to be
installed as part of an app suite that will utilize the filter if that
makes a difference.

You don’t need an INF for this. All you need is a simple app.
Installing a filter on an existing device requires three steps:

  1. Copy the binary to \Windows\System32\Drivers (CopyFile)
  2. Create a services entry (OpenSCManager, CreateService)
  3. Update the LowerFilters key for the device you want to filter
    (SetupDiGetClassDevs, SetupDiGetDeviceRegistryProperty,
    SetupDiSetDeviceRegistryProperty)
  4. Restart the device (SetupDiSetClassInstallParams,
    SetupDiCallClassInstaller)

It’s a little wordy, but it’s not complicated.


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

Also assuming your inf file is correct you can use the ancient but
functional rundll command line, msft still documents this here:
https://msdn.microsoft.com/en-us/windows/hardware/drivers/ifs/using-an-inf-file-to-install-a-file-system-filter-driver

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132
path-to-inf\infname.inf

Mark Roddy

On Mon, Apr 10, 2017 at 5:37 PM, Tim Roberts wrote:

> DJ Sisolak wrote:
> >
> >
> > Forgive me if this is a common question. I have created a lower filter
> > driver for the USB Audio class driver to allow us to send vendor
> > command directly to the hub. I have the driver working and it runs
> > perfectly for me when I install it using the usual right click update
> > driver in device manager, but I need to be able to have our customers
> > install this in the field on OSes from Win7 up to Win10 (Yes, it does
> > run on all of them) and it has the proper signatures. What I have not
> > done before is create a driver installer. I am looking for some advice
> > on what tools to use for this. Should I roll my own using the setup
> > api? or use a tool like InstallShield or Wix? This also needs to be
> > installed as part of an app suite that will utilize the filter if that
> > makes a difference.
> >
>
> You don’t need an INF for this. All you need is a simple app.
> Installing a filter on an existing device requires three steps:
> 1. Copy the binary to \Windows\System32\Drivers (CopyFile)
> 2. Create a services entry (OpenSCManager, CreateService)
> 3. Update the LowerFilters key for the device you want to filter
> (SetupDiGetClassDevs, SetupDiGetDeviceRegistryProperty,
> SetupDiSetDeviceRegistryProperty)
> 4. Restart the device (SetupDiSetClassInstallParams,
> SetupDiCallClassInstaller)
>
> It’s a little wordy, but it’s not complicated.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:> showlists.cfm?list=ntdev>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:></http:>

Thanks Tim/Mark,

A quick follow up on this …

Tim, if I want future plugins of the USB device to enumerate the driver with the filter I am assuming that I want to install the INF for this. If I understand what you are saying below, the direct manipulation of the registry through the setup api will only be effective for devices that are already installed. I am assuming I will need to use the setup api approach as well for those devices that have already been plugged in and enumerated with the class driver only. Will the steps you mention below work for devices that have been enumerated into the system but are not currently physically attached? I do not want our customers to have to do this more than once.

thanks again!
DJ

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Monday, April 10, 2017 6:40 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Installing a filter driver in the field

Also assuming your inf file is correct you can use the ancient but functional rundll command line, msft still documents this here: https://msdn.microsoft.com/en-us/windows/hardware/drivers/ifs/using-an-inf-file-to-install-a-file-system-filter-driver -

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 path-to-inf\infname.inf

Mark Roddy

On Mon, Apr 10, 2017 at 5:37 PM, Tim Roberts > wrote:
DJ Sisolak wrote:
>
>
> Forgive me if this is a common question. I have created a lower filter
> driver for the USB Audio class driver to allow us to send vendor
> command directly to the hub. I have the driver working and it runs
> perfectly for me when I install it using the usual right click update
> driver in device manager, but I need to be able to have our customers
> install this in the field on OSes from Win7 up to Win10 (Yes, it does
> run on all of them) and it has the proper signatures. What I have not
> done before is create a driver installer. I am looking for some advice
> on what tools to use for this. Should I roll my own using the setup
> api? or use a tool like InstallShield or Wix? This also needs to be
> installed as part of an app suite that will utilize the filter if that
> makes a difference.
>

You don’t need an INF for this. All you need is a simple app.
Installing a filter on an existing device requires three steps:
1. Copy the binary to \Windows\System32\Drivers (CopyFile)
2. Create a services entry (OpenSCManager, CreateService)
3. Update the LowerFilters key for the device you want to filter
(SetupDiGetClassDevs, SetupDiGetDeviceRegistryProperty,
SetupDiSetDeviceRegistryProperty)
4. Restart the device (SetupDiSetClassInstallParams,
SetupDiCallClassInstaller)

It’s a little wordy, but it’s not complicated.


Tim Roberts, xxxxx@probo.commailto:xxxxx
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:

— NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at To unsubscribe, visit the List Server section of OSR Online at</http:></http:></http:></mailto:xxxxx>

On Apr 12, 2017, at 5:01 PM, DJ Sisolak > wrote:

Tim, if I want future plugins of the USB device to enumerate the driver with the filter I am assuming that I want to install the INF for this. If I understand what you are saying below, the direct manipulation of the registry through the setup api will only be effective for devices that are already installed.

Yes.

I am assuming I will need to use the setup api approach as well for those devices that have already been plugged in and enumerated with the class driver only. Will the steps you mention below work for devices that have been enumerated into the system but are not currently physically attached? I do not want our customers to have to do this more than once.

You might be able to do this with a class filter as well. That can be installed the same way, it’s just that the registry entry goes into a different location. If you filtered all Media class devices, you’d have to make sure in your AddDevice that it was one you want to handle, because you’d get loaded for all Audio devices, not just USB.

Tim Roberts, xxxxx@probo.commailto:xxxxx
Providenza & Boekelheide, Inc.</mailto:xxxxx>

HI Tim,

First thanks! For the most part this is all working well and I can insert and remove the filter at will. I do have one final question though… It seems when I am running my installer app when the device is not plugged in the call to SetupDiCallClassInstaller fails with error 0xE000020B regardless of if I am inserting or removing the filter. It seems to be fine when the device is plugged in (provided I match 64 bit installer with 64 bit system and same for 32 bit). Should I worry about this or consider it expected? Is this simply telling me there is no device to run the class installer on to change the parameter?

thanks again!
DJ

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, April 13, 2017 1:35 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Installing a filter driver in the field

On Apr 12, 2017, at 5:01 PM, DJ Sisolak > wrote:

Tim, if I want future plugins of the USB device to enumerate the driver with the filter I am assuming that I want to install the INF for this. If I understand what you are saying below, the direct manipulation of the registry through the setup api will only be effective for devices that are already installed.

Yes.

I am assuming I will need to use the setup api approach as well for those devices that have already been plugged in and enumerated with the class driver only. Will the steps you mention below work for devices that have been enumerated into the system but are not currently physically attached? I do not want our customers to have to do this more than once.

You might be able to do this with a class filter as well. That can be installed the same way, it’s just that the registry entry goes into a different location. If you filtered all Media class devices, you’d have to make sure in your AddDevice that it was one you want to handle, because you’d get loaded for all Audio devices, not just USB.

Tim Roberts, xxxxx@probo.commailto:xxxxx
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></mailto:xxxxx>

DJ Sisolak wrote:

First thanks! For the most part this is all working well and I can
insert and remove the filter at will. I do have one final question
though… It seems when I am running my installer app when the device is
not plugged in the call to SetupDiCallClassInstallerfails with error
0xE000020B regardless of if I am inserting or removing the filter. It
seems to be fine when the device is plugged in (provided I match 64
bit installer with 64 bit system and same for 32 bit). Should I worry
about this or consider it expected? Is this simply telling me there is
no device to run the class installer on to change the parameter?

Right. The SetupDiCallClassInstaller function is used to trigger a
restart. If the device is not running, it’s not necessary to restart –
it will pick up the filter change the next time you plug in.


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