最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

installation - Installing windows driver to program files using inf, without hitting SystemRoot? - Stack Overflow

programmeradmin0浏览0评论

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论