The original Windows printer-driver interface required that a driver developer code, test, and debug the 24 required driver functions. This was a time-consuming task that required a thorough understanding of Windows, the Windows graphics-device interface (GDI), the printer hardware, and the printer command set. Developers continue to use this interface to develop Windows printer drivers for pen plotters, daisy-wheel printers, Adobe PostScriptÒ printers, and printers that use printer-control languages which are similar to PostScript.
The new Windows printer-driver interface provides two dynamic-link libraries: UNIDRV.DLL and DMCOLOR.DLL which contain the 24 required functions. (The functions in DMCOLOR.DLL support color printers). By providing these functions, a driver developer no longer needs a thorough understanding of Windows and GDI in order to develop a printer driver. Using the new interface, a developer who understands the hardware and command set for a printer can develop a driver with comparatively little effort. In addition to providing the two dynamic-link libraries, Microsoft also provides the source code for a minidriver. A minidriver is an executable file that forwards calls from the Windows GDI to UNIDRV.DLL. In addition to forwarding GDI calls, the minidriver maintains a collection of data structures which are referred to as the printer's data table. A data table contains data such as the printer's resolution, color capabilities, metrics for device fonts, and so on. A data table also contains the strings which correspond to various printer commands. Using the new Windows application, UniTool (UNITOOL.EXE), a driver developer initializes the structure members in a printer's data table.
It is possible and sometimes necessary for a developer to create a second type of minidriver which contains data and private code. A developer must provide private code whenever the Universal Printer Driver does not provide functionality required by a printer. For example, UNIDRV.DLL expects the pins on a 9-pin dot-matrix printer to be ordered such that the topmost addressable pin corresponds to bit-seven in a byte of graphics data and the bottommost addressable pin corresponds to bit-zero. However, some printers (such as the older Okidata dot-matrix printers) reverse this ordering. The only solution to this and similar problems is to provide developers with the ability to supply private callback functions which perform device-specific operations. A callback function is a developer-supplied function which executes in addition to or in place of one of the Microsoft-supplied Universal Printer Driver functions. For a complete description of the various callback functions, see Appendix A, “Minidriver Callback Functions.”