$ show pbatard/rufus
Rufus is a Windows-native GUI application for creating bootable USB drives and formatting removable media. In production it is a single binary that drives raw disk I/O through Win32/NT APIs, parses ISO/WIM/VHD/FFU images, decompresses archives in many formats, formats to FAT/FAT32/NTFS/UDF/exFAT/ReFS/ext2/3/4, and writes MBR/PBR/bootloaders such as Syslinux and GRUB. It also implements Windows-specific features such as UEFI Secure Boot revocation updates, Windows To Go support, VSS snapshots, and dark-mode UI. Architecturally it is a classic monolithic C application: an autotools/VS build produces one executable with a Win32 dialog UI, a resource-based localization system, and tightly coupled modules for device enumeration, formatting, ISO mounting, and WIM application. The repo vendors a large collection of self-contained C libraries (wimlib, libcdio, ext2fs, ms-sys, syslinux libinstaller, bled decompression, getopt) and adapts them for Windows raw-block I/O. Runtime dependencies are Windows system DLLs, Microsoft symbol-server downloads, UEFI revocation databases, and optional network fetches of boot components. The project is actively maintained with CI workflows for VS2026 and MinGW, CodeQL, Coverity, and dependabot. Its code quality is characterized by defensive low-level Windows programming, careful handling of version-dependent APIs, and extensive real-hardware compatibility work. The main risk is technical drift: many vendored dependencies are snapshots of older upstream libraries, and several modules rely on undocumented or semi-documented Windows behavior.
The LLM identified 4 files worth highlighting for reuse:
Implements dark theme support for Win32 applications using undocumented Windows APIs (DwmSetWindowAttribute and UxTheme's SetPreferredAppMode), with careful version detection and redraw handling. Because it is isolated to darkmode.c/darkmode.h and exposes a small API, it can be dropped into other Win32 applications to add Windows 10/11 dark mode without pulling in any Rufus internals.
Entry point to a lightweight decompression suite sourced from BusyBox but adapted for Rufus. It sniffs archive magic and dispatches to streaming decoders for zip, gzip, bzip2, xz/LZMA, zstd and VTSI through a callback-based I/O abstraction (transformer_state_t / unpacker function table). The module is self-contained and demonstrates a clean pattern for adding multi-format decompression to tools that cannot rely on system libraries.
Implements an ext2_io_manager backed by Windows NT native APIs (NtCreateFile, DeviceIoControl) so e2fsprogs can operate directly on raw disks and volumes from Windows. It maps Win32 errors to errno, supports partition-relative offsets, and is isolated behind the ext2fs I/O manager interface. This is a reusable bridge for any project that needs raw block-level filesystem access on Windows without a POSIX layer.
Provides generic entropy-decoding primitives used by the WIM compression codecs: canonical Huffman table construction, bitstream readers, and optimized LZ copy routines. The code is self-contained, documented against algorithm edge cases such as code length overflow, and written to be fast with word-at-a-time copy and table-size compile checks. It can be extracted to accelerate other compression implementations.