The Windows Driver Kit (WDK) 11

 

 

 

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

 

Building the Windows device driver - Print device driver sample code: The sample files and folders

 

 

Building the Windows device driver - Print device driver sample code: The SOURCES, MAKEFILE and others

 

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.

 

Building the Windows device driver - Print device driver sample code: The SOURCES file content

 

Building the Windows device driver - Print device driver sample code: The MAKEFILE file content

 

Building the Windows device driver - Print device driver sample code: The DIRS file 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.

 

Building the Windows device driver - Print device driver sample code: Invoking the x86, Win XP build environment

 

 

Run the build –cZ command from RC, UI and Render directories.

 

Building the Windows device driver - Print device driver sample code: Building the RC files

 

Building the Windows device driver - Print device driver sample code: Building the UI files

 

 

Building the Windows device driver - Print device driver sample code: Building the Render files

 

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.

 

Installing the Windows printer device driver steps: Invoking the Add new printer wizard

 

Installing the Windows printer device driver steps: The Add new printer wizard launched with welcome page

 

Installing the Windows printer device driver steps: selecting the printer port

 

 

Installing the Windows printer device driver steps: Selecting the LPT1 printer port

 

Installing the Windows printer device driver steps: Selecting the printer driver file

 

 

Installing the Windows printer device driver steps: choosing the INF file for printer driver

 

Installing the Windows printer device driver steps: The selected printer driver file and path

 

 

Installing the Windows printer device driver steps: The manufacturer and model selection with the message said the driver is not digitally sign by Microsoft

 

 

Installing the Windows printer device driver steps: Setting the printer name and not the default printer

 

 

Installing the Windows printer device driver steps: Not sharing the printer

 

 

Installing the Windows printer device driver steps: No need to print the test page

 

 

Installing the Windows printer device driver steps: Digitally sign message for Windows device driver

 

If there is error stating file cannot be found, point to the appropriate folder.

 

Installing the Windows printer device driver steps: The Add new printer wizard completed successfully

 

 

Installing the Windows printer device driver steps: The installed printer seen through the Printer and Faxes snap-in

 

 

Installing the Windows printer device driver steps: Invoking the printer properties page

 

 

Installing the Windows printer device driver steps: the printer properties page seen as normal or typical icon

 

 

Useful WDK references

 

  1. Advanced Driver Debugging (PPT by Microsoft)
  2. Windows Device Driver Development (PDF – simplified steps)
  3. WDK Build Utility Reference (MSDN)
  4. Windows RootKit

 

 

 

< Windows Driver Kit (WDK) 10 | Windows Driver Kit (WDK) Programming | Win32 Programming | Win32 Network Management APIs >