![]() |
|
#1
|
|||
|
|||
Simple ProgramIs there a way I can make a very simple C program recieve inputs, that will become variables, from program X running on my computer? Then, The program I am going to make will simply print text on the screen in a text window of program X and hit enter based on some logic operators. I am running windows xp if that makes a difference. thanks,
justin |
|
#2
|
||||
|
||||
|
Quote:
__________________
Age is unimportant -- except in cheese |
|
#3
|
|||
|
|||
|
I downloaded a program called Tsearch that searches the memory in use by the program I want my program to communicate with. What I want to do is have my program look at certain memory addresses and base on their values, do something. How can I get my program to search the other program's memory in use? thank, justin
ps, i think im making progress.... I used this int z = 1985; printf("%d",&z); and it gave me a memory address of a variable I made. if I can do this, couldnt I read from a memory address of another program, then based on its value, print something to another memory address? Last edited by thejustman85 : 29-Mar-2005 at 03:23.
Reason: rememberd something extra
|
|
#4
|
|||
|
|||
|
If you're trying to read info from another program currently running, I'd recommend using the ReadProcessMemory() function. There's also a WriteProcessMemory, if you need to change values.
|
|
#5
|
|||
|
|||
|
Ok here is an example...
CPP / C++ / C Code:
...Now after I run the program once I get 37814108. I dont know if that will be the same address always but I just did it for an example. How can I use ReadProcessMemory() function to get the value at an address and use it as a variable? I dont really understand the information provided on the link in the previous post. help justin |
|
#7
|
||||
|
||||
|
From your questions, the real answer is:
No you can't. You need more knowledge over and above the basic syntax of C. You need to learn more about inter-process communication and other high level programming techniques. Take your learning a little slower. A program cannot read the memory from another program. The OS protects running programs from prying. __________________
Age is unimportant -- except in cheese |
|
#8
|
|||
|
|||
|
Quote:
|
|
#9
|
|||
|
|||
|
Code:
This gives me an error when I run it. Why cant i print the int value of this memory address. Its an address of another program, but why wont it work? |
|
#10
|
|||
|
|||
|
Quote:
Assuming you are running your program in a hosted environment (Windows, Linux, etc.) contrasted with an embedded non-hosted environment: this is not the address of another program. Furthermore, you are only allowed to access memory within the space that the operating system gives you. (Your program variables, functions, etc. plus whatever memory you get through library allocation programs such as malloc().) When you run your C program, the operating system maps a particular area of memory to your program's memory space. Addresses that you get (by printing out values of pointers, for example) are "virtual addresses". User programs such as your example have no way of knowing what's in any particular physical memory address at any time. When you run a particular program, it is assigned a place in physical memory and loaded there by the operating system. The next time you run the program, it might go into a completely different physical address. Bottom line: With 'modern' operating systems (Windows XP, Linux) user programs like your example can not directly access physical resources (memory, i/o port addresses, etc.) Now, operating systems typically have ways of hooking debug programs into other processes, and I invite you to search msdn.com for "Basic Debugging" topics (that's not for debugging BASIC programs, but an overview and technical exposition of methods for observing and correcting programs running under Windows operating systems). Your first post in this thread began this way: Quote:
Now "simple" is kind of subjective, but if I had to give a simple answer to your simple question, I would have to say, "It depends on what you mean by 'simple'." Regards, Dave "Things should be made as simple as possible, but no simpler." ---Albert Einstein |
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [TUTORIAL] Calling an external program in C (Linux) | dsmith | C Programming Language | 4 | 22-Apr-2005 13:30 |
| Help with simple math table program (was a SIMPLE program) | Bubba | C Programming Language | 3 | 09-Mar-2005 12:40 |
| Help with a simple program | matthewbarr | C Programming Language | 3 | 10-Feb-2005 10:08 |
| Help with a simple program. | bluedragon27 | C Programming Language | 1 | 16-Nov-2004 15:40 |
| How to write simple program like ........? | laputa9000 | C++ Forum | 3 | 29-Oct-2003 12:09 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The