Hi,
Like some of you I am not too familiar with device driver. However, I was able to successfully modify kbfiltr to intercept/change scan codes for PS/2 keyboards. Now I want to do the same thing for HID keyboards. It is a custom keyboard and the keys I want to intercept do not make it to the PS/2 (keyboard class filter). So I suspect I need a lower HID filter. As a start I’m using the “hidusbfx2” DDk sample and trying to modify it. But at this point I can’t get it to install successfully, or if it does, no keystrokes make it to the user.
Using the simpler HID mouse example, Firefly and Firefly.inx, (with no Minidriver) I have changed the Class to Keyboard and the associated guid and changed the "include="and “needs=” appropriately and it installs and tests OK.
However, when I do the same thing to the hidusbfx2, with the minidriver, the install fails. Even if I use a simple filter with no callback, the install also fails, or if it succeeds, no keystrokes make it to applications, as I mentioned above.
Any ideas?
When looking at various posts, every INF is slightly different. I don’t know what differences are important and which make no difference.
I am running Win7/64.
Here is the current INF my I am using:
[Version]
Signature = “$WINDOWS NT$”
;Class = HIDClass
;ClassGuid = {745a17a0-74d3-11d0-b6fe-00a0c90f57da}
Class=Keyboard
ClassGUID={4D36E96B-E325-11CE-BFC1-08002BE10318}
Provider = %VENDOR%
LayoutFile = layout.inf
DriverVer=08/24/2014,6.1.7600.16385
CatalogFile = atgi_kmdfsamples.cat
;
; Layout.inf (etc.) list all files shipped with the operating system so the
; source description sections are only needed if other files are needed.
;
; In order to use IHV drivers, the SourceDisksNames section must list the
; disk(s) containing the drivers and the SourceDisksFiles section must list
; which disk number each file to be copied is found on.
; Disk number 99 is used to avoid a conflict with the disk numbers defined
; in layout.inf
;
; Files used in a driver installation need to be digitally signed otherwise
; installation may fail. See documentation elsewhere in the DDK regarding
; driver signing.
[SourceDisksFiles]
hidusbfx2.sys = 99
hidkmdf.sys = 99
[SourceDisksNames]
99 = %DISK_NAME%,“”
[DestinationDirs]
CopyFunctionDriver = 12
CopyFilterDriver = 12
[Manufacturer]
%VENDOR%=Vendor, NTx86, NTAMD64
; For XP and later
[Vendor.NTx86]
%hidusbfx2% = hidusbfx2.Inst, HID\VID_17F6&PID_0828
;%customCollection% = customCollection.Inst, HID_DEVICE_UP:FF00_U:0001
;%customCollection% = customCollection.Inst, HID_DEVICE_UP:0001_U:0006
; For Win7 and later so that we can use inbox HID-KMDF mapper
[Vendor.NTAMD64]
%hidusbfx2% = hidusbfx2.Inst.Win7, HID\VID_17F6&PID_0828
;%customCollection% = customCollection.Inst, HID_DEVICE_UP:FF00_U:0001
;%customCollection% = customCollection.Inst, HID_DEVICE_UP:0001_U:0006
;===============================================================
; Install section for XP thru Vista
;===============================================================
[hidusbfx2.Inst.NT]
Include = keyboard.inf
Needs = HID_Keyboard_Inst.NT
CopyFiles = CopyFunctionDriver, CopyFilterDriver
[hidusbfx2.Inst.NT.HW]
Include = keyboard.inf
Needs = HID_Keyboard_Inst.NT
AddReg = hidusbfx2_Parameters.AddReg
;
; hidkmdf is the function driver and hidusbfx2 is the lower filter
;
[hidusbfx2.Inst.NT.Services]
AddService = hidkmdf,0x00000002,hidkmdf_Service_Inst,
AddService = hidusbfx2, hidusbfx2_Service_Inst
[CopyFunctionDriver]
hidkmdf.sys
[hidusbfx2_Parameters.AddReg]
HKR,“LowerFilters”,0x00010000,“hidusbfx2”
[hidkmdf_Service_Inst]
DisplayName = %hidkmdf.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\hidkmdf.sys
LoadOrderGroup = PNP Filter
;===============================================================
; Install section for Win7 and later
; Use the inbox mshidkmdf.sys as the shim
;===============================================================
[hidusbfx2.Inst.Win7.NT]
; Just copy the driver. No neeed to copy other system binaries.
Include = keyboard.inf
Needs = HID_Keyboard_Inst.NT
;CopyFiles = CopyFilterDriver
;mshidkmdf.sys does not load (setupdapa.dev.log sys “mshidkmdf.sys” is disabled)
; so lets try loading hidkmdf.sys
CopyFiles = CopyFilterDriver,CopyFunctionDriver
[hidusbfx2.Inst.Win7.NT.HW]
Include = keyboard.inf
Needs = HID_Keyboard_Inst.NT
AddReg = hidusbfx2_Win7_Parameters.AddReg
;
; mshidkmdf is the function driver and hidusbfx2 is the lower filter
;
[hidusbfx2.Inst.Win7.NT.Services]
AddService = hidusbfx2, hidusbfx2_Service_Inst
;AddService = mshidkmdf, 0x000001fa, mshidkmdf.AddService ;flag 0x2 sets this as the service for the device
AddService = hidkmdf, 0x000001fa, mshidkmdf.AddService ;flag 0x2 sets this as the service for the device
[CopyFilterDriver]
hidusbfx2.sys
[mshidkmdf.AddService]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
;ServiceBinary = %10%\System32\Drivers\mshidkmdf.sys
ServiceBinary = %12%\hidkmdf.sys
[hidusbfx2_Win7_Parameters.AddReg]
HKR,“LowerFilters”,0x00010000,“hidusbfx2”
;===============================================================
; Service section (common to all OS versions)
;===============================================================
[hidusbfx2_Service_Inst]
DisplayName = %hidusbfx2%
ServiceType = %SERVICE_KERNEL_DRIVER%
StartType = %SERVICE_DEMAND_START%
ErrorControl = %SERVICE_ERROR_IGNORE%
ServiceBinary = %12%\hidusbfx2.sys
;===============================================================
; Custom Collection install section
; - Only a Null service is installed.
;===============================================================
[customCollection.Inst.NT]
; NULL section
[customCollection.Inst.NT.HW]
AddReg = customCollection.Inst.AddReg.NT.HW
[customCollection.Inst.AddReg.NT.HW]
HKR,“SelectiveSuspendEnabled”,0x00000001,0x1
[customCollection.Inst.NT.Services]
AddService = ,0x00000002, ; NULL Service
;================================================================
; WDF Coinstaller installation
;===============================================================
[DestinationDirs]
hidusbfx2.Inst_CoInstaller_CopyFiles = 11
[hidusbfx2.Inst.NT.CoInstallers]
AddReg=hidusbfx2.Inst_CoInstaller_AddReg
CopyFiles=hidusbfx2.Inst_CoInstaller_CopyFiles
[hidusbfx2.Inst_CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “WdfCoInstaller01009.dll,WdfCoInstaller”
[hidusbfx2.Inst_CoInstaller_CopyFiles]
WdfCoInstaller01009.dll,0x00000010 ;COPYFLG_NO_OVERWRITE (for win2k)
[SourceDisksFiles]
WdfCoInstaller01009.dll=99 ; make sure the number matches with SourceDisksNames
[hidusbfx2.Inst.NT.Wdf]
KmdfService = hidusbfx2, hidusbfx2_wdfsect
[hidusbfx2_wdfsect]
KmdfLibraryVersion = 1.9
;================================================================
; Strings section
;===============================================================
[Strings]
;Localizable
VENDOR = “atgi Vendor Name”
hidusbfx2 = “atgi KMDF HID Minidriver for OSR USB-FX2 Device”
customCollection = “atgi HID Vendor-defined Collection for OSR USB-FX2”
DISK_NAME = “atgi HID USB FX2 Device Sample Install Disk”
hidkmdf.SVCDESC = “atgi Filter Driver Service for HID-KMDF Interface layer”
;Non-Localizable
SERVICE_BOOT_START = 0x0
SERVICE_SYSTEM_START = 0x1
SERVICE_AUTO_START = 0x2
SERVICE_DEMAND_START = 0x3
SERVICE_DISABLED = 0x4
SERVICE_KERNEL_DRIVER = 0x1
SERVICE_ERROR_IGNORE = 0x0
SERVICE_ERROR_NORMAL = 0x1
SERVICE_ERROR_SEVERE = 0x2
SERVICE_ERROR_CRITICAL = 0x3
REG_EXPAND_SZ = 0x00020000
REG_DWORD = 0x00010001
REG_MULTI_SZ = 0x00010000
REG_BINARY = 0x00000001
REG_SZ = 0x00000000