C# Pointers to other application's memory [duplicate]
Possible Duplicate:
How to access structure in other program's memory?
Hello. I want to access another application memory. I'm writing game hack (Don't worry, it's only for single-player mode). I have found pointer to player structure in game's memory.
I don't want to use pInvoked ReadProcessMemory because I want to be able to read individual structure's field. I know address in game's memory where is array of player structs.
Using pInvoked ReadProcessMemory is not very practical in this case.
How can I use C#'s unsafe pointers to map other processes memory as struct? Or if it's not possibe to use direct pointers, what would be the way of using readPrcessMemory?
I want in the end to be able to so sth like that.
player is some kind of class representing struct in memory. Players is some kind Collection of players.
foreach(player guy in Players)
{
DrawESP(guy.X, guy.Y, guy.Z);
}
You cannot simply recompile from memory like that.
Create the object's structure in your own application (class/struct/etc) and use ReadProcessMemory to read in the appropriate bytes, then intepret those bytes in such a way as to fill your structure.
If you're not familiar with using pointers in such a manner, I would politely suggest writing trainers is not for you and you need to do some reading first.
I'd suggest learning to write trainers in C++, it's significantly easier to think in terms of 'unsafe' code that way.
Two options:
- ReadProcessMemory
- Load a DLL into the remote process, that DLL can then access memory directly using unsafe pointers.
精彩评论