Access RAM of PC?

I would like to write a program in C++ that will be able to view the current state of a spot in the PC's actual RAM (ex. what another program has in RAM), not allocated by the program but that does exist. I'm not sure how it works, with regards to virtual memory, but is there a way to do what I want?
[313 byte] By [AberAber] at [2007-11-19 8:54:25]
# 1 Re: Access RAM of PC?
I would like to write a program in C++ that will be able to view the current state of a spot in the PC's actual RAM (ex. what another program has in RAM), not allocated by the program but that does exist. I'm not sure how it works, with regards to virtual memory, but is there a way to do what I want?Your program is not allowed to directly access another program's address space.
Siddhartha at 2007-11-9 12:05:25 >
# 2 Re: Access RAM of PC?
Your program is not allowed to directly access another program's address space.

Are you sure, that has to be possible? A lot of programs seem to be able to do it, and they haven't spawned one or the other?
AberAber at 2007-11-9 12:06:23 >
# 3 Re: Access RAM of PC?
You can use the ReadProcessMemory and WriteProcessMemory functions, if you have the needed access rights (PROCESS_VM_READ or PROCESS_VM_WRITE) to the process.
With Windows 95, all the processes can be opened with maximum access rights.
But i think that a non-root process under Windows NT can only access to processes of the same user.
SuperKoko at 2007-11-9 12:07:21 >
# 4 Re: Access RAM of PC?
You can use the ReadProcessMemory and WriteProcessMemory functions, if you have the needed access rights (PROCESS_VM_READ or PROCESS_VM_WRITE) to the process.
With Windows 95, all the processes can be opened with maximum access rights.
But i think that a non-root process under Windows NT can only access to processes of the same user.

There's got to be a way to do this. Some kind of driver maybe?
AberAber at 2007-11-9 12:08:27 >
# 5 Re: Access RAM of PC?
You can use the ReadProcessMemory and WriteProcessMemory functions, if you have the needed access rights (PROCESS_VM_READ or PROCESS_VM_WRITE) to the process.
With Windows 95, all the processes can be opened with maximum access rights.
But i think that a non-root process under Windows NT can only access to processes of the same user.These are debugging APIs - but, they may work as well: no idea. If you (OP) needs a HANDLE to the process you want to peek into: call OpenProcess.

BTW, Opening a process in no way means ability to peek into it's address space - directly.

Opening a process using OpenProcess will give you a HANDLE to the other process, which you can use with Windows to give your process information about another.

In this case, calling those APIs causes Windows to copy the memory content of another process into a buffer sent by yours.

Again, the content (of the memory) may change, and you will not know it.
(Besides, on what basis will one arrive at the addresses you want to peek at?)
Siddhartha at 2007-11-9 12:09:26 >
# 6 Re: Access RAM of PC?
I was hoping there was some way to tell which programs used what portions of memory. Looking to make a kind of aim logger.
AberAber at 2007-11-9 12:10:28 >