Thread: Changing a program from another program?

  1. #1
    Registered User kakayoma's Avatar
    Join Date
    Jul 2009
    Location
    Dallas, Texas
    Posts
    42

    Question Changing a program from another program?

    I have a question is it possible to change the execution of one program with another?

    Such as if there is a program which does something like this:

    Code:
    char a[10];
    void abc()
    {
    a = "Hello";
    cout<<a;
    abc();
    }
    how would i write a program that changes a to Dog??

    Vista - Something We all Love to Hate.

  2. #2
    Registered User
    Join Date
    Sep 2008
    Posts
    47
    I don't think it's possible to create a program that can actually change the value to dog, as the value has already been set. You could consider creating a .txt file that can be read (and changed by you if needed) to give a the value of your choice (dog). So the value could "be set" from outside the program itself.

    You could even create another program to write this file, choosing the value to change the variable to. Though it's not a permanent change and obviously won't work if you delete the .txt file with the value in. So it doesn't change it as such, just (temporarily) gives it a value from outside the program in effect.
    Last edited by Jake.c; 10-17-2009 at 04:56 PM.

  3. #3
    Registered User kakayoma's Avatar
    Join Date
    Jul 2009
    Location
    Dallas, Texas
    Posts
    42
    i undeerstand and know how to do this but im trying to find out if there is a way to change it even if its not programmed to be changed like some way to force the application to change


    Quote Originally Posted by Jake.c View Post
    I don't think it's possible to create a program that can actually change the value to dog, as the value has already been set. You could consider creating a .txt file that can be read (and changed by you if needed) to give a the value of your choice (dog). So the value could "be set" from outside the program itself.

    You could even create another program to write this file, choosing the value to change the variable to. Though it's not a permanent change and obviously won't work if you delete the .txt file with the value in. So it doesn't change it as such, just (temporarily) gives it a value from outside the program in effect.

    Vista - Something We all Love to Hate.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Quote Originally Posted by kakayoma View Post
    i undeerstand and know how to do this but im trying to find out if there is a way to change it even if its not programmed to be changed like some way to force the application to change
    Give it a good lecture?

    Seriously though - sure, anything's possible. Is it trivial or even practical to do so? Of course not.

    Why would you want to do this, anyway? If it's open-source, just recompile it. If it isn't then you probably don't have any business messing with it in the first place.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    Yes it is possible and it isn't all that hard.

    You'll need to look into the Windows Functions ReadProcessMemory and WriteProcessMemory. You also need a way to get the process handle, but I'll leave that up to you.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No, that is the easy part. The hard part comes later when figuring out what to change.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. Replies: 5
    Last Post: 09-14-2006, 09:47 PM
  4. Changing program from .cpp to .exe
    By BIt_toRreNt in forum C++ Programming
    Replies: 6
    Last Post: 02-16-2005, 04:24 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM