The NT Insider

Throw the Book at 'Em: Books on Writing NT and WDM Device Drivers
(By: The NT Insider, Vol 6, Issue 6, Nov-Dec 1999 | Published: 15-Dec-99| Modified: 31-Oct-02)


Before we start the reviews, let?s get the issue of ?objectivity? out of the way. An author of one of the WDM books has written that he doesn?t comment on other author?s books because you, the reader, would have reason to doubt his objectivity. I don?t really know what that means, to be perfectly honest. Yeah, the partners here at OSR have written a book about NT device driver development.  But, if you think we?d dis some other book to increase sales of a book that OSR wrote, you must not understand how much driver book authors make from book sales!

Nobody writes a book about device driver development to make money. Even if you?re a highly sought-after author, who managed to make an usually good deal with a publisher (like us!), you?ll never make enough money from writing one of these books to come close to paying for the time it takes to write it. So, given that the money at stake is truly a pittance, what possible interest would we at OSR have in giving you bad advice? Sure, we have opinions (about almost everything).   And, naturally, we wrote our book to fit in with what we think a device driver book should be.  But I don?t think that means we have the obligation to park our opinions at the door when it comes to any other book that?s written in the field.

What Makes a Good Drive Book

Much more interesting than the issue of objectivity is the question of what a ?good? driver book should contain.  The questions here typically involve four issues:

1.   What prerequisite experience or knowledge does the book assume the reader has.

2.   How much depth does the book delve into about the subject? In the field of drivers, the potential level of detail is almost infinite. What types of drivers does the book describe? In what level of detail?

3.   How much architectural and explanatory information does the book contain? That is, how much does the book explain how the driver environment works and what the function calls one makes mean.

4.   How much practical, pragmatic, and information does the book contain? Does the author share personal experiences about pragmatic driver development issues?

Each author, along with their editors, will make a decision on each of these issues. It comes down to personal preference and what sort of book the author wants to write. 

Regardless of the type of information the book contains, we think that the one absolute for a technical book is it must be accurate. While every book ever published will have some errors, hideous technical errors in important details are unacceptable. At best this points out a flawed review process. At worst, it points out an author who is out of their depth.

As we review each of the available books, we?ll comment with regard to each of the items in this section.

The Reviews

OK, let?s get on with the reviews. Reviews are presented in order of date of the book?s publication.

The Windows NT Device Driver Book by Art Baker (Prentice Hall)

This book had the honor of being the first book published about NT drivers. The book predates Windows 2000 and WDM, and thus addresses Windows NT V4.0 only. We understand that Mr. Baker is currently working on a revision. The NT Insider published a detailed review of this book back in April 1997 shortly after it was first published. We reviewed the book?s first printing.

The book assumes very little prerequisite knowledge from the reader. It describes a small subset of possible Windows NT drivers, and delves into very little detail. Writers of drivers for PCI devices will be left stumped as to how to find their devices on the PCI bus, for example. Basic PIO and DMA details are provided. For the drivers the book does target, a pragmatic ?this is how you do it? approach is taken. Little architectural background about Windows NT is provided.

Probably the most difficult thing about this book is its technical accuracy. The book?s first printing suffered from numerous, serious, technical errors (some of which we detailed in our April 1997 review). We don?t know if these errors have been corrected in subsequent printings.

Windows NT Device Driver Development by Peter Viscarola and W. Anthony Mason (Macmillan)

This book was released in October 1998. The book is in its second printing. This is the book by OSR?s two consulting partners. Naturally, that reason alone makes this our favorite book. However, this book addresses Windows NT V4.0 only, with just a passing (and mostly useless) reference to Windows 2000 and WDM. The authors are working on an update for Windows 2000.

This book assumes the reader has a solid knowledge of operating systems software and computer engineering concepts. The book provides a great deal of architectural detail about how Windows NT and its I/O subsystem work, and how device drivers work within the Windows NT operating system. It explains how drivers work, and thus how they should be written, using a ?top down? approach.

In addition to the architectural information, the book also contains lots of practical advice based on the author?s experience developing real NT drivers. However, the book rarely tells the reader ?you should do it this way.? Rather, it tends to explain what needs to be done and what tools are available to the driver developer to accomplish the goal within the operating systems? general framework. 

The book goes into considerable depth about different types of device drivers, including details about both Busmaster DMA and programmed I/O. Common buffer DMA is also discussed. The book is highly accurate, technically.

Developing Windows NT Device Drivers by Edward N. Dekker and Joseph M. Newcomer (Addison)

This is a wide-ranging book that seemingly seeks to be the encyclopedia of driver writing. We reviewed the first printing of the book. This is a book about Windows NT V4.0, with about 150 pages of information describing Windows 2000. The Windows 2000 information is based on the Beta 1 DDK and, though still surprisingly accurate, can?t really be relied on.

The book assumes very little prerequisite knowledge on the part of its readers, starting with a historical overview of computers and device drivers. The background in the book focuses most strongly on devices and their associated hardware, and presents lots of hardware details. In terms of the business of actually writing drivers, the book takes a mostly pragmatic approach. It covers drivers for both DMA and programmed I/O (PIO) type devices. Many of the details of driver development are described with interspersed code samples that demonstrate the technique being described. People who like code samples will love this. People who tend to read the prose in a book and skip the code samples will probably be less thrilled.

The book is accurate, technically, especially when dealing with the practical details of how a device driver is written. The authors share lots of their experiences and offer pragmatic advice about driver development. As a knowledgeable device driver reading this book, it was clear to me that the authors know how to write NT device drivers, and know how to explain the issues involved to their readers. When the book strays into the territory of describing underlying Windows NT architecture, it sometimes gets the details wrong. When this is the case, however, it is almost never of any consequence.

We can?t leave the description of this book without commenting on its unusual style. The book is just chock-a-block with asides, footnotes, personal observations, and opinions. In the footnotes or other marginalia we are given the author?s experiences with or opinions on everything from a particular model of Toshiba Deskstation (it only has IRQ 11 for use in expansion) to the development of robotic arms (unfortunately, the engineers only intended the ?disable? command to be used when the arm was docked? but failed to tell users) to the use of shredded paper as mulch for growing corn (seems to work) to bit stuffing in NRZI encoding (which can, ah, waste bandwidth). Reading the book is a bit like hanging out with the authors and listening to a collection of their stories. Whether or not you, as a reader, find this amusing or annoying will be a personal decision.

Writing Windows WDM Device Drivers by Chris Cant (R&D Books)

This book, released in 1999, addresses only the WDM environment (though there is a single chapter that briefly describes the native NT driver model). We reviewed the first printing.

If you?re looking for good, solid, device or hardware information (a la Dekker and Newcomer) or detailed operating system architecture information (a la Viscarola and Mason) you?ll have to look elsewhere. We think this book might be more appropriately titled ?Introduction to WDM for Win32 Programmers.? It assumes very little prerequisite knowledge and goes into very little detail ? even less than the Baker book. DMA gets two pages, in Appendix C. MDLs never get explained anywhere. In general, the text is imprecise in its use of language and sometimes inaccurate (MDLs, the reader is told are ?only available to hardware that can perform Direct Memory Access?).

If you?re a Win32 programmer, or a technology manager, looking to understand the basics of the world of drivers, this book might work for you. On the other hand, if you need to know how to write a device driver for a real device, it won?t be necessary for you to add this book to your bookshelf.

Programming the Microsoft Windows Driver Model by Walter Oney (Microsoft Press)

This book was recently released. We reviewed the first printing. The book deals strictly with WDM driver development and as such, it provides a clear and pragmatic discussion of how WDM drivers are structured and built. It assumes the reader starts with a solid knowledge of operating system software, approximately on a par with that assumed by the Viscarola and Mason book. While the book does have plenty of statements that include the phrase ?Microsoft recommends? (the book?s subtitle is, after all, ?the official guide to the Microsoft Windows Driver Model?) these rarely get in the way of the material.

The book focuses very sharply on WDM driver issues, delving of particularly interesting places. The book goes into considerable detail, for example, describing NT?s I/O completion logic and why it?s necessary to call IoMarkIrpPending(?). However, the book does not pretend to provide a comprehensive background in Win9x or Windows 2000 operating systems architecture, internals, or the I/O subsystem.

The book covers a reasonably wide-range of device types and architectures including both PIO and Busmaster DMA. ?New model? DMA (in which the driver calls the GetScatterGatherList(?) and PutScatterGatherList(?) functions from the DMA operations vector) on Windows 2000 is also described. PnP, power management, and WMI are well described. There is even a helpful chapter on creating .INF files. Each chapter ends with Win98 compatibility notes. 

The book is clearly written and the information it provides appears to be technically very accurate. In our read-through of the book for this review, we couldn?t find a single significant technical error.


So, what books of these do we think you should own? Buy the Oney book for the scoop on WDM. Buy the Dekker/Newcomer book for the introduction to device drivers and the interesting device hardware information. Buy the Viscarola/Mason book (cuz they?re the ones who pay for The NT Insider to get printed and mailed and) for the wealth of NT operating system architecture and I/O subsystem architecture information it provides. We think if you own all three of these books, you?ll have a pretty complete picture of how to write Windows 2000 drivers. 

This article was printed from OSR Online

Copyright 2017 OSR Open Systems Resources, Inc.