|  | UltraDefrag Handbook 7.1.3

Development

If you'd like to know what's under the hood you are welcome to inspect UltraDefrag sources. 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.

# Compilation

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:

- MinGW or Microsoft Windows SDK v7.1
- wxWidgets 3.1.0, Doxygen 1.8.4, NSIS 3.xx, 7-zip
- Lua 5.1.x, UPX (extract them somewhere on your %path%)
- Transifex client (put it to \src\tools\transifex folder)
- GNU gettext (optional; for translations management)
- MiKTeX (optional; for pdf documentation; use basic installer)

To configure build environment follow these steps:

:: edit the main configuration file
edit setvars.cmd
:: patch the installed software
patch-tools
:: 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
build
:: show all available options
build --help
:: use predefined build actions
build-menu

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

start-CodeBlocks

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

## Defragmentation

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

## Threads

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