Printer sharing, information retrieval, and data storage are among the most frequently used network services. This also means that when something major happens to a print server or file server - lots of people are adversely affected. Issues with Print Servers and the Print Spooler are very common issues for the Performance team. So today, we're going to kick off our series of posts on Printing with an overview of the Windows Printing Architecture and the Print Spooler.
Broken down into basic elements, the Windows printing architecture consists of a print spooler and a set of print drivers. The print spooler is the primary component of the printing interface. Most administrators are familiar with the spooler as an executable file (spoolsv.exe) that manages the printing process. In a default configuration, the spooler is loaded at system startup and continues to run until the operating system is shut down. The print spooler consists of a set of Microsoft and vendor components that perform the following tasks:
- Should a print job be handled locally or across a network?
- Accepting a data stream created by GDI, in conjunction with a printer driver, for output on a particular printer type
- Spooling the data to a file
- Selecting the first available physical printer in a logical printer queue
- Converting a data stream from a spooled format such as EMF to a format that can be sent to the printer hardware (such as PCL)
- Sending a data stream to printer hardware
- Maintaining the registry database for spooler components and printer forms
Below is a simplified view of the print spooler components. When looking at this diagram, if the printer hardware is local to the system, then the "client" and "server" pieces are all on the same machine.
Application - The print application creates a print job by calling Graphics Device Interface (GDI) functions
GDI - GDI includes user-mode and kernel-mode components. The user-mode component, Microsoft Win32 GDI, is used by Win32 applications that require graphics support. The kernel-mode component, the graphics engine, exports services and functions that graphics device drivers can use
Winspool.drv - This is the client interface into the spooler.
Spoolsv.exe - This is the spooler's API server. It is implemented as a service when the OS is started
Spoolss.dll - Spoolss.dll acts as a router, determining which print provider to call based on a printer name or handle supplied with each function call. It then passes the function call to the correct provider.
OK - so let's discuss print providers. The print provider is responsible for several functions, including directing print jobs to local or remote print devices and print queue management operations such as starting, stopping and enumerating print queues. Print providers implement a common set of capabilities that are defined by a set of API functions. These functions are called by spoolss.dll. The diagram below illustrates possible flow paths involving different print providers.