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

0

UPDATE: Thanks to the answer below I managed to get this to work on Windows 7. I have since realized that Windows 10 installs but overrides my driver with the OEM USB Serial driver. Please see: Trouble installing custom inf in Windows 10 Professional. Windows overrides it with OEM driver

-

I attempted to make an Inf file that installs a usb-serial device using the standard windows usb-serial driver. This file successfully installs the driver on Windows 8.1 and Windows 10 but fails in Windows 7 32bit and Windows 7 64 bit. I attempted to right-click install the driver from the desktop (default install). The first time I attempted this I was presented with the error "The inf file you suggested does not support this method of installation". I added the defaultInstall sections to the inf file. After I did this the error disappeared but the system could not find usbser.sys. "The file 'usbser.sys' on windows cd is needed."

What do I need to add to the inf file below in order to make this successfully install from Windows 7?

Current inf file:

;************************************************************
; 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"

If I then use the command RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 c500.inf on the command line I'm prompted with the error "Installation failed".

windows
usb
driver
cat
inf
asked on Stack Overflow Jan 30, 2017 by Luke Allison • edited May 23, 2017 by Community

2 Answers

0

I've made plenty of usbser.sys-based drivers that work on Windows 7. Here is an example: https://github.com/pololu/p-star-examples/blob/master/drivers/p-star-serial.inf

I think you don't need to have your "DriverCopyFiles.nt" section and the references to it. Look at the driver I linked to above which shows how to refer to a "FakeModemCopyFileSection" instead.

Also, one thing that looks fishy about yours is that you chose to make "usbser" by a string in the "Strings" section. I really don't see the point of that and the whitespace near for the definition of that string is messed up. You can just write "usbser" in the places where it is used.

answered on Stack Overflow Jan 31, 2017 by David Grayson
0

This in addition to David Grayson's answer. I used his example at https://github.com/pololu/p-star-examples/blob/master/drivers/p-star-serial.inf as basis for my inf files.

Make sure that whatever identification information you specify in the .inf file matches exactly what is shown as the Hardware Ids in Device Manager. For instance, I had some &MI_00 or &MI_01 stuff in the Hardware Ids once and that made Windows to not match the device.

Hardware Ids in Device Manager

Hmm, it seems that the &REV_0000 was not required.

answered on Stack Overflow Nov 6, 2018 by PkP

User contributions licensed under CC BY-SA 3.0