This appendix explains the public interface to the GENERIC.SYS support library that most of the sample drivers in this book use. I need to explain a few things about GENERIC first.
I built GENERIC for the simple reason that I kept needing to change the Plug and Play (PnP) and power support for my sample drivers while I was writing this book. I'll probably have to change that support after this book is published, too. Rather than try to change over 20 sample drivers each time I learned some new fact about PnP and power management, I decided to build GENERIC and let it handle all the IRP_MJ_PNP and IRP_MJ_POWER requests that came my way.
I kept WDMWIZ.AWX (the subject of the next appendix) and GENERIC in synchrony. That is, if you build a driver using WDMWIZ, you'll end with the same functionality whether or not you elect to use GENERIC. If you decide to use GENERIC, your driver will call GENERIC to handle some of the more complicated things that WDM drivers do. If you decide not to use it, your driver will include all that code.
I designed GENERIC to be redistributed as part of WDM driver packages, but only under a royalty-free license agreement that will protect end users from inconsistency. Please consult the sample program license agreement for more details about this.
Finally, I used Microsoft's AUTODUCK tool to automatically generate documentation for the functions GENERIC exports. AUTODUCK takes specially formatted comments in source code and turns them into documentation. If you remember to update the comments, you can keep your documentation up-to-date fairly painlessly. You'll find the documentation in the GENERIC directory on the companion disc under the name GENERIC.RTF. I could lie and tell you we put it there for your convenience or so that I could change it up until the last minute—which I did!—but the truth is that we printed the covers before we knew exactly how many pages were in the book, and there turned out to be too many. So much for any illusions you may have treasured about the intellectual purity of the publishing process.