From what you say it seems that you have some confusion about how a modern OS manage memory.
First of all I suggest you to read
this[
^] and
this[
^] to clarify the basics (in an actual OS the memory is virtual and each executable generally is allocated on the same standard virtual address 0x400000).
When you'll have more clear ideas you can start from
OpenProcess()[
^] function. From this, if you have enough privileges, you can obtain an handle to the process. With this handle you can access the process resources, memory is one of them. Use function
ReadProcessMemory()[
^] function.
These functions are typically used in debuggers to access debugging process memory, the locations to read to inspect variables are obtained from debug info's using the functions from
dbghelp[
^] library.
Good luck! ;)
P.S. It should be clear that whichever address you read through ReadProcessMemory() you are reading data at the specified
logical address inside the process, not a physical global memory address.