Access to process memory from external programm

T

TIM

for example i have one simple programm

int main()
{
int test = NULL;
while(1){
printf("%d\n",test);
getch();
test++;
}
return 0;
}

After compiling and running it, i want to access to its memory adress
location(under windows) from other programm(which i want to write, but
dont know how or better say, from to start :)) and find this "test"
variable and change its value during programm run-time. How i can do it
from external programm written in C++? Any help would be appreciated. THX.
 
J

Joona I Palaste

TIM said:
for example i have one simple programm
int main()
{
int test = NULL;
while(1){
printf("%d\n",test);
getch();
test++;
}
return 0;
}
After compiling and running it, i want to access to its memory adress
location(under windows) from other programm(which i want to write, but
dont know how or better say, from to start :)) and find this "test"
variable and change its value during programm run-time. How i can do it
from external programm written in C++? Any help would be appreciated. THX.

From the viewpoint of the C standard: You can't. C has no concept of
other processes in the first place.
From a looser viewpoint: Usually processes can't write to each other's
memory space, so you're still out of luck. Some OSes provide the concept
of "shared memory" which might help, but that'd be off-topic here.
YR WLCM.

--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"As a boy, I often dreamed of being a baseball, but now we must go forward, not
backward, upward, not forward, and always whirling, whirling towards freedom!"
- Kang
 
T

TIM

Joona said:
From the viewpoint of the C standard: You can't. C has no concept of
other processes in the first place.
From a looser viewpoint: Usually processes can't write to each other's
memory space, so you're still out of luck. Some OSes provide the concept
of "shared memory" which might help, but that'd be off-topic here.
YR WLCM.
LoL how is then written programm such as ARTMONEY? If C doesnt have
concepts of other processes, maybe C++ does? or i must better do it with
ASM?
thx.
 
J

Joona I Palaste

TIM said:
LoL how is then written programm such as ARTMONEY? If C doesnt have
concepts of other processes, maybe C++ does? or i must better do it with
ASM?
thx.

Read what I wrote. "Some OSes provide the concept of 'shared memory'
which might help, but that'd be off-topic here." C, as such, doesn't
have the concept of other processes, but OS-specific extensions to C do.
The same is true for C++: C++ doesn't have the concept of other
processes, but OS-specific extensions to C++ do.
You can either do it with ASM, or find a C- or C++- compatible library
where someone has already done it with ASM for you.
 
T

TIM

Joona said:
Read what I wrote. "Some OSes provide the concept of 'shared memory'
which might help, but that'd be off-topic here." C, as such, doesn't
have the concept of other processes, but OS-specific extensions to C do.
The same is true for C++: C++ doesn't have the concept of other
processes, but OS-specific extensions to C++ do.
You can either do it with ASM, or find a C- or C++- compatible library
where someone has already done it with ASM for you.
Thx for help, but i dont like to use someone else work, i like to make
things by myself and learn to new things, only then you get full
control...so i will make it.
 
J

Joona I Palaste

TIM said:
Thx for help, but i dont like to use someone else work, i like to make
things by myself and learn to new things, only then you get full
control...so i will make it.

Here, "someone else's work" includes any system core libraries your OS
might have. Depending on your OS, "making things yourself" might even
require implementing your own multi-tasking kernel. This is a very
great deal of work, and overkill just to be able to use shared memory.
Therefore I suggest you first check your own OS's core libraries,
whether they support shared memory. If they do, fine. Otherwise you can
make things yourself or try to find a third-party solution.
 
C

Christopher Benson-Manica

TIM said:
After compiling and running it, i want to access to its memory adress
location(under windows) from other programm(which i want to write, but
dont know how or better say, from to start :)) and find this "test"
variable and change its value during programm run-time. How i can do it
from external programm written in C++? Any help would be appreciated. THX.

I think Joona meant to post these URL's (didn't you, Joona? ;)):

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top