[38.4] How can I decompile an executable program back into C++ source code?
You gotta be kidding, right?
Here are a few of the many reasons this is not even remotely feasible:
* What makes you think the program was written in C++ to begin with?
* Even if you are sure it was originally written (at least partially) in C++, which one of the gazillion C++ compilers produced it?
* Even if you know the compiler, which particular version of the compiler was used?
* Even if you know the compiler's manufacturer and version number, what compile-time options were used?
* Even if you know the compiler's manufacturer and version number and compile-time options, what third party libraries were linked-in, and what was their version?
* Even if you know all that stuff, most executables have had their debugging information stripped out, so the resulting decompiled code will be totally unreadable.
* Even if you know everything about the compiler, manufacturer, version number, compile-time options, third party libraries, and debugging information, the cost of writing a decompiler that works with even one particular compiler and has even a modest success rate at generating code would be significant — on the par with writing the compiler itself from scratch.
But the biggest question is not how you can decompile someone's code, but why do you want to do this? If you're trying to reverse-engineer someone else's code, shame on you; go find honest work. If you're trying to recover from losing your own source, the best suggestion I have is to make better backups next time.
(Don't bother writing me email saying there are legitimate reasons for decompiling; I didn't say there weren't.)