Development Seeing the code in a .exe?

Discussion in 'Software' started by GeorgeStorm, 14 Mar 2013.

  1. GeorgeStorm

    GeorgeStorm Aggressive PC Builder

    Joined:
    16 Dec 2008
    Posts:
    7,024
    Likes Received:
    565
    Hey,
    As above, a friend has a program he wants to add some functionality to, but he only has a .exe, is there any way he can access the source code to try and edit it?

    Thanks
     
  2. GoodBytes

    GoodBytes How many wifi's does it have?

    Joined:
    20 Jan 2007
    Posts:
    12,300
    Likes Received:
    710
    Yes. If you understand Hex code or binary code, maybe you can do something.
    But in reality no. You can use a decompiler, but you need to know how to use the decompiler, and you need to know how the program was made, and which programming language, and see if the decompiler works or not for that programming language.

    Also, when you decompile code, you don't have comments, you don't have any organization of the code.. all that is lost. Some function might exists, some might disappear as the compiler usually does a lot of optimization. For example, if you do a loop on a code 30 times, you might have this code:
    Code:
    for (int i = 0; i < array.length(); ++i) {
        array[i] = i;
    }
    
    Where for the length of the array, for each cell, insert the value of i.

    Well the compiler might see this and go: Well the array is only length 30, I know that I am faster at doing:
    Code:
    array[0] = 0;
    array[1] = 1;
    array[2] = 2;
    array[3] = 3;
    ...
    array[29] = 29;
    
    Then doing a loop, so let me decompose the loop.

    So basically code becomes difficult to read, also, depending on the language you decompile, you might also lose variable names, and generic names are used, like var1, var2, etc... and that makes it a bit pain to work with.

    Also you can have code ambiguity, where the decompiler doesn't know how to processed at a certain point... so the way it processed is wrong, and you need to figure out a way to fix it, because the program can't be recompiled due to an error, or doesn't work properly.

    Also, decompiling a program goes against all software license agreement. The big thing behind license agreement is for you to not go and say: "Well I bought it, I can do what I want.. I am claiming it's mine, and I am going to sale it and makes 100% profit on, and put my name everywhere." Which was a common practice back in the early days of software and games, before license agreements. Hence it's creation.

    Your best bet, is to look into DLL injection. But that is more like adding your own code to do something apart. Like Fraps uses DLL injection for calculating and showing FPS. Steam uses DLL injection for it's menu/chat thing. Trillian 5 uses DLL injection to be able to access you chat client and chat while in a game, and get chat notification. But none interacts with the game. In the case of Steam, it's devs that implements Steam library function to allow this.
     
  3. notmeagain

    notmeagain Minimodder

    Joined:
    29 Jan 2009
    Posts:
    561
    Likes Received:
    15
    DLL Injection.

    If you are using an exe that's compiled from Java, you may be able to de-class the compiled code and edit it directly and recompile - but you will have to deal with obsfurcation.

    Ie:

    Player.class -> health variable

    might be renamed to:

    a.class -> b variable
     
  4. tuk

    tuk Don't Tase Me, Bro!

    Joined:
    28 Oct 2012
    Posts:
    493
    Likes Received:
    10
    Generally speaking, there is no workable way of converting an exe back to its original source.

    However, if you know assembler/opcode you can edit the exe directly.

    I'm not an expert by any means, but I have some experience of the above, if you describe the target & intention in more detail, I might be able to give you a better answer ..or even have a look myself if I have the time & it's interesting enough.

    ps
    dll injection is only the delivery method for the new code( after all the hard work has been done deciphering the exe code & deciding what needs adding/changing)...personally I have never bothered with dll injection as you cant remove the code after its been injected.
     
    Last edited: 15 Mar 2013
  5. Daedelus

    Daedelus What's a Dremel?

    Joined:
    7 May 2009
    Posts:
    253
    Likes Received:
    12
    If your friend is asking if it can be done then he won't be able to do it.
     
    wolfticket likes this.
  6. notmeagain

    notmeagain Minimodder

    Joined:
    29 Jan 2009
    Posts:
    561
    Likes Received:
    15
    I was going to say that, but then realised that such questions are the first footfall on the path of enlightenment, and didn't want to downhearten the little feller.

    You're a meanie.
     
  7. tuk

    tuk Don't Tase Me, Bro!

    Joined:
    28 Oct 2012
    Posts:
    493
    Likes Received:
    10
    Very true, however I have offered to take a look & might even do the difficult/EXE part for him ...as long as he can create the control GUI to handle the new functionality using c++ or whatever.

    Here is a similar project I did a while back, it was proof of concept only and never released to the public...iow I hope I'm not breaking any forum rules.

    I didn't have access to the source code either, but wanted to customize a highly protected program ....aka Call of Duty - Black Ops. The on-screen map(top left) in this game always bothered me ...so I decided to re-design the map.

    Start the video below & pause on 0:02 secs & each of the other times listed, read the description and then play to next time in the list:

    The yellow triangle is my location on the map, I'm outside a round building & you can see from my view that I'm staring at the exterior wall of the building(only inches away). The green triangles are my team mates.

    0:04 secs:
    The green stripe moving across the screen is the UAV scan which highlights enemies as red dots ..which fade after a time(take note).

    0:07 secs:
    First thing I do is increase the size of the map & zoom out.

    0.09 secs:
    However I don't need the player triangles to be big ..so I will now reduce their size.

    0.18 secs:
    also, the capture point icons/flags are too big so I will reduce these as well.

    0.20 secs:
    The green UAV bar is too slow and the red enemy dots fade too quickly ..so I will increase the speed of the uav ..until its so fast you cannot even see it on the screen ...the only evidence you have of the UAV ..is unlike before the enemy red dots do not fade :D(cos they are being updated so quickly)

    0.27 secs:
    Finally, anyone who is familiar with this game, will know the dreaded UAV jammer perk, which an enemy can use to jam the map information with white noise(see video) ...in this case I can turn the enemy jammer on/off like a light switch




    As you can see I'm deploying my code into the EXE while its running :) ...by using the control panel below, which contains additional 'functionality' not show in the video. ..this control panel also allows me to remove my code at any time
    [​IMG]

    COD-BO also contains code to prevent me from doing what I describe above...if COD-BO detects that I have changed even a single byte, it will instantly kick me from the game or ban me forever ...how I got around this protection/detection code is a more complicated discussion.
     
    Last edited: 20 Mar 2013

Share This Page