Jump to content

Decompiler For C++


alxhotel
 Share

Recommended Posts

Well, I just started in the world of coding. I started with C++ because lots of you told me that C++ was the mother of al languages. So I start programming simple stuff, and then I ask me: Exist a decompiler to get the source code of a program in .exe ?

I dont know if it's just my imagination but, could exist?

Please Help, (sorry for my english, is terrible)

Link to comment
Share on other sites

Well, nothing that will show the original source code in plain text, but you could use a debugger to see what it does.

Link to comment
Share on other sites

There's nothing really that exists that will output in c/c++, the only good way requires two prerequisites: knowing assembly and being able to use ollybdg/some other debugger (but ollydbg shows APIs). Then, use w32dasm to save the file in assembly, and use ollydbg to translate it. It's kinda wierd to explain, but it makes sense when you do it. The few decompilers out there will produce rubbish code, which you will need to know assembly to translate into c++ anyways.

However, since you will probably learn assembly best after you already know a higher level language, you might want to stick to textbooks/open source stuff. There are equivalent programs if you are using linux.

Edited by Tox1k
Link to comment
Share on other sites

No such thing as Decompiler, I wish that existed, I have lots of C programs that I wish I could decompile them.

You could try reserve engineering it, but it would take some time and lots of efforts.

Link to comment
Share on other sites

Well, I just started in the world of coding. I started with C++ because lots of you told me that C++ was the mother of al languages. So I start programming simple stuff, and then I ask me: Exist a decompiler to get the source code of a program in .exe ?

I dont know if it's just my imagination but, could exist?

Please Help, (sorry for my english, is terrible)

In general, no. A true decompiler simply can't exist for most high level languages. The process of compiling source code into a native binary is a very lossy conversion. Unless you explicitly tell the compiler to include debugging information in the binary, the compiler will "forget" all your variable names. All the comments will be lost because they are ignored by the compiler. For the purpose of optimization, it will re-arrange the order or pattern of your instructions. Certain control structures are provided as a convenience for the programmer, but don't really exist at the machine level. For example, in the machine code there is no difference between a for-loop and a while-loop, both are just conditional jumps.

Think of it this way, there are a lot of different ways you could describe the quadratic equation in English, but there is one canonical way to write the equation in mathematical notation. Can you look at a mathematical equation and determine the exact words (and the exact order) that another person might use to describe that equation?

Let's use a simple case for demonstration.

The equation: 1 + 1 = 2

Could be translated into any of these English sentences:

1. One plus one equals two.

2. One and one equals two.

3. The addition of one and one results in two.

4. Two is the sum of one and one.

5. When summed together, one and one produce two.

This is why a decompiler can't translate from compiled code back into the high-level language that was used to generate it.

In the case of Java, you can get much better results from a decompiler for a number of reasons.

1. Java bytecode is closer to the Java language than machine language is to C++. (Optimization is done at run-time by the just-in-time compiler.)

2. Java often encodes debugging information such as line numbers and variable names into the class files for use in error messages.

3. Java was designed with disassembly in mind, the official JDK even includes a tool to do it (javap).

This is one reason why Java is frequently used by companies for internal software development or for server-side code, but rarely used for developing products which will be sold to end-users. (Although tools do exist to obfuscate source code and make it harder to reverse. Notch uses such a tool on the Minecraft JARs he distributes.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...