PDA

View Full Version : pointers



MassacreAL
11-16-2005, 05:10 PM
just trying to make a program which will read all my RAM to my monitor. ive tried this:
#include <iostream>
using namespace std;

int main(){
char * u = new char;

for(;;){
char * a = (u--);
cout << *a;
}


return 0;}
very simply program. program makes pointer (somewhere) and then its reading from memory under this pointer. for example address in pointer is 1000, in next cycle its 999. read. next cycle 998. read.... but after short time, windows tell me some error, and i really dont know how can i go over this error.

sometimes it makes really horrible sound from pc speaker, so ive also added if(..), and instead of ugly sound from pc speaker it tells you only "beep". isnt that funny :D

MassacreAL
11-16-2005, 06:32 PM
wuhah cant wait for answer i want to make trainer to games, 1000000 money and stuff like that :)

BobtheCkroach
11-16-2005, 06:55 PM
found something here: http://www.freepascal.org/docs-html/rtl/sysutils/eaccessviolation.html

I guess that's a pascal site, but based on the fact that it says it's an IO level thing, I think it still applies.

DeathEngineer could probably tell you for sure.

I think (though I'm not 100% sure) that this is what's going on:

Windows keeps track of it's own memory...and doesn't allow applications to run into it. Basically, my guess would be that you're requesting system (kernel) RAM, and windows doesn't care for it, and lets you know that.

In other words..."I say thee NAY!"

:D

JIMINATOR
11-16-2005, 08:42 PM
you can't just go snooping around in memory. your program will have to get memory handles to the processes that it needs to explore. With programs as huge and complex as they are, memory snooping is going to be a waste of time. A debugger would do a better job. you will probably be better off looking for a trainer, where someone else has done the hard work.

BobtheCkroach
11-16-2005, 09:27 PM
Ah, JIM, you explained that so much better than I did...but it's what I meant!

Jimbo, my man, are you back for good? You're back, right Jimbo? You won't leave us again will you? :D

Nice to see ya, bud :thumbs:

SALvation
11-16-2005, 09:35 PM
You're trying to develop a game trainer? I hope your PC becomes self aware and kicks you square in the nuts.

MassacreAL
11-16-2005, 09:57 PM
well guys there is something wrong. i made and application which make array in 'new int' (hehe), but i didnt close it. then i used my first application which should read all memory, but i didnt found array created by my second application. so it means acces violation doesnt mean end of physical memory or something, but only end of memory used by current application. and i guess windows are hated culprit :mad:

and good to see you back, Jiminator :thumbs:
and games with trainers are so boring, im doing that for another reason ;)

MassacreAL
11-16-2005, 10:03 PM
yeh i know you told me i cant snoop around in memory, but...is there any way?

BobtheCkroach
11-16-2005, 10:13 PM
well guys there is something wrong. i made and application which make array in 'new int' (hehe), but i didnt close it. then i used my first application which should read all memory, but i didnt found array created by my second application. so it means acces violation doesnt mean end of physical memory or something, but only end of memory used by current application. and i guess windows are hated culprit :mad:

and good to see you back, Jiminator :thumbs:
and games with trainers are so boring, im doing that for another reason ;)

Windows isn't the "hated culprit"...it's the job of the OS (linux, mac, windows, any other) to do things like this. It's simply protecting other processing from being screwed up. Imagine if you were running a critical application - a server w/ an e-commerce checkout for instance (say e-bay)...now imagine some other application went through and deleted some of the transactions in memory, etc. Sucky deal for you!

Same thing for all apps, and for windows mem itself...you'll have massive errors if you start letting processes start screwing w/ each other's mem.

Morpheus
11-16-2005, 10:51 PM
That, and when Windows multi-tasks it moves info around in the memory, it'd be better off leaving the memory snooping to windows and people that have experience with that sort of stuff.

Death Engineer
11-17-2005, 01:20 PM
Jim and others explained things accurately. A bit scaled down version: When you start a process (an exe), that process is allocated some ammount of memory. That process is ONLY allowed to access the allocated memory (for most intents and purposes). Are there ways to access memory outside of the processes allocated memory? Yes. But as Jim said, there are better tools already built to do this than building your own C++ program.

Accessing memory from another process is called crossing a process boundary and is not as simple as just creating a pointer and assigning to a random place. Basically, you have to get permission from the OS to access the memory.

MassacreAL
11-17-2005, 01:51 PM
tnx for every explanations, esspecialy DE, Bob and Jim :thumbs:

krazy
12-01-2005, 02:01 AM
I hope your PC becomes self aware and kicks you square in the nuts.

:funny: GL Mas

JIMINATOR
12-01-2005, 05:54 AM
that process is allocated some ammount of memory. Nice spelin! :thumbs:

Speedsweeper
12-01-2005, 06:06 AM
Nice spelin! :thumbs:


DE made a spelling mistake!!!!! How is he going to live with himself? :D