Need to completely remove a device driver in windows 7 - windows

I have an old USB device that is not recognized by windows 7, so I grabbed the device driver for the chip that handles the USB communications. After I modified it I used it to install for the device. Stupid I know, but now I need to get rid of it.
Below is the code from the inf setup file. This does not have the VID and PID that I changed. I need to reverse all the changes it made.
; Installation INF for the Cypress Generic USB Driver for Windows Vista
; Processor support for OS unknown platforms.
;
; (c) Copyright 2010 Cypress Semiconductor Corporation
;
[Version]
Signature="$WINDOWS NT$"
Class=USB
ClassGUID={36FC9E60-C465-11CF-8056-444553540000}
provider=%CYUSB_Provider%
CatalogFile=CYUSB.cat
DriverVer=10/12/2010,3.4.4.000
[SourceDisksNames]
1=%CYUSB_Install%,,,
[SourceDisksFiles]
CYUSB.sys = 1
[DestinationDirs]
CYUSB.Files.Ext = 10,System32\Drivers
[ControlFlags]
ExcludeFromSelect = *
[Manufacturer]
%CYUSB_Provider%=Device,NT,NTx86,NTamd64
;for all platforms
[Device]
;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb, USB\VID_XXXX&PID_XXXX
;for windows 2000 non intel platforms
[Device.NT]
; Cypress FX2LP default ID
%VID_04B4&PID_8613.DeviceDesc%=CyUsb, USB\VID_04B4&PID_8613
; Cypress FX1 default ID
%VID_04B4&PID_6473.DeviceDesc%=CyUsb, USB\VID_04B4&PID_6473
; Cypress Streamer Device. CyStream firmware examples use this VID/PID
%VID_04B4&PID_1003.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1003
; Cypress FX2LP Example Device. DVK firmware examples use this VID/PID
%VID_04B4&PID_1004.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1004
;for x86 platforms
[Device.NTx86]
; Cypress FX2LP default ID
%VID_04B4&PID_8613.DeviceDesc%=CyUsb, USB\VID_04B4&PID_8613
; Cypress FX1 default ID
%VID_04B4&PID_6473.DeviceDesc%=CyUsb, USB\VID_04B4&PID_6473
; Cypress Streamer Device. CyStream firmware examples use this VID/PID
%VID_04B4&PID_1003.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1003
; Cypress FX2LP Example Device. DVK firmware examples use this VID/PID
%VID_04B4&PID_1004.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1004
;for x64 platforms
[Device.NTamd64]
; Cypress FX2LP default ID
%VID_04B4&PID_8613.DeviceDesc%=CyUsb, USB\VID_04B4&PID_8613
; Cypress FX1 default ID
%VID_04B4&PID_6473.DeviceDesc%=CyUsb, USB\VID_04B4&PID_6473
; Cypress Streamer Device. CyStream firmware examples use this VID/PID
%VID_04B4&PID_1003.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1003
; Cypress FX2LP Example Device. DVK firmware examples use this VID/PID
%VID_04B4&PID_1004.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1004
[CYUSB]
CopyFiles=CYUSB.Files.Ext
AddReg=CyUsb.AddReg
[CYUSB.HW]
AddReg=CYUSB.AddReg.Guid
[CYUSB.Services]
Addservice = CYUSB,2,CYUSB.AddService
[CYUSB.NT]
CopyFiles=CYUSB.Files.Ext
AddReg=CyUsb.AddReg
[CYUSB.NT.HW]
AddReg=CYUSB.AddReg.Guid
[CYUSB.NT.Services]
Addservice = CYUSB,2,CYUSB.AddService
[CYUSB.NTx86]
CopyFiles=CYUSB.Files.Ext
AddReg=CyUsb.AddReg
[CYUSB.NTx86.HW]
AddReg=CYUSB.AddReg.Guid
[CYUSB.NTx86.Services]
Addservice = CYUSB,2,CYUSB.AddService
[CYUSB.NTamd64]
CopyFiles=CYUSB.Files.Ext
AddReg=CyUsb.AddReg
[CYUSB.NTamd64.HW]
AddReg=CYUSB.AddReg.Guid
[CYUSB.NTamd64.Services]
Addservice = CYUSB,2,CYUSB.AddService
[CYUSB.AddReg]
; Deprecating - do not use in new apps to identify a CYUSB driver
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,CYUSB.sys
; You may optionally include a check for DriverBase in your application to check for a CYUSB driver
HKR,,DriverBase,,CYUSB.sys
HKR,"Parameters","MaximumTransferSize",0x10001,4096
HKR,"Parameters","DebugLevel",0x10001,2
HKR,,FriendlyName,,%CYUSB_Description%
[CYUSB.AddService]
DisplayName = %CYUSB_Description%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\System32\Drivers\CYUSB.sys
AddReg = CYUSB.AddReg
LoadOrderGroup = Base
[CYUSB.Files.Ext]
CYUSB.sys
[CYUSB.AddReg.Guid]
HKR,,DriverGUID,,%CYUSB.GUID%
[Strings]
CYUSB_Provider = "Cypress"
CYUSB_Company = "Cypress Semiconductor Corporation"
CYUSB_Description = "Cypress Generic USB Driver"
CYUSB_DisplayName = "Cypress USB Generic"
CYUSB_Install = "Cypress CYUSB Driver Installation Disk"
VID_04B4&PID_8613.DeviceDesc="Cypress EZ-USB FX2LP No EEPROM"
VID_04B4&PID_6473.DeviceDesc="Cypress EZ-USB FX1 - No EEPROM"
VID_04B4&PID_1004.DeviceDesc="Cypress EZ-USB Example Device"
VID_04B4&PID_1003.DeviceDesc="Cypress EZ-USB Streamer Device"
VID_XXXX&PID_XXXX.DeviceDesc="Cypress USB Generic Driver (3.4.4.000)"
CYUSB.GUID="{AE18AA60-7F6A-11d4-97DD-00010229B959}"
CYUSB_Unused = "."

Another option (the Microsoft way, without doing random unknown deletings in the registry) is to start CMD as "run as admin" and then list all installed drivers in the Windows 7 driver store via:
pnputil -e
if this caused a longer list you can pipe that into a file via:
pnputil -e > C:\driverexport.txt
If you have found now the driver you need to remove use the following comand:
pnputil.exe -d OemNUMBER.inf
replace NUMBER with your number from your example. You might try to use -F to force the uninstallation. Once a reboot is done the driver should be gone.
This might be also usefull to delete old drivers and get some HD space back.
Source

If you have installed a driver for a device and you want to remove it (and the driver store) just plug in your device. Open Device Manager, right click the device and select Uninstall. There will be a box that says "Remove driver software" - check this box and Uninstall the driver. This should remove it from the driver store and uninstall the device from the registry.
If all drivers for the device has been removed you should be able to plug it in and see that no driver loads for the device. If it does there could be multiple versions in your driver store and you go through the same steps until Windows doesn't recognize the device.
Note that the SYS file will remain in the C:\Windows\System32\drivers directory per policy, but if all devices and installations are removed that use it you can safely delete this driver as well.

While the steps mentioned in answers above may be correct, this is a significantly easier method to do it:
Go to Device Manager or alternatively run the command
devmgmt.msc
Right-click the device you need to uninstall and go to Properties. Select the Details tab and then select INF Name from the drop-down list
Once you have the INF Name type in this command in a command window opened with Admin privileges
pnputil.exe -d INFName.inf
if you face issues try forced deletion
pnputil.exe -f -d INFName.inf

Related

how add INF printer file on RPI3B+ (NTarm) windows iot core

I user RPI3B+ (OS: Windows iot core 10 v10.0.17661.1001) and I want to add a USB Kiosk Printer (Brand: SNBC)
I changed the OS in .inf file to use NTarm according described in this link
and then add .inf file with devcon add command, oem0.inf generate successfully and name of printer shows in connected devices after restart.
but I don't know how to test Printer to know that is enable and working or it is just a USB empty name
I tried application "CustomUsbDeviceAccess" from "Windows-universal-samples-master" . but it shows not device connected
Here is printer INF file:
[Version]
Signature = "$Windows NT$"
Class = USB
ClassGUID = {36FC9E60-C465-11CF-8056-444553540000}
Provider = SNBC
CatalogFile =WinUSBInstallation.cat
DriverVer = 05/10/2011,3.2.0.0
; ========== Manufacturer/Models sections ===========
[Manufacturer]
%ManufacturerName%=Standard,NTarm
[Standard.NTarm]
; POS/KIOSK Printers
%DeviceName% =USB_Install, USB\VID_154F&PID_154F
%DeviceName% =USB_Install, USB\VID_04ce&PID_04ce
%DeviceName% =USB_Install, USB\VID_154F&PID_1001
; ========== Class definition ===========
[ClassInstall32]
AddReg = ClassInstall_AddReg
[ClassInstall_AddReg]
HKR,,,,%ClassName%
HKR,,NoInstallClass,,1
HKR,,IconPath,%REG_MULTI_SZ%,"%systemroot%\system32\setupapi.dll,-20"
HKR,,LowerLogoVersion,,5.2
; =================== Installation ===================
[USB_Install]
Include = winusb.inf
Needs = WINUSB.NT
[USB_Install.Services]
Include =winusb.inf
Needs = WINUSB.NT.Services
[USB_Install.HW]
AddReg=Dev_AddReg
[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{ec55ee47-5758-4378-926b-68ed0aec8170}"
; =================== Strings ===================
[Strings]
Provider="SNBC"
Disk="SNBC Printer Driver"
REG_MULTI_SZ = 0x00010000
ManufacturerName="SNBC"
ClassName="Universal Serial Bus devices"
DeviceName="BT080-R"
Can anybody help me please?
I'm not sure the printer USB driver is supported on Windows IoT Core on Raspberry PI. You may contact the supplier of the peripheral to get the sys/inf files.Does this device support serial communication or Bluetooth? I think you can change to use a printer support serial port/Bluetooth instead of USB.

Create HCK and HLK tests for .inf file drivers required?

We have an hardware device that is used by many customers. We support windows 7 - 10 OS's. With this device, a driver and software is included. The device is is built in China, they eventually use a Cypress USB driver. The .inf file can be found below. The Chinese company then adds some references for their own device inside the .inf file, which magically makes it work, in combination with their software.
My background is not C++ or any hardware related development. Now we have customers receiving code 52 error when the driver is installed and plugged in.
Windows cannot verify the digital signature for this file. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source.
So after a lot of googling it seems like the Chinese company didn't keep up with the latest standards for drivers. Newer devices have secure boot enabled which blocks drivers that are not signed correctly.
Now I am wondering a few things:
Would getting my driver though the various HCK/HLK/WLK test be required? My driver is simply a .inf file, .sys file and a generated .cat file.
Would generating a .cab file with makecab be sufficient?
Is my driver actually a kernel mode driver or user mode driver?
This will of course be tested: but would signing the cat file with an EV certificate solve this problem already?
Getting though the HCK and HLK test seems a lot of work for a simple .inf file. While the guidelines are pretty clear, I am not entirely sure if there are specific things I don't need to do in my scenario.
.inf file code:
; Installation INF for the Cypress Generic USB Driver for Windows 2000
; Processor support for x86 based platforms.
;
; (c) Copyright 2011 Cypress Semiconductor Corporation
;
[Version]
Signature="$WINDOWS NT$"
Class=USB
ClassGUID={36FC9E60-C465-11CF-8056-444553540000}
provider=%CYUSB_Provider%
CatalogFile=CYUSB.cat
DriverVer=10/17/2011,3.4.7.000
[SourceDisksNames]
1=%CYUSB_Install%,,,
[SourceDisksFiles]
CYUSB.sys = 1
[DestinationDirs]
CYUSB.Files.Ext = 10,System32\Drivers
[ControlFlags]
ExcludeFromSelect = *
[Manufacturer]
%CYUSB_Provider%=Device,NT,NTx86,NTamd64
;for all platforms
[Device]
;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb, USB\VID_XXXX&PID_XXXX
;for windows 2000 non intel platforms
[Device.NT]
;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb, USB\VID_XXXX&PID_XXXX
;for x86 platforms
[Device.NTx86]
;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb, USB\VID_XXXX&PID_XXXX
;for x64 platforms
[Device.NTamd64]
;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb, USB\VID_XXXX&PID_XXXX
[CYUSB]
CopyFiles=CYUSB.Files.Ext
AddReg=CyUsb.AddReg
[CYUSB.HW]
AddReg=CYUSB.AddReg.Guid
[CYUSB.Services]
Addservice = CYUSB,2,CYUSB.AddService
[CYUSB.NT]
CopyFiles=CYUSB.Files.Ext
AddReg=CyUsb.AddReg
[CYUSB.NT.HW]
AddReg=CYUSB.AddReg.Guid
[CYUSB.NT.Services]
Addservice = CYUSB,2,CYUSB.AddService
[CYUSB.NTx86]
CopyFiles=CYUSB.Files.Ext
AddReg=CyUsb.AddReg
[CYUSB.NTx86.HW]
AddReg=CYUSB.AddReg.Guid
[CYUSB.NTx86.Services]
Addservice = CYUSB,2,CYUSB.AddService
[CYUSB.NTamd64]
CopyFiles=CYUSB.Files.Ext
AddReg=CyUsb.AddReg
[CYUSB.NTamd64.HW]
AddReg=CYUSB.AddReg.Guid
[CYUSB.NTamd64.Services]
Addservice = CYUSB,2,CYUSB.AddService
[CYUSB.AddReg]
; Deprecating - do not use in new apps to identify a CYUSB driver
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,CYUSB.sys
; You may optionally include a check for DriverBase in your application to check for a CYUSB driver
HKR,,DriverBase,,CYUSB.sys
HKR,"Parameters","MaximumTransferSize",0x10001,4096
HKR,"Parameters","DebugLevel",0x10001,2
HKR,,FriendlyName,,%CYUSB_Description%
[CYUSB.AddService]
DisplayName = %CYUSB_Description%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\System32\Drivers\CYUSB.sys
AddReg = CYUSB.AddReg
LoadOrderGroup = Base
[CYUSB.Files.Ext]
CYUSB.sys
[CYUSB.AddReg.Guid]
HKR,,DriverGUID,,%CYUSB.GUID%
[Strings]
CYUSB_Provider = "Cypress"
CYUSB_Company = "Cypress Semiconductor Corporation"
CYUSB_Description = "Cypress Generic USB Driver"
CYUSB_DisplayName = "Cypress USB Generic"
CYUSB_Install = "Cypress CYUSB Driver Installation Disk"
VID_XXXX&PID_XXXX.DeviceDesc="Cypress USB Generic Driver (3.4.7.000)"
CYUSB.GUID="{AE18AA60-7F6A-11d4-97DD-00010229B959}"
CYUSB_Unused = "."
Microsoft keeps adding hurdles, you might have to sign it in their dev portal now and you need a EV cert. to sign up. There is also a difference between a clean install and a upgrade when it comes to the enforcement of secure boot!
I would recommend that you read/join the OSR mailing list, it has multiple threads dealing with the struggles of Windows 10 & SHA2 signing.
Their blog might also be useful.

Trouble installing custom inf in Windows 10 Professional. Windows overrides it with OEM driver

I have made a signed USB Serial inf file for a custom device and created an installer that successfully installs the driver to Windows 7 (32/64), Windows 8.1 (64) but not Windows 10. This applies to the default installation (right-click, install) directly on the file, using Device Manager and using PNPUTIL. The device driver successfully installs but the OEM usbser driver is used instead. After clicking "Update Driver" and selecting my driver in Device Manager, Windows prompts me with "The best driver software is already installed for your device". If I use Device Manager and choose "Have Disk" I can successfully get around the issue with Windows 10 enforcing their own driver. This doesn't get me any closer to having a successful inf file and installer though.
My process for default installation:
Unplug the device from the USB port
Load a snap shot of freshly-installed Windows 10 Professional
Right click, install on the .inf file
Plug in the device
Look at Device Manager and see that the standard USB Serial Device driver made by Microsoft is used instead of my driver
If I then uninstall it and repeat steps 3-5 it sometimes allows my custom driver to stick.
I've been told that my driver installs on Windows 10 Enterprise, which confuses matters further.
Question: What am I doing wrong?
My inf file:
;************************************************************
; Windows USB CDC ACM Setup File
; Copyright (c) 2000 Microsoft Corporation
; Version v1.1, updated 17 April 2013
[Strings]
DriverPackageDisplayName="Rinstrum USB Serial Drivers"
ManufacturerName="Rinstrum"
ServiceName="USB RS-232 Emulation Driver"
linux.gserial="Rinstrum USB Gadget Serial"
MFGNAME="Rinstrum"
[DefaultInstall]
CopyINF=c500.inf
[Version]
DriverVer=03/02/2017,1.0.0.0
Signature=$Windows NT$
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MFGNAME%
CatalogFile=c500.cat
DriverPackageDisplayName=%DriverPackageDisplayName%
PnpLockdown=1
[Manufacturer]
%MFGNAME%=Models,NTx86,NTamd64,NTarm
[DestinationDirs]
DefaultDestDir=12
FakeModemCopyFileSection=12
[Models.NTx86]
%linux.gserial%=DriverInstall, USB\VID_1FC9&PID_816A, USB\VID_1FC9&PID_816A&MI_00
[Models.NTamd64]
%linux.gserial%=DriverInstall, USB\VID_1FC9&PID_816A, USB\VID_1FC9&PID_816A&MI_00
[Models.NTarm]
%linux.gserial%=DriverInstall, USB\VID_1FC9&PID_816A, USB\VID_1FC9&PID_816A&MI_00
[DriverInstall]
Include=mdmcpq.inf
CopyFiles=FakeModemCopyFileSection
AddReg=DriverAddReg
[DriverAddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.Services]
Include=mdmcpq.inf
AddService=usbser,0x2,DriverService
[DriverService]
DisplayName=%ServiceName%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\usbser.sys
LoadOrderGroup=Base
Update: additional info from setupapi.dev.log
>>> [Device Install (DiInstallDriver) - C:\Users\R&D\Desktop\c500.inf]
>>> Section start 2017/02/03 17:17:58.321
cmd: "C:\Windows\System32\InfDefaultInstall.exe" "C:\Users\R&D\Desktop\c500.inf"
ndv: Flags: 0x00000000
ndv: INF path: C:\Users\R&D\Desktop\c500.inf
inf: {SetupCopyOEMInf: C:\Users\R&D\Desktop\c500.inf} 17:17:58.337
inf: Copy style: 0x00000000 !
inf: Driver package is already in driver store
inf: Driver Store Path: C:\Windows\System32\DriverStore\FileRepository\c500.inf_amd64_4fee793fb11027ac\c500.inf inf: Published Inf Path: C:\Windows\INF\oem4.inf
inf: {SetupCopyOEMInf exit (0x00000000)} 17:17:58.368
<<< Section end 2017/02/03 17:17:58.399
<<< [Exit status: SUCCESS]
Update:
setupapi.dev.log gives the following error when trying to install the device
sig: Success: File is signed in Authenticode(tm) catalog.
sig: Error 0xe0000242: The publisher of an Authenticode(tm) signed catalog has not yet been established as trusted.
Update:
The VBox guest additions installer manages to install my inf file in WIN10. Here is the source:
https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Additions/WINNT/Installer/VBoxDrvInst.cpp#L433
Windows needs to be activated before the user is granted the permission to override the OEM drivers in Windows 10. Activating windows on my test machine solved this issue.
Try setting your DriverVer directive correctly, with today's date and 1.0.0.0. The date is one thing that Windows looks at when deciding what driver to use.

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

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".
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.
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.
Hmm, it seems that the &REV_0000 was not required.

New driver not being utilized

I finally found a guide on for creating drivers, built it and followed this guide https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2016/april/adventures-in-windows-driver-development-part-1/ to install it on the VM, but when I plug in my device it shows up as a serial port, not what I named it as, so It uses the windows driver instead of mine. How can I get it to use mine?
I'm on windows 10 , I followed the guide exactly up until the part where it said to use" devcon.exe install %filepath%echo.inf root\ECHO " to install it, I just right clicked and clicked install instead, would that do it? I did the same for the certificate.
;
; USBDriver1.inf
;
[Version]
Signature="$Windows NT$"
Class=USBDevice
ClassGuid={88BAE032-5A81-49f0-BC3D-A4FF138216D6}
Provider=%ManufacturerName%
CatalogFile=USBDriver1.cat
DriverVer=
[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$
[Standard.NT$ARCH$]
%DeviceName%=MyDevice_Install, USB\VID_2341&PID_8036&MI_00
[SourceDisksFiles]
USBDriver1.dll=1
WudfUpdate_$UMDFCOINSTALLERVERSION$.dll=1
[SourceDisksNames]
1 = %DiskName%
; =================== UMDF Device ==================================
[MyDevice_Install.NT]
CopyFiles=UMDriverCopy
Include=WINUSB.INF ; Import sections from WINUSB.INF
Needs=WINUSB.NT ; Run the CopyFiles & AddReg directives for WinUsb.INF
[MyDevice_Install.NT.hw]
AddReg=USBDriver1_AddReg
[MyDevice_Install.NT.Services]
AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall ; flag 0x2 sets this as the service for the device
AddService=WinUsb,0x000001f8,WinUsb_ServiceInstall ; this service is installed because its a filter.
[MyDevice_Install.NT.CoInstallers]
CopyFiles=CoInstallers_CopyFiles
AddReg=CoInstallers_AddReg
[MyDevice_Install.NT.Wdf]
UmdfDispatcher=WinUsb
UmdfService=USBDriver1,USBDriver1_Install
UmdfServiceOrder=USBDriver1
[USBDriver1_Install]
UmdfLibraryVersion=$UMDFVERSION$
ServiceBinary=%12%\UMDF\USBDriver1.dll
DriverCLSID={5138ba31-5a05-4a39-b1d0-2f7c0dd59d36}
[USBDriver1_AddReg]
; By default, USBDevice class uses iProduct descriptor to name the device in
; Device Manager on Windows 8 and higher.
; Uncomment for this device to use %DeviceName% on Windows 8 and higher:
;HKR,,FriendlyName,,%DeviceName%
HKR,,"LowerFilters",0x00010008,"WinUsb" ; FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND
HKR,,"WinUsbPowerPolicyOwnershipDisabled",0x00010001,1
[WUDFRD_ServiceInstall]
DisplayName = %WudfRdDisplayName%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WUDFRd.sys
[WinUsb_ServiceInstall]
DisplayName = %WinUsb_SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys
[CoInstallers_CopyFiles]
WudfUpdate_$UMDFCOINSTALLERVERSION$.dll
[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010008,"WudfUpdate_$UMDFCOINSTALLERVERSION$.dll"
[DestinationDirs]
UMDriverCopy=12,UMDF ; copy to drivers\umdf
CoInstallers_CopyFiles=11
[UMDriverCopy]
USBDriver1.dll
; =================== Generic ==================================
[Strings]
ManufacturerName="<Your manufacturer name>" ;TODO: Replace with your manufacturer name
ClassName="Universal Serial Bus devices"
DiskName = "USBDriver1 Installation Disk"
WudfRdDisplayName="Windows Driver Foundation - User-mode Driver Framework Reflector"
WinUsb_SvcDesc="WinUSB Driver"
DeviceName="USBDriver1 Device"
REG_MULTI_SZ = 0x00010000
Your INF file seem not to contain information about hardware IDs (compatible IDs may also be an option I suppose) of a device your driver supports. You need to specify them, so the system may use them when searching for a driver matching IDs of a newly connected device.
Look into WDK samples for an idea how to do it (the RAMDisk sample may help you if you are writting a function driver). For example, one of my kernel drivers gets loaded for devices reporting RemBus\RAMDisk and RemBus\FileDisk hardware IDs. I instructed Windows to do so by the following part of my INF file:
[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$
[Standard.NT$ARCH$]
%ramdisk.DeviceDesc%=remdisk_Device, RemBus\RAMDisk
%filedisk.DeviceDesc%=remdisk_Device, RemBus\FileDisk

Resources