将Windows驱动程序sys文件保留在system32 \ drivers目录之外是否合法?似乎可以通过CreateService“手动”配置驱动程序,并使用driver.sys文件的绝对路径。但是当INF文件用于使用InstallHinfSection安装驱动程序时,驱动程序位置不是system32 \ drivers,InstallHinfSection将失败并显示错误
!!! dvi:驱动程序路径不在系统根目录中 ! inf:{安装Inf部分[DefaultInstall.NT.Services]退出(0xe0000217)} ! inf:错误0xe0000217:此INF中的服务安装部分无效。 inf:{安装Inf部分[DefaultInstall.NT]} 什么时候 ServiceBinary =%1%\ MyDriverdrv.sys;目前的目录 并且成功的时候 ServiceBinary =%12%\ MyDriverdrv.sys; SYSTEM32 \驱动程序
INf文件:
;
; INF file to install MyDriver registry filter driver
;
[Version]
signature = "$Windows NT$"
Provider = %MyDriverInc%
CatalogFile =
; Distribution Media information
;
[SourceDisksNames]
1 = %MyDriverdrv.MediaDesc%
[SourceDisksFiles]
MyDriverdrv.sys = 1
[DestinationDirs]
DefaultDestDir = 12
MyDriver.DriverFiles = 12
[DefaultInstall.NT]
CopyFiles = MyDriver.DriverFiles
[DefaultUninstall.NT]
DelFiles = MyDriver.DriverFiles
[MyDriver.DriverFiles]
MyDriverdrv.sys
[DefaultInstall.NT.Services]
AddService = %ServiceName%, , MyDriverdrv_Service_Inst
[DefaultUninstall.NT.Services]
AddService = %ServiceName%, 0x200
[MyDriverdrv_Service_Inst]
DisplayName = %MyDriverdrv.SvcDesc%
ServiceType = 1; SERVICE_KERNEL_DRIVER
StartType = 3; SERVICE_DEMAND_START
ErrorControl = 1; SERVICE_ERROR_NORMAL
ServiceBinary = %1%\MyDriverdrv.sys
[Strings]
MyDriverInc = "MyDriver, Inc"
ServiceName = "MyDriverdrv"
MyDriverdrv.SvcDesc = "MyDriver Trace Kernel Mode Driver"
MyDriverdrv.MediaDesc = "MyDriver Trace Kernel Mode Driver"
由于INF文件是现在安装驱动程序的官方方式,我没有办法在本地保存驱动程序文件。
谢谢!