C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-17-2009, 03:02 PM   #1
Registered User
 
kakayoma's Avatar
 
Join Date: Jul 2009
Location: Dallas, Texas
Posts: 39
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.
kakayoma is offline   Reply With Quote
Old 10-17-2009, 04:53 PM   #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.
Jake.c is offline   Reply With Quote
Old 10-22-2009, 05:24 PM   #3
Registered User
 
kakayoma's Avatar
 
Join Date: Jul 2009
Location: Dallas, Texas
Posts: 39
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.
kakayoma is offline   Reply With Quote
Old 10-22-2009, 06:42 PM   #4
Guest
 
Sebastiani's Avatar
 
Join Date: Aug 2001
Posts: 4,923
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.
Sebastiani is offline   Reply With Quote
Old 10-23-2009, 11:07 PM   #5
Registered User
 
Join Date: Jan 2009
Posts: 30
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.
DeadPlanet is offline   Reply With Quote
Old 10-24-2009, 02:35 AM   #6
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
No, that is the easy part. The hard part comes later when figuring out what to change.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BOOKKEEPING PROGRAM, need help! yabud C Programming 3 11-16-2006 11:17 PM
Can someome help me with a program please? WinterInChicago C++ Programming 3 09-21-2006 10:58 PM
Linking program to a .lib without changing Project Settings (Looking for code) Kurisu33 C++ Programming 5 09-14-2006 09:47 PM
Changing program from .cpp to .exe BIt_toRreNt C++ Programming 6 02-16-2005 04:24 PM
My program, anyhelp @licomb C Programming 14 08-14-2001 10:04 PM


All times are GMT -6. The time now is 01:55 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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