USB Printers - Architecture and Driver Support

Updated: November 2, 2005

This paper describes guidelines and implementation requirements for supporting USB printers under current versions of Microsoft Windows operating systems.

This information applies for the following operating systems:
Microsoft Windows 98
Microsoft Windows Me
Microsoft Windows 2000
Microsoft Windows XP

*
On This Page
Introduction
Introduction
USB Printing OverviewUSB Printing Overview
FAQ for USB Printer Installation
FAQ for USB Printer Installation
ReferencesReferences

Introduction

Windows 2000, Windows XP, and Windows Millennium Edition (Windows Me) supply a general kernel-mode USB print driver, Usbprint.sys, which works with the system-supplied port monitor Usbmon.dll to provide end-to-end connectivity between USB printers and high-level printer drivers. Together these components make up the Microsoft USB printing solution.

Vendors are encouraged to write high-level printer drivers that rely on Usbprint.sys rather than writing their own kernel-mode USB print drivers.

Usbprint.sys greatly simplifies the task of writing a high-level printer driver:

Usbprint.sys handles kernel-mode operations such as power management on behalf of the high-level printer driver.

Usbprint.sys provides an interface very similar to that used by parallel printers, so it is possible for a single printer driver to work correctly on both USB and parallel port, without modification.

Usbprint.sys has been extensively tested with numerous printers, dongles, PCs, and mobile systems on the Windows 2000 and Windows XP operating systems.

For maximum cross-platform compatibility, vendor-supplied printer drivers should not depend on proprietary device-control commands or any parallel port IOCTLs except for IOCTL_PAR_QUERY_DEVICE_ID. A printer driver that follows these guidelines can drive printers over both USB and parallel ports on Windows XP, Windows 2000, and Windows Me.

The Windows DDK describes the procedures for writing a printer driver. If such a driver is correctly implemented as described in the DDK, the driver should "just work," because the printer driver installation mechanisms are the same on all three operating systems, over any bus. See the list of references at the end of this article for more information.

Note: Usbprint.sys and Usbmon.dll work together to simplify the task of writing a vendor-supplied language monitor. If a language monitor uses only the WritePort, ReadPort, and IOCTL_PAR_QUERY_DEVICE_ID interfaces, it will be portable between USB and parallel ports.

Top of pageTop of page

USB Printing Overview

This section presents a high-level overview of the components in the Microsoft USB printing solution.

USB and Parallel Print Architecture

The following figure shows the system-supplied and vendor-supplied components that can be involved in printing over USB and parallel ports on Windows operating systems. The only required vendor-supplied component is the high-level printer driver, which is layered above the spooler. A vendor can optionally supply a language monitor that is layered between the spooler and Usbmon.dll (for USB) or Localmon.dll (for parallel port).

Windows USB and Parallel Port Printing Architecture

usbprint1.GIF
Click to view full-size image.

This figure shows a vendor-supplied kernel-mode USB print driver (labeled IHV-supplied USB Print Driver) layered above the USB driver stack. The USB driver stack consists of Usbhub.sys, Usbd.sys, and other layers underneath.

The Windows 98 operating systems did not include an in-box kernel-mode USB print driver. Because of this, a vendor-supplied USB print driver was originally needed for USB printing. Microsoft has since made the USB printing solution available to vendors for redistribution with their printer drivers for the Windows 98 operating systems. The Microsoft USB printing solution for Windows 98 and Windows 98 Second Edition will be available for redistribution until June 30, 2007, after which time online self-help support may no longer be available, as described in the Product Lifecycle Policies.

USB Printer Installation Process

USB printer installation varies slightly over Windows 2000, Windows XP, and Windows Me. This section describes the process and identifies the differences between the three operating systems in context of the general USB printer installation process.

1.

The user connects a USB printer to the PC for the first time.
All systems. The system displays the "Found New Hardware" message.

2.

The kernel-mode USB print driver is loaded.
Windows 2000 and Windows XP. On the basis of the USB printer's compatible ID (USB class code Class_07), Setup locates the system-supplied Usbprint.inf and uses it to load Usbprint.sys silently.
Windows Me. The Add New Hardware Wizard appears. The user points to a vendor-supplied Usbprint.inf or requests Windows Me to perform an automatic search for this file. After Usbprint.inf is found, Setup uses it to install Usbprint.sys.

3.

The high-level printer driver is installed.
Windows 2000 and Windows XP. Setup searches Ntprint.inf for a matching Hardware ID. If Setup finds an exact match in Ntprint.inf, it installs the corresponding in-box driver. The user sees a message that lists the vendor name and model of the printer.
Otherwise, the Add New Hardware Wizard pops up again. The user points to the location of the vendor-supplied INF and driver files, which Setup uses to install the vendor-supplied printer driver.
Windows Me. Setup searches for a matching in-box printer driver and, if it finds one, loads that driver without prompting the user.
Otherwise, the Add New Hardware Wizard pops up again. The user points to the location of the vendor-supplied INF and driver files, which Setup uses to install the vendor-supplied printer driver.

4.

The printer is fully installed and ready to print.

For information about how Windows ranks drivers and selects the preferred driver to load, see "How Setup Selects Drivers" in the Windows DDK. This information also applies to Windows Me. Driver selection is also influenced by digital signature and the driver signing policy in effect on the system. For more information, see Driver Signing for Windows.

INFs for Installing USB Printing on Windows

This section presents two sample INF files that can be modified to install USB printing on Windows Me, Windows 2000, and Windows XP.

Vendors should supply unique Plug and Play hardware IDs (VID/PID) for their devices and modify these examples as needed before including them in their driver packages.

Vendors should also prepare INFs using the following steps before submitting their driver packages to WHQL for testing and digital signature:

Use the ChkINF utility to validate the INFs for digital signature.
ChkINF is provided in the Windows DDK.

Check Signability on the Windows Quality Online Services web site when you submit your package.

Submit the INFs with your driver package to WHQL for testing and digital signature. For information, see Driver Signing for Windows.

Installing USB Printing on Windows Me
To ensure that USB printers continue to work correctly when a user upgrades from Windows 98 to Windows Me, Usbprint.sys is supplied with the system but not automatically installed on Windows Me. This avoids any possible incompatibility with a vendor-supplied kernel-mode USB print driver that might already be installed on the user's system.

[Version]
Signature="$CHICAGO$"
Class=USB
ClassGUID={36FC9E60-C465-11CF-8056-444553540000}
Provider=%MSFT%
DriverVer=12/17/1999
CatalogFile=print9x.cat

[ControlFlags]
ExcludeFromSelect = *
[DestinationDirs]
DefaultDestDir = 10,system32\drivers

[Manufacturer]
%MSFT%=Microsoft

[Microsoft]
%USBPRINT.DeviceDesc% = USBPRINT_Inst,USB\Class_07

[USBPRINT_Inst]
Copyfiles = USBPRINT_Inst.CopyFiles
AddReg    = USBPRINT.AddReg
DriverVer=12/17/1999

[USBPRINT_Inst.CopyFiles]
usbprint.sys,,,16

[USBPRINT.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,"usbprint.sys"

[SourceDisksNames]
1 = "USB disk",,,""

[SourceDisksFiles]
usbprint.sys = 1

[strings]
MSFT                  = "Microsoft"
USBPRINT.DeviceDesc   = "USB Printing Support"
			

Writing a Cross-Platform INF to Install USB Printer Drivers
This section describes a cross-platform printer INF that will install a USB or parallel printer driver on Windows XP, Windows 2000, and Windows Me.

[Version]
Signature="$CHICAGO$"
Class=Printer
ClassGUID={4d36e979-e325-11ce-bfc1-08002be10318}
Provider=%MS%
CatalogFile=print9x.cat
CatalogFile.NT=print2K.cat
DriverVer=1/1/2000,4.00.2450.1

; The Manufacturer section lists all of the manufacturers that we will
; display in the Dialog box

[Manufacturer]
"Man"

[HP]
"Man printer" = DRIVER.DRV,MYPNPID

[DRIVER.DRV.NT]
; Windows 2000 printer driver installation entries go here.

[DRIVER.DRV]
; Windows 95/Me printer driver installation entries go here.

CopyFiles=@DRIVER.DRV,UNICLR,FINSTALL,MONITOR
DataSection=UNI_DATA
PortMonitor=usbmon.dll,usbmon.dll
DriverVer=1/1/2000,4.00.2450.1

[MONITOR]
usbmon.dll,,,16

[FINSTALL]
finstall.dll
finstall.hlp

[UNICLR]
iconlib.dll
dmcolor.dll
unidrv.dll
unidrv.hlp

[UNI_DATA]
HelpFile=unidrv.hlp
DefaultDataType=EMF

[DestinationDirs.NT]
DefaultDestDir=66000

[DestinationDirs]
DefaultDestDir=11

[SourceDisksNames.NT]
2  =  %Disk2%,,,""

[SourceDisksNames]
1  =  %Disk1%,,,""

[SourceDisksFiles.NT]
;NT files to install

[SourceDisksFiles]
printer.inf  = 1
finstall.dll = 1
finstall.hlp = 1
driver.drv   = 1
iconlib.dll  = 1
dmcolor.dll  = 1
unidrv.dll   = 1
unidrv.hlp   = 1
usbmon.dll   = 1

[Strings]
MS="Microsoft"
Disk1="Win9x disk"
Disk2="Win2000 disk"
			
Top of pageTop of page

FAQ for USB Printer Installation

This section provides answers to some frequently asked questions about USB printer drivers and installation.

If a user has installed my company's USB printing solution for Windows Me, what happens if a second vendor's solution tries to load?
The two solutions might conflict with each other and interfere with successful printing on the user's system. The operating system cannot detect or prevent such conflicts. Vendors should use the Microsoft USB printing solution.

If my company supplies a top-to-bottom USB printing solution for Windows 98 and Windows Me, what is the mechanism for upgrading to the Microsoft USB printing solution?
Uninstall the vendor-supplied solution completely and then install the Microsoft solution. It should be possible for an update program to uninstall the vendor-supplied solution transparently, without requiring specific action on the part of the user. Update instructions should also be included in case the user wants to perform these steps manually.

If my company wants to use the Microsoft USB printing solution for Windows 98, what is the process for redistributing those files?
If you are requesting permission to redistribute these files for the first time, complete the USBPrint Redistribution License Request [43 KB]. If you are renewing your redistribution agreement, complete the USBPrint Redistribution License Renewal Request [46 KB]. Send your completed form to usbprdst@microsoft.com where your application will be reviewed for approval.

My company has a USB printing solution for Windows Me. What is the process for driver signing? What files do I have to submit?
Submit your entire driver package to WHQL for testing and digital signature, as described at Driver Signing for Windows.

If my company uses the Microsoft USB printing solution for Windows 98, what happens when the user upgrades to Windows Me, Windows 2000, or Windows XP?
The printer will continue to work. The user will not have to reinstall the printer after upgrading.

If my company wants to redistribute Usbprint.sys and Usbmon.dll for Windows 98, do I have to resubmit the driver package to WHQL for testing?
A driver's digital signature is generated from the complete set of binaries in the driver package. Adding files or changing existing files in the package invalidates the existing digital signature. The driver package must be resubmitted to WHQL for testing and a new digital signature.

Top of pageTop of page

References

Using Windows USB Print Drivers

Install USB printer drivers on Windows operating systems as described in this article.

On Windows 2000 and Windows Me, use the Microsoft-provided USB print driver, Usbprint.sys.

On Windows Me, provide a Usbprint.inf file in your driver package to load Usbprint.sys.

Write a cross-platform INF to install your printer driver on Windows 2000/Windows XP and Windows Me.

Use the COPYFLG_NO_OVERWRITE flag (hexadecimal 10) in INF [CopyFiles] sections to prevent Setup from copying a file that already exists on the system.

Use the following tools to prepare INFs for submission to WHQL.

For information about ChkINF, see the Windows DDK

For information on Signability, see the Windows Quality Online Services web site.

Submit your driver package to WHQL for testing and digital signature.

For information, see Driver Signing for Windows.

Read about Windows printer drivers and USB printing.

Windows Driver Development Kit, available at: Windows Driver Development Kit: Overview

"Printer Drivers and Spooler Components"

"Printing Plug and Play for Windows 2000"

Universal Serial Bus Device Class Definition for Printing Devices, available at: http://www.usb.org/developers/devclass_docs/, see under "Printer Class." This link leaves the Microsoft.com site

Resources

Redistribution Information Contact
USBREDIST@microsoft.com

Product Lifecycle Information
http://www.microsoft.com/lifecycle/

Driver Signing for Windows


Top of pageTop of page