I’m trying to write a plugin for an application and I’m stuck where I need to read the contents from memory and store that in a class. I’ve been given the following:
UserInfo = 0x9F9648
UserInfoSize = 0x560
That’s the location of where the content is stored and I’ve been given the following class to store it in:
class CUserInfo
{
public:
__int32 clientNum; //0x0000
__int32 Valid; //0x0004
char unknown8[4]; //0x0008
char Name[16]; //0x000C
... and some other properties
};
The problem is that I don’t know how to get the contents from the address location and store it in a class instance.
Anyone any idea how to do that??
You can use
reinterpret_cast<>to convert an integer address into a pointer to any needed type, then dereference the pointer.For example:
Of course this is dangerous practice. You should be aware of access violation and alignment errors when you try to access an arbitrary memory address.