Hi,

I was wondering if anyone had experience installing a CLASS filter
driver on an already existing setup class. I have found limited
resources on the subject (at least for a class filter driver), and I
haven't found anything on msdn on how to install a class filter driver
with WDF. Their link points to here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/specinst_708d78ad-ba66-40a0-946a-a0bb261e8a8a.xml.asp

which directs you to use an app to do the following:

1. Call SetupInstallFilesFromInfSection for the [upperfilter_inst]
section.
2. Call SetupInstallServicesFromInfSection for the
[upperfilter_inst.Services] section.
3. Call SetupInstallFromInfSection for the [upperfilter_inst]
section, once for each class key it wants to register the upperfilt
service for.

However, I think WDF is a different beast as it requires the
wdfcoinstaller to install the runtime. So I am not sure if this method
is what I should do (and besides it didn't work). So, I found from
osronline that with wdf we are supposed to use WdfPreDeviceInstall and
WdfPostDeviceInstall. How do these fit in with a class filter driver?
>From what I understand, I can use those functions along with
CreateService to install my filter driver's service, but what about
registration? As far as I know step 3 in the older documentation says
to use SetupInstallFromInfSection to register the class filter driver.
Does that only add the "UpperFilters" value to the class key in the
registry? Does it do anything else? When I tried to use it I didn't
see any entry appear

Any help on how to install a class filter driver using the WDF/KMDF
would be much appreciated.

Thanks!

Re: WDF Class Filter Driver Installation by Scott

Scott
Tue Oct 10 10:43:27 CDT 2006

You're right, you do need to call the coinstaller. This article touches on
some of the gotchas in the end and also has a sample that shows you what
you need to do: http://www.osronline.com/article.cfm?id=446&nocache=1

You can also refer to the nonpnp sample in the KMDF kit as it has the same
issue (it's an NT4 style driver)

-scott

--
Scott Noone
Software Engineer
OSR Open Systems Resources, Inc.
http://www.osronline.com


"Gabe" <gabe.black@ni.com> wrote in message
news:1160489915.628140.28730@m73g2000cwd.googlegroups.com...
> Hi,
>
> I was wondering if anyone had experience installing a CLASS filter
> driver on an already existing setup class. I have found limited
> resources on the subject (at least for a class filter driver), and I
> haven't found anything on msdn on how to install a class filter driver
> with WDF. Their link points to here:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/specinst_708d78ad-ba66-40a0-946a-a0bb261e8a8a.xml.asp
>
> which directs you to use an app to do the following:
>
> 1. Call SetupInstallFilesFromInfSection for the [upperfilter_inst]
> section.
> 2. Call SetupInstallServicesFromInfSection for the
> [upperfilter_inst.Services] section.
> 3. Call SetupInstallFromInfSection for the [upperfilter_inst]
> section, once for each class key it wants to register the upperfilt
> service for.
>
> However, I think WDF is a different beast as it requires the
> wdfcoinstaller to install the runtime. So I am not sure if this method
> is what I should do (and besides it didn't work). So, I found from
> osronline that with wdf we are supposed to use WdfPreDeviceInstall and
> WdfPostDeviceInstall. How do these fit in with a class filter driver?
>>From what I understand, I can use those functions along with
> CreateService to install my filter driver's service, but what about
> registration? As far as I know step 3 in the older documentation says
> to use SetupInstallFromInfSection to register the class filter driver.
> Does that only add the "UpperFilters" value to the class key in the
> registry? Does it do anything else? When I tried to use it I didn't
> see any entry appear
>
> Any help on how to install a class filter driver using the WDF/KMDF
> would be much appreciated.
>
> Thanks!
>



Re: WDF Class Filter Driver Installation by Gabe

Gabe
Tue Oct 10 13:09:35 CDT 2006

Thank you for the reply. That article was helpful and it made me aware
of the WdfPreDeviceInstall and WdfPostDeviceInstall functions; however,
it does not programmatically register the filter driver. It'll install
the service, but after it installs the service it instructs you to
manually set the value in the class key to "register" the driver as a
class filter driver...

So I guess what is missing is what SetupInstallFromInfSection does. Or
what right clicking on the inf file -> Install would do for non-Wdf
filter drivers.

Should they need to set a registry value for the coinstaller? If I
install a device filter driver manually (through device manager), it'll
look at the coinstaller section and add an entry for CoInstallers32 and
put in wdfcoinstallerxxxx.dll. Furthermore, if in device manager I go
to the device and go to properties->Driver tab and then Driver Details,
I see the list of drivers for my device. I'll have my filter, followed
by the device driver, and underneath that is wdfcoinstaller01005.dll.
Again this happens if I install the filter as a device filter for a
specific device by going to Device Manager, right click on the device,
update, followed by manually choosing my filter driver.

Does something similar need to be set in the class registry key for the
class filter driver case? Because just setting UpperFilters in the
class key will have my filter in the list of drivers for the devices of
that class, but I don't see wdfcoinstaller01005.dll !!

Thanks again for the reply.

Scott Noone wrote:
> You're right, you do need to call the coinstaller. This article touches on
> some of the gotchas in the end and also has a sample that shows you what
> you need to do: http://www.osronline.com/article.cfm?id=446&nocache=1
>
> You can also refer to the nonpnp sample in the KMDF kit as it has the same
> issue (it's an NT4 style driver)
>
> -scott
>
> --
> Scott Noone
> Software Engineer
> OSR Open Systems Resources, Inc.
> http://www.osronline.com
>
>
> "Gabe" <gabe.black@ni.com> wrote in message
> news:1160489915.628140.28730@m73g2000cwd.googlegroups.com...
> > Hi,
> >
> > I was wondering if anyone had experience installing a CLASS filter
> > driver on an already existing setup class. I have found limited
> > resources on the subject (at least for a class filter driver), and I
> > haven't found anything on msdn on how to install a class filter driver
> > with WDF. Their link points to here:
> >
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/specinst_708d78ad-ba66-40a0-946a-a0bb261e8a8a.xml.asp
> >
> > which directs you to use an app to do the following:
> >
> > 1. Call SetupInstallFilesFromInfSection for the [upperfilter_inst]
> > section.
> > 2. Call SetupInstallServicesFromInfSection for the
> > [upperfilter_inst.Services] section.
> > 3. Call SetupInstallFromInfSection for the [upperfilter_inst]
> > section, once for each class key it wants to register the upperfilt
> > service for.
> >
> > However, I think WDF is a different beast as it requires the
> > wdfcoinstaller to install the runtime. So I am not sure if this method
> > is what I should do (and besides it didn't work). So, I found from
> > osronline that with wdf we are supposed to use WdfPreDeviceInstall and
> > WdfPostDeviceInstall. How do these fit in with a class filter driver?
> >>From what I understand, I can use those functions along with
> > CreateService to install my filter driver's service, but what about
> > registration? As far as I know step 3 in the older documentation says
> > to use SetupInstallFromInfSection to register the class filter driver.
> > Does that only add the "UpperFilters" value to the class key in the
> > registry? Does it do anything else? When I tried to use it I didn't
> > see any entry appear
> >
> > Any help on how to install a class filter driver using the WDF/KMDF
> > would be much appreciated.
> >
> > Thanks!
> >


Re: WDF Class Filter Driver Installation by Scott

Scott
Tue Oct 10 14:13:49 CDT 2006

Right. There are only two pieces to installing a class filter driver:

1) Create the service

2) Add yourself to the UpperFilters or LowerFilters REG_MULTI_SZ under the
class key for the class you want to filter
(HKLM\System\CCS\Control\Class\{ClassGUID})

And that's it.

Right Click->Install on an INF is terribly misleading. All that does is
process the DefaultInstall section of the INF supplied, nothing more. If you
look at the INF file for diskperf you'll see that the DefaultInstall section
just specifies the creation parameters for the service and the UpperFilters
value.

There're no concept of coinstallers for class filters, hence the need to
cook your own installation program. Just call the coinstaller entry points
before and after creating your service, slap in the Upper/LowerFilters
value, and you should be all set.

-scott

--
Scott Noone
Software Engineer
OSR Open Systems Resources, Inc.
http://www.osronline.com


"Gabe" <gabe.black@ni.com> wrote in message
news:1160503775.144869.211350@k70g2000cwa.googlegroups.com...
> Thank you for the reply. That article was helpful and it made me aware
> of the WdfPreDeviceInstall and WdfPostDeviceInstall functions; however,
> it does not programmatically register the filter driver. It'll install
> the service, but after it installs the service it instructs you to
> manually set the value in the class key to "register" the driver as a
> class filter driver...
>
> So I guess what is missing is what SetupInstallFromInfSection does. Or
> what right clicking on the inf file -> Install would do for non-Wdf
> filter drivers.
>
> Should they need to set a registry value for the coinstaller? If I
> install a device filter driver manually (through device manager), it'll
> look at the coinstaller section and add an entry for CoInstallers32 and
> put in wdfcoinstallerxxxx.dll. Furthermore, if in device manager I go
> to the device and go to properties->Driver tab and then Driver Details,
> I see the list of drivers for my device. I'll have my filter, followed
> by the device driver, and underneath that is wdfcoinstaller01005.dll.
> Again this happens if I install the filter as a device filter for a
> specific device by going to Device Manager, right click on the device,
> update, followed by manually choosing my filter driver.
>
> Does something similar need to be set in the class registry key for the
> class filter driver case? Because just setting UpperFilters in the
> class key will have my filter in the list of drivers for the devices of
> that class, but I don't see wdfcoinstaller01005.dll !!
>
> Thanks again for the reply.
>
> Scott Noone wrote:
>> You're right, you do need to call the coinstaller. This article touches
>> on
>> some of the gotchas in the end and also has a sample that shows you what
>> you need to do: http://www.osronline.com/article.cfm?id=446&nocache=1
>>
>> You can also refer to the nonpnp sample in the KMDF kit as it has the
>> same
>> issue (it's an NT4 style driver)
>>
>> -scott
>>
>> --
>> Scott Noone
>> Software Engineer
>> OSR Open Systems Resources, Inc.
>> http://www.osronline.com
>>
>>
>> "Gabe" <gabe.black@ni.com> wrote in message
>> news:1160489915.628140.28730@m73g2000cwd.googlegroups.com...
>> > Hi,
>> >
>> > I was wondering if anyone had experience installing a CLASS filter
>> > driver on an already existing setup class. I have found limited
>> > resources on the subject (at least for a class filter driver), and I
>> > haven't found anything on msdn on how to install a class filter driver
>> > with WDF. Their link points to here:
>> >
>> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/specinst_708d78ad-ba66-40a0-946a-a0bb261e8a8a.xml.asp
>> >
>> > which directs you to use an app to do the following:
>> >
>> > 1. Call SetupInstallFilesFromInfSection for the [upperfilter_inst]
>> > section.
>> > 2. Call SetupInstallServicesFromInfSection for the
>> > [upperfilter_inst.Services] section.
>> > 3. Call SetupInstallFromInfSection for the [upperfilter_inst]
>> > section, once for each class key it wants to register the upperfilt
>> > service for.
>> >
>> > However, I think WDF is a different beast as it requires the
>> > wdfcoinstaller to install the runtime. So I am not sure if this method
>> > is what I should do (and besides it didn't work). So, I found from
>> > osronline that with wdf we are supposed to use WdfPreDeviceInstall and
>> > WdfPostDeviceInstall. How do these fit in with a class filter driver?
>> >>From what I understand, I can use those functions along with
>> > CreateService to install my filter driver's service, but what about
>> > registration? As far as I know step 3 in the older documentation says
>> > to use SetupInstallFromInfSection to register the class filter driver.
>> > Does that only add the "UpperFilters" value to the class key in the
>> > registry? Does it do anything else? When I tried to use it I didn't
>> > see any entry appear
>> >
>> > Any help on how to install a class filter driver using the WDF/KMDF
>> > would be much appreciated.
>> >
>> > Thanks!
>> >
>



Re: WDF Class Filter Driver Installation by Abhishek

Abhishek
Tue Oct 10 17:03:17 CDT 2006

To add a yourself to the list of upper or lower filters, please do *not*
open the (HKLM\System\CCS\Control\Class\{ClassGUID}) registry key directly.
That registry key is an internal PnP data structure and should be accessed
only through the SetupDiXxx APIs provided.

Is your code for Vista only? If so, you should use the new property APIs on
Vista. SetupDiGetClassProperty and SetupDiSetClassProperty
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_r/hh/DevInst_r/lh-device-properties-ref-v2_2f95ba64-9d12-4ce0-b1ca-083e379ed784.xml.asp

If your code needs to run on XP as well, then do the following -
SetupDiOpenClassRegKey to open the class key for your class. After that use,
the registry APIs RegSetValueEx and RegQueryValueEx to modify the
REGSTR_VAL_UPPERFILTERS and REGSTR_VAL_LOWERFILTERS values. Note that
REGSTR_VAL_UPPERFILTERS and REGSTR_VAL_LOWERFILTERS are defined in regstr.h.

Thanks,
Abhishek

"Scott Noone" <snoone@osr.com> wrote in message
news:u%23Sx4AK7GHA.660@TK2MSFTNGP03.phx.gbl...
> Right. There are only two pieces to installing a class filter driver:
>
> 1) Create the service
>
> 2) Add yourself to the UpperFilters or LowerFilters REG_MULTI_SZ under the
> class key for the class you want to filter
> (HKLM\System\CCS\Control\Class\{ClassGUID})
>
> And that's it.
>
> Right Click->Install on an INF is terribly misleading. All that does is
> process the DefaultInstall section of the INF supplied, nothing more. If
> you look at the INF file for diskperf you'll see that the DefaultInstall
> section just specifies the creation parameters for the service and the
> UpperFilters value.
>
> There're no concept of coinstallers for class filters, hence the need to
> cook your own installation program. Just call the coinstaller entry points
> before and after creating your service, slap in the Upper/LowerFilters
> value, and you should be all set.
>
> -scott
>
> --
> Scott Noone
> Software Engineer
> OSR Open Systems Resources, Inc.
> http://www.osronline.com
>
>
> "Gabe" <gabe.black@ni.com> wrote in message
> news:1160503775.144869.211350@k70g2000cwa.googlegroups.com...
>> Thank you for the reply. That article was helpful and it made me aware
>> of the WdfPreDeviceInstall and WdfPostDeviceInstall functions; however,
>> it does not programmatically register the filter driver. It'll install
>> the service, but after it installs the service it instructs you to
>> manually set the value in the class key to "register" the driver as a
>> class filter driver...
>>
>> So I guess what is missing is what SetupInstallFromInfSection does. Or
>> what right clicking on the inf file -> Install would do for non-Wdf
>> filter drivers.
>>
>> Should they need to set a registry value for the coinstaller? If I
>> install a device filter driver manually (through device manager), it'll
>> look at the coinstaller section and add an entry for CoInstallers32 and
>> put in wdfcoinstallerxxxx.dll. Furthermore, if in device manager I go
>> to the device and go to properties->Driver tab and then Driver Details,
>> I see the list of drivers for my device. I'll have my filter, followed
>> by the device driver, and underneath that is wdfcoinstaller01005.dll.
>> Again this happens if I install the filter as a device filter for a
>> specific device by going to Device Manager, right click on the device,
>> update, followed by manually choosing my filter driver.
>>
>> Does something similar need to be set in the class registry key for the
>> class filter driver case? Because just setting UpperFilters in the
>> class key will have my filter in the list of drivers for the devices of
>> that class, but I don't see wdfcoinstaller01005.dll !!
>>
>> Thanks again for the reply.
>>
>> Scott Noone wrote:
>>> You're right, you do need to call the coinstaller. This article touches
>>> on
>>> some of the gotchas in the end and also has a sample that shows you
>>> what
>>> you need to do: http://www.osronline.com/article.cfm?id=446&nocache=1
>>>
>>> You can also refer to the nonpnp sample in the KMDF kit as it has the
>>> same
>>> issue (it's an NT4 style driver)
>>>
>>> -scott
>>>
>>> --
>>> Scott Noone
>>> Software Engineer
>>> OSR Open Systems Resources, Inc.
>>> http://www.osronline.com
>>>
>>>
>>> "Gabe" <gabe.black@ni.com> wrote in message
>>> news:1160489915.628140.28730@m73g2000cwd.googlegroups.com...
>>> > Hi,
>>> >
>>> > I was wondering if anyone had experience installing a CLASS filter
>>> > driver on an already existing setup class. I have found limited
>>> > resources on the subject (at least for a class filter driver), and I
>>> > haven't found anything on msdn on how to install a class filter driver
>>> > with WDF. Their link points to here:
>>> >
>>> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/specinst_708d78ad-ba66-40a0-946a-a0bb261e8a8a.xml.asp
>>> >
>>> > which directs you to use an app to do the following:
>>> >
>>> > 1. Call SetupInstallFilesFromInfSection for the [upperfilter_inst]
>>> > section.
>>> > 2. Call SetupInstallServicesFromInfSection for the
>>> > [upperfilter_inst.Services] section.
>>> > 3. Call SetupInstallFromInfSection for the [upperfilter_inst]
>>> > section, once for each class key it wants to register the upperfilt
>>> > service for.
>>> >
>>> > However, I think WDF is a different beast as it requires the
>>> > wdfcoinstaller to install the runtime. So I am not sure if this
>>> > method
>>> > is what I should do (and besides it didn't work). So, I found from
>>> > osronline that with wdf we are supposed to use WdfPreDeviceInstall and
>>> > WdfPostDeviceInstall. How do these fit in with a class filter driver?
>>> >>From what I understand, I can use those functions along with
>>> > CreateService to install my filter driver's service, but what about
>>> > registration? As far as I know step 3 in the older documentation says
>>> > to use SetupInstallFromInfSection to register the class filter driver.
>>> > Does that only add the "UpperFilters" value to the class key in the
>>> > registry? Does it do anything else? When I tried to use it I didn't
>>> > see any entry appear
>>> >
>>> > Any help on how to install a class filter driver using the WDF/KMDF
>>> > would be much appreciated.
>>> >
>>> > Thanks!
>>> >
>>
>
>



Re: WDF Class Filter Driver Installation by Gabe

Gabe
Tue Oct 10 17:17:11 CDT 2006

Ok, then I think I did most everything right. The class I am filtering
on is the System class. I've installed the driver as a boot time
driver and it works just fine. It crashes though after I set
UpperFilters in the class key. Wnddbg shows that during normal boot it
loads wdf01000.sys and then calls into FxDriverEntry followed by my
DriverEntry as seen here:

WdfLdr: DllInitialize - OsVersion(5.1)
WdfLdr: WdfLdrDiagnosticsValueByNameAsULONG - Value 0x1
WdfLdr: WdfLdrDiagnosticsValueByNameAsULONG - Status 0x0
WdfLdr: GetVersionImageName - Version Image Name "Wdf01000.sys"
WdfLdr: WdfRegisterLibrary - Module(837CCFB0)
nipciflt!FxDriverEntry: <<<< ------- MY FILTER DRIVER
WdfLdr: GetVersionRegistryHandle - Component path
\Registry\Machine\System\CurrentControlSet\Control\Wdf\Kmdf\KmdfLibrary\Versions
WdfLdr: GetVersionServicePath - GetVersionServicePath
(\Registry\Machine\System\CurrentControlSet\Services\Wdf01000)

However, after I add myself to the UpperFilters under the class key I
don't see the access to Wdf01000.sys and instead see

WdfLdr: DllInitialize - OsVersion(5.1)
nipciflt!FxDriverEntry: <<<< ------- MY FILTER DRIVER
WdfLdr: GetVersionRegistryHandle - Component path
\Registry\Machine\System\CurrentControlSet\Control\Wdf\Kmdf\KmdfLibrary\Versions
WdfLdr: GetVersionServicePath - GetVersionServicePath
(\Registry\Machine\System\CurrentControlSet\Services\Wdf01000)
WdfLdr: ReferenceVersion - ERROR: FindModuleByServiceName
(\Registry\Machine\System\CurrentControlSet\Services\Wdf01000) failed
with Status 0xc0000001
WdfLdr: ReferenceVersion - ERROR: Failed with Status 0xc0000001
WdfLdr: WdfVersionBind - ERROR: ReferenceVersion failed with Status
0xc0000001
WdfLdr: WdfVersionBind - Returning with Status 0xc0000001

After some other drivers load I get

INACCESSIBLE_BOOT_DEVICE (7b)


I've even tried setting the group of my driver to the same group
(WdfLoadGroup) as Wdf01000.sys (with no Tag set so it loads last in
that group) and verified that Wdf01000.sys had a Start of boot time 0
(and also belonged to WdfLoadGroup).

It seems that making the driver an upper filter of the System Setup
Class has changed the boot order... Anyone know what's going on?

Thanks,
Gabe

Scott Noone wrote:
> Right. There are only two pieces to installing a class filter driver:
>
> 1) Create the service
>
> 2) Add yourself to the UpperFilters or LowerFilters REG_MULTI_SZ under the
> class key for the class you want to filter
> (HKLM\System\CCS\Control\Class\{ClassGUID})
>
> And that's it.
>
> Right Click->Install on an INF is terribly misleading. All that does is
> process the DefaultInstall section of the INF supplied, nothing more. If you
> look at the INF file for diskperf you'll see that the DefaultInstall section
> just specifies the creation parameters for the service and the UpperFilters
> value.
>
> There're no concept of coinstallers for class filters, hence the need to
> cook your own installation program. Just call the coinstaller entry points
> before and after creating your service, slap in the Upper/LowerFilters
> value, and you should be all set.
>
> -scott
>
> --
> Scott Noone
> Software Engineer
> OSR Open Systems Resources, Inc.
> http://www.osronline.com
>
>
> "Gabe" <gabe.black@ni.com> wrote in message
> news:1160503775.144869.211350@k70g2000cwa.googlegroups.com...
> > Thank you for the reply. That article was helpful and it made me aware
> > of the WdfPreDeviceInstall and WdfPostDeviceInstall functions; however,
> > it does not programmatically register the filter driver. It'll install
> > the service, but after it installs the service it instructs you to
> > manually set the value in the class key to "register" the driver as a
> > class filter driver...
> >
> > So I guess what is missing is what SetupInstallFromInfSection does. Or
> > what right clicking on the inf file -> Install would do for non-Wdf
> > filter drivers.
> >
> > Should they need to set a registry value for the coinstaller? If I
> > install a device filter driver manually (through device manager), it'll
> > look at the coinstaller section and add an entry for CoInstallers32 and
> > put in wdfcoinstallerxxxx.dll. Furthermore, if in device manager I go
> > to the device and go to properties->Driver tab and then Driver Details,
> > I see the list of drivers for my device. I'll have my filter, followed
> > by the device driver, and underneath that is wdfcoinstaller01005.dll.
> > Again this happens if I install the filter as a device filter for a
> > specific device by going to Device Manager, right click on the device,
> > update, followed by manually choosing my filter driver.
> >
> > Does something similar need to be set in the class registry key for the
> > class filter driver case? Because just setting UpperFilters in the
> > class key will have my filter in the list of drivers for the devices of
> > that class, but I don't see wdfcoinstaller01005.dll !!
> >
> > Thanks again for the reply.
> >
> > Scott Noone wrote:
> >> You're right, you do need to call the coinstaller. This article touches
> >> on
> >> some of the gotchas in the end and also has a sample that shows you what
> >> you need to do: http://www.osronline.com/article.cfm?id=446&nocache=1
> >>
> >> You can also refer to the nonpnp sample in the KMDF kit as it has the
> >> same
> >> issue (it's an NT4 style driver)
> >>
> >> -scott
> >>
> >> --
> >> Scott Noone
> >> Software Engineer
> >> OSR Open Systems Resources, Inc.
> >> http://www.osronline.com
> >>
> >>
> >> "Gabe" <gabe.black@ni.com> wrote in message
> >> news:1160489915.628140.28730@m73g2000cwd.googlegroups.com...
> >> > Hi,
> >> >
> >> > I was wondering if anyone had experience installing a CLASS filter
> >> > driver on an already existing setup class. I have found limited
> >> > resources on the subject (at least for a class filter driver), and I
> >> > haven't found anything on msdn on how to install a class filter driver
> >> > with WDF. Their link points to here:
> >> >
> >> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/specinst_708d78ad-ba66-40a0-946a-a0bb261e8a8a.xml.asp
> >> >
> >> > which directs you to use an app to do the following:
> >> >
> >> > 1. Call SetupInstallFilesFromInfSection for the [upperfilter_inst]
> >> > section.
> >> > 2. Call SetupInstallServicesFromInfSection for the
> >> > [upperfilter_inst.Services] section.
> >> > 3. Call SetupInstallFromInfSection for the [upperfilter_inst]
> >> > section, once for each class key it wants to register the upperfilt
> >> > service for.
> >> >
> >> > However, I think WDF is a different beast as it requires the
> >> > wdfcoinstaller to install the runtime. So I am not sure if this method
> >> > is what I should do (and besides it didn't work). So, I found from
> >> > osronline that with wdf we are supposed to use WdfPreDeviceInstall and
> >> > WdfPostDeviceInstall. How do these fit in with a class filter driver?
> >> >>From what I understand, I can use those functions along with
> >> > CreateService to install my filter driver's service, but what about
> >> > registration? As far as I know step 3 in the older documentation says
> >> > to use SetupInstallFromInfSection to register the class filter driver.
> >> > Does that only add the "UpperFilters" value to the class key in the
> >> > registry? Does it do anything else? When I tried to use it I didn't
> >> > see any entry appear
> >> >
> >> > Any help on how to install a class filter driver using the WDF/KMDF
> >> > would be much appreciated.
> >> >
> >> > Thanks!
> >> >
> >


Re: WDF Class Filter Driver Installation by Vishal

Vishal
Tue Oct 10 19:30:59 CDT 2006

I am guessing KMDF runtime is loading after your driver and not before..
Could you send me what you see for the following registry value ?

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServiceGroupOrder: List


Thanks,

Vishal

--
This posting is provided "AS IS" with no warranties, and confers no
rights.
http://www.microsoft.com/whdc/driver/wdf/default.mspx


"Gabe" <gabe.black@ni.com> wrote in message
news:1160518631.828346.18460@h48g2000cwc.googlegroups.com...
> Ok, then I think I did most everything right. The class I am filtering
> on is the System class. I've installed the driver as a boot time
> driver and it works just fine. It crashes though after I set
> UpperFilters in the class key. Wnddbg shows that during normal boot it
> loads wdf01000.sys and then calls into FxDriverEntry followed by my
> DriverEntry as seen here:
>
> WdfLdr: DllInitialize - OsVersion(5.1)
> WdfLdr: WdfLdrDiagnosticsValueByNameAsULONG - Value 0x1
> WdfLdr: WdfLdrDiagnosticsValueByNameAsULONG - Status 0x0
> WdfLdr: GetVersionImageName - Version Image Name "Wdf01000.sys"
> WdfLdr: WdfRegisterLibrary - Module(837CCFB0)
> nipciflt!FxDriverEntry: <<<< ------- MY FILTER DRIVER
> WdfLdr: GetVersionRegistryHandle - Component path
> \Registry\Machine\System\CurrentControlSet\Control\Wdf\Kmdf\KmdfLibrary\Versions
> WdfLdr: GetVersionServicePath - GetVersionServicePath
> (\Registry\Machine\System\CurrentControlSet\Services\Wdf01000)
>
> However, after I add myself to the UpperFilters under the class key I
> don't see the access to Wdf01000.sys and instead see
>
> WdfLdr: DllInitialize - OsVersion(5.1)
> nipciflt!FxDriverEntry: <<<< ------- MY FILTER DRIVER
> WdfLdr: GetVersionRegistryHandle - Component path
> \Registry\Machine\System\CurrentControlSet\Control\Wdf\Kmdf\KmdfLibrary\Versions
> WdfLdr: GetVersionServicePath - GetVersionServicePath
> (\Registry\Machine\System\CurrentControlSet\Services\Wdf01000)
> WdfLdr: ReferenceVersion - ERROR: FindModuleByServiceName
> (\Registry\Machine\System\CurrentControlSet\Services\Wdf01000) failed
> with Status 0xc0000001
> WdfLdr: ReferenceVersion - ERROR: Failed with Status 0xc0000001
> WdfLdr: WdfVersionBind - ERROR: ReferenceVersion failed with Status
> 0xc0000001
> WdfLdr: WdfVersionBind - Returning with Status 0xc0000001
>
> After some other drivers load I get
>
> INACCESSIBLE_BOOT_DEVICE (7b)
>
>
> I've even tried setting the group of my driver to the same group
> (WdfLoadGroup) as Wdf01000.sys (with no Tag set so it loads last in
> that group) and verified that Wdf01000.sys had a Start of boot time 0
> (and also belonged to WdfLoadGroup).
>
> It seems that making the driver an upper filter of the System Setup
> Class has changed the boot order... Anyone know what's going on?
>
> Thanks,
> Gabe
>
> Scott Noone wrote:
>> Right. There are only two pieces to installing a class filter driver:
>>
>> 1) Create the service
>>
>> 2) Add yourself to the UpperFilters or LowerFilters REG_MULTI_SZ under
>> the
>> class key for the class you want to filter
>> (HKLM\System\CCS\Control\Class\{ClassGUID})
>>
>> And that's it.
>>
>> Right Click->Install on an INF is terribly misleading. All that does is
>> process the DefaultInstall section of the INF supplied, nothing more. If
>> you
>> look at the INF file for diskperf you'll see that the DefaultInstall
>> section
>> just specifies the creation parameters for the service and the
>> UpperFilters
>> value.
>>
>> There're no concept of coinstallers for class filters, hence the need to
>> cook your own installation program. Just call the coinstaller entry
>> points
>> before and after creating your service, slap in the Upper/LowerFilters
>> value, and you should be all set.
>>
>> -scott
>>
>> --
>> Scott Noone
>> Software Engineer
>> OSR Open Systems Resources, Inc.
>> http://www.osronline.com
>>
>>
>> "Gabe" <gabe.black@ni.com> wrote in message
>> news:1160503775.144869.211350@k70g2000cwa.googlegroups.com...
>> > Thank you for the reply. That article was helpful and it made me aware
>> > of the WdfPreDeviceInstall and WdfPostDeviceInstall functions; however,
>> > it does not programmatically register the filter driver. It'll install
>> > the service, but after it installs the service it instructs you to
>> > manually set the value in the class key to "register" the driver as a
>> > class filter driver...
>> >
>> > So I guess what is missing is what SetupInstallFromInfSection does. Or
>> > what right clicking on the inf file -> Install would do for non-Wdf
>> > filter drivers.
>> >
>> > Should they need to set a registry value for the coinstaller? If I
>> > install a device filter driver manually (through device manager), it'll
>> > look at the coinstaller section and add an entry for CoInstallers32 and
>> > put in wdfcoinstallerxxxx.dll. Furthermore, if in device manager I go
>> > to the device and go to properties->Driver tab and then Driver Details,
>> > I see the list of drivers for my device. I'll have my filter, followed
>> > by the device driver, and underneath that is wdfcoinstaller01005.dll.
>> > Again this happens if I install the filter as a device filter for a
>> > specific device by going to Device Manager, right click on the device,
>> > update, followed by manually choosing my filter driver.
>> >
>> > Does something similar need to be set in the class registry key for the
>> > class filter driver case? Because just setting UpperFilters in the
>> > class key will have my filter in the list of drivers for the devices of
>> > that class, but I don't see wdfcoinstaller01005.dll !!
>> >
>> > Thanks again for the reply.
>> >
>> > Scott Noone wrote:
>> >> You're right, you do need to call the coinstaller. This article
>> >> touches
>> >> on
>> >> some of the gotchas in the end and also has a sample that shows you
>> >> what
>> >> you need to do: http://www.osronline.com/article.cfm?id=446&nocache=1
>> >>
>> >> You can also refer to the nonpnp sample in the KMDF kit as it has the
>> >> same
>> >> issue (it's an NT4 style driver)
>> >>
>> >> -scott
>> >>
>> >> --
>> >> Scott Noone
>> >> Software Engineer
>> >> OSR Open Systems Resources, Inc.
>> >> http://www.osronline.com
>> >>
>> >>
>> >> "Gabe" <gabe.black@ni.com> wrote in message
>> >> news:1160489915.628140.28730@m73g2000cwd.googlegroups.com...
>> >> > Hi,
>> >> >
>> >> > I was wondering if anyone had experience installing a CLASS filter
>> >> > driver on an already existing setup class. I have found limited
>> >> > resources on the subject (at least for a class filter driver), and I
>> >> > haven't found anything on msdn on how to install a class filter
>> >> > driver
>> >> > with WDF. Their link points to here:
>> >> >
>> >> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/specinst_708d78ad-ba66-40a0-946a-a0bb261e8a8a.xml.asp
>> >> >
>> >> > which directs you to use an app to do the following:
>> >> >
>> >> > 1. Call SetupInstallFilesFromInfSection for the [upperfilter_inst]
>> >> > section.
>> >> > 2. Call SetupInstallServicesFromInfSection for the
>> >> > [upperfilter_inst.Services] section.
>> >> > 3. Call SetupInstallFromInfSection for the [upperfilter_inst]
>> >> > section, once for each class key it wants to register the upperfilt
>> >> > service for.
>> >> >
>> >> > However, I think WDF is a different beast as it requires the
>> >> > wdfcoinstaller to install the runtime. So I am not sure if this
>> >> > method
>> >> > is what I should do (and besides it didn't work). So, I found from
>> >> > osronline that with wdf we are supposed to use WdfPreDeviceInstall
>> >> > and
>> >> > WdfPostDeviceInstall. How do these fit in with a class filter
>> >> > driver?
>> >> >>From what I understand, I can use those functions along with
>> >> > CreateService to install my filter driver's service, but what about
>> >> > registration? As far as I know step 3 in the older documentation
>> >> > says
>> >> > to use SetupInstallFromInfSection to register the class filter
>> >> > driver.
>> >> > Does that only add the "UpperFilters" value to the class key in the
>> >> > registry? Does it do anything else? When I tried to use it I
>> >> > didn't
>> >> > see any entry appear
>> >> >
>> >> > Any help on how to install a class filter driver using the WDF/KMDF
>> >> > would be much appreciated.
>> >> >
>> >> > Thanks!
>> >> >
>> >
>



Re: WDF Class Filter Driver Installation by Gabe

Gabe
Wed Oct 11 10:06:20 CDT 2006

The use case for the driver is primarily for Vista, but it will be use
in XP as well.

Vishal Manan [MSFT] wrote:
> I am guessing KMDF runtime is loading after your driver and not before..
> Could you send me what you see for the following registry value ?
>
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServiceGroupOrder: List
>

System Reserved
Boot Bus Extender
WdfLoadGroup
System Bus Extender
SCSI miniport
Port
Primary Disk
SCSI Class
SCSI CDROM Class
FSFilter Infrastructure
FSFilter System
FSFilter Bottom
FSFilter Copy Protection
FSFilter Security Enhancer
FSFilter Open File
FSFilter Physical Quota Management
FSFilter Encryption
FSFilter Compression
FSFilter HSM
FSFilter Cluster File System
FSFilter System Recovery
FSFilter Quota Management
FSFilter Content Screener
FSFilter Continuous Backup
FSFilter Replication
FSFilter Anti-Virus
FSFilter Undelete
FSFilter Activity Monitor
FSFilter Top
Filter
Boot File System
Base
Pointer Port
Keyboard Port
Pointer Class
Keyboard Class
Video Init
Video
Video Save
File System
Event Log
Streams Drivers
NDIS Wrapper
COM Infrastructure
UIGroup
LocalValidation
PlugPlay
PNP_TDI
NDIS
TDI
NetBIOSGroup
ShellSvcGroup
SchedulerGroup
SpoolerGroup
AudioGroup
SmartCardGroup
NetworkProvider
RemoteValidation
NetDDEGroup
Parallel arbitrator
Extended Base
PCI Configuration


Re: WDF Class Filter Driver Installation by Gabe

Gabe
Wed Oct 11 13:36:06 CDT 2006

Ok, I changed the WdfLoadGroup to load before Boot Bus Extender:

System Reserved
WdfLoadGroup
Boot Bus Extender
System Bus Extender
.......

and now it loads just fine... Is this something that I shouldn't do or
is there another way? If no one sees any problem with doing it this
way then great! I would rather use WDF than WDM!

Thanks!


Re: WDF Class Filter Driver Installation by Vishal

Vishal
Wed Oct 11 14:37:23 CDT 2006

On windows xp WdfLoadGroup is at the third position (1 based) because there
is a hardcoded assumption in the OS that "Boot Bus Extender" is always the
second group. I don't what repercussions this can have if you move "Boot Bus
Extender" to the third position (from what you have described below).

Is it possible for you to change the Loadgroup of your class filter to
"System Bus Extender" instead of "Boot Bus Extender"? This way the OS
assumption on Windows XP described above will be preserved and you wouldn't
have to hand edit the registry.


Thanks,

Vishal

--
This posting is provided "AS IS" with no warranties, and confers no
rights.
http://www.microsoft.com/whdc/driver/wdf/default.mspx

"Gabe" <gabe.black@ni.com> wrote in message
news:1160591766.295512.177930@k70g2000cwa.googlegroups.com...
> Ok, I changed the WdfLoadGroup to load before Boot Bus Extender:
>
> System Reserved
> WdfLoadGroup
> Boot Bus Extender
> System Bus Extender
> .......
>
> and now it loads just fine... Is this something that I shouldn't do or
> is there another way? If no one sees any problem with doing it this
> way then great! I would rather use WDF than WDM!
>
> Thanks!
>



Re: WDF Class Filter Driver Installation by Gabe

Gabe
Wed Oct 11 17:04:24 CDT 2006

My filter can be in a group that loads much later as long as it is
BOOT_START. The problem is that when I make it a class filter driver
for the System Class (either by setting the registry key manually or by
using the SetupDI method you described earlier, the outcome is the
same) some device in the class I guess gets loaded before WdfLoadGroup
and tries to load my upper filter driver. The problem is that KMDF
hasn't been loaded yet as shown above. So I guess the issue is getting
KMDF to load in time. I did this by changing the group that KMDF
belongs to be before Boot Bus Extender.

> On windows xp WdfLoadGroup is at the third position (1 based) because there
> is a hardcoded assumption in the OS that "Boot Bus Extender" is always the
> second group. I don't what repercussions this can have if you move "Boot Bus
> Extender" to the third position

Is there a better way to ensure that KMDF gets loaded in time?


Re: WDF Class Filter Driver Installation by Gabe

Gabe
Thu Oct 12 09:36:08 CDT 2006

Sorry, I didn't proof-read my last post. After reading it, I realize
it wasn't very coherent.

The problem that I am running into now is that KMDF isn't getting
loaded in time. I was able to make it load in time by putting the
group that it belongs to (WdfLoadGroup) before Boot Bus Extender. My
filter driver can belong to a group that loads much later. However, if
I make it a class filter driver for System, the OS tries to load my
driver during the Boot Bus Extender load time, even though my filter
drive belongs to a later group. The OS doesn't seem to recognize that
it also needs to load KMDF before it loads my driver. That is why I
put the WdfLoadGroup before Boot Bus Extender.

I guess an alternative would be to make KMDF belong to the Boot Bus
Extender group as well. That way I preserve the ordering and Boot Bus
Extender stays in the number 2 slot. Are there any repercussions in
doing it that way? Or is there another way to tell the OS of the
dependency ( like there is for services with DependOnGroup and
DependOnService )?

Thanks,
Gabe

Gabe wrote:
> My filter can be in a group that loads much later as long as it is
> BOOT_START. The problem is that when I make it a class filter driver
> for the System Class (either by setting the registry key manually or by
> using the SetupDI method you described earlier, the outcome is the
> same) some device in the class I guess gets loaded before WdfLoadGroup
> and tries to load my upper filter driver. The problem is that KMDF
> hasn't been loaded yet as shown above. So I guess the issue is getting
> KMDF to load in time. I did this by changing the group that KMDF
> belongs to be before Boot Bus Extender.
>
> > On windows xp WdfLoadGroup is at the third position (1 based) because there
> > is a hardcoded assumption in the OS that "Boot Bus Extender" is always the
> > second group. I don't what repercussions this can have if you move "Boot Bus
> > Extender" to the third position
>
> Is there a better way to ensure that KMDF gets loaded in time?


Re: WDF Class Filter Driver Installation by Vishal

Vishal
Fri Oct 13 20:47:26 CDT 2006

Given your situation I would rather have KMDF belong to the BootBusExtender
group (by changing the service key of wdf01000) and use tags(this describes
how to use tags http://support.microsoft.com/kb/115486) to define the load
order rather than muck with the OS by placing the wdfloadgroup above
bootbusextender under the "list".

You can't use DependOnGroup and DependOnService as they don't work with
Boot start (start type of 0) drivers.


Vishal


--
This posting is provided "AS IS" with no warranties, and confers no
rights.
http://www.microsoft.com/whdc/driver/wdf/default.mspx

"Gabe" <gabe.black@ni.com> wrote in message
news:1160663768.441438.130950@k70g2000cwa.googlegroups.com...
> Sorry, I didn't proof-read my last post. After reading it, I realize
> it wasn't very coherent.
>
> The problem that I am running into now is that KMDF isn't getting
> loaded in time. I was able to make it load in time by putting the
> group that it belongs to (WdfLoadGroup) before Boot Bus Extender. My
> filter driver can belong to a group that loads much later. However, if
> I make it a class filter driver for System, the OS tries to load my
> driver during the Boot Bus Extender load time, even though my filter
> drive belongs to a later group. The OS doesn't seem to recognize that
> it also needs to load KMDF before it loads my driver. That is why I
> put the WdfLoadGroup before Boot Bus Extender.
>
> I guess an alternative would be to make KMDF belong to the Boot Bus
> Extender group as well. That way I preserve the ordering and Boot Bus
> Extender stays in the number 2 slot. Are there any repercussions in
> doing it that way? Or is there another way to tell the OS of the
> dependency ( like there is for services with DependOnGroup and
> DependOnService )?
>
> Thanks,
> Gabe
>
> Gabe wrote:
>> My filter can be in a group that loads much later as long as it is
>> BOOT_START. The problem is that when I make it a class filter driver
>> for the System Class (either by setting the registry key manually or by
>> using the SetupDI method you described earlier, the outcome is the
>> same) some device in the class I guess gets loaded before WdfLoadGroup
>> and tries to load my upper filter driver. The problem is that KMDF
>> hasn't been loaded yet as shown above. So I guess the issue is getting
>> KMDF to load in time. I did this by changing the group that KMDF
>> belongs to be before Boot Bus Extender.
>>
>> > On windows xp WdfLoadGroup is at the third position (1 based) because
>> > there
>> > is a hardcoded assumption in the OS that "Boot Bus Extender" is always
>> > the
>> > second group. I don't what repercussions this can have if you move
>> > "Boot Bus
>> > Extender" to the third position
>>
>> Is there a better way to ensure that KMDF gets loaded in time?
>