ESP is on the stack. The stack is a pile of temporary constantly changing data. At any given time, any value on the stack may be anything and have been set by any function. All functions on the thread use the stack, and they all share it for all of their temporary data.
Imagine a pile of garbage with things constantly being added to the top and things constantly rolling down the side. At one position on the heap, at one time, you may find what you want, but it is quickly covered by something else rolling down the hill. It may appear and reappear, but it may not be at the same location, and it will always disappear.
You can not use anything on the stack for any purpose. It is garbage.
There is only one exception, that being a “CGame” class declared on the stack, or a pointer to such a class declared on the stack, as is done with Nintendo DS games. For example:
- Code: Select all
int main() {
CGame * pgGame = new CGame();
pgGame->Run();
return 0;
}
But you really need to verify yourself whether this is the case, and whether it is or not does not matter; you have no reliable way of getting the offset into the stack of the object.
L. Spiro
Our songs remind you of songs you’ve never heard.