Re: WDF Class Filter Driver Installation

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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@xxxxxx> wrote in message
news:1160503775.144869.211350@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxx> wrote in message
news:1160489915.628140.28730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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!



.



Relevant Pages

  • Re: IOCTL_INTERNAL_MOUSE_CONNECT Equivalent for the Bluetooth Stack
    ... an INF cannot install a class filter. ... the mouclass class driver pends read irps and maintains a circular ring ... but I apparently had the driver loaded just above mouclass. ...
    (microsoft.public.development.device.drivers)
  • Re: Problem with KMDF 1.1 driver installation
    ... Does your INF file install more than one driver? ... The reason is that it installs the upgrade for the lower river ... WdfLdr: DllInitialize: OsVersion ...
    (microsoft.public.development.device.drivers)
  • Re: problem with installing avssamp to audio capture sources category
    ... i sucessfully install & uninstall my driver under 3 categories ... I want make kernel mode driver, ... I don't remember all the quirks of SWENUM, ... > but IIRC you can have one filter in a single category per SWENUM device. ...
    (microsoft.public.development.device.drivers)
  • Re: DDK bug? moufiltr installation
    ... I was able to install moufiltr on my PC either ... I will also try the lower filter option. ... I only fond mouclass driver source code in DDK (2003 ...
    (microsoft.public.development.device.drivers)
  • Re: apsfilter question/problem SOLVED PARTIALLY
    ... Installed apsfilter and samba on my old hp netserver so I'd ... that mentioned that driver, 10) PPA printer, so I chose that. ... additional filter 'pnm2ppa' not found. ... Do I need to install another more complete version? ...
    (freebsd-questions)