Installing file system minifilter from INF launched from debug

落爺英雄遲暮 提交于 2019-12-06 08:24:02

问题


I am working on my first file system mini-filter. I am using the SwapBuffers sample project in the WDK. I have successfully compiled and deployed this project to a VM from a physical laptop. But the installation from the INF file is failing. I looked in the log file in C:\DriverTest\Logs on the target machine and found these lines in the log file.

UserText="WDTF_TARGETS: Query("HardwareIDs='WDTF\NOEXIST'")"
UserText="WDTF_DRIVER_SETUP_SYSTEM: CreateRootEnumeratedDevicesFromPackage()"
UserText="WDTF_DRIVER_SETUP_SYSTEM:
UserText="WDTF_TEST: System has no device the driver package can  be installed onto."

Here is the INF file. It is unmodified from the original sample.

;;; SwapBuffers
;;; Copyright (c) 2001, Microsoft Corporation
[Version]
signature   = "$Windows NT$"
Class       = "Encryption"                              ;This is determined by the work this filter driver does
ClassGuid   = {a0a701c0-a511-42ff-aa6c-06dc0395576f}    ;This value is determined by the Class
Provider    = %Msft%
DriverVer   = 06/16/2007,1.0.0.3
CatalogFile = swapbuffers.cat

[DestinationDirs]
DefaultDestDir          = 12
MiniFilter.DriverFiles  = 12            ;%windir%\system32\drivers

;; Default install sections
[DefaultInstall]
OptionDesc          = %ServiceDescription%
CopyFiles           = MiniFilter.DriverFiles

[DefaultInstall.Services]
AddService          = %ServiceName%,,MiniFilter.Service

;; Default uninstall sections
[DefaultUninstall]
DelFiles   = MiniFilter.DriverFiles

[DefaultUninstall.Services]
DelService = SwapBuffers,0x200      ;Ensure service is stopped before deleting

; Services Section
[MiniFilter.Service]
DisplayName      = %ServiceName%
Description      = %ServiceDescription%
ServiceBinary    = %12%\%DriverName%.sys        ;%windir%\system32\drivers\
Dependencies     = "FltMgr"
ServiceType      = 2                            ;SERVICE_FILE_SYSTEM_DRIVER
;StartType        = 0                           ;SERVICE_BOOT_START
StartType        = 3                            ;SERVICE_DEMAND_START
ErrorControl     = 1                            ;SERVICE_ERROR_NORMAL
LoadOrderGroup   = "FSFilter Encryption"
AddReg           = MiniFilter.AddRegistry

; Registry Modifications
[MiniFilter.AddRegistry]
HKR,,"SupportedFeatures",0x00010001,0x3
HKR,"Instances","DefaultInstance",0x00000000,%Instance1.Name%
HKR,"Instances\"%Instance1.Name%,"Altitude",0x00000000,%Instance1.Altitude%
HKR,"Instances\"%Instance1.Name%,"Flags",0x00010001,%Instance1.Flags%

; Copy Files
[MiniFilter.DriverFiles]
%DriverName%.sys

[SourceDisksFiles]
swapbuffers.sys = 1,,

[SourceDisksNames]
1 = %DiskId1%,,,

;; String Section
[Strings]
Msft                    = "Microsoft Corporation"
ServiceDescription      = "Swap Buffers Sample Mini-Filter Driver"
ServiceName             = "SwapBuffers"
DriverName              = "SwapBuffers"
DiskId1                 = "SwapBuffers Device Installation Disk"

;Instances specific information.
Instance1.Name          = "SwapBuffers Instance"
Instance1.Altitude      = "141000"
Instance1.Flags         = 0x0          ; allow automatic attachments

The VMware session has a single hard drive that shows up as a SCSI drive looking at DEVCON.

Can anyone tell me what I'm missing here?


回答1:


If your driver is not for a piece of hardware, go to

  1. select the "driver package"
  2. open "configuration"
  3. go to "driver install" -> "deployment"
  4. select "Do Not Install"

If needed use a custom command e.g. to run "svcctrl.exe" with the desired parameters.




回答2:


inf install can fail on these common cases:

  • The driver is not signed.
  • The driver is a debug driver signed with the test certificate but the certificate wasn't installed on the target machine. The test certificate generated under your output dir (cer file). Copy it to the target machine and double click it.
  • The target machine needs to have test signing enabled:
    • Open admin console
    • bcdedit -set TESTSIGNING ON
    • reboot

I find it easier to install from a batch file (don't omit the "./"): RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 ./MY_DRIVER_NAME.inf



来源:https://stackoverflow.com/questions/19779530/installing-file-system-minifilter-from-inf-launched-from-debug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!