I have dll injected into executable with a few function hooks installed. Executable has global std::map variable, declared as
std::map<int, int> g_lenMap;
I know it's address from the disassembly. I need to insert key/value pair into this map (or somehow hook ::find() function, which looks much more different for me).
However, the most obvious way doesnt work:
std::map<int,int>* g_lenMap;
g_lenMap = (std::map<int,int> *) 0x4D7480;
int result = (*g_lenMap)[100];
It throws "map/set iterators incompatible" assert. I can easily read and change other global variables/structures, but not std::map. What am I doing wrong?