I am trying to "hack" a game (Red Alert 3), I try to make a program which shows the unit list of my opponents. As for that I first need to find a (static) pointer to my own list which I can do on single player.
I have noticed this behaviour: (by looking at which addresses are changed by the add_unit code):
- if a units hasn't been build yet, create a new address for it (random?) and set the value to 1 (amount of units of that type)
- when the unit has been already build once in the game, increment the original address of the unit type by 1
This looks to me like std::vector behaviour. Now I am having trouble to find the "base" address of the vector, and a bigger problem: How would I access by index? Where does a std::vector store it's addresses it has for elements?
Extra info:
The code is (from what I have read from the assembly) compiled with MS Visual C++ 2005 (MSVCR80 dll's are required to play)
This is what the addresses in the vector look like:
(The highlighted address is the one which appeared as the first element - first unit build)
This doesn't look like I could iterate by adding a constant value?
Whenever a new address is added, all the other addresses are perfectly valid and don't change.
A typical (though by no means mandatory) implementation of
vector
is to have three consecutive words:Element access is done via
start[i]
(which is why it's important to have thestart
pointer at the front, to avoid unnecessary offset computations), size isend - start
, and capacity iscapacity - start
. Memory allocation obtainsc * sizeof(T)
bytes and setsstart
to the address of the allocated memory andcapacity
tostart + c
. Element construction incrementsend
.