Windows via C/C++

Author: Jeffrey Richter & Christophe Nasarre
Publisher: Microsoft Press
Pages: 820
Aimed at: Competent C/C++ Windows programmers
Rating: 4
Pros: If you need a low-level approach this is it
Cons: Low-level approach
Reviewed by: Harry Fairhead

This is a classic and, as it has reached its fifth edition, it's a popular classic. Is it still relevant?


This is a classic and, as it has reached its fifth edition, it's a popular classic. Is it still relevant?

This is a classic and, as it has reached its fifth edition, it's a popular classic. However, things move on and the information contained within isn't quite as important as it used to be. When this book was young, Windows programming was very often a low-level dive into the inner workings of the operating system. It often felt a lot like creating assembly language programs with the difference that you coded a lot of it in C or C++. The big question is, how relevant is this sort of approach today - or has the book mutated into something less low level?

The good or bad news depending on your point of view is that the approach is as low level as it ever was. It most certainly doesn't start off with a "hello world" program or indeed any program of any sort. It assumes that you are a competent C/C++ Windows programmer and know how to create a program. Chapter 1 dives straight into a look at error handling - which, as you will know if you are a candidate for reading this book, isn't straightforward.




Next we move on to working with text and in this case we are not talking about fonts and formatting - but ANSI v Unicode and the problems this causes.

Part I of the book is brought to a close with a careful look at Kernel objects, including a "what are they" and how to share them. Overall I'm not convinced, and wasn't in the earlier editions, that this is a good way to start the book. It may be about advanced topics but there are more important and "bigger" advanced topics that could start the book with more of a direction towards understanding the bigger picture.

Part II is called Getting Work Done and it is essentially a deep look into processes and threading. After an introduction to processes and working with threads Chapter 7 deals with thread priorities and touches on thread affinities. When the book was first written there was no need to consider the possibility that we might have multiple processors or cores - one processor was all we could generally afford.

The next three chapters deal with synchronization, but in more depth than you probably have encountered before. Then we have a chapter on the Windows thread pool - yes Windows has a thread pool - and finally a short chapter on fibers.

Part III is about memory management and thankfully this has become much simpler over the editions of the book. Now the issues are dealing with virtual address space in user and kernel mode. Most applications just let the system get on with managing memory but if you need to control how it all works then this is what you have to read. Chapter 17 deals with memory mapped files and Chapter 18 dives into the heap. A lot of the information you are presented with isn't practical in the sense that you might use it to create a super clever program - you might but it is unlikely - but it is what you need to know when you are trying to find a really obscure bug.

Part IV is about DLLs - and yes DLLs are still important despite the attempts by .NET to get rid of the classic DLL that this book deals with. If anything, DLLs are about to become more important again with the resurrection of COM in WinRT as part of Windows 8. In this case, the book does start off with what you might call a beginner's introduction to DLLs. Then on to advanced techniques including loading a DLL explicitly; thread local storage and finally DLL injection and API hooking. In an ideal world you probably wouldn't need such techniques, but Windows is far from ideal.

The final part of the book, to my mind, covers a completely different sort of topic in that it has as much to do with C/C++ as Windows - structured exception handling. The book rounds out with an appendix on the build environment and it is missing the chapter on windowing and messaging that was in the fourth edition. I can't really see why it was dropped, and I never really understood why it was at the end of the previous editions. For me, windowing and the message pump is basically what makes Windows programming different. Understanding the dispatcher and the message queue is the key to many clever tricks. Its coverage was always relegated to the end of the book and now it is gone.

It is worth saying that the book has been extended to take account of modern trends, such as multi-core and 64-bit processors, but it is still essentially the 4th edition with updates - and the omission of the aforementioned chapter of on windowing.

The big question is - do you need a copy?

If you are asking yourself this question then the answer is probably "no". This is a book that contains more information than you probably require, perhaps ever. It is a low-level look at Windows programming and if this is what you need then this is the book you need.

It is still a classic but I hope that the chapter on windowing and messaging makes it back into the next edition.


Adventures of a Computational Explorer

Author: Stephen Wolfram
Publisher: Wolfram Media
Pages: 432
ISBN: 978-1579550264
Kindle: B07Z6BYVSC
Audience: Fans of  Stephen Wolfram
Rating:  3
Reviewer: Alex Armstrong
A personal account of being a computer geek?

Reliable Source: Lessons from a Life in Software Engineering

Author: James Bonang
Date: January 2022
Pages: 608
Kindle: B09QCBVJ9V
Audience: General interest
Rating: 5
Reviewer: Kay Ewbank

This book combines a fun read with interesting insights into how to write reliable programs.

More Reviews

Last Updated ( Monday, 16 January 2012 )