Windows System Programming, Edition 4

Publication Date: February, 2010

Published by Addison-Wesley Professional. Part of the Addison-Wesley Microsoft Technology Series series

Dowload the Examples file (Beta 1 version)

At last, Edition 4 is nearly complete! It's taken longer than expected, but the results have been worth the effort. There are many improvements, but I've also been able to retain the basic approach and style of Editions 1-3. I hope you enjoy it and will look forward to hearing from readers.

John Hart, January 18, 2010

About Edition 4

Here is the link to the informIT Windows System Programming, Rough Cuts, 4th Edition page

Edition 4 is a significant update of Edition 3 (2004) and its predecessors. I've reworked all the examples, added new examples, added lots of new material, and corrected misleading and (at times) incorrect statements. Here's a summary from the preface:

Changes in Edition 4

Edition 1, titled Win32 System Programming, was published in 1997 and was updated with Edition 2 (2000) and Edition 3 (2004). Much has changed, and much has stayed the same since these previous editions, and Windows has been part of ongoing, rapid progress in computing technology. The outstanding factors to me that explain the Edition 4 changes are the following:

This fourth edition presents extensive new material along with updates and reorganization to keep up with recent progress and:

I've also taken care to make program appearance be much more uniform than in previous editions. For example, I've consistently used the "camel notation" for variable names (this is one of many possible conventions; I found the camel notation to be convenient, and sticking to some convention is better than none at all). I believe that changes of this nature will simplify code understanding.

One more point: The technical reviewers did an incredible job. They suggested numerous improvements of all sorts. It took a lot of work to address all the suggestions, but the effort was definitely worthwhile and will add value for readers at all levels. The reviewers names and a full acknowledgement are in the book's preface.

From the Back Cover

Here is the book's back cover copy, which explains a bit more, but in the third person:

Windows System Programming, Fourth Edition, now contains extensive new coverage of 64-bit programming, parallelism, multicore systems, and many other crucial topics. Johnson Hart’s robust code examples have been updated and streamlined throughout. They have been debugged and tested in both 32-bit and 64-bit versions, on single and multiprocessor systems, and under Windows 7, Vista, Server 2008, and Windows XP. To clarify program operation, sample programs are now illustrated with dozens of screen shots.

Hart systematically covers Windows externals at the API level, presenting practical coverage of all the services Windows programmers need, and emphasizing how Windows functions actually behave and interact in real-world applications. Hart begins with features used in single-process applications and gradually progresses to more sophisticated functions and multithreaded environments. Topics covered include file systems, memory management, exceptions, processes, threads, synchronization, interprocess communication, Windows services, and security.

New coverage in this edition includes:

Windows Versions: Vista, 7, Server 2008, Server 2003, and Windows XP

Edition 4 assumes that you are using or targeting a "current" Windows version, and the book freely exploits new Windows features. In particular, Windows Vista and later Windows versions (Server 2008 and Windows 7) support useful new API features and also provide improved performance in some cases. These three versions use Windows NT kernel version 6, or "NT6" for simplicity (Microsoft does not use the term "NT6", but it's a convenient term).

Nonetheless, Windows XP and Server 2003, and even Server 2000 (based on Windows NT kernel version 5, or "NT5"), will be around for some time, and Vista adoption has been slow (Windows 7 may have a higher adoption rate). Therefore, nearly all programs will operate under NT5. Exmaple programs that depend upon NT6 will issue an error message if you run them on an NT5 system. However, there are workarounds in some cases.

The NT6 advantages are most significant for multithreaded programs (impacting Chapters 9, 10, and 14). Thus, NT6 provides:

Futthermore, NT6 asynchronous I/O performance is much better than on NT5. You do not need to make any code changes to realize this performance improvement.

From the point of view of the Windows API, NT6 provides numerous advantages. I say this fully realizing that many users, for very good reasons, will stick with Windows XP for some time. Furthermore, if you are developing applications for a wide audience, you will need to assure that the applications run correctly, if not optimally, on NT5 systems.

The Examples, Visual Studio, and Open Source Tools

The Examples file, which you can download from this site, contains complete programs for all the examples in the book. Numerous adddtional examples, generally mentioned in the book, illustrate addtional points or exploare alternative methods to solve problems.

All the examples are provided as Visual Studio solutions, in both Visual Studio 2008 and Visual Studio 2005 format. The projects convert easily to Visual Studio 2010 (Beta 2) form. However, I'll add the new solutions after the VS 2010 planned for April 2010.

Some Edition 3 readers have reported success using open source development tools, such as gcc and g++ in the Gnu Compiler Collection (http://gcc.gnu.org/). Readers interested in these tools can look at the MinGW open source pro ject (www.mingw.org),

The examples have been tested, and performance comparisons performed, on all current Windows versions, in both 32-bit and 64-bit form where appropriate.