Installing HID upper filter

Hi,

I am a newbie in windows driver development. I try to write a upper filter for an HID Device based an the WDK 8.1 Toaster Sample Driver. The filter should read the data send by a Pen and generate touch events to the OS. I don’t really know, if a driver filter can deal with this functionality, but from what a read a filter should be enough. For the moment, I just want to be able to intercept the Pen data, but I have problems installing this filter. I tried to install the filter using devcon tool by calling “devcon /r classfilter HIDClass +myfilter”. Devcon returns failed.

I also tried to install the filter by updating the pen device, but after installing the filter, windows needs to reboot and after rebooting the filter is not installed.

Can somebody describe the steps I have to do, to install a filter driver.

You don’t want a class filter, that would have you filtering the HIDClass fdo too and all other types of HID that you are not interested in. howdid you install the filter as a device upper filter? What devcon command did you use? What does the inf look like?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, February 25, 2015 5:59 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Installing HID upper filter

Hi,

I am a newbie in windows driver development. I try to write a upper filter for an HID Device based an the WDK 8.1 Toaster Sample Driver. The filter should read the data send by a Pen and generate touch events to the OS. I don’t really know, if a driver filter can deal with this functionality, but from what a read a filter should be enough. For the moment, I just want to be able to intercept the Pen data, but I have problems installing this filter. I tried to install the filter using devcon tool by calling “devcon /r classfilter HIDClass +myfilter”. Devcon returns failed.

I also tried to install the filter by updating the pen device, but after installing the filter, windows needs to reboot and after rebooting the filter is not installed.

Can somebody describe the steps I have to do, to install a filter driver.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

I modify my INF file so that I can install the filter on a specific mouse device. I was able to install this filter by updating the mouse driver (have disk option). My filter was successful been installed ans started and I was able to handle control event of the HID Device. But now I a not sure if an upper filter is able the modify the HID data and pass the modified data to the OS. (considering the “keyboard and mouse HID client drivers” document: https://msdn.microsoft.com/en-us/library/windows/hardware/jj128406(v=vs.85).aspx )

I wan to intercept the mouse events generated by a Pen and generate touch events to the OS.

Here is my INF:

[Version]
Signature=“$Windows NT$”
Class=Mouse
ClassGUID={4D36E96F-E325-11CE-BFC1-08002BE10318}
Provider=%Provider%
DriverVer=02/25/2015,15.0.48.465
CatalogFile=KmdfSamples.cat

[DestinationDirs]
DefaultDestDir = 12 ; DIRID_DRIVERS

[ControlFlags]
; We don’t want our device to be installable via the non-PnP hardware dialogs
ExcludeFromSelect = *

; Manufacturer Section
; ---------------------------------------------------------
[Manufacturer]
%ShinyThings%=ShinyThingsMfg,NTamd64

; Devices Section for Win2K
; ---------------------------------------------------------
[ShinyThingsMfg]
%HID\Vid_0458&Pid_00CA.DeviceDesc%=Firefly_Inst, HID\Vid_0458&Pid_00CA

; Devices Section for XP and above
; ---------------------------------------------------------
[ShinyThingsMfg.NTamd64]
%HID\Vid_0458&Pid_00CA.DeviceDesc%=Firefly_Inst, HID\Vid_0458&Pid_00CA

; Install Section for Windows 2000 & Windows XP
; ---------------------------------------------------------

[Firefly_Inst.NT]
Include = MSMOUSE.INF
Needs = HID_Mouse_Inst.NT
CopyFiles = Firefly_Inst_CopyFiles.NT

[Firefly_Inst.NT.HW]
Include = MSMOUSE.INF
Needs = HID_Mouse_Inst.NT
AddReg = Firefly_Inst_HWAddReg.NT

[Firefly_Inst_HWAddReg.NT]
HKR,“UpperFilters”,0x00010000,“Firefly”

[Firefly_Inst_CopyFiles.NT]
Firefly.sys

[Firefly_Inst.NT.Services]
Needs = HID_Mouse_Inst.NT.Services
AddService = Firefly, , Firefly_Service_Inst

[Firefly_Service_Inst]
DisplayName = %Firefly.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\Firefly.sys
LoadOrderGroup = PNP Filter

; Source Media Section
; ---------------------------------------------------------
[SourceDisksNames]
1 = %DiskName%

[SourceDisksFiles]
Firefly.sys = 1

;
;— Firefly_Inst WDF Coinstaller installation ------
;

[DestinationDirs]
Firefly_Inst_CoInstaller_CopyFiles = 11

[Firefly_Inst.NT.CoInstallers]
AddReg=Firefly_Inst_CoInstaller_AddReg
CopyFiles=Firefly_Inst_CoInstaller_CopyFiles

[Firefly_Inst_CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “WdfCoInstaller01011.dll,WdfCoInstaller”

[Firefly_Inst_CoInstaller_CopyFiles]
WdfCoInstaller01011.dll

[SourceDisksFiles]
WdfCoInstaller01011.dll=1 ; make sure the number matches with SourceDisksNames

[Firefly_Inst.NT.Wdf]
KmdfService = Firefly, Firefly_wdfsect
[Firefly_wdfsect]
KmdfLibraryVersion = 1.11

; Strings Section
; ---------------------------------------------------------
[Strings]
; Provider names
Provider = “IsiQiri”

; Mfg names
ShinyThings = “QPen”

; Service names
Firefly.SvcDesc = “QPen Service”

; Media names
DiskName = “QPen Driver Disk”

; HID device IDs
HID\VID_0458&PID_00CA.DeviceDesc = “QPen Mouse”

; Standard defs
SPSVCINST_TAGTOFRONT = 0x00000001
SPSVCINST_ASSOCSERVICE= 0x00000002
SERVICE_KERNEL_DRIVER = 1
SERVICE_BOOT_START = 0
SERVICE_SYSTEM_START = 1
SERVICE_AUTO_START = 2
SERVICE_ERROR_NORMAL = 1
SERVICE_ERROR_IGNORE = 0
REG_EXPAND_SZ = 0x00020000
REG_DWORD = 0x00010001
REG_SZ = 0x00000000