[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


can i get cpp file  from exe file ??

Posted on 2004-11-07
Medium Priority
Last Modified: 2012-08-14

i trying to find the way that i can get cpp file from the exe (that has been generated by vc++)
is it possible?

Question by:tom_mk

Accepted Solution

Physicistm earned 672 total points
ID: 12519657
I'm affraid that once compiled program can't be brought back to .cpp file ...
And if that is the case that only in form of decomposed original in Assembler language.
The compiling process is actually one way directions, there are numerous optimizations in questions that are being done to establich an .exe files which can't be back-tracked to restore the original file.

I'm sorry.

Hope this explains it ...
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 664 total points
ID: 12519779
Definitively no. You can't.
A binary (.exe) file doesn't have variables information or source code information, unless it have specific debugging options.
Release (non test) executables don't use to have this information. A simple test: open your exe file with an hexadecimal editor, if you don't see variable names, then you won't obtain nothing.
LVL 10

Expert Comment

by:Murugesan Nagarajan
ID: 12521129
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 19

Assisted Solution

RanjeetRain earned 664 total points
ID: 12522349
This is an endless debate. The comnclusion always is - No, you cannot get your source code written in a high-level language back from a compiled binary executable.

The reason is simple. There are irreversible factors that go into the making of an executable program. Here is what happens, in brief.

(1) Program is compiled and a symbol table is created
(2) Procedures and functions are compiled
(3) Optimization, if any applicable, is done
(4) Various compiled modules are linked to form an executable binary
(5) OS specific headers are added to the file

You can see that first three steps are not reversible. And they are what will make it impossible to generate the source code back. Any good decompiler can reproduce a reasnably readable assembly code from a binary executable. But converting assembly instructions again to get back the HLL source code is a huge challenge.

I am not sure if there has been developed any intelligent decompilers that can produce source code in a high level language, but even if they do so, rest assured what they will reproduce will be significantly different from the original source code.


Expert Comment

ID: 12523316
In fact as you know the compiler maybe you can. You'll need a computer with the headers used to compile the program, at least those you know. Then you can search for a decompiler. Search at www.proggrammersheaven.com and at astalavista.com.

Expert Comment

ID: 12572363

Actually, you CAN get SOURCE code back from any executable. But the chances of understanding it in any meaninful way is not good.

The c++ source would look something  like:
String  a001="0";
String a002="1";
int a003=1;
for (a003=0; a003-<=100;a003++){}

and where the decompiler fails to decompile the code it will throw the assembly code inline in the C++ program, which would look like :
<cpp  code snipped>
inline ASM
{ add ax, 3
add ax, 3
rot ax, 3
bnl ax, 3
add ax, 3
div ax, 3
mul ax, 3
<more c++ code here>

And to JUST get that virtually useless code out of the binary, you need to know exactly which compiler created the code in the first place, such as GCC, intel C++, MS vC++, and you need to know exactly what version of the compiler was used, and exactly what command line parameters were used. Theres even some tools on internet to do it. The are called DE-Compilers, or reverse compilers.

Such as this one called DCC

Now, having said that its also illegal to use decompilers in a corporate envioronment on someone elses code you dont own, in the USA. Due to the DMCA act which specifically forbids reverse enginerring or decrypting without permission by federal law now.


Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question