Now, when I do the code above how come the Result does not show code: 0x0509b74? |
It would be a pretty useless function if you always got back from it exactly what you put in, don't you think?
Basically because I thought that the ExeBaseAddress+ExeBaseOffset equals 0x0509b74 and where to store it would be at &Result. Or is &Result just the address of where it is going to be stored? That is what I'm confused with. |
Suppose you and I each have 10 bags numbered 0 to 9. we can put anything a bag, but it can contain at most one thing. And of course, while your bag 4 may contain a brick, mine could contain nothing, or a fish, or whatever.
When you do ReadProcessMemory(), what you're telling me is "show me what you've put in bag x, so I can put it in one of my bags".
So, an exchange could go like this:
-Show me what you've put in bag 0x0509b74, so I can put it in my bag &Result.
-I don't have a bag numbered 0x0509b74. (ReadProcessMemory() may fail with an error, which you've failed to check).
-I'll put some garbage in my &Result bag.
A different exchange could go like this:
-Show me what you've put in bag 0x0509b74, so I can put it in my bag &Result.
-My bag contains a dog.
-I'll put a dog in my &Result bag. Now Result == dog.
Note that &Result is a number that identifies a bag, while Result are the contents of that bag. In this case, a dog.