1. Computing

Decompiling Delphi (1/3)

About Reverse Engineering


Decompilation? Reverse? Cracking?
Simply speaking, decompilation is the inverse of compilation: translating an executable file into a higher level language.
Suppose you lose your Delphi project's source and you only have the executable file: reverse engineering (decompilation) is useful if the original sources are not available.
Hm, "sources not available", does this mean that we can decompile other people's Delphi projects? Well, yes and no..

Is true decompilation possible?
No, of course not. Fully automated decompilation is not possible - no decompiler could exactly reproduce the original source code.

When a Delphi project is compiled and linked to produce a standalone executable file, most of the names used in the program are converted to addresses. This loss of names means that a decompiler would have to create unique names for all the constants, variables, functions, and procedures. Even if a certain degree of success is achieved, the generated "source code" lacks meaningful variable and function names.
Obviously, source language syntax no longer exists in the executable. It would be very difficult for a decompiler to interpret the series of machine language instructions (ASM) that exist in an executable file and decide what the original source instruction was.

Why and when to use.
Reverse engineering can be used for a several reasons, some of which are:
. Recovery of lost source code
. Migration of applications to a new hardware platform
. Determination of the existence of viruses or malicious code in the program
. Error correction when the owner of the application is not available to make the correction.
. Recovery of someone else's source code (to determine an algorithm for example).

Is this legal?
Reverse engineering is NOT cracking, although it is sometimes difficult to draw the fine line between those two. Computer programs are protected by copyright and trademark laws. Different countries have different exceptions to the copyright owner's rights. The most common ones state that it is ok to decompile: for the purposes of interpretability where the interface specification has not been made available, for the purposes of error correction where the owner of the copyright is not available to make the correction, to determine parts of the program that are not protected by copyright. Of course you should be very carefull / contact your lawyer if you are in doubt whether you are permitted to disassemble some program's exe file.

Note: if you are looking for Delphi cracks, key generators or just serial numbers: you are on the wrong site. Please bear in mind that everything you find here is written/presented for exploration / educational purposes only.

©2014 About.com. All rights reserved.