none
driver stacks RRS feed

  • Question

  • I need to attach a filter driver as an upper filter to a function driver. When I install the drivers separately and attach the filter as an upper filter to the function driver in regstry by specifying UpperFilters flag in the CurrnetControlSet\Class section of function driver , it is OK.  I can view the stack in Device Tree and able to pass requests downthe stack.  Now  I need to attach the filter as an upper filter to the function driver via INF. I checked by specifying the UpperFilters flag in the INF of the function driver ss below but in this case, only the function driver seems installed. Though the filter is installed, the stack is not created. The below is how I tried.

    ;
    ; KMDFFunctionDriver.inf
    ;
    
    [Version]
    Signature="$WINDOWS NT$"
    Class=KMDFFunctionDriverSample ; TODO: edit Class
    ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
    Provider=%ManufacturerName%
    CatalogFile=KMDFFunctionDriver.cat
    DriverVer=01/26/2014,20.54.40.865
    
    [DestinationDirs]
    DefaultDestDir = 12
    
    ; ================= Class section =====================
    
    [ClassInstall32]
    Addreg=SampleClassReg
    
    [SampleClassReg]
    HKR,,,0,%ClassName%
    HKR,,Icon,,-5
    
    [SourceDisksNames]
    1 = %DiskName%,,,""
    
    [SourceDisksFiles]
    KMDFFunctionDriver.sys  = 1
    KMDFFilterDriver.sys = 1
    
    ;*****************************************
    ; Install Section
    ;*****************************************
    
    [Manufacturer]
    %ManufacturerName%=Standard,NTamd64
    
    [Standard.NTamd64]
    %KMDFFunctionDriver.DeviceDesc%=KMDFFunctionDriver_Device, Root\KMDFFunctionDriver ; TODO: edit hw-id
    
    [KMDFFunctionDriver_Device.NT]
    CopyFiles=Drivers_Dir
    
    [KMDFFunctionDriver.NT.HW]
    AddReg = KMDFFunctionDriver.NT.HW.AddReg
    
    [KMDFFunctionDriver.NT.HW.AddReg]
    HKR,,"UpperFilters",0x00010000,"KMDFFilterDriver"
    
    [Drivers_Dir]
    KMDFFunctionDriver.sys
    KMDFFilterDriver.sys
    
    ;-------------- Service installation
    [KMDFFunctionDriver_Device.NT.Services]
    AddService = KMDFFilterDriver,, KMDFFilterDriver_Service_Inst
    AddService = KMDFFunctionDriver,%SPSVCINST_ASSOCSERVICE%, KMDFFunctionDriver_Service_Inst
    
    
    ; -------------- KMDFFunctionDriver driver install sections
    [KMDFFunctionDriver_Service_Inst]
    DisplayName    = %KMDFFunctionDriver.SVCDESC%
    ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
    StartType      = 3               ; SERVICE_DEMAND_START
    ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\KMDFFunctionDriver.sys
    LoadOrderGroup = Extended Base
    
    ; -------------- KMDFFilterDriver driver install sections
    [KMDFFilterDriver_Service_Inst]
    DisplayName    = %KMDFFilterDriver.SVCDESC%
    ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
    StartType      = 3               ; SERVICE_DEMAND_START
    ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\KMDFFilterDriver.sys
    LoadOrderGroup = Extended Base
    
    ;
    ;--- KMDFFunctionDriver_Device Coinstaller installation ------
    ;
    
    [DestinationDirs]
    KMDFFunctionDriver_Device_CoInstaller_CopyFiles = 11
    KMDFFilterDriver_Device_CoInstaller_CopyFiles = 11
    
    
    [KMDFFunctionDriver_Device.NT.CoInstallers]
    AddReg=KMDFFunctionDriver_Device_CoInstaller_AddReg
    CopyFiles=KMDFFunctionDriver_Device_CoInstaller_CopyFiles
    
    [KMDFFilterDriver_Device.NT.CoInstallers]
    AddReg=KMDFFilterDriver_Device_CoInstaller_AddReg
    CopyFiles=KMDFFilterDriver_Device_CoInstaller_CopyFiles
    
    
    [KMDFFunctionDriver_Device_CoInstaller_AddReg]
    HKR,,CoInstallers32,0x00010000, "WdfCoInstaller01011.dll,WdfCoInstaller"
    
    [KMDFFunctionDriver_Device_CoInstaller_CopyFiles]
    WdfCoInstaller01011.dll
    
    [KMDFFilterDriver_Device_CoInstaller_AddReg]
    HKR,,CoInstallers32,0x00010000, "WdfCoInstaller01011.dll,WdfCoInstaller"
    
    [KMDFFilterDriver_Device_CoInstaller_CopyFiles]
    WdfCoInstaller01011.dll
    
    [SourceDisksFiles]
    WdfCoInstaller01011.dll=1 ; make sure the number matches with SourceDisksNames
    
    [KMDFFunctionDriver_Device.NT.Wdf]
    KmdfService =  KMDFFunctionDriver, KMDFFunctionDriver_wdfsect
    [KMDFFunctionDriver_wdfsect]
    KmdfLibraryVersion = 1.11
    
    
    [KMDFFilterDriver_Device.NT.Wdf]
    KmdfService =  KMDFFilterDriver, KMDFFilterDriver_wdfsect
    [KMDFFilterDriver_wdfsect]
    KmdfLibraryVersion = 1.11
    
    
    [Strings]
    SPSVCINST_ASSOCSERVICE= 0x00000002
    ManufacturerName="trial" ; TODO: add ManufacturerName
    ClassName="KMDFFunctionDriverSamples" ; TODO: edit ClassName
    DiskName = "KMDFFunctionDriver Installation Disk"
    KMDFFunctionDriver.DeviceDesc = "KMDFFunctionDriver Device"
    KMDFFunctionDriver.SVCDESC = "KMDFFunctionDriver Service"
    KMDFFilterDriver.DeviceDesc = "KMDFFilterDriver Device"
    KMDFFilterDriver.SVCDESC = "KMDFFilterDriver Service"


    • Edited by its_me_here Thursday, January 30, 2014 1:28 AM
    Thursday, January 30, 2014 1:25 AM

Answers

  • The AddReg sections were not being invoked. Though the filter driver was installed, the stack was not created because the UpperFilter entry in the registry was not added.  I suspect this is because of the mismatch in the Model section and the AddReg section headers. Once it was corrected, the sections were read during the installation and the stack was set up.
    Friday, January 31, 2014 5:17 AM

All replies

  • Perhaps you are missing the ntamd64 decoration for the install section,

    KMDFFunctionDriver_Device.NTamd64]
    CopyFiles=Drivers_Dir

    [KMDFFunctionDriver.NTamd64.HW]
    AddReg = KMDFFunctionDriver.NT.HW.AddReg

     


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, January 30, 2014 3:47 AM
  • Look in setupapi.dev.log to see if your copyfiles and addreg sections are being processed. Perhaps copyfiles isn't working either. Ntamd64 decoration guidelines: http://msdn.microsoft.com/en-us/library/windows/hardware/ff540220(v=vs.85).aspx

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, January 30, 2014 3:52 AM
  • Thanks Doron. There was some mistakes in some sections. In Model section , it is KMDFFunctionDriver_Device. So crrected the below sections to match the entry in Model Section.

     

    [KMDFFunctionDriver_Device.NT.HW]
    AddReg = KMDFFunctionDriver_Device.NT.HW.AddReg
    
    [KMDFFunctionDriver_Device.NT.HW.AddReg]
    HKR,,"UpperFilters",0x00010000,"KMDFFilterDriver"
    

    Thursday, January 30, 2014 12:39 PM
  • And how does it work now? You can look through setupapi.dev.log to see which sections were recognized. While you probably won't see errors inn the log, you can deduce what is going wrong by what isn't there

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, January 30, 2014 3:08 PM
  • The AddReg sections were not being invoked. Though the filter driver was installed, the stack was not created because the UpperFilter entry in the registry was not added.  I suspect this is because of the mismatch in the Model section and the AddReg section headers. Once it was corrected, the sections were read during the installation and the stack was set up.
    Friday, January 31, 2014 5:17 AM