none
Installation of kmdf based disk filter driver. RRS feed

  • Question

  • currently I am installing my disk filter driver an application that uses api's :

    1.  pfnWdfPreDeviceInstallEx()

    2. CreateService()

    3. pfnWdfPostDeviceInstall()

    and my inf file is :

    ----------------------------------

    [Version]
    Signature="$WINDOWS NT$"
    ClassGuid = {4D36E967-E325-11CE-BFC1-08002BE10318}
    CatalogFile=diskdriver.cat


    [diskfilter.NT.Wdf]
    KmdfService = diskfilter, diskfilter_Service_kmdfInst

    [diskfilter_Service_kmdfInst]
    KmdfLibraryVersion = 1.11

    ------------------------------------

    after installing service I go into registry of disk class driver HKLM\~\class\{4D36E967-E325-11CE-BFC1-08002BE10318} and I add manually entry for upperfilter.

    I know that api I used is meant to be used for non-pnp drivers and my one is pnp driver but it works for me. 

    Now I want to install driver using devcon utility.

    For the installation of kmdf based disk filter driver we need :

    1. Add a service.

    2. copy .sys to C:\Windows\system32\drivers and coinstaller into C:\Windows\system32. 

    2. make an entry in disk class as "upperfilter".

    So for this I have written inf file :

    -----------------------------------------------------

    [Version]
    Signature="$WINDOWS NT$"
    Class=DiskDrive  
    ClassGuid={4D36E967-E325-11CE-BFC1-08002BE10318} 
    Provider=%ManufacturerName%
    CatalogFile=diskfilter.cat
    DriverVer=02/18/2014,15.52.23.903

    [DestinationDirs]
    DefaultDestDir = 12



    ;*****************************************
    ; Install Section
    ;*****************************************

    [Manufacturer]
    %ManufacturerName%=Standard,NTx86


    [standard.NTx86.NT]
    CopyFiles=Drivers_Dir

    [Drivers_Dir]
    KMDFDriver1.sys

    [standard.NTx86.NT.HW]
    AddReg = upperfilter

    [upperfilter]
    HKR,,"UpperFilters",0x00010000,"KMDFDriver1"


    ;-------------- Service installation
    [KMDFDriver1_Device.NT.Services]
    AddService = KMDFDriver1,, KMDFDriver1_Service_Inst

    ; -------------- KMDFDriver1 driver install sections
    [KMDFDriver1_Service_Inst]
    DisplayName    = %KMDFDriver1.SVCDESC%
    ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
    StartType      = 0               ; SERVICE_BOOT_START
    ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\KMDFDriver1.sys



    [SourceDisksNames]
    1 = %DiskName%,,,""

    [SourceDisksFiles]
    KMDFDriver1.sys  = 1,,

    ;
    ;--- KMDFDriver1_Device Coinstaller installation ------
    ;

    [DestinationDirs]
    KMDFDriver1_Device_CoInstaller_CopyFiles = 11

    [KMDFDriver1_Device.NT.CoInstallers]
    AddReg=KMDFDriver1_Device_CoInstaller_AddReg
    CopyFiles=KMDFDriver1_Device_CoInstaller_CopyFiles

    [KMDFDriver1_Device_CoInstaller_AddReg]
    HKR,,CoInstallers32,0x00010000, "WdfCoInstaller01011.dll,WdfCoInstaller"

    [KMDFDriver1_Device_CoInstaller_CopyFiles]
    WdfCoInstaller01011.dll

    [SourceDisksFiles]
    WdfCoInstaller01011.dll=1 ; make sure the number matches with SourceDisksNames

    [KMDFDriver1_Device.NT.Wdf]
    KmdfService =  KMDFDriver1, KMDFDriver1_wdfsect
    [KMDFDriver1_wdfsect]
    KmdfLibraryVersion = 1.11

    [Strings]
    ManufacturerName="Ankit Bhatia" 
    DiskName = "KMDFDriver1 Installation Disk"
    KMDFDriver1.SVCDESC = "KMDFDriver1 Service"

    --------------------------------------------

    Now I do not think so disk filter driver would be installed using devcon utility because it needs hardware-id and it might changes in disk class driver.

    So here are 2 question that I would want to ask :

    1. I think my install section part in .inf file is not correct. Please tell what is wrong with my inf file ?

    2. Now how would I install my disk filter driver ? 



    Tuesday, February 18, 2014 5:28 PM

Answers

  • Well one of the first rules should always be run Chkinf and fix all errors and warnings.  Taking your file above gets:

    ; (W22.1.2212) No Copyright information found. 
    [Version]
     Signature="$WINDOWS NT$"
     Class=DiskDrive  
     ClassGuid={4D36E967-E325-11CE-BFC1-08002BE10318} 
     Provider=%ManufacturerName%
     CatalogFile=diskfilter.cat
     DriverVer=02/18/2014,15.52.23.903
     
    [DestinationDirs]
     DefaultDestDir = 12
     
    
    
    ;*****************************************
     ; Install Section
     ;*****************************************
     
    [Manufacturer]
     %ManufacturerName%=Standard,NTx86
    ; (E22.1.1003) Section [Standard.NTx86] not defined. 
     
    
    [standard.NTx86.NT]
    ; (W22.1.2083) Section [STANDARD.NTX86.NT] not referenced 
     CopyFiles=Drivers_Dir
     
    [Drivers_Dir]
    ; (W22.1.2083) Section [DRIVERS_DIR] not referenced 
     KMDFDriver1.sys
     
    [standard.NTx86.NT.HW]
    ; (W22.1.2083) Section [STANDARD.NTX86.NT.HW] not referenced 
     AddReg = upperfilter
     
    [upperfilter]
    ; (W22.1.2083) Section [UPPERFILTER] not referenced 
     HKR,,"UpperFilters",0x00010000,"KMDFDriver1"
     
    
    ;-------------- Service installation
     [KMDFDriver1_Device.NT.Services]
    ; (W22.1.2083) Section [KMDFDRIVER1_DEVICE.NT.SERVICES] not referenced 
     AddService = KMDFDriver1,, KMDFDriver1_Service_Inst
     
    ; -------------- KMDFDriver1 driver install sections
     [KMDFDriver1_Service_Inst]
    ; (W22.1.2083) Section [KMDFDRIVER1_SERVICE_INST] not referenced 
     DisplayName    = %KMDFDriver1.SVCDESC%
     ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
     StartType      = 0               ; SERVICE_BOOT_START
     ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
     ServiceBinary  = %12%\KMDFDriver1.sys
     
    
    
    [SourceDisksNames]
     1 = %DiskName%,,,""
     
    [SourceDisksFiles]
     KMDFDriver1.sys  = 1,,
     
    ;
     ;--- KMDFDriver1_Device Coinstaller installation ------
     ;
     
    [DestinationDirs]
     KMDFDriver1_Device_CoInstaller_CopyFiles = 11
     
    [KMDFDriver1_Device.NT.CoInstallers]
    ; (W22.1.2083) Section [KMDFDRIVER1_DEVICE.NT.COINSTALLERS] not referenced 
     AddReg=KMDFDriver1_Device_CoInstaller_AddReg
     CopyFiles=KMDFDriver1_Device_CoInstaller_CopyFiles
     
    [KMDFDriver1_Device_CoInstaller_AddReg]
    ; (W22.1.2083) Section [KMDFDRIVER1_DEVICE_COINSTALLER_ADDREG] not referenced 
     HKR,,CoInstallers32,0x00010000, "WdfCoInstaller01011.dll,WdfCoInstaller"
     
    [KMDFDriver1_Device_CoInstaller_CopyFiles]
    ; (W22.1.2083) Section [KMDFDRIVER1_DEVICE_COINSTALLER_COPYFILES] not referenced 
     WdfCoInstaller01011.dll
     
    [SourceDisksFiles]
     WdfCoInstaller01011.dll=1 ; make sure the number matches with SourceDisksNames
     
    [KMDFDriver1_Device.NT.Wdf]
    ; (W22.1.2083) Section [KMDFDRIVER1_DEVICE.NT.WDF] not referenced 
     KmdfService =  KMDFDriver1, KMDFDriver1_wdfsect
     [KMDFDriver1_wdfsect]
    ; (W22.1.2083) Section [KMDFDRIVER1_WDFSECT] not referenced 
     KmdfLibraryVersion = 1.11
     
    [Strings]
     ManufacturerName="Ankit Bhatia" 
     DiskName = "KMDFDriver1 Installation Disk"
     KMDFDriver1.SVCDESC = "KMDFDriver1 Service"
    
    

    Now personally, I don't try to install device specific filters with INF files, but instead follow the AddFilter example from the WDK.



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

    Tuesday, February 18, 2014 5:45 PM