none
Questions on WdfFdoInitSetFilter(DeviceInit) RRS feed

  • Question

  • Hi:

     

    I'm having questions on WdfFdoInitSetFilter(DeviceInit):

     In MS doc, it says:

     "The WdfFdoInitSetFilter method identifies the calling driver as an upper-level or lower-level filter driver, for a specified device."

     My questions are: 

    1. Does this method specify the calling driver is EITHER an upper or lower filter? Or it does neither?

     2. If not, where should it be specified weather the calling driver is an upper filter or an lower filter? The INF AddReg section? Is INF the only way to do it ?

     3. The method indicates the calling driver as a filter driver, but for which FDO? Does the WDF framework take care of that by the parameter "DeviceInit"? How does the framework know that it's the right time to pass the calling driver the DeviceInit of "correct" FDO ?

     Thanks in advance.

    Polaris


    leo

    Monday, March 31, 2014 5:16 PM

Answers

  • 1) no I does not. the location in the stack is controlled by the INF

    2) the INF is the only way

    3) For the FDO stack that is being built upon which you have been installed as filter. this logic is no different for the FDO itself

    basically this API turns on a set of behaviors that ALL filter drivers must follow, it doesn't need to know where in the stack you are located.


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

    Monday, March 31, 2014 10:32 PM
  • The API indicates that the driver is a filter driver. But you attach the filter driver as an upper/lower filter in the INF file. See below a sample INF where a filter driver is attached as a upper filter to a function driver.

    FunctionDriver_Device.NT.HW]
    AddReg = FunctionDriver_Device.NT.HW.AddReg
    
    [FunctionDriver_Device.NT.HW.AddReg]
    HKR,,"UpperFilters",0x00010000,"FilterDriver"
    
    [Drivers_Dir]
    FunctionDriver.sys
    FilterDriver.sys
    
    ;-------------- Service installation
    [FunctionDriver_Device.NT.Services]
    AddService = FilterDriver,, FilterDriver_Service_Inst
    AddService = FunctionDriver,%SPSVCINST_ASSOCSERVICE%, FunctionDriver_Service_Inst
    
    
    
    ; -------------- FilterDriver driver install sections
    [FilterDriver_Service_Inst]
    DisplayName    = %FilterDriver.SVCDESC%
    ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
    StartType      = 3               ; SERVICE_DEMAND_START
    ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\FilterDriver.sys
    LoadOrderGroup = PNP Filter
    
    ; -------------- FunctionDriver driver install sections
    
    [FunctionDriver_Service_Inst]
    DisplayName    = %FunctionDriver.SVCDESC%
    ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
    StartType      = 3               ; SERVICE_DEMAND_START
    ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\FunctionDriver.sys
    LoadOrderGroup = Extended Base
    
    Hope this helps.

    • Marked as answer by SJ-Hills Wednesday, April 2, 2014 6:15 PM
    Wednesday, April 2, 2014 2:02 PM

All replies

  • The call specifies the driver is a filter driver.  Whether it is an upper filter or a lower filter and what it attaches to (i.e. the FDO) is specified by the INF.  Besides the INF, your install program can change the registry, but it is not something the driver can do directly.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Monday, March 31, 2014 5:26 PM
  • 1) no I does not. the location in the stack is controlled by the INF

    2) the INF is the only way

    3) For the FDO stack that is being built upon which you have been installed as filter. this logic is no different for the FDO itself

    basically this API turns on a set of behaviors that ALL filter drivers must follow, it doesn't need to know where in the stack you are located.


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

    Monday, March 31, 2014 10:32 PM
  • The API indicates that the driver is a filter driver. But you attach the filter driver as an upper/lower filter in the INF file. See below a sample INF where a filter driver is attached as a upper filter to a function driver.

    FunctionDriver_Device.NT.HW]
    AddReg = FunctionDriver_Device.NT.HW.AddReg
    
    [FunctionDriver_Device.NT.HW.AddReg]
    HKR,,"UpperFilters",0x00010000,"FilterDriver"
    
    [Drivers_Dir]
    FunctionDriver.sys
    FilterDriver.sys
    
    ;-------------- Service installation
    [FunctionDriver_Device.NT.Services]
    AddService = FilterDriver,, FilterDriver_Service_Inst
    AddService = FunctionDriver,%SPSVCINST_ASSOCSERVICE%, FunctionDriver_Service_Inst
    
    
    
    ; -------------- FilterDriver driver install sections
    [FilterDriver_Service_Inst]
    DisplayName    = %FilterDriver.SVCDESC%
    ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
    StartType      = 3               ; SERVICE_DEMAND_START
    ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\FilterDriver.sys
    LoadOrderGroup = PNP Filter
    
    ; -------------- FunctionDriver driver install sections
    
    [FunctionDriver_Service_Inst]
    DisplayName    = %FunctionDriver.SVCDESC%
    ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
    StartType      = 3               ; SERVICE_DEMAND_START
    ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\FunctionDriver.sys
    LoadOrderGroup = Extended Base
    
    Hope this helps.

    • Marked as answer by SJ-Hills Wednesday, April 2, 2014 6:15 PM
    Wednesday, April 2, 2014 2:02 PM