469,647 Members | 1,708 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

Access to process memory from external programm

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.
Nov 14 '05 #1
6 2996
TIM <ds****@hot.ee> scribbled the following:
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 (pa*****@cc.helsinki.fi) ------------- 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
Nov 14 '05 #2
TIM
Joona I Palaste wrote:
TIM <ds****@hot.ee> scribbled the following:
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.

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.
Nov 14 '05 #3
TIM <ds****@hot.ee> scribbled the following:
Joona I Palaste wrote:
TIM <ds****@hot.ee> scribbled the following:
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.

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.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"It's time, it's time, it's time to dump the slime!"
- Dr. Dante
Nov 14 '05 #4
TIM
Joona I Palaste wrote:
TIM <ds****@hot.ee> scribbled the following:
Joona I Palaste wrote:
TIM <ds****@hot.ee> scribbled the following:

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.


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.

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.
Nov 14 '05 #5
TIM <ds****@hot.ee> scribbled the following:
Joona I Palaste wrote:
TIM <ds****@hot.ee> scribbled the following:
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.

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.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I am looking for myself. Have you seen me somewhere?"
- Anon
Nov 14 '05 #6
TIM <ds****@hot.ee> spoke thus:
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

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by TIM | last post: by
11 posts views Thread by X-Centric | last post: by
11 posts views Thread by Tyron | last post: by
6 posts views Thread by Alexander Widera | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.