I'm creating a minifilter driver on Windows 10 and trying to install it via an INF file. I don't want to place the .sys file under \Windows\System32\drivers; I specifically need it in C:\Program Files (x86)\SomeFolder. However, during the INF-based installation (using pnputil /add-driver /install), Windows keeps assigning the service ImagePath to something like:
That path doesn't exist in kernel mode, because \SystemRoot translates to C:\Windows. As a result, the driver fails to install or start with error code 0xC000003A (The system cannot find the path specified).
For example, here’s a simplified version of my INF:
Signature = "$Windows NT$"
Class = "ActivityMonitor"
ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2}
Provider = %ProviderName%
DriverVer = 08/01/2025,1.0.0.0
[DestinationDirs]
MyDriverFiles = 24, "Program Files (x86)\SomeFolder"
[DefaultInstall.NTamd64]
CopyInf = MyDriver.inf
; CopyFiles = MyDriverFiles
[DefaultInstall.NTamd64.Services]
AddService = %ServiceName%,,MyDriver.Service
[MyDriver.Service]
ServiceType = 2 ; SERVICE_FILE_SYSTEM_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %24%\Program Files (x86)\SomeFolder\MyDriver.sys
; etc...
[Strings]
ProviderName = "MyCompany"
ServiceName = "MyDriver"
Registry ends up with: ImagePath = \SystemRoot\Program Files (x86)\SomeFolder\MyDriver.sys
Is there a way to install a minifilter driver so that it loads from C:\Program Files (x86) without Windows forcing the path under \SystemRoot?
In the past I used to manually assign the path by my installer to the registry like ??\C:, but 24H2 lately has introduces stricter rules, which removes the registry.