#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    359
    Rep Power
    34

    convert exe to C or C++ file


    Hi
    Is this possible ?

    I attached a zip file that contains an exe for a small C program , can any body tell me what is the code ? ( convert the exe to C or C++ again )?

    thanks
    Attached Files
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    Disassembling a program is relatively trivial (though the code can be obscured quite a bit), but decompiling a program is not guarenteed to result in any intelligent code at all. Unless you just happen to have a debug executable (with symbols and lac-o optimization), recovering the original code is next to impossible. You have lost nearly every variable and function name, optimization may have inlined a lot of functions and some code structures can be completely rewritten by the optimizer. There is still a little research into decompilers, but the general consensus is it is a waste of time. Either reverse engineer the program or go back to the original requirements and recreate it (or get really REALLY good at reading optimized assembler).

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  4. #3
  5. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,109
    Rep Power
    1802
    Decompilers that do exist are for specific and usually very simple compilers (usually DOS compilers). If the code has been optimised, you can probably forget it. Either way unless you know what compiler was used, you are unlikely ot get a result.

    Different compilers will generate different code, so decompilers work with knowledge of how the compiler generates code and recognising code patterns. While such decompiled code may be functionally equivilent to the original, it is unlikely to be identical, and very unlikly to be understandable (no coments for example).

    In addition symbol table information is usualy reqiured and this is normally stripped from released executables. With the symbol table, the decompiler will know the entry point of each routine and will enable it to distinguish code from data. In addition symbol names will make the resultant code easier to follow.

    Why do you need to do this?

    I did not run your executable (I am not that stupid), but it appears to be compiled with Borland C/C++ 4.5, and is a Win32 GUI program but uses Easywin to allow traditional stdio semantics. On that basis I would suggest not a chance, since the code is not generic enough to lend itself to the limited and simple tools available.

    Here http://www.debugmode.com/dcompile/disc.htm is an example of what a decompiler can do. This is for Borland TurboC for DOS, (a relatively simple compiler and execution environment), as you can see the output is not the original code.

    Your best bet is to specify precisely what the code does and code from scratch. If you have dificulty with that, you might posting the spec to this forum; but don't expect a free coding service!

    Clifford
    Last edited by clifford; November 21st, 2004 at 03:31 AM.
  6. #4
  7. Lord of Dorkness
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    Central New York. Texan via Arizona, out of his element!
    Posts
    8,524
    Rep Power
    3314
    There seems to be a fairly widespread perception that a function can be derived from its output. A fair amount of scientific effort is spent trying to derive the code that produced the current state of the universe. Beyond a given level of complexity, t'ain't a trivial process. Clifford's link is an excellent illustration. Better to reengineer it if it does much beyond "Hello, world." Even if (big if) you managed to derive all the 'facts' the presentation wouldn't win any literary prizes.
    Functionality rules and clarity matters; if you can work a little elegance in there, you're stylin'.
    If you can't spell "u", "ur", and "ne1", why would I hire you? 300 baud modem? Forget I mentioned it.
    DaWei on Pointers Politically Incorrect.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    359
    Rep Power
    34
    Is there a compiler that any user can't decompile it ? impossible to decompile ?
  10. #6
  11. Last Day: May 29, 2005
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2004
    Location
    elemental sphere
    Posts
    742
    Rep Power
    10
    also if it WAS possible to decompile it then you could decompile Windows too and other software, so if you would have just thought a little bit then you would know that would not be possible, I don't know in how far you can disassemble it (to asm), but some people are really good at reading that so I don't know what would be the possibilities.
  12. #7
  13. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    I guess you are not getting the point. Decompilation is possible, but the result is nearly useless except in a very few cases. Spend some time googling and read up on the subject.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  14. #8
  15. Lord of Dorkness
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    Central New York. Texan via Arizona, out of his element!
    Posts
    8,524
    Rep Power
    3314
    Disassembly from machine code and decompilation are two different things. One is converting the binary patterns with which the machine works to mnemonic instructions in virtually a one-to-one correspondence. One then reads the mnemonics and infers what the program is attempting to do. The level of imformation and concepts is qualitatively different. One can become quite facile at interpreting machine code; extrapolating what one sees to the use of an STL multi-map is a horse of an entirely different set of teeth marks on your butt.
    Functionality rules and clarity matters; if you can work a little elegance in there, you're stylin'.
    If you can't spell "u", "ur", and "ne1", why would I hire you? 300 baud modem? Forget I mentioned it.
    DaWei on Pointers Politically Incorrect.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    1
    Rep Power
    0

    To learn something;


    i was impressed :eek: by seeing that exe file sir

    sir, i was executed your exe file.I dono which program is that, because iam a beginner to learn computer programming.

    can you send me how to convert c program into exe file in stepbystep procedure?

    if you send to me means it will helps me to improve my knowledge and skill :tbulb: sir ......
    thank you a lot..

    Comments on this post

    • clifford disagrees : You resurrected a 9 year old thread to spout nonsense. Only a fool would have downloaded and executed the attached executable, and you have obviously not read the thread. Consider this, the answer to a question is 25 what is the question?
  18. #10
  19. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    You just hijacked a thread. That's when you use a thread started by somebody else to ask an unrelated question. That is bad forum behavior that must be avoided, especially when the thread being hijacked is old. What did you think you would accomplish? Did you think that motivation would read your message? With most threads like this, the person who created it would have left this forum a short time later, so you'd be nine years too late for your message to be read. As it is, motivation last posted here in August 2009, so you're only 4 years 4 months late, which is still too late.

    If you have an actual question to ask, then create your own thread and ask it there. Just make sure that it's a valid question and that you have given us all the information we need to answer it.

    Asking us for a detailed set of instructions for using your compiler is not a valid question. That came with your compiler, plus your teacher or textbook or tutorial would have already given that to you. Besides, since we don't know which compiler you're using, that would be an impossible task. Similarly, asking us to personally teach you how to program would not be a valid question.

    So if you really have a question to ask, then create your own thread to ask it in. And keep in mind that since you have just done an extremely rude thing, many here will have already decided that you're not worth responding to. Do not grovel or beg, but rather ask actual questions that are valid.

    And get rid of those idiotic smilies. All they ever do is mess up code listings.

    And before you yet again run just any old EXE file you find on-line, learn and remember that when you run somebody else's program on your computer, then that computer no longer belongs to you.
    Last edited by dwise1_aol; December 31st, 2013 at 03:00 PM.

IMN logo majestic logo threadwatch logo seochat tools logo