Introduction
What Is This Book About?
This book is about the disassembly of x86 machine code into human-readable assembly, and the decompilationof x86 assembly code into human-readable C or C++ source code. Some topics covered will be common to allcomputer architectures, not just x86-compatible machines.
What Will This Book Cover?
This book is going to look in-depth at the disassembly and decompilation of x86 machine code and assemblycode. We are going to look at the way programs are made using assemblers and compilers, and examine the waythat assembly code is made from C or C++ source code. Using this knowledge, we will try to reverse the process. By examining common structures, such as data and control structures, we can find patterns that enableus to disassemble and decompile programs quickly.
Who Is This Book For?
This book is for readers at the undergraduate level with experience programming in x86 Assembly and C or C++. This book is not designed to teach assembly language programming, C or C++ programming, or compiler/assembler theory.
What Are The Prerequisites?
The reader should have a thorough understanding of x86 Assembly, C Programming, and possibly C++Programming. This book is intended to increase the reader's understanding of the relationship between x86machine code, x86 Assembly Language, and the C Programming Language. If you are not too familar with thesetopics, you may want to reread some of the above-mentioned books before continuing.
What is Disassembly?
Computer programs are written originally in a human readable code form, such as assembly language or ahigh-level language. These programs are then compiled into a binary format called
machine code
. This binaryformat is not directly readable or understandable by humans. Many programs, such as proprietary commercial programs, or very old legacy programs may not have the source code available to you.Programs frequently perform tasks that need to be duplicated, or need to be made to interact with other programs. Without the source code and without adequate documentation, these tasks can be difficult toaccomplish. This book outlines tools and techniques for attempting to convert the raw machine code of anexecutable file into equivalent code in assembly language and the high-level languages C and C++. With thehigh-level code to perform a particular task, several things become possible:Programs can be ported to new computer platforms, by compiling the source code in a differentenvironment.1.The algorithm used by a program can be determined. This allows other programs to make use of the samealgorithm, or for updated versions of a program to be rewritten without needing to track down old copies2.