5

Is it legal to keep windows driver sys file outside of system32\drivers directory? It appears that it is possible if a driver is "manually" configured via CreateService with absolute path to the driver.sys file. However when INF file is used to install the driver using InstallHinfSection and driver location is other than system32\drivers InstallHinfSection will fail with error

!!! dvi: Driver Path not in system root !!! inf: {Install Inf Section [DefaultInstall.NT.Services] exit(0xe0000217)} !!! inf: Error 0xe0000217: A service installation section in this INF is invalid. inf: {Install Inf Section [DefaultInstall.NT]} when ServiceBinary = %1%\MyDriverdrv.sys ; current dir and succeeds when ServiceBinary = %12%\MyDriverdrv.sys ; system32\drivers

INf file:

;
; 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"

since INF files is an official way to install drivers now, I don't see a way to keep driver file locally.

Thanks!

user1289452
  • 109
  • 1
  • 4

0 Answers0