sendPacket
Hello! I just found your article a day ago, it's magic! Can you help me a bit? I want to hook sendPacket function, i found it, got addresses, but i don't get how to hook it properly. Can i use function for recvPacket? (Hook) and do it like:
sendPacketDW = (DWORD(_stdcall*)(DWORD, const char*, ...))DATA_SEND_ADDR;
sendPacket = (DWORD(_stdcall*)(DWORD, const char*, ...))Hook((LPVOID)sendPacketDW, testDW, HOOK_SIZE);
Also why HOOK_SIZE is 6? Should it be 6 for sendPacket too?
Also should i need to initialize SendPacketFP = DATA_SEND_SOCKET_INFO;. I think when we hook, it's value initialized, but if i'm trying to send packet by myself its empty.
Hello, yes this method should work just fine. The Hook size is set to 6 because it is the size of the instructions that are going to be overwritten by the hook (jmp instruction of 5) so when the instructions before the jmp are backed up at the hook location, they are going to be fully copied. It depends on what instructions there are before you make the hook.
For the last question I am not sure anything, the best would be to check that in a debugger :)