如何编写正确的过滤驱动 inf文件
我希望能写一个过滤驱动过滤摄像头的数据并进行显示,之前使用Minifilter,但是安装之后在设备管理器中发现自己写的驱动没有被启动,
别问什么这是在UBS下面,我试过安装在Camera设备类的lowerFilter下也没有用
inf文件如下
;;;
;;; UVCFilter
;;;
[Version]
Signature = "$Windows NT$"
; TODO - Change the Class and ClassGuid to match the Load Order Group value, see https://msdn.microsoft.com/en-us/windows/hardware/gg462963
ClassGuid={ca3e7ab9-b4c3-4ae6-8251-579ef933890f} ; chkinf compat &!
Class=Camera ; inf2cat compat &!
;Class = "_TODO_Change_Class_appropriately_"
;ClassGuid = {_TODO_Change_ClassGuid_appropriately_}
Provider = %ManufacturerName%
DriverVer = 08/18/2022,1.0.0.0
CatalogFile = UVCFilter.cat
PnpLockDown=1
DriverPackageType = ClassFilter ; DIFx identifier
[DestinationDirs]
DefaultDestDir = 12
UVCFilter.DriverFiles = 12 ;%windir%\system32\drivers
;;
;; Default install sections
;;
[DefaultInstall]
OptionDesc = %ServiceDescription%
CopyFiles = UVCFilter.DriverFiles
[DefaultInstall.Services]
AddService = %ServiceName%,,UVCFilter.Service
;;
;; Default uninstall sections
;;
[DefaultUninstall]
DelFiles = UVCFilter.DriverFiles
[DefaultUninstall.Services]
DelService = %ServiceName%,0x200 ;Ensure service is stopped before deleting
;
; Services Section
;
[UVCFilter.Service]
DisplayName = %ServiceName%
Description = %ServiceDescription%
ServiceBinary = %12%\%DriverName%.sys ;%windir%\system32\drivers\
Dependencies = "FltMgr"
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0 ; SERVICE_BOOT_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
; TODO - Change the Load Order Group value
; LoadOrderGroup = "FSFilter Activity Monitor"
;LoadOrderGroup = "System Bus Extender"
AddReg = UVCFilter.AddRegistry
;
; Registry Modifications
;
[UVCFilter.AddRegistry]
HKLM, System\CurrentControlSet\Control\Class\{ca3e7ab9-b4c3-4ae6-8251-579ef933890f}, LowerFilters, 0x00010008, UVCFilter ; firewire
;
; Copy Files
;
[UVCFilter.DriverFiles]
%DriverName%.sys
[SourceDisksFiles]
UVCFilter.sys = 1,,
[SourceDisksNames]
1 = %DiskId1%,,,
;;
;; String Section
;;
[Strings]
; TODO - Add your manufacturer
ManufacturerName = "XChip"
ServiceDescription = "UVCFilter Mini-Filter Driver"
ServiceName = "UVCFilter"
DriverName = "UVCFilter"
DiskId1 = "UVCFilter Device Installation Disk"
;Instances specific information.
DefaultInstance = "UVCFilter Instance"
Instance1.Name = "UVCFilter Instance"
; TODO - Change the altitude value, see https://msdn.microsoft.com/en-us/windows/hardware/drivers/ifs/load-order-groups-and-altitudes-for-minifilter-drivers
Instance1.Altitude = "_TODO_Change_Altitude_appropriately_"
Instance1.Flags = 0x0 ; Allow all attachments
然后我试图使用标准的KMDF框架编写驱动,但是这次连驱动都安装不上,
inf文件如下
;
; KMDFFilter.inf
;
[Version]
Signature="$WINDOWS NT$"
Class=Camera ; TODO: edit Class
ClassGuid={ca3e7ab9-b4c3-4ae6-8251-579ef933890f} ; TODO: edit ClassGuid
Provider=%ManufacturerName%
CatalogFile=KMDFFilter.cat
DriverVer= ; TODO: set DriverVer in stampinf property pages
[DestinationDirs]
DefaultDestDir = 12
KMDFFilter_Device_CoInstaller_CopyFiles = 12
; ================= Class section =====================
;[ClassInstall32]
;Addreg=SampleClassReg
[SampleClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,-5
[SourceDisksNames]
1 = %DiskName%,,,""
[SourceDisksFiles]
KMDFFilter.sys = 1,,
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames
;*****************************************
; Install Section
;*****************************************
[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$
[Standard.NT$ARCH$]
%KMDFFilter.DeviceDesc%=KMDFFilter_Device, Root\KMDFFilter ; TODO: edit hw-id
[KMDFFilter_Device.NT]
CopyFiles=Drivers_Dir
[Drivers_Dir]
KMDFFilter.sys
;-------------- Service installation
[KMDFFilter_Device.NT.Services]
AddService = KMDFFilter,%SPSVCINST_ASSOCSERVICE%, KMDFFilter_Service_Inst
; -------------- KMDFFilter driver install sections
[KMDFFilter_Service_Inst]
DisplayName = %KMDFFilter.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\KMDFFilter.sys
;
;--- KMDFFilter_Device Coinstaller installation ------
;
[KMDFFilter_Device.NT.CoInstallers]
AddReg=KMDFFilter_Device_CoInstaller_AddReg
CopyFiles=KMDFFilter_Device_CoInstaller_CopyFiles
[KMDFFilter_Device_CoInstaller_AddReg]
HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"
HKLM, System\CurrentControlSet\Control\Class\{ca3e7ab9-b4c3-4ae6-8251-579ef933890f}, LowerFilters, 0x00010008, KMDFFilter ; usb
[KMDFFilter_Device_CoInstaller_CopyFiles]
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
[KMDFFilter_Device.NT.Wdf]
KmdfService = KMDFFilter, KMDFFilter_wdfsect
[KMDFFilter_wdfsect]
KmdfLibraryVersion = $KMDFVERSION$
[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName="<XChip>" ;TODO: Replace with your manufacturer name
ClassName="Camera" ; TODO: edit ClassName
DiskName = "KMDFFilter Installation Disk"
KMDFFilter.DeviceDesc = "KMDFFilter Device"
KMDFFilter.SVCDESC = "KMDFFilter Service"
驱动的.c文件就不需要放出来了,这些文件是VS的框架自动生成的我没有任何修改,但是就是启动不了驱动,
请不要用模糊的语言回答这个问题,我已经看了很多模拟两可的答复了,能正确启动驱动才会结题