Print Devices: Generic Text-Only Driver Sample
The sample codes for various Windows device drivers can be found under the Windows Driver Kit installation if the sample code module has been selected during the WDK installation. Those Windows driver sample source codes can be found under the SRC subfolder:
C:\WinDDK\7600.16385.0\src
The online version can be found at Windows Driver Code Sample. Another one is WDK 8.1 and Other WDK Samples. In this exercise we will try building a sample generic text-only printing driver. The Generic Text-Only Driver (TTY) sample demonstrates how to implement a print driver that is Unidrv-based, generic, and text-only. The TTY driver is a generic, text-only driver. It prints only text, and it prints the text in the native font of the print device, regardless of any formatting in the original document. The TTY driver sample uses the same source files as in the in-box driver, which means you can expect the same output as the in-box generic text-only driver when you build and install this sample. The following Figures show the SOURCES, MAKEFILE and dirs files content.
To create a version with verbose debug output, add WPP_DEBUG to the compile defines in the sources file. To build the samples, run build -cZ from each directory (RC, UI, and Render). The DLLs are placed in the appropriate platform directory (that is, i386). Open the Windows XP Check Build Environment.
Run the build –cZ command from RC, UI and Render directories.
After building the samples, you can install the samples by using the Add Printer wizard. Select the local printer, click Have Disk, and point to the directory that contains the tty.inf file (this file already provided for us and may need some modification, for example the path of some of the file. We do nothing in this case). Microsoft Windows 2000 and later drivers do not need to be copied to the local directory that contains tty.inf. The following Figures show the steps on how to install the printer driver as we do for Windows.
If there is error stating file cannot be found, point to the appropriate folder.
Useful WDK references