Inf 文件仅在 Windows 7 中找不到 usbser.sys

Inf file can't find usbser.sys in Windows 7 only

更新: 感谢下面的回答,我设法让它在 Windows 7 上运行。从那以后我意识到 Windows 10 次安装但是使用 OEM USB 串行驱动程序覆盖我的驱动程序。请参阅:

-

我试图制作一个 Inf 文件,使用标准 windows USB 串行驱动程序安装 USB 串行设备。此文件在 Windows 8.1 和 Windows 10 上成功安装驱动程序,但在 Windows 7 32 位和 Windows 7 64 位上失败。我试图右键单击从桌面安装驱动程序(默认安装)。我第一次尝试此操作时收到错误 "The inf file you suggested does not support this method of installation"。我将 defaultInstall 部分添加到 inf 文件中。在我这样做之后,错误消失了,但系统找不到 usbser.sys。 "The file 'usbser.sys' on windows cd is needed."

为了从 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,系统会提示错误 "Installation failed".

我制作了很多 usbser.sys-based 可以在 Windows 7 上运行的驱动程序。这是一个示例:https://github.com/pololu/p-star-examples/blob/master/drivers/p-star-serial.inf

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

此外,您的问题看起来很可疑,因为您选择在 "Strings" 部分中使用字符串制作 "usbser"。我真的不明白这一点,并且该字符串定义附近的空白被弄乱了。在需要的地方直接写"usbser"就可以了

这是对 David Grayson 回答的补充。我在 https://github.com/pololu/p-star-examples/blob/master/drivers/p-star-serial.inf 中使用他的示例作为我的 inf 文件的基础。

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

嗯,似乎不需要 &REV_0000。