You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

内核驱动创建失败求助:设备驱动未安装,INF文件疑有误

Fix: "The device driver is not installed on any device" Error for Your Kernel Driver

Got it, let's figure out why you're hitting this error. The root cause is your INF file is missing critical configuration that tells Windows which device your driver should attach to—even if you didn't modify it, the template you used is incomplete for a functional driver installation.

What's Wrong with Your Current INF?

Looking at your INF, the [Standard.NT$ARCH$] section is empty. This section is supposed to map a hardware ID to your driver's installation instructions. Without it, Windows has no idea which device to install your driver on, hence the error message.

Your driver code is actually fine—it's just the INF that's not wired up correctly.

Step-by-Step Fix for the INF File

Here's the updated, complete INF that will work with your test driver (we'll set it up as a virtual "root" device since this is a basic test driver):

; hellodriver.inf 
[Version] 
Signature="$WINDOWS NT$" 
Class=System 
ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318} 
Provider=%ManufacturerName% 
DriverVer=01/01/2024,1.0.0.0 ; Add a valid date/version (required for signed drivers)
CatalogFile=hellodriver.cat 
PnpLockDown=1 

[DestinationDirs] 
DefaultDestDir = 12 ; System32\drivers folder

[SourceDisksNames] 
1 = %DiskName%,,,"" 

[SourceDisksFiles] 
hellodriver.sys = 1 ; Map your sys file to the source disk

[Manufacturer] 
%ManufacturerName%=Standard,NT$ARCH$ 

; Add hardware ID mapping here
[Standard.NT$ARCH$]
%MyDeviceName%=MyDriver_Install, Root\HelloDriver ; Virtual root device hardware ID

; Installation section
[MyDriver_Install]
CopyFiles=DriverCopyFiles

; Service registration section
[MyDriver_Install.Services]
AddService=HelloDriver,0x00000002,DriverService_Install ; 0x2 means start service after install

; File copy instructions
[DriverCopyFiles]
hellodriver.sys

; Service configuration
[DriverService_Install]
DisplayName=%MyDeviceName%
ServiceType=1                  ; SERVICE_KERNEL_DRIVER
StartType=3                    ; SERVICE_DEMAND_START (start manually via sc start)
ErrorControl=1                 ; SERVICE_ERROR_NORMAL
ServiceBinary=%12%\hellodriver.sys

[Strings] 
ManufacturerName="Your Test Manufacturer" ; Replace with your actual name
MyDeviceName="Hello Test Kernel Driver"
DiskName="hellodriver Source Disk"

Key Changes Made:

  • Added a hardware ID (Root\HelloDriver) in [Standard.NT$ARCH$] to create a virtual device for your driver
  • Added installation, service registration, and file copy sections to tell Windows how to deploy your driver
  • Added a valid DriverVer (required for proper driver installation, especially if you plan to sign it later)
  • Mapped your hellodriver.sys file in [SourceDisksFiles] so Windows knows where to find it

How to Install the Fixed Driver

  1. Compile your driver code to get hellodriver.sys
  2. Place hellodriver.sys and the updated INF in the same folder
  3. Use devcon (Windows Device Console) to install it:
    devcon install hellodriver.inf Root\HelloDriver
    
    Alternatively, you can install it manually via Device Manager:
    • Open Device Manager → Action → Add legacy hardware
    • Follow the wizard to select your INF file

Once installed, you can start the driver with:

sc start HelloDriver

And check debug output with DebugView or WinDbg.

内容的提问来源于stack exchange,提问作者asfasf asdgasg

火山引擎 最新活动