If you'd like to know what's under the hood you are welcome to inspect UltraDefrag 7 sources which are licensed under GPL. They are outdated but still good for educational purposes. You can either use an online svn browser or download sources from SourceForge. Alternatively you can setup an SVN client (for instance TortoiseSVN) and check sources out from their base address.

Essential parts of UltraDefrag are written in four programming languages:

UltraDefrag core libraries are written in pure C for compatibility with Windows boot environment where only primitive ntdll interfaces are available. Both graphical and command line tools are written in C++ on top of wxWidgets library which helps to keep things simple. For configuration purposes and reports generation the program uses the Lua scripting language. UltraDefrag installers are written in NSIS.


First of all, to build the program download and unpack its sources somewhere. Make sure the path doesn't contain spaces (GNU make doesn't like them). Then install the following software:

To configure build environment follow these steps:

:: edit the main configuration file
edit setvars.cmd
:: patch the installed software
:: build wxWidgets using all the compilers
:: involved in development
wxbuild --use-mingw
wxbuild --use-winsdk

To build UltraDefrag use the following commands:

:: build the program using defaults
:: show all available options
build --help
:: use predefined build actions

If you need an IDE for development install Code::Blocks as well. To launch it in correct environment type:


If you'd like to know how the build process works inspect .cmd files - they contain the complete information.

Web resources

Follow these links to understand better UltraDefrag design and internals.

Batch scripting

Hidden features of Windows batch files
Windows command line syntax
Rob van der Woude's scripting pages

Binary trees

The Art of Computer Programming

Boot time interface

Windows native API reference
Windows x86 system call table


Inside Windows NT disk defragmenting
Improvements in Windows 7
Improvements in Windows XP
Defragmenting Files (Windows)
Master File Table (Windows)

File systems

NTFS on-disk structure

Graphical interface

Design apps for the Windows desktop
Writing High-DPI Win32 Applications

Software design

The Art of Unix Programming
GNU coding standards
Information for maintainers of GNU software


Writing reentrant and threadsafe code
A short guide to mastering thread-safety