Geeky question

Soldato
Joined
20 Jul 2008
Posts
4,576
I used to write programmes in QBasic many years ago. From what I remember, you wrote the source code in BAS format and then compiled it to an EXE.

Why exactly can one not just "decompile" an EXE back to source code?

I would have thought it is just like converting between two measurements. I struggle to understand the idea that when you compile something it goes through a one-way translation into "machine code" that only your computer understands.

Crossed my mind :D

cheers
 
Its not a direct 1 to 1 mapping from program code to compiled machine code, so its not possible to get back to exactly what you type in your program code.
 
Because there are a million ways you can code something. In theory, you could write a program (Px) that could assess what another program (P1) does and then generates similar (or exact, if lucky) code that when re-compiled would produce a program(P2) that has the same effects as P1. When P1 was compiled the exe loses all information of what code it was even written in, so it is all rather complex, but in theory you could de-compile(?) it into a code, but it would be stupid and boring.
 
The best you can do is disassemble the compiled executable. Assembly code is basically a symbolic representation of the machine code. If your good enough with asm, you can easily reverse the program, learn its logic and algorithms to a point where you could write it again in a high level language (or modify it for your benefit...)
 
Back
Top Bottom