none
Sample Code for "Storage filter driver" RRS feed

  • Question

  • HI I am looking for sample code that works as "storage filter driver" either UpperFilter or LowerFilter.

    I have used sample code from Visual Studio, KMDF which creates Driver/Device/Queue files.

    I am trying to modify the inf as follows.

    ;;==============================================

    ;
    ; KMDF_A1.inf
    ;
    [Version]
    Signature="$WINDOWS NT$"
    ;Class=Sample ; TODO: edit Class
    ;ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
    ;Class = Volume
    ;ClassGuid = {71a27cdd-812a-11d0-bec7-08002be2092f}
    Class = DiskDrive
    ClassGuid = {4d36e967-e325-11ce-bfc1-08002be10318}
    ;Class = Extension
    ;ClassGuid = {e2f84ce7-8efa-411c-aa69-97454ca4cb57}
    ;Class = Keyboard
    ;ClassGuid = {4d36e96b-e325-11ce-bfc1-08002be10318}
    Provider=%ManufacturerName%
    CatalogFile=KMDF_A1.cat
    DriverVer= 12-12-2019; TODO: set DriverVer in stampinf property pages
    [DestinationDirs]
    DefaultDestDir = 12
    KMDF_A1_Device_CoInstaller_CopyFiles = 11

    ;*****************************************
    ; Install Section
    ;*****************************************
    [Manufacturer]
    ;%ManufacturerName%=Standard,NT$ARCH$
    ;%ManufacturerName%=Standard
    ;[KMDF_A1_install.HW]
    [KMDF_A1_inst]
    AddReg=KMDF_A1_addreg
    [KMDF_A1_addreg]
    HKR,,"UpperFilters",0x0001000A,"KMDF_A1" ; REG_MULTI_SZ value

    ; -------------- KMDF_A1 driver install sections
    [KMDF_A1_Service_Inst]
    DisplayName    = %KMDF_A1.SVCDESC%
    ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
    StartType      = 1               ; SERVICE_DEMAND_START
    ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\KMDF_A1.sys

    [Strings]
    SPSVCINST_ASSOCSERVICE= 0x00000002
    ManufacturerName="ShasRaTech-VRD" ;TODO: Replace with your manufacturer name
    ClassName="KMDF_A1" ; TODO: edit ClassName
    DiskName = "KMDF_A1 Installation Disk"
    KMDF_A1.DeviceDesc = "KMDF_A1 Device"
    KMDF_A1.SVCDESC = "KMDF_A1 Service"

    ;;=======================================================

    the driver gets installed, but when I try to start the driver, it gives me the following error.
    =============================

    The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

    =============================

    Please help me, to understand what error I am doing.

    Thanks, Arun Ayachith.

    Friday, December 20, 2019 6:37 PM

Answers

  • Your INF is wrong, because you have nothing in your [Manufacturer] section.  Where did you think this device was going to load?  What device or class were you intending to filter?

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Monday, December 23, 2019 6:48 AM

All replies

  • There hasn't really been a disk filter in the WDK samples since diskperf which was last in the Windows 8 WDK.  Unfortunately that sample was wdm not KMDF.    The best you can do is to take a sample KMDF filter such as one from toaster, and then study the disk driver sample to understand what requests are going to be seen by the filter.

    You will on the INF have to change the class to disk and remove a number of things from the toaster filter, but that is about all you can do to start.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Sunday, December 22, 2019 6:55 PM
  • Your INF is wrong, because you have nothing in your [Manufacturer] section.  Where did you think this device was going to load?  What device or class were you intending to filter?

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Monday, December 23, 2019 6:48 AM