Okay so here is the deal, I am injecting a DLL into a target process and have it read some of it’s registers. Problem is, whenever my function is called, the size of the content I have to grab is constantly changing.
Since i can’t use vectors, how would I do it if I were to store an array of bytes for which I have no idea of the size beforehand ?
Here is my code so far, which obviously doesnt compile because of C3068.
__declspec(naked) void _LocalHandleMessage()
{
__asm {
// Here i obviously have to store the data i'm sending to HandlePaquet
sub esp, __LOCAL_SIZE
pushad
pushfd
}
{
DWORD opcode;
DWORD size;
std::vector<BYTE> packetContent;
HandlePaquet(opcode, size, packetContent, true);
}
__asm {
popfd
popad
add esp, __LOCAL_SIZE
retn
}
}
Also, I would like to be able to inject the address of a class member method into the target process, but it seems that it’s not possible, unless I didnt google enough.
About injecting address – if you are talking about hooking – yes you can, you need to modify virtual method table. You can find examples in any open source game hack.
If member method is not virtual method and doesn’t exist in vtable you need to change call opcode, or just put jmp xxxxxxxx at the begining of the method.
Look here for more details