Device specific filter driver does not take effect

Hi All,
I write a pci bus filter driver, but it’s not working correctly. Using command line “rundll32.exe setupapi.dll,InstallHinfSection myifilter_Win10_install 132 .\myfilter.inf” to install.
After installation, ths .sys file goes to system32/dirvers/ , and service registerd in HKLM/SYSTEM/CurrentControlSet/Control/Services successful. But the “HKR,“UpperFilters”” has gone!
Query for all registry keys do not find a key named “UpperFilters” and value is “mypcifilter”, so I supposed that the driver has problem with installation, but I dont’t know how to resolve it.

My inf configuration:
[Manufacturer]
%ManufacturerName%= Win10, NT$ARCH$

[Win10.NT$ARCH$]
%mypcifilter.DeviceDesc0%=myifilter_Win10_install, PCI\CC_0604 ; PCI-PCI BRIDGE
%mypcifilter.DeviceDesc1%=myifilter_Win10_install, PCI\CC_0604&DT_4 ; PCI Express Root Port
%mypcifilter.DeviceDesc2%=myifilter_Win10_install, PCI\CC_0604&DT_5 ; PCI Express Upstream Switch Port
%mypcifilter.DeviceDesc3%=myifilter_Win10_install, PCI\CC_0604&DT_6 ; PCI Express Downstream Switch Port
%mypcifilter.DeviceDesc4%=myifilter_Win10_install, PCI\CC_0604&DT_7 ; PCI Express to PCI(-X) Bridge
%mypcifilter.DeviceDesc5%=myifilter_Win10_install, PCI\CC_0604&DT_8 ; PCI(-X) to PCI Express Bridge

[myifilter_Win10_install.NT]
Include = pci.inf
Needs = PCI_DRV
CopyFiles = Drivers_Dir

[myifilter_Win10_install.NT.HW]
Include = pci.inf
Needs = PCI_DRV.HW
AddReg = mypcifilter_reg

[myifilter_Win10_install.NT.Services]
Include = pci.inf
Needs = PCI_DRV.Services
AddService = mypcifilter,%SPSVCINST_ASSOCSERVICE%, mypcifilter_Service_Inst

[Drivers_Dir]
mypcifilter.sys
;mypcifilter.sys,0x00004000 ; COPYFLG_IN_USE_RENAME

[mypcifilter_reg]
; append this service to existing REG_MULTI_SZ list, if any
HKR,“UpperFilters”,0x00010008,“mypcifilter”

; -------------- mypcifilter driver install sections
[mypcifilter_Service_Inst]
DisplayName = %mypcifilter.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\mypcifilter.sys
LoadOrderGroup = Extended Base

xxxxx@sina.com

What does setupapi.dev.log say? Which device did it install on? The log should indicate if the upperfilter was added. I would assume that the install requires a reboot as the boot stack is downstream of the root port.

Bent from my phone


From: 30171415500n behalf of
Sent: Tuesday, July 10, 2018 8:14 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Device specific filter driver does not take effect

Hi All,
I write a pci bus filter driver, but it’s not working correctly. Using command line “rundll32.exe setupapi.dll,InstallHinfSection myifilter_Win10_install 132 .\myfilter.inf” to install.
After installation, ths .sys file goes to system32/dirvers/ , and service registerd in HKLM/SYSTEM/CurrentControlSet/Control/Services successful. But the “HKR,“UpperFilters”” has gone!
Query for all registry keys do not find a key named “UpperFilters” and value is “mypcifilter”, so I supposed that the driver has problem with installation, but I dont’t know how to resolve it.

My inf configuration:
[Manufacturer]
%ManufacturerName%= Win10, NT$ARCH$

[Win10.NT$ARCH$]
%mypcifilter.DeviceDesc0%=myifilter_Win10_install, PCI\CC_0604 ; PCI-PCI BRIDGE
%mypcifilter.DeviceDesc1%=myifilter_Win10_install, PCI\CC_0604&DT_4 ; PCI Express Root Port
%mypcifilter.DeviceDesc2%=myifilter_Win10_install, PCI\CC_0604&DT_5 ; PCI Express Upstream Switch Port
%mypcifilter.DeviceDesc3%=myifilter_Win10_install, PCI\CC_0604&DT_6 ; PCI Express Downstream Switch Port
%mypcifilter.DeviceDesc4%=myifilter_Win10_install, PCI\CC_0604&DT_7 ; PCI Express to PCI(-X) Bridge
%mypcifilter.DeviceDesc5%=myifilter_Win10_install, PCI\CC_0604&DT_8 ; PCI(-X) to PCI Express Bridge

[myifilter_Win10_install.NT]
Include = pci.inf
Needs = PCI_DRV
CopyFiles = Drivers_Dir

[myifilter_Win10_install.NT.HW]
Include = pci.inf
Needs = PCI_DRV.HW
AddReg = mypcifilter_reg

[myifilter_Win10_install.NT.Services]
Include = pci.inf
Needs = PCI_DRV.Services
AddService = mypcifilter,%SPSVCINST_ASSOCSERVICE%, mypcifilter_Service_Inst

[Drivers_Dir]
mypcifilter.sys
;mypcifilter.sys,0x00004000 ; COPYFLG_IN_USE_RENAME

[mypcifilter_reg]
; append this service to existing REG_MULTI_SZ list, if any
HKR,“UpperFilters”,0x00010008,“mypcifilter”

; -------------- mypcifilter driver install sections
[mypcifilter_Service_Inst]
DisplayName = %mypcifilter.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\mypcifilter.sys
LoadOrderGroup = Extended Base


xxxxx@sina.com


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

It seems to be successful from the setuplog.

The msdn doc says that Addreg in DDInstall.HW should add the reg to the device’s hardware key, so I add the “UpperFilters” key to HKLM/SYSTEM/CurrentControlSet/Enum/PCI/{specific-hardwareID} manually, it works!

Log:

>> [Install INF Section (InstallHInfSection) - myfilter.inf]
>> Section start 2018/07/11 11:54:19.122
cmd: rundll32 setupapi.dll, InstallHinfSection myifilter_Win10_install 132 .\myfilter.inf
inf: INF - .\myfilter.inf
inf: Section - myifilter_Win10_install
inf: Mode - 132
inf: Opened INF: ‘F:\lizzoe\mypcifilter\myfilter.inf’ ([strings])
inf: Opened PNF: ‘C:\Windows\INF\pci.inf’ ([strings.0804])
dvi: Included pci.inf under [myifilter_Win10_install.NT].
dvi: Needs [PCI_DRV] under [myifilter_Win10_install.NT].
inf: Installing section [myifilter_Win10_install.NT] from ‘.\myfilter.inf’.
inf: {Install Inf Section [myifilter_Win10_install.NT]}
inf: CopyFiles=Drivers_Dir (myfilter.inf line 73)
flq: QueueSingleCopy…
flq: Inf : ‘F:\lizzoe\mypcifilter\myfilter.inf’
flq: SourceInf: ‘F:\lizzoe\mypcifilter\myfilter.inf’
flq: SourceSection: [sourcedisksfiles]
flq: SourceRootPath: 'F:\lizzoe\mypcifilter'
flq: {FILE_QUEUE_COPY}
flq: CopyStyle - 0x00000024
flq: {FILE_QUEUE_COPY}
flq: CopyStyle - 0x00000024
flq: SourceRootPath - 'F:\lizzoe\mypcifilter'
flq: SourceFilename - ‘mypcifilter.sys’
flq: TargetDirectory- ‘C:\Windows\system32\DRIVERS’
flq: TargetFilename - ‘mypcifilter.sys’
flq: SourceDesc - ‘mypcifilter Installation Disk’
flq: {FILE_QUEUE_COPY exit(0x00000000)}
flq: {FILE_QUEUE_COPY exit(0x00000000)}
inf: {Install Inf Section [myifilter_Win10_install.NT] exit (0x00000000)}
inf: {Install Inf Section [PCI_DRV]}
inf: {Install Inf Section [PCI_DRV] exit (0x00000000)}
flq: {FILE_QUEUE_COMMIT} 11:54:19.151
flq: {SPFILENOTIFY_STARTQUEUE}
flq: {SPFILENOTIFY_STARTQUEUE - exit(0x00000001)}
flq: {FILE_QUEUE_COMMIT_COPY_SUBQUEUE}
flq: {SPFILENOTIFY_STARTSUBQUEUE}
flq: {SPFILENOTIFY_STARTSUBQUEUE - exit(0x00000001)}
flq: Source Media:
flq: Description - [mypcifilter Installation Disk]
flq: SourcePath - [F:\lizzoe\mypcifilter]
flq: SourceFile - [mypcifilter.sys]
flq: Flags - 0x00000000
flq: {SPFQNOTIFY_NEEDMEDIA}
flq: {SPFILENOTIFY_NEEDMEDIA}
flq: {SPFILENOTIFY_NEEDMEDIA - exit(0x00000001)}
flq: {SPFQNOTIFY_NEEDMEDIA - returned 0x00000001}
flq: Source Media: SPFQOPERATION_DOIT
flq: {FILE_QUEUE_COMMIT_COPY_FILE}
flq: {SPFILENOTIFY_STARTCOPY}
flq: {SPFILENOTIFY_STARTCOPY - exit(0x00000001)}
flq: Copying ‘F:\lizzoe\mypcifilter\mypcifilter.sys’ to ‘C:\Windows\system32\DRIVERS\mypcifilter.sys’.
flq: CopyFile: ‘F:\lizzoe\mypcifilter\mypcifilter.sys’ to ‘C:\Windows\system32\DRIVERS\SET9A5A.tmp’
cpy: CopyFile Drp is NOT active
flq: MoveFile: ‘C:\Windows\system32\DRIVERS\SET9A5A.tmp’ to ‘C:\Windows\system32\DRIVERS\mypcifilter.sys’
flq: {SPFILENOTIFY_ENDCOPY}
flq: {SPFILENOTIFY_ENDCOPY - exit(0x00000001)}
flq: {FILE_QUEUE_COMMIT_COPY_FILE exit OK}
flq: {SPFILENOTIFY_ENDSUBQUEUE}
flq: {SPFILENOTIFY_ENDSUBQUEUE - exit(0x00000001)}
flq: {FILE_QUEUE_COMMIT_COPY_SUBQUEUE exit OK}
flq: {SPFILENOTIFY_ENDQUEUE}
flq: {SPFILENOTIFY_ENDQUEUE - exit(0x00000001)}
flq: {FILE_QUEUE_COMMIT exit OK} 11:54:19.238
inf: {Install Inf Section [myifilter_Win10_install.NT]}
inf: {Install from INF Section - myifilter_Win10_install.NT} 11:54:19.239
inf: Flags - 0x000007ef
inf: Reference Key - 0
inf: Source root - (null)
inf: Copy flags - 0x000007ef
inf: {Install from INF Section - exit(0x00000000)} 11:54:19.242
inf: {Install Inf Section [myifilter_Win10_install.NT] exit (0x00000000)}
inf: {Install Inf Section [PCI_DRV]}
inf: {Install from INF Section - PCI_DRV} 11:54:19.243
inf: Flags - 0x000007ef
inf: Reference Key - 0
inf: Source root - (null)
inf: Copy flags - 0x000007ef
inf: {Install from INF Section - exit(0x00000000)} 11:54:19.245
inf: {Install Inf Section [PCI_DRV] exit (0x00000000)}
dvi: Included pci.inf under [myifilter_Win10_install.NT.Services].
dvi: Needs [PCI_DRV.Services] under [myifilter_Win10_install.NT.Services].
inf: {Install Inf Section [myifilter_Win10_install.NT.Services]}
inf: AddService=mypcifilter,0x00000002,mypcifilter_Service_Inst (myfilter.inf line 83)
inf: ServiceType=1 (myfilter.inf line 96)
inf: StartType=3 (myfilter.inf line 97)
inf: ErrorControl=1 (myfilter.inf line 98)
inf: ServiceBinary=C:\Windows\system32\DRIVERS\mypcifilter.sys (myfilter.inf line 99)
inf: DisplayName=“mypcifilter Service” (myfilter.inf line 95)
inf: LoadOrderGroup=“Extended Base” (myfilter.inf line 100)
dvi: Add Service: Created service ‘mypcifilter’.
inf: {Install from INF Section - mypcifilter_Service_Inst} 11:54:19.282
inf: Flags - 0x00100004
inf: Reference Key - 3
inf: Source root - (null)
inf: Copy flags - 0x00100004
inf: {Install from INF Section - exit(0x00000000)} 11:54:19.286
inf: {Install Inf Section [myifilter_Win10_install.NT.Services] exit(0x00000000)}
<<< Section end 2018/07/11 11:54:19.750
<<< [Exit status: SUCCESS]

xxxxx@sina.com

From: xxxxx@microsoft.com
Date: 2018-07-11 12:11
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Device specific filter driver does not take effect
What does setupapi.dev.log say? Which device did it install on? The log should indicate if the upperfilter was added. I would assume that the install requires a reboot as the boot stack is downstream of the root port.

Bent from my phone

From: 30171415500n behalf of
Sent: Tuesday, July 10, 2018 8:14 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Device specific filter driver does not take effect

Hi All,
I write a pci bus filter driver, but it’s not working correctly. Using command line “rundll32.exe setupapi.dll,InstallHinfSection myifilter_Win10_install 132 .\myfilter.inf” to install.
After installation, ths .sys file goes to system32/dirvers/ , and service registerd in HKLM/SYSTEM/CurrentControlSet/Control/Services successful. But the “HKR,“UpperFilters”” has gone!
Query for all registry keys do not find a key named “UpperFilters” and value is “mypcifilter”, so I supposed that the driver has problem with installation, but I dont’t know how to resolve it.

My inf configuration:
[Manufacturer]
%ManufacturerName%= Win10, NT$ARCH$

[Win10.NT$ARCH$]
%mypcifilter.DeviceDesc0%=myifilter_Win10_install, PCI\CC_0604 ; PCI-PCI BRIDGE
%mypcifilter.DeviceDesc1%=myifilter_Win10_install, PCI\CC_0604&DT_4 ; PCI Express Root Port
%mypcifilter.DeviceDesc2%=myifilter_Win10_install, PCI\CC_0604&DT_5 ; PCI Express Upstream Switch Port
%mypcifilter.DeviceDesc3%=myifilter_Win10_install, PCI\CC_0604&DT_6 ; PCI Express Downstream Switch Port
%mypcifilter.DeviceDesc4%=myifilter_Win10_install, PCI\CC_0604&DT_7 ; PCI Express to PCI(-X) Bridge
%mypcifilter.DeviceDesc5%=myifilter_Win10_install, PCI\CC_0604&DT_8 ; PCI(-X) to PCI Express Bridge

[myifilter_Win10_install.NT]
Include = pci.inf
Needs = PCI_DRV
CopyFiles = Drivers_Dir

[myifilter_Win10_install.NT.HW]
Include = pci.inf
Needs = PCI_DRV.HW
AddReg = mypcifilter_reg

[myifilter_Win10_install.NT.Services]
Include = pci.inf
Needs = PCI_DRV.Services
AddService = mypcifilter,%SPSVCINST_ASSOCSERVICE%, mypcifilter_Service_Inst

[Drivers_Dir]
mypcifilter.sys
;mypcifilter.sys,0x00004000 ; COPYFLG_IN_USE_RENAME

[mypcifilter_reg]
; append this service to existing REG_MULTI_SZ list, if any
HKR,“UpperFilters”,0x00010008,“mypcifilter”

; -------------- mypcifilter driver install sections
[mypcifilter_Service_Inst]
DisplayName = %mypcifilter.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\mypcifilter.sys
LoadOrderGroup = Extended Base

xxxxx@sina.com


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></http:></http:></http:>

On Jul 10, 2018, at 11:37 PM, xxxxx@sina.com wrote:
>
> It seems to be successful from the setuplog.
>
> The msdn doc says that Addreg in DDInstall.HW should add the reg to the device’s hardware key,

It will. But you didn’t ask it to run the DDInstall.HW section. You specifically asked it to run the DDInstall section. The automatic execution of the other sections only happens if you do a genuine PnP install, by pre-installing the driver package and triggering a reload of the affected devices. Without that, the system doesn’t have any idea what hardware keys are supposed to be involved.

Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.