|Last modified: 4 August 1997.|
The Windows NT Device Driver Book
"A Guide for Programmers"
by Art Baker, 1997, Prentice Hall ISBN 0-13-184474-1
522 pages and 1 floppy disk of source code
There was only one book in the computer book shop list which seemed to deal with NT device drivers. Taking the plunge, I was happy to find that The Windows NT Device Driver Book was aimed at programmers and, being recent, covered NT 4.0.
If you need to write a NT driver, you will need Microsoft's NT Device Driver Kit from the MSDN Professional subscription. Although the kit has lots of source code and full documentation, its presentation leaves something to be desired.
Writing NT device drivers does take a bit of homework, so there's nothing like a good book to help you through it.
The Windows NT Device Driver Book takes things in the right order. It advises you to learn about your hardware electronics and architecture first before plunging into the necessary gruesome NT detail.
Taking a big gulp, you have to learn about the basics of kernel-mode I/O processing and all the data structures you will have to contend with. Slowly a parallel port driver takes shape. First it just loads and unloads itself. Then it picks up information about hardware that NT has already detected, and allocates it as necessary. Driver I/O dispatch routines are written, and then finally you do some interrupt-based data transfers.
Time-outs and timer-based drivers are covered, and the use of DMA. Device error logging and system threads are then explained. Higher-level drivers are described briefly.
Misplaced at the end of the book, Art Baker has very useful chapters on building, installing and testing drivers. If you want to understand those NT "blue screens of death" then look no further as a useful appendix gives bugcheck codes and their likely explanations. There are clear explanations of the development process, including details of tools and techniques which are not necessarily obvious to the new driver writer.
The author seems to be familiar with many different types of hardware and driver. Most of the examples are based on using the parallel port. Several techniques for these transfers are given. However he also has code examples for the serial port.
On the down side, the first working example was supposed to send a line of text out my parallel port to a printer. This interrupt driven driver did not seem to work; I did not get round to finding out why.
The book should have described how to fit into the NT driver structure. For example, if writing a driver to access the parallel port, you should really fit into the NT driver hierarchy. Ie, your driver should use the existing NT "parport" arbitrator driver to gain access to a parallel port while you need it. His example drivers simply grab the parallel port for the entire NT session.
That said, the book more than lived up to its early promise. It worked well as a tutorial and a reference. I therefore recommend it heartily to anyone considering writing their own NT device driver.