473,231 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Programms memory adress location access?

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.
Jul 22 '05 #1
11 1559
TIM wrote in news:40**********@news.estpak.ee in comp.lang.c++:
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.


Alas Standard C++, has nothing to say about accesing data or code
in *other* programmes.

You should ask this in a windows programming newsgroup say:

comp.os.ms-windows.programmer.win32

<off-topic>

You should IMO rethink your question, what you ask above can only
really be done by a debugger, which will require a programme
compiled with debuging information, if this is what you want to
do ask about it directly, also such things are not only os specific
but compiler specific, so ask in a newsgroup that supports your
compiler.

Some terms you might want to google up on:

IPC - Inter Process Communications
RPC - Remote Procedure Calls
COM - Component Object Model (win32 /mostly/)

</off-topic>

HTH.

Rob.
--
http://www.victim-prime.dsl.pipex.com/
Jul 22 '05 #2
TIM wrote in news:40**********@news.estpak.ee in comp.lang.c++:
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.


Alas Standard C++, has nothing to say about accesing data or code
in *other* programmes.

You should ask this in a windows programming newsgroup say:

comp.os.ms-windows.programmer.win32

<off-topic>

You should IMO rethink your question, what you ask above can only
really be done by a debugger, which will require a programme
compiled with debuging information, if this is what you want to
do ask about it directly, also such things are not only os specific
but compiler specific, so ask in a newsgroup that supports your
compiler.

Some terms you might want to google up on:

IPC - Inter Process Communications
RPC - Remote Procedure Calls
COM - Component Object Model (win32 /mostly/)

</off-topic>

HTH.

Rob.
--
http://www.victim-prime.dsl.pipex.com/
Jul 22 '05 #3
TIM wrote:
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.


Sorry, there's no standard way to do this in C++. Try asking in a
Windows group.
Jul 22 '05 #4
TIM wrote:
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.


Sorry, there's no standard way to do this in C++. Try asking in a
Windows group.
Jul 22 '05 #5
TIM wrote:
for example i have one simple programm

int main()
{
int test = NULL;
NULL is undeclared (and if it were defined the usual way, it would be
very strange to assign it to an int).
while(1){
printf("%d\n",test);
getch();
Neither of these functions are declared, so this should not compile.
test++;
This will eventually overflow, giving undefined behavior.
}
return 0;
}


-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #6
* Kevin Goodsell <us*********************@neverbox.com> schriebt:
int test = NULL;


NULL is undeclared (and if it were defined the usual way, it would be
very strange to assign it to an int).


Uhm, Kevin, this is [comp.lang.c++] you're replying in. I agree that it
is strange to use NULL in such a context, but in C++ the strangeness does
not flow from the definition of NULL, which is required to be 0 (unfortunate
in my opinion, but that's the way it turned out in the standards battle). In
C++ the strangeness flows only from convention and perhaps aesthetics.

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #7
Alf P. Steinbach wrote:
* Kevin Goodsell <us*********************@neverbox.com> schriebt:
int test = NULL;


NULL is undeclared (and if it were defined the usual way, it would be
very strange to assign it to an int).

Uhm, Kevin, this is [comp.lang.c++] you're replying in. I agree that it
is strange to use NULL in such a context, but in C++ the strangeness does
not flow from the definition of NULL, which is required to be 0 (unfortunate
in my opinion, but that's the way it turned out in the standards battle). In
C++ the strangeness flows only from convention and perhaps aesthetics.


Yes, what I said wasn't really what I meant. What I meant was that
'NULL' could be some identifier that the OP created, e.g.

int NULL = 7;

In which case the code wouldn't be completely weird (though using NULL
as an identifier declared in your program is probably a bad idea, since
it is likely to conflict with the standard NULL).

If, on the other hand, the NULL in question was supposed to be the
standard NULL, then it's strange to use it with ints, since it is
intended to represent a null pointer.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #8
On 2004-04-11, Alf P. Steinbach <al***@start.no> wrote:
* Kevin Goodsell <us*********************@neverbox.com> schriebt:
> int test = NULL;


NULL is undeclared (and if it were defined the usual way, it would be
very strange to assign it to an int).


Uhm, Kevin, this is [comp.lang.c++] you're replying in. I agree that it
is strange to use NULL in such a context, but in C++ the strangeness does
not flow from the definition of NULL, which is required to be 0 (unfortunate
in my opinion, but that's the way it turned out in the standards battle). In
C++ the strangeness flows only from convention and perhaps aesthetics.


I thought NULL is platform dependend.. At least Bjarne Stroustrup writes
so.

Best Regards,
Radek.

--
"Oceniaj± mnie, choć wcale mnie nie znaj±. Dlatego jestem sam"
Shrek
email: sad<at>rpg<kropka>pl JID: ra****@jabber.atman.pl
Jul 22 '05 #9
Radosław Grzanka wrote:

I thought NULL is platform dependend.. At least Bjarne Stroustrup writes
so.


NULL expands to an implementation-defined null pointer constant. But
that's a very narrow category -- it must be an integer constant
expression with the value 0. So it could be (1 - 1) or (!!!!!!!1), but
realistically you are unlikely to find NULL defined as something other
than 0 or 0L (or something very similar).

You might be confusing NULL (a standard macro) and null pointer
constants with the concept of a pointer that is null. A null pointer
constant (such as NULL, or 0) when converted to a pointer, gives a null
pointer. The representation used for a null pointer is undefined, so
could vary from system to system. In other words, a pointer to address 0
may or may not be a null pointer, but an integer constant expression
with the value 0, when converted to a pointer, must be translated to a
null pointer (even if that means that it becomes something like 0xFF00FF00).

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #10
TIM
Kevin Goodsell wrote:
TIM wrote:
for example i have one simple programm

int main()
{
int test = NULL;

NULL is undeclared (and if it were defined the usual way, it would be
very strange to assign it to an int).
while(1){
printf("%d\n",test);
getch();

Neither of these functions are declared, so this should not compile.
test++;

This will eventually overflow, giving undefined behavior.
}
return 0;
}


-Kevin

LOL i just havent written here include files
#include <iostream>
#include <conio.h>
there is all declarations(and will compile without a problem), but
anyway thats not the question i aksed.
thx.
i just wanted to make programm such ARTMOBNEY if you heard of it...
Jul 22 '05 #11
TIM wrote:

LOL i just havent written here include files
#include <iostream>
#include <conio.h>
there is all declarations(and will compile without a problem), but
anyway thats not the question i aksed.


When posting code you should always post the *complete* code (check the
FAQ, section 5 for a more detailed discussion of how to post code). It
looks like your question was already answered. I was just commenting on
the problems with the code you posted.

For future reference <conio.h> is not standard C++, so you should not
use it in portable programs or include it in code posted here.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: hall | last post by:
I have a question regarding where memory is allocated when arrays are created. I'll illustrate this by example. I may be wrong on some details, do feel free to correct me. The code piece: int...
2
by: shyamal | last post by:
I want to display memory content using C++ on LINUX. For example, the user may ask to display 256 bytes from 0x1000ff00. The problem is , if any location is invalid, the program will coredump...
1
by: Riadh Elloumi | last post by:
Hi, I have some problems when debugging memory allocation (for both malloc and new) in a program that uses standard lists and vectors. When I add an element to the vector, the overloaded...
11
by: TIM | last post by:
for example i have one simple programm int main() { int test = NULL; while(1){ printf("%d\n",test); getch(); test++; }
10
by: fabio de francesco | last post by:
Hi what do you think of the following? Why are we permitted to do that? And why the C++ Library doesn't stop someone willing to perfom that assignement (*a = 20)? #include <iostream> ...
6
by: TIM | last post by:
for example i have one simple programm int main() { int test = NULL; while(1){ printf("%d\n",test); getch(); test++; }
10
by: s.subbarayan | last post by:
Dear all, I happen to come across this exciting inspiring article regarding memory leaks in this website: http://www.embedded.com/story/OEG20020222S0026 In this article the author mentions:...
3
by: iwdu15 | last post by:
hi, this might b getting a bit too...low level but how can i check to see if a certain memory address holds a charge? -- -iwdu15
0
by: MichK | last post by:
Hi, I have a problem with passing a pointer in visual basic. The thing is I receive an array address of a certain API I call in visual basic. There is no value passed, just an address in the...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.