Microsvuln / windows-via-c-cpp

Unofficial source code repo for Jeffrey Richter and Christophe Nasarre's Windows via C/C++ 5th edition.

Home Page:https://www.microsoftpressstore.com/store/windows-via-c-c-plus-plus-9780735639218

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows via C/C++ 5th edition source code

Introduction

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.

Building

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.

Changes

The source code has been updated to use VS 2022 Community 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.

Considerations

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 C++/WinRT, wxWidgets, Boost, or POCO C++ may be more appropriate.

When using any Win32 code from this repo in production, always consult the Windows API Index for relevant and updated API usage notes. Remember that this book was written pre-Windows 10 (which changed a lot about Windows), so some parts of it may no longer reflect Windows' actual internal functionality.

Considerations for specific samples

  • JobLab: On Windows 8 and above, the sample terminates early due to the initial IsProcessInJob() 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.

Additional resources

About

Unofficial source code repo for Jeffrey Richter and Christophe Nasarre's Windows via C/C++ 5th edition.

https://www.microsoftpressstore.com/store/windows-via-c-c-plus-plus-9780735639218

License:MIT License


Languages

Language:C++ 93.1%Language:C 6.8%Language:Batchfile 0.1%