为什么Devcon能正确安装驱动,而右键安装却不起作用

Why does Devcon install a driver correctly while right-click install does not work

我已经为虚拟 HID 设备创建了一个驱动程序(.inf、.cat 和 .sys 文件),我可以使用

在命令行上成功安装它
    devcon.exe /r install .\VirtualU2FToken.inf root\VirtualU2FToken

之后虚拟设备出现在设备管理器中。但是,当我右击inf文件并选择'Install'时,Windows声称已成功安装驱动程序但设备却没有出现。

所以我的问题是:右键(好像叫DefaultInfInstall.exe)和devcon.exe安装驱动有什么区别?我需要做什么 右击工作?

我的 inf 文件如下:

;
; VirtualU2FToken.inf
;

[Version]
Signature="$WINDOWS NT$"
Class=HIDClass ; TODO: edit Class
ClassGuid={745a17a0-74d3-11d0-b6fe-00a0c90f57da} ; TODO: edit ClassGuid
Provider=%ManufacturerName%
DriverPackageType=ClassFilter
CatalogFile=VirtualU2FToken.cat
DriverVer= ; TODO: set DriverVer in stampinf property pages

[DestinationDirs]
DefaultDestDir = 12
VirtualU2FToken_Device_CoInstaller_CopyFiles = 11

; ================= Class section =====================

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

[SourceDisksFiles]
VirtualU2FToken.sys  = 1,,
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames

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

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

[Standard.NT$ARCH$]
%VirtualU2FToken.DeviceDesc%=VirtualU2FToken_Device, Root\VirtualU2FToken ; TODO: edit hw-id

[VirtualU2FToken_Device.NT]
CopyFiles=Drivers_Dir

[VirtualU2FToken_Device.NT.HW]
AddReg = VirtualU2FToken_Device.NT.AddReg

[VirtualU2FToken_Device.NT.AddReg]
HKR,,"LowerFilters",0x00010000,"vhf"

[Drivers_Dir]
VirtualU2FToken.sys

;-------------- Service installation
[VirtualU2FToken_Device.NT.Services]
AddService = VirtualU2FToken,%SPSVCINST_ASSOCSERVICE%, VirtualU2FToken_Service_Inst

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

;
;--- VirtualU2FToken_Device Coinstaller installation ------
;

[VirtualU2FToken_Device.NT.CoInstallers]
AddReg=VirtualU2FToken_Device_CoInstaller_AddReg
CopyFiles=VirtualU2FToken_Device_CoInstaller_CopyFiles

[VirtualU2FToken_Device_CoInstaller_AddReg]
HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"

[VirtualU2FToken_Device_CoInstaller_CopyFiles]
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll

[VirtualU2FToken_Device.NT.Wdf]
KmdfService =  VirtualU2FToken, VirtualU2FToken_wdfsect

[VirtualU2FToken_wdfsect]
KmdfLibraryVersion = $KMDFVERSION$

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName="Nexus Group A.B." ;TODO: Replace with your manufacturer name
ClassName="HIDClass" ; TODO: edit ClassName
DiskName = "VirtualU2FToken Installation Disk"
VirtualU2FToken.DeviceDesc = "VirtualU2FToken Device"
VirtualU2FToken.SVCDESC = "VirtualU2FToken Service"

这是因为您正在使用 Root 枚举器 (Root\VirtualU2FToken) 当您使用 Devcon 安装时,它会创建名为 Root\VirtualU2FToken

的设备节点

当您使用设备管理器安装(或 pnputil)时,它不会创建新的设备节点,它只是将驱动程序安装到驱动程序存储