Thread: Could there be a something like a De-compiler ?

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    29

    Could there be a something like a De-compiler ?

    Hi !!,
    I have been thinking about this for quite a while. Even tried a search but nothing helped. I wanted to know if there is something called a de-compiler that would convert an executable file into source code ? Like usually a programmer writes source code and then compiles it to get the .exe file, can I feed the .exe to some kind of a de-compiler and get the source code back? Is that possible or is it as worthless as trying to un-bake a cake ? please help.

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    There are some programs that are out there that would give you back assembly language, I have never used them and don't know of any by name. To my knowledge, you wouldn't be able to get anything resembling C or C++ or any other high-level language (I could be wrong).
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    I know I had a really good link on this. Technicly it would be possible, In reality it isn't. To start with you don't know if it was written in C. You don't know what libs that was included. You don't know what settings the compiler had when generating the exe. And even if you did all the variables and functions get there names changed. I know about attempts to do this but the end result is poor and it is always faster(and more fun) to just write your own code.

  4. #4
    Sayeh
    Guest
    What you are looking for is called a Disassembler. And no, it won't take it back to a high level language. You must understand that all compilers, regardless of how they are made, conceptually use 2 passes.

    The first pass converts things to syntax-correct format, still high-level. The second pass converts all of that to assembler.

    which is then linked and resolved and saved into an .exe file.

    Since there is an increasing loss of information in the process, you can't get it back.

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    >>trying to un-bake a cake

    He he...good analogy....

  6. #6
    back? dbaryl's Avatar
    Join Date
    Oct 2001
    Posts
    597
    ...isn't that the reason why the source is not given out? If you could de-compile something back to C, then there'd be no point to keep the code a secret, huh?
    This is my signature. Remind me to change it.

  7. #7
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    This thread made me think of something a C teacher once told me after I said something about that you couldn't do anything in C that couldn't be done in Asm.
    He said something like,,,"Wrong Asm can't do everything that C can, there is nothing in Asm that handles selections"

    Now I don't know Asm but it didn't make sense to me because if C and C++ get converted to asm it has to support everything C can do. Was he right when he made that statment?

  8. #8
    Sayeh
    Guest
    >> He said something like,,,"Wrong Asm can't do everything
    >> that C can, there is nothing in Asm that handles selections"

    The phrase, in and of itself, is somewhat confusing. Since, in fact, all executable code is reduced to assembler, it is obviously the most powerful language in terms of no boundaries. However, it carries great responsibility and may be considered tedious to some. Impractical for most, thus higher-level language compilers were developed to reduce 'human-understandable' computerese into 'machine language'.

    It is more than likely your educator was confused, or riding on personal, ignorance-based theories.

  9. #9
    Unregistered
    Guest
    Take a look at the C decompiler on this page:
    http://www.hakor.com/Appz.html

  10. #10
    Registered User
    Join Date
    Feb 2002
    Posts
    2
    Technically, we can decompile an exe, but practically speaking, we have to know the compile r specifications, the libraries included etc for writing the decompiler. also information about structures unions and classes(if c++) will be lost as the high level lang is just converted to sequence of MOV, PUSH and POPS in asm.With these restrictions, if we were to build a decompiler for even a small exe, we could save time by writing program than by writing a decompiler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  3. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  4. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 06:42 AM
  5. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM