change running .exe

This is a discussion on change running .exe within the Windows Programming forums, part of the Platform Specific Boards category; hi, its me again with the same old question. im sure it must be possible to change a running exe-file. ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    37

    change running .exe

    hi, its me again with the same old question.

    im sure it must be possible to change a running exe-file.
    anybody an idea?

  2. #2
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hmm, what exactly do you mean by change?. It is possible to draw on that programs client window. You would simply use FindWindow() to get a handle to it then get a Device Context from the handle. Again depeding on what you mean by change it is possible to change varibles in a running instance. You would need to find the location of the varible in the ram, then set up some pointers to it. It isnt impossible, but depeding on what you are planning on changing it could get quite tricky....

    Hope that helps, it would help if you could be more specifc though

    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    37
    oh. stupid me:-)

    i mean... change the file. something like open...write andsoon
    i want my program to change itselfe on disk while it is running. but windows dont want it:-(

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    So you mean you want the program to change it's own code (= functionality) during runtime? Windows doesn't allow that. By the way, where should the program get it's new functionality from? I can imagine you will be using function pointers.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Location
    England
    Posts
    121
    A challenge for the gurus - make a program which can decompile an exe back to it's source, including comments etc, that 10 year old who was going to write his own OS could have a go at this too, seems to be his kind of thing.

  6. #6
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    lol, i only know of softice that dissasebles back to code. But i never found a working copy that would work on 2k or xp....
    TNT
    You Can Stop Me, But You Cant Stop Us All

  7. #7
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Originally posted by Robert602
    A challenge for the gurus - make a program which can decompile an exe back to it's source, including comments etc, that 10 year old who was going to write his own OS could have a go at this too, seems to be his kind of thing.

    Comments aren't compiled into the .exe. They are ignored by the compiler. You also can't get back the original source (its like trying to unbake a cake) [you'd have to convert the machine code to asm and then to C , by then you wouldn't have variable names and lots of stuff would look very different.

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    You can't, as far as I know modify a .exe while it is running.

    Could shut it down, modify it and restart.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  9. #9
    Registered User
    Join Date
    Sep 2001
    Posts
    37
    ok. stop fooling on me.

    what i make is: put a text file at the end of my exe so the prog can save a text to itselfe. that is not impossible. im a beginner, but it was no really big problem to do that. but my problem is to edit the text while the prog is running.
    im not 10 years old nor am i programming something like an os.
    my prog should be something like a posti.
    (maby you know the small yello papers)

    so maby there is a "guru" out there who can help me.
    it must be possible to do that... even with windows.

  10. #10
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    I suspect what you want to do and what you are asking to do are very different things. Perhaps you should describe your problem, rather than your attempted solution.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  11. #11
    Registered User
    Join Date
    Aug 2001
    Posts
    207
    wesentlich: do you mean that you want your program to open a txt file, read its content, maybe modify it, and save the file under the same name again (without changing its code I mean) ?

  12. #12
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    Or
    Open a text file, write the (decompiled or not) .exe to the text file.

    Modify the text file (the .exe's text, changing the way the .exe works) as you see fit and copy back over the .exe (so when it runs next time your changes will have taken place)? (which sounds like a virus)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  13. #13
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> (which sounds like a virus)

    That had occured to me as well, but generally, would a virus want to append code to itself, (i.e. the current .exe, which is open of course)? I would have thought it would want to append to some other .exe.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  14. #14
    Banned maes's Avatar
    Join Date
    Aug 2001
    Posts
    744
    I have a similar question. How does an update work. this is what I want to do. I have a program. and it checks over the internet to see if there is a new version available. if there is, download it and overwrite or change the current exe. can this be done with one exe?
    SVG is the future

  15. #15
    Registered User
    Join Date
    Sep 2001
    Posts
    37
    first of all.
    thanx for your replies.
    and may you excuse my bad english.


    ok. i hafe a form with a richEdit textfield. the contents of the textfield is added at the end of my exe file. i have made this by copying the exe from 0 to filelength with open&write and then write the text. so the exe is still executable and it can read its contents from the added text.
    and now all i need to be lucky is, saving the changed text on closing the prog.
    but as you all wrote... windows wont me to do that.

    i have also tryed to make a temp(clone) on start, lounch it and close. the clone (who knows his existance as a clone by reading some extra information from the added text) can now change the original exe
    but that is only a second-choice-solution.

    now i know that windows wont things like changing a running file. but maby there is a tricky solution how this can be done.
    everything is possible.

    and i dont want to make a virus.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reference parameters and calculating change
    By Cstudent2121 in forum C Programming
    Replies: 6
    Last Post: 11-04-2005, 02:19 PM
  2. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 07:55 AM
  3. Change Value in an array
    By beginner999 in forum C Programming
    Replies: 3
    Last Post: 01-18-2003, 06:16 AM
  4. Replies: 2
    Last Post: 11-08-2002, 02:22 AM
  5. Replies: 2
    Last Post: 09-04-2001, 02:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21