Installing windows with usb driver

Overview of Microsoft-provided USB drivers

This topics in this section describe the class drivers, generic client driver, and the parent composite driver that are provided by Microsoft.

Microsoft-provided USB drivers for controllers and hubs

Microsoft provides these set of drivers:

  • For USB host controllers and hubs. For more information, see USB host-side drivers in Windows. You can develop a custom host controller driver that communicates with the USB host controller extension (UCX) driver. For more information, see Developing Windows drivers for USB host controllers.
  • For handling common function logic for USB devices. For more information, see USB device-side drivers in Windows.
  • For supporting Type-C connectors. For more information, see USB connector manager class extension (UcmCx).

Other Microsoft-provided USB drivers

Microsoft supports USB biometric devices (fingerprint readers) by providing the Windows Biometric Framework. See the Windows Biometric Framework.

Windows Server 2008

Windows Server 2003

Starting in Windows 7, Microsoft has replaced the kernel mode component of the Windows Vista USB driver stack (Wpdusb.sys) for Windows Portable Devices (WPD) with the generic Winusb.sys.

Microsoft provides the Wpdusb.sys driver to manage portable devices that support the Media Transfer Protocol. See WPD Design Guide.

Windows XP with Service Pack 2 (SP2)

Device setup class Microsoft-provided driver and INF Windows support Description
USB Usbccgp.sys is a parent driver for composite devices that supports multiple functions. For more information, see USB Generic Parent Driver (Usbccgp.sys).
Biometric
Media Transfer Protocol Devices Wpdusb.sys (Obsolete) Winusb.sys can be used as the USB device’s function driver instead of implementing a driver. See WinUSB.

Microsoft-provided USB device class drivers

Microsoft provides drivers for several USB device classes approved by USB-IF. These drivers and their installation files are included in Windows. They are available in the \Windows\System32\DriverStore\FileRepository folder.

Adding USB 3.0 Drivers to Windows 7 Install Media

The Windows 7 RTM distribution doesn’t support USB 3.0 out-of-the-box, and you can encounter some problems with the installation of Windows 7 on a computer/laptop having USB 3.0 ports only (most modern devices released after 2015 have only USB3 ports). For example, USB keyboard and mouse may not work in Windows 7 Setup wizard, or the installer may require to load drivers for your CD/DVD drive:

Accordingly, you cannot install Windows 7 (or Windows Server 2008 R2) from a USB drive to a computer on which all peripheral devices are connected via USB 3.0 ports.

To install Windows 7 correctly on some computer models, you can disable USB 3.0 mode in BIOS settings by switching to USB 2.0 compatibility mode (Legacy USB 2.0). In all other cases, you will have to modify Windows 7 install distro and integrate USB 3.0 drivers for your motherboard chipset to the boot and install WIM images.

All the operations of modifying of the Windows 7 ISO image, described below, are performed on a computer running Windows 10.

First of all, find USB 3.0 drivers for your chipset and download them from the vendor website (in our example, it is Intel® USB 3.0 eXtensible Host Controller Driver for Intel® 7 Series/C216 Chipset Family). Create a new directory c:\tmp, and create two subfolders inside it: mount and USB3. Unpack the archive with drivers to the USB3 folder. Inside the USB3 catalog you can create several subfolders with different USB 3.0 drivers for popular chipset models.

Next, you need to update the Windows 7 install image (it may be an ISO file or a ready image copied to the installation USB stick). You’ll need two WIM files to be copied to the c:\tmp directory from the Windows 7 ISO image or the installation disk:

  • sources\boot.wim – WinPE boot image used to install Windows on your device;
  • sources\install.wim – Windows 7 image that will be installed on your computer.

Run a command prompt with the administrator privileges, and use the DISM tool to mount WinPE boot image (boot.wim) and integrate the USB 3.0 drivers into it:

dism /mount-wim /wimfile:c:\tmp\boot.wim /index:2 /mountdir:c:\tmp\mount
dism /image:c:\tmp\mount /add-driver:»c:\tmp\usb3″ /recurse

The following message indicates that the specified USB3 driver was successfully added to the boot.wim image of the Windows 7 installation environment:

Save the changes in the image and unmount the boot.wim file (to avoid DISM errors, make sure that you closed all File Explorer windows and the file managers, which has the c:\tmp\mount directory open):

dism /unmount-wim /mountdir:c:\tmp\mount /commit
dism /cleanup-wim

Similarly, you need to update the operating system installation image in the install.wim file. Here the main difference is that the install.wim image can contain several Windows 7 editions with different indexes. So, you will have to add drivers to that Windows edition you are going to install (or to all available Windows 7 editions in turn).

You can list the available Windows 7 editions in the install.wim image as follows:

dism /Get-WimInfo /WimFile:c:\tmp\install.wim

In our example, there are 4 different Windows editions in the install.wim image. We’ll add the USB 3.0 driver to Windows 7 PROFESSIONAL with the index 3 (this number will be used to address the edition using DISM).

Then add the USB 3.0 drivers to the Windows image like we did it above:

WinUSB (Winusb.sys) Installation

For certain Universal Serial Bus (USB) devices, such as devices that are accessed by only a single application, you can install WinUSB (Winusb.sys) in the device’s kernel-mode stack as the USB device’s function driver instead of implementing a driver.

This topic contains these sections:

Automatic installation of WinUSB without an INF file

As an OEM or independent hardware vendor (IHV), you can build your device so that the Winusb.sys gets installed automatically on WindowsВ 8 and later versions of the operating system. Such a device is called a WinUSB device and does not require you to write a custom INF file that references in-box Winusb.inf.

When you connect a WinUSB device, the system reads device information and loads Winusb.sys automatically.

For more information, see WinUSB Device.

Installing WinUSB by specifying the system-provided device class

When you connect your device, you might notice that Windows loads Winusb.sys automatically (if the IHV has defined the device as a WinUSB Device). Otherwise follow these instructions to load the driver:

  1. Plug in your device to the host system.
  2. Open Device Manager and locate the device.
  3. Select and hold (or right-click) the device and select Update driver software. from the context menu.
  4. In the wizard, select Browse my computer for driver software.
  5. Select Let me pick from a list of device drivers on my computer.
  6. From the list of device classes, select Universal Serial Bus devices.
  7. The wizard displays WinUsb Device. Select it to load the driver.

If Universal Serial Bus devices does not appear in the list of device classes, then you need to install the driver by using a custom INF. The preceding procedure does not add a device interface GUID for an app (UWP app or Windows desktop app) to access the device. You must add the GUID manually by following this procedure.

Load the driver as described in the preceding procedure.

Generate a device interface GUID for your device, by using a tool such as guidgen.exe.

Find the registry key for the device under this key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\

Under the Device Parameters key, add a String registry entry named DeviceInterfaceGUID or a Multi-String entry named DeviceInterfaceGUIDs. Set the value to the GUID you generated in step 2.

Disconnect the device from the system and reconnect it to the same physical port. NoteВ В If you change the physical port then you must repeat steps 1 through 4.

Writing a custom INF for WinUSB installation

As part of the driver package, you provide an .inf file that installs Winusb.sys as the function driver for the USB device.

The following example .inf file shows WinUSB installation for most USB devices with some modifications, such as changing USB_Install in section names to an appropriate DDInstall value. You should also change the version, manufacturer, and model sections as necessary. For example, provide an appropriate manufacture’s name, the name of your signed catalog file, the correct device class, and the vendor identifier (VID) and product identifier (PID) for the device. For info on creating a catalog file, see Creating a Catalog File for Test-Signing a Driver Package.

Also notice that the setup class is set to «USBDevice». Vendors can use the «USBDevice» setup class for devices that do not belong to another class and are not USB host controllers or hubs.

If you are installing WinUSB as the function driver for one of the functions in a USB composite device, you must provide the hardware ID that is associated with the function, in the INF. You can obtain the hardware ID for the function from the properties of the devnode in Device Manager. The hardware ID string format is «USB\VID_vvvv&PID_pppp».

The following INF installs WinUSB as the OSR USB FX2 board’s function driver on a x64-based system.

Starting in Windows 10, version 1709, the Windows Driver Kit provides InfVerif.exe that you can use to test a driver INF file to make sure there are no syntax issues and the INF file is universal. We recommened that you provide a universal INF. For more information, see Using a Universal INF File.

Only include a ClassInstall32 section in a device INF file to install a new custom device setup class. INF files for devices in an installed class, whether a system-supplied device setup class or a custom class, must not include a ClassInstall32 section.

Except for device-specific values and several issues that are noted in the following list, you can use these sections and directives to install WinUSB for any USB device. These list items describe the Includes and Directives in the preceding .inf file.

USB_Install: The Include and Needs directives in the USB_Install section are required for installing WinUSB. You should not modify these directives.

USB_Install.Services: The Include directive in the USB_Install.Services section includes the system-supplied .inf for WinUSB (WinUSB.inf). This .inf file is installed by the WinUSB co-installer if it isn’t already on the target system. The Needs directive specifies the section within WinUSB.inf that contains information required to install Winusb.sys as the device’s function driver. You should not modify these directives. NoteВ В Because WindowsВ XP doesn’t provide WinUSB.inf, the file must either be copied to WindowsВ XP systems by the co-installer, or you should provide a separate decorated section for WindowsВ XP.

USB_Install.HW: This section is the key in the .inf file. It specifies the device interface globally unique identifier (GUID) for your device. The AddReg directive sets the specified interface GUID in a standard registry value. When Winusb.sys is loaded as the device’s function driver, it reads the registry value DeviceInterfaceGUIDs key and uses the specified GUID to represent the device interface. You should replace the GUID in this example with one that you create specifically for your device. If the protocols for the device change, create a new device interface GUID.

NoteВ В User-mode software must call SetupDiGetClassDevs to enumerate the registered device interfaces that are associated with one of the device interface classes specified under the DeviceInterfaceGUIDs key. SetupDiGetClassDevs returns the device handle for the device that the user-mode software must then pass to the WinUsb_Initialize routine to obtain a WinUSB handle for the device interface. For more info about these routines, see How to Access a USB Device by Using WinUSB Functions.

The following INF installs WinUSB as the OSR USB FX2 board’s function driver on a x64-based system. The example shows INF with WDF coinstallers.

USB_Install.CoInstallers: This section, which includes the referenced AddReg and CopyFiles sections, contains data and instructions to install the WinUSB and KMDF co-installers and associate them with the device. Most USB devices can use these sections and directives without modification.

The x86-based and x64-based versions of Windows have separate co-installers.

NoteВ В Each co-installer has free and checked versions. Use the free version to install WinUSB on free builds of Windows, including all retail versions. Use the checked version (with the «_chk» suffix) to install WinUSB on checked builds of Windows.

Each time Winusb.sys loads, it registers a device interface that has the device interface classes that are specified in the registry under the DeviceInterfaceGUIDs key.

NoteВ В If you use the redistributable WinUSB package for WindowsВ XP or Windows ServerВ 2003, make sure that you don’t uninstall WinUSB in your uninstall packages. Other USB devices might be using WinUSB, so its binaries must remain in the shared folder.

How to create a driver package that installs Winusb.sys

To use WinUSB as the device’s function driver, you create a driver package. The driver package must contain these files:

  • WinUSB co-installer (Winusbcoinstaller.dll)
  • KMDF co-installer (WdfcoinstallerXXX.dll)
  • An .inf file that installs Winusb.sys as the device’s function driver. For more information, see Writing an .Inf File for WinUSB Installation.
  • A signed catalog file for the package. This file is required to install WinUSB on x64 versions of Windows starting withВ Vista.

NoteВ В Make sure that the driver package contents meet these requirements:

  • The KMDF and WinUSB co-installer files must be obtained from the same version of the Windows Driver Kit (WDK).
  • The co-installer files must be obtained from the latest version of the WDK, so that the driver supports all the latest Windows releases.
  • The contents of the driver package must be digitally signed with a Winqual release signature. For more info about how to create and test signed catalog files, see Kernel-Mode Code Signing Walkthrough on the Windows Dev Center — Hardware site.

    Create a driver package folder on the machine that the USB device is connected to. For example, c:\UsbDevice.

    Copy the WinUSB co-installer (WinusbcoinstallerX.dll) from the WinDDK\BuildNumber\redist\winusb folder to the driver package folder.

    The WinUSB co-installer (Winusbcoinstaller.dll) installs WinUSB on the target system, if necessary. The WDK includes three versions of the co-installer depending on the system architecture: x86-based, x64-based, and Itanium-based systems. They are all named WinusbcoinstallerX.dll and are located in the appropriate subdirectory in the WinDDK\BuildNumber\redist\winusb folder.

    Copy the KMDF co-installer (WdfcoinstallerXXX.dll) from the WinDDK\BuildNumber\redist\wdf folder to the driver package folder.

    The KMDF co-installer (WdfcoinstallerXXX.dll) installs the correct version of KMDF on the target system, if necessary. The version of WinUSB co-installer must match the KMDF co-installer because KMDF-based client drivers, such as Winusb.sys, require the corresponding version of the KMDF framework to be installed properly on the system. For example, Winusbcoinstaller2.dll requires KMDF version 1.9, which is installed by Wdfcoinstaller01009.dll. The x86 and x64 versions of WdfcoinstallerXXX.dll are included with the WDK under the WinDDK\BuildNumber\redist\wdf folder. The following table shows the WinUSB co-installer and the associated KMDF co-installer to use on the target system.

    Use this table to determine the WinUSB co-installer and the associated KMDF co-installer.

    WinUSB co-installer KMDF library version KMDF co-installer
    Winusbcoinstaller.dll Requires KMDF version 1.5 or later
    Winusbcoinstaller2.dll Requires KMDF version 1.9 or later Wdfcoinstaller01009.dll
    Winusbcoinstaller2.dll Requires KMDF version 1.11 or later WdfCoInstaller01011.dll

    Write an .inf file that installs Winusb.sys as the function driver for the USB device.

    Create a signed catalog file for the package. This file is required to install WinUSB on x64 versions of Windows.

    Attach the USB device to your computer.

    Open Device Manager to install the driver. Follow the instructions on the Update Driver Software wizard and choose manual installation. You will need to provide the location of the driver package folder to complete the installation.

    Читайте также:  Linux local mysql server
Оцените статью