$ show ayoubfaouzi/windows-internals
This repository is a personal study collection focused on Windows internals, combining condensed book notes (Windows Internals 6th/7th ed., Windows System Programming, .NET IL Assembler) with standalone sample code for Windows kernel drivers and user-mode utilities. The code is not a cohesive application but rather multiple independent Visual Studio projects demonstrating key Windows API patterns: WDM driver skeletons (skeleton, dispatch pass-through, IOCTL handling, keyboard filter, file system filter) and user-mode examples (heap enumeration, singly linked lists, Authenticode signature verification). The material is educational in nature, targeting developers and researchers learning Windows kernel-mode programming and system internals. While the code is functional and well-commented, it relies on the older WDM model and some deprecated API patterns, reflecting a ~2017 vintage. The file system filter driver and keyboard filter driver exhibit non-trivial driver engineering patterns that can serve as reusable templates, though they require the Windows Driver Kit to build. No tests, CI, or deployment configurations exist; the repo is purely a reference and learning resource.
The LLM identified 4 files worth highlighting for reuse:
Implements the core logic for a file system filter driver: attaching to a file system device or volume, detaching, and enumerating file system volumes. The code demonstrates correct use of IoCreateDevice, IoGetDeviceObjectPointer, and direct callback registration (FsFilterNotificationCallback). This module is a self-contained, reusable skeleton for any file system filter driver, providing a clean pattern for volume attachment and detachment that can be adapted to different filtering requirements. It shows deep understanding of the Windows I/O manager and file system driver stack.
A keyboard class filter driver that demonstrates the completion routine pattern and pending I/O management. It uses a custom IRP_MJ_READ completion routine to intercept keystrokes, an IoCompletion routine that decrements a pending I/O count, and a proper unload routine that cancels pending IRPs. This is a reusable template for any lower-level filter driver that needs to monitor or modify data in I/O completion, with clear lock management and IRP cancellation logic.
A self-contained console application that verifies Authenticode signatures on PE files using WinVerifyTrust with the generic VERIFY_ACTION (WINTRUST_ACTION_GENERIC_VERIFY_V2). It demonstrates the correct setup of WINTRUST_DATA, WINTRUST_FILE_INFO, and the local provider GUID. This is a clean, reusable example for any application that needs to validate digital signatures, with proper error handling for catalog and signature-based verification.
Implements Fast I/O dispatch routines for a file system filter driver, providing pass-through handlers for all Fast I/O operations. The module uses the VALID_FAST_IO_DISPATCH_HANDLER macro to safely set up each dispatch entry point. This is a reusable skeleton for any driver that needs to add Fast I/O handling, demonstrating the required boilerplate and the pattern for forwarding operations to the next lower driver in the stack.