Thread: locked exe file

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    locked exe file

    I have a locked .exe file....is there a way to view to code?
    I cant right click on it and click open with notepad for example....how do i view this code if its a .exe file.

    It opens up in command prompt....

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    The code inside an .exe file is in assembly, not C.

    C code (portable, human friendly) is compiled by a C compiler into assembly. Assembly is platform specific, meaning the exact same C code will produce different assembly code on different platforms. Which a big reason to use C.

    Also, assembly is not so easy to understand. You can examine an .exe for assembly, which contains other OS stuff as well, I dunno how on windows. But there is no C source there to look at.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Actually the code in an .exe is machine code, not assembly language
    (Unless the exe is just a wrapper for an interpreter or JIT-compiler, like .net/autoit/etc. But that's beyond the scope of this post)
    The process goes: c code -> (compiler) -> assembly code -> (assembler) -> machine code

    You can disassemble a compiled binary to get the corresponding assembly listing. (Not necesserily the same code as produced by the compiler because of optimizations)
    And I'm not trying to be rude here; but if your best idea is trying to open an .exe file in notepad then you won't be able to understand the output from said disassembler.
    On a side note; there are also a few decompilers around. But noone that works perfectly, and getting back the original c code is impossible.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by _Mike View Post
    Actually the code in an .exe is machine code, not assembly
    Probably why I found the "assembly" so hard to understand
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM