Inf文件可以';t仅在Windows 7中找不到usbser.sys

Inf文件可以';t仅在Windows 7中找不到usbser.sys,windows,usb,driver,cat,inf,Windows,Usb,Driver,Cat,Inf,更新:多亏了下面的答案,我才得以在Windows 7上运行。后来我意识到Windows 10安装了,但用OEM USB串行驱动程序覆盖了我的驱动程序。请参阅: - 我试图创建一个Inf文件,该文件使用标准的windows usb串行驱动程序安装usb串行设备。此文件在Windows 8.1和Windows 10上成功安装了驱动程序,但在Windows 7 32位和Windows 7 64位上失败。我试图右键单击从桌面安装驱动程序(默认安装)。我第一次尝试这样做时,出现了一个错误“您建议的inf文

更新:多亏了下面的答案,我才得以在Windows 7上运行。后来我意识到Windows 10安装了,但用OEM USB串行驱动程序覆盖了我的驱动程序。请参阅:

-

我试图创建一个Inf文件,该文件使用标准的windows usb串行驱动程序安装usb串行设备。此文件在Windows 8.1和Windows 10上成功安装了驱动程序,但在Windows 7 32位和Windows 7 64位上失败。我试图右键单击从桌面安装驱动程序(默认安装)。我第一次尝试这样做时,出现了一个错误“您建议的inf文件不支持这种安装方法”。我将defaultInstall部分添加到inf文件中。执行此操作后,错误消失,但系统无法找到usbser.sys。“需要windows cd上的文件‘usbser.sys’。”

要从Windows 7成功安装,我需要向下面的inf文件添加什么

当前inf文件:

;************************************************************
; Windows USB CDC ACM Setup File
; Copyright (c) 2000 Microsoft Corporation

; Version v1.1, updated 17 April 2013

[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MFGNAME%
LayoutFile=layout.inf
CatalogFile=%MFGFILENAME%.cat
DriverVer=11/15/2007,5.1.2600.0

[Manufacturer]
%MFGNAME%=DeviceList, NTamd64

[DestinationDirs]
DefaultDestDir=12

;------------------------------------------------------------------------------
;  Windows 2000/XP/Vista-32bit Sections
;------------------------------------------------------------------------------

;DEFAULT SECTION ADDED
;---------------------------------------------
[DefaultInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg

[DefaultInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
;---------------------------------------------

[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg

[DriverCopyFiles.nt]
usbser.sys,,,0x20

[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"

[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt

[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys

;------------------------------------------------------------------------------
;  Vista-64bit Sections
;------------------------------------------------------------------------------

;DEFAULT SECTION ADDED
;---------------------------------
[DefaultInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg

[DefaultInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
;----------------------------------

[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg

[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20

[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"

[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64

[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys


;------------------------------------------------------------------------------
;  Vendor and Product ID Definitions
;------------------------------------------------------------------------------
; When developing your USB device, the VID and PID used in the PC side
; application program and the firmware on the microcontroller must match.
; Modify the below line to use your VID and PID.  Use the format as shown below.
; Note: One INF file can be used for multiple devices with different VID and PIDs.
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%linux.gserial%=DriverInstall, USB\VID_1FC9&PID_816A, USB\VID_1FC9&PID_816A&MI_00

[DeviceList.NTamd64]
%linux.gserial%=DriverInstall, USB\VID_1FC9&PID_816A, USB\VID_1FC9&PID_816A&MI_00

;------------------------------------------------------------------------------
;  String Definitions
;------------------------------------------------------------------------------
;Modify these strings to customize your device
;------------------------------------------------------------------------------
[Strings]
MFGFILENAME="c500"
DRIVERFILENAME ="usbser"
MFGNAME="Rinstrum Pty Ltd"
INSTDISK="Rinstrum USB Gadget Serial Driver Installer"
linux.gserial="Rinstrum USB Gadget Serial"
SERVICE="USB RS-232 Emulation Driver"

如果然后在命令行上使用命令RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 c500.inf,系统会提示我错误“安装失败”。

我已经制作了大量基于usbser.sys的驱动程序,可在Windows 7上运行。以下是一个例子:

我认为您不需要有“DriverCopyFiles.nt”部分和对它的引用。看看我上面链接的驱动程序,它显示了如何引用“FakeModemCopyFileSection”


另外,有一件事看起来很可疑,那就是您选择了在“字符串”部分使用字符串制作“usbser”。我真的看不出这有什么意义,而且字符串定义附近的空格也搞乱了。你可以在使用usbser的地方写上它。

这是对David Grayson答案的补充。我用他的例子作为我的inf文件的基础

确保在.inf文件中指定的标识信息与设备管理器中显示的硬件ID完全匹配。例如,我曾经在硬件ID中有一些&MI_00或&MI_01的东西,这使得Windows与设备不匹配


嗯,似乎不需要&REV_0000。

谢谢您的回答。我注意到您直接在CopyFiles部分调用了inf文件。这不是坏习惯吗?“注意CopyFiles指令不应引用目录文件或INF文件本身;SetupAPI会自动复制这些文件。”-请再次查看,我没有引用我自己的INF文件的
CopyFiles
指令。对此,我深表歉意。在遵循了您的模板之后,我似乎在Win32方面取得了一些成功。现在来试试其他操作系统。不过这在Windows 10中不起作用。即使在插入USB设备之前运行inf文件,它也只会使用通用USB串行驱动程序,并显示为“USB串行设备”,而不是在inf文件中使用的正确驱动程序名称。知道windows 10缺少什么吗?在安装正确的驱动程序之前,您已经将设备插入了windows 10,因此它使用了windows 10附带的通用驱动程序(usbser.inf)。您的设备完全可用,但如果您想在设备管理器中看到正确的名称,请右键单击它并选择卸载,然后拔下插头并重新安装。