首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法安装驱动程序

无法安装驱动程序
EN

Stack Overflow用户
提问于 2022-01-07 09:48:12
回答 1查看 386关注 0票数 0

我使用这个纹身(https://learn.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/writing-a-very-small-kmdf--driver)构建了一个简单的驱动程序。我试图安装我的驱动程序,但是当我运行devcon工具时,我得到了:

代码语言:javascript
运行
复制
Device node created. Install is complete when drivers are installed...
Updating drivers for Root/MyFiestDriver from C:\Users\WDKRemoteUser\Downloads\drive-download-20220107T092709Z-001\MyFiestDriver.inf.
devcon.exe failed.

我检查了日志并获得了以下错误消息:

代码语言:javascript
运行
复制
     [Device Install (UpdateDriverForPlugAndPlayDevices) - Root/MyFirstDriver]
>>>  Section start 2022/01/07 12:36:43.703
      cmd: devcon.exe  install MyFirstDriver.inf Root/MyFirstDriver
     ndv: INF path: C:\Users\WDKRemoteUser\Downloads\drive-download-20220107T092709Z-001\MyFirstDriver.inf
     ndv: Install flags: 0x00000001
     ndv: {Update Device Driver - ROOT\SYSTEM\0001}
     ndv:      Search options: 0x00000080
     ndv:      Searching single INF 'C:\Users\WDKRemoteUser\Downloads\drive-download-20220107T092709Z-001\MyFirstDriver.inf'
     dvi:      {Build Driver List} 12:36:43.734
     dvi:           Searching for hardware ID(s):
     dvi:                root/MyFirstDriver
     dvi:      {Build Driver List - exit(0x00000000)} 12:36:43.812
!    ndv:      No matching drivers found in single INF
     dvi:      {DIF_SELECTBESTCOMPATDRV} 12:36:43.828
     dvi:           Default installer: Enter 12:36:43.828
     dvi:                {Select Best Driver}
!    dvi:                     Selecting driver failed(0xe0000228)
     dvi:                {Select Best Driver - exit(0xe0000228)}
!    dvi:           Default installer: failed
!    dvi:           Error 0xe0000228: There are no compatible drivers for this device.
     dvi:      {DIF_SELECTBESTCOMPATDRV - exit(0xe0000228)} 12:36:43.859
!    ndv:      Unable to select best compatible driver. Error = 0xe0000228
     ndv:      No drivers found for device.
     ndv: {Update Device Driver - exit(00000103)}
!    ndv: No better matching drivers found for device 'ROOT\SYSTEM\0001'.
     ndv: {Update Device Driver - ROOT\SYSTEM\0002}
     ndv:      Search options: 0x00000080
     ndv:      Searching single INF 'C:\Users\WDKRemoteUser\Downloads\drive-download-20220107T092709Z-001\MyFirstDriver.inf'
     dvi:      {Build Driver List} 12:36:43.906
     dvi:           Searching for hardware ID(s):
     dvi:                root/MyFirstDriver
     dvi:      {Build Driver List - exit(0x00000000)} 12:36:43.922
!    ndv:      No matching drivers found in single INF
     dvi:      {DIF_SELECTBESTCOMPATDRV} 12:36:43.922
     dvi:           Default installer: Enter 12:36:43.937
     dvi:                {Select Best Driver}
!    dvi:                     Selecting driver failed(0xe0000228)
     dvi:                {Select Best Driver - exit(0xe0000228)}
!    dvi:           Default installer: failed
!    dvi:           Error 0xe0000228: There are no compatible drivers for this device.
     dvi:      {DIF_SELECTBESTCOMPATDRV - exit(0xe0000228)} 12:36:43.953
!    ndv:      Unable to select best compatible driver. Error = 0xe0000228
     ndv:      No drivers found for device.
     ndv: {Update Device Driver - exit(00000103)}
!    ndv: No better matching drivers found for device 'ROOT\SYSTEM\0002'.
!    ndv: No devices were updated.
<<<  Section end 2022/01/07 12:36:44.062
<<<  [Exit status: FAILURE(0x00000103)]

我使用为我生成的inf文件visual studio,无论如何也找不到来修复这个问题。

我使用的inf文件如下所示:

代码语言:javascript
运行
复制
    ;
; MyFirstDriver.inf
;

[Version]
Signature="$WINDOWS NT$"
Class=System ; TODO: specify appropriate Class
ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318} ; TODO: specify appropriate ClassGuid
Provider=%ManufacturerName%
CatalogFile=MyFirstDriver.cat
DriverVer = 01/04/2022,10.43.33.93
PnpLockdown=1

[DestinationDirs]
DefaultDestDir = 12
MyFirstDriver_Device_CoInstaller_CopyFiles = 11

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

[SourceDisksFiles]
MyFirstDriver.sys  = 1,,
;


;*****************************************
; Install Section
;*****************************************

[Manufacturer]
%ManufacturerName%=Standard,NTamd64

[Standard.NTamd64]
%MyFirstDriver.DeviceDesc%=MyFirstDriver_Device, Root\MyFirstDriver ; TODO: edit hw-id

[MyFirstDriver_Device.NT]
CopyFiles=Drivers_Dir

[Drivers_Dir]
MyFirstDriver.sys

;-------------- Service installation
[MyFirstDriver_Device.NT.Services]
AddService = MyFirstDriver,%SPSVCINST_ASSOCSERVICE%, MyFirstDriver_Service_Inst

; -------------- MyFirstDriver driver install sections
[MyFirstDriver_Service_Inst]
DisplayName    = %MyFirstDriver.SVCDESC%
ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
StartType      = 3               ; SERVICE_DEMAND_START
ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
ServiceBinary  = %12%\MyFirstDriver.sys

;
;--- MyFirstDriver_Device Coinstaller installation ------
;

[MyFirstDriver_Device.NT.CoInstallers]
AddReg=MyFirstDriver_Device_CoInstaller_AddReg
CopyFiles=MyFirstDriver_Device_CoInstaller_CopyFiles

[MyFirstDriver_Device_CoInstaller_AddReg]
;


[MyFirstDriver_Device_CoInstaller_CopyFiles]
;


[MyFirstDriver_Device.NT.Wdf]
KmdfService =  MyFirstDriver, MyFirstDriver_wdfsect
[MyFirstDriver_wdfsect]
KmdfLibraryVersion = 1.15

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName="<Your manufacturer name>" ;TODO: Replace with your manufacturer name
DiskName = "MyFirstDriver Installation Disk"
MyFirstDriver.DeviceDesc = "MyFirstDriver Device"
MyFirstDriver.SVCDESC = "MyFirstDriver Service"
EN

Stack Overflow用户

发布于 2022-02-17 18:59:35

我也有过同样的问题。在您的示例中,您将"root/MyFirstDriver“传递给devcon,但是您已经将inx/inf文件中的id定义为类似但不相同的字符串"root\MyFirstDriver”。我猜这就是为什么你的devcon命令失败了。

在我的例子中,字符串是相同的,但是我仍然得到了“在单个INF中没有找到匹配的驱动程序”错误。最后,我发现我正在使用的调试Win32驱动程序不起作用。将示例项目切换到x64发行版build,为我解决了这个问题。

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70619385

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档