typedef Packet* (__fastcall* RakPeer_Receive)(void*);
RakPeer_Receive fpReceive = NULL;
Packet* __fastcall HOOK_RakPeer_Receive(void* pRakPeer) {
Packet* packet = fpReceive(pRakPeer);
if (packet != nullptr && packet->data) {
// your code
}
return packet;
}
MH_CreateAndEnableHook(dwSampModule + 0x31180, &HOOK_RakPeer_Receive, reinterpret_cast<LPVOID*>(&fpReceive))