Thread: Extract C Code from a .EXE

  1. #1
    Unregistered
    Guest

    Unhappy Extract C Code from a .EXE

    I need to know how to extract C code from just and .EXE

    Email [email protected]

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I need to know how to extract C code from just and .EXE
    Yea, it's about time for another one of these questions. The answer is STFW. You can find all the info you want about disassembly and decompiling.

    -Prelude
    My best code is written with the delete key.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    >> I need to know how to extract C code from just and .EXE
    >
    > Yea, it's about time for another one of these questions. The
    > answer is STFW.

    Haha. That's funny. Took me a second to figure out the acronym. I usually just say STFU...

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Well, the C code is not in the EXE like you think it is. It's all pure asm from the OBJs.

  5. #5
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    by the way, if you got code that was compiled with debugging info it might help you understand the structure of the program better...

    and... what does it stand for?!?! i can't figure it out!!!
    hasafraggin shizigishin oppashigger...

  6. #6
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Originally posted by doubleanti
    and... what does it stand for?!?! i can't figure it out!!!
    STFW: Search The... er, Fine Web.
    Jason Deckard

  7. #7
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Search The Fine Web, (thanks Jason!)

    >>>
    if you got code that was compiled with debugging info it might help you understand the structure of the program better...
    <<<

    True, it may be a little better, but unless you know what compiler was used originally, how can the decompiler know which high level language constructs were used to produce the resulting assembler? Several different tracts of code could compile down to the same assembler, espeacially true with a good optimising compiler.

    Of course one could argue that any version that compiled down to the same assembler would be helpful, however, without knowledge of what libraries, (for example), were used, the resulting output is only valid in the simplest of cases and rarely more than useless.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  8. #8
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    >which high level language constructs were used to produce the resulting assembler?

    pray to the programming gods and forego determinism for intuition...

    and yes, just a little better... but the day i discuss the finer points of op codes with Bubba is the day i've ported AKTIF to windows... in fact, it'll be before the day i port... and the day after i graduate from uni... heeh...
    hasafraggin shizigishin oppashigger...

  9. #9
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Unhappy

    Hi all,

    dont u think it is possible for us to construct a (new) program from an ASM program. Maybe not the original code that produced the exe, but u can construct something similar(atleast in the logic).
    One problem that I agree is that it would test ur nerve to first go through the entire ASM code before u write the first line of the C code. But if u are ready to sit for hours with the asm code (with concentration) then u can understand it and write ur own code.

    Regards,
    Sriharsha.
    Help everyone you can

  10. #10
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Don't exactly get what you mean. There is an exe, a decompiler or debugger can show the ASM instructions. From there, it could be possible to create a C code. The program should be able to locate variables, recognize functions etc.

  11. #11
    Registered User
    Join Date
    Sep 2001
    Location
    Fiji
    Posts
    212
    If we were meant to what the source code was then it would be OPEN SOURCE and released under the GPL or others similar.

    kwigibo

  12. #12
    Registered User
    Join Date
    Mar 2002
    Posts
    95
    The only problem with decompiling a program is that theres no such thing as a name and even if there was a magical program to convert asm to c, you wouldnt be able to read it very we'll. Write a program that is say a couple of hundred lines, and dont use any names except for say single letters and give it to someone to read, odds are they cant. If ya need to modify the exe then you'll need to learn asm.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Explain this C code in english
    By soadlink in forum C Programming
    Replies: 16
    Last Post: 08-31-2006, 12:48 AM
  2. Updating/Patching Code .EXE
    By Sentral in forum Game Programming
    Replies: 6
    Last Post: 07-12-2006, 01:53 AM
  3. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  4. Replies: 4
    Last Post: 01-16-2002, 12:04 AM
  5. starting a .exe from code
    By Eber Kain in forum C++ Programming
    Replies: 1
    Last Post: 11-11-2001, 02:09 PM