This is an unofficial source code repo for Jeffrey Richter and Christophe Nasarre's Windows via C/C++ 5th edition. No representation is made that the source code belongs to me, it's simply reproduced here for convenience (so you don't need to dig up the physical media of the book) and remains the copyright of Jeffrey Richter and Christophe Nasarre.
You'll need Visual Studio 2022 with the Desktop development with C++ workload installed. Some samples use MFC, so you'll need to install the C++ MFC for latest v143 build tools (x86 & x64) Visual Studio component to build them (MFC is not installed by default in newer versions of Visual Studio). You should then be able to open any of the VS solution files and build them. It may be possible to open the VS solution files using older (but still modern) versions of Visual Studio, but I've not tested this.
The source code has been updated to use VS 2022 (any edition), retargeted to the latest Windows SDK, and to fix a compilation error. The original untouched VS files that came with the book's CD can be found in earlier commits. Older but still modern versions of VS may still be able to open the solution files, but I've not tested this.
All samples still function (as of the time of this writing), but some samples may generate deprecation and security warnings upon compilation, and I recommend you heed those warnings if you intend to use any code in production. Remember this is decades old Win32 code -- depending on what you're trying to do, more modern approaches such as the C++ standard library, C++/WinRT, wxWidgets, Boost, or POCO C++ may be more appropriate.
When using any Win32 code from this repo in production, don't simply copy-paste code; consult the book to understand the code and also review the Windows API Index for relevant and updated API usage notes. It's important to note that this book was written pre-Windows 10 (which, alongside Windows 11, changed a lot about Windows), so while it's still an invaluable resource to learn from, some parts of it may no longer reflect Windows' actual internal functionality.
JobLab
: On Windows 8 and above, the sample terminates early due to the initialIsProcessInJob()
check detecting the process is in a job. This check can be disabled on Windows 8 and above, as the rules around processes and jobs were changed starting in Windows 8. See my comment and this issue for further information.