Код:
// Hook Bind for Ex Packets VirtualProtect((LPVOID)0x460547, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect);
bCacheD = (BYTE *)0x460547;
*bCacheD = 0xE9;
bCacheD++;
*(DWORD *)bCacheD = ((DWORD)ExBindHook - (0x460547 + 5));
VirtualProtect((LPVOID)0x460547, 5, dwOldProtect, &dwOldProtect);
// Hook to bind the rest of Ex Packets
VirtualProtect((LPVOID)0x4FFB8C, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect);
bCacheD = (BYTE *)0x4FFB8C;
*bCacheD = 0xE8;
*(DWORD *)bCacheD = ((DWORD)BindExPackets - (0x4FFB8C + 5));
VirtualProtect((LPVOID)0x4FFB8C, 5, dwOldProtect, &dwOldProtect);
// Hook RequestExPacket
VirtualProtect((LPVOID)0x466748, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect);
bCacheD = (BYTE *)0x466748;
*bCacheD = 0xE9;
bCacheD++;
*(DWORD *)bCacheD = ((DWORD)RequestExPacketHook - (0x466748 + 5));
VirtualProtect((LPVOID)0x466748, 5, dwOldProtect, &dwOldProtect);
Код:
bool BindExPackets(int id, Callback func){
guard(L"bool BindExPackets(int id, Callback func)", BindExPackets);
ExBind(id, func); // 0x23 - RequestLoadPledgeSiegeKillDeathCount
ExBind(0x24, ExtPacket01);
unguard;
return true;
}
Код:
?RequestExPacketHook@@YAXXZ PROC
cmp ecx, 37h
ja InvalidId
mov ecx, ExPacketTable[ecx*4]
jmp short FnEnd
InvalidId:
mov ecx, 45DFB0h
FnEnd:
mov edx, [esp+1Ch]
push eax
push edx
call ecx
mov esi, [esi+8]
mov ecx, [esp+14h]
add esp, 8
add dwFuncCountTable[esi*4], 0FFFFFFFFh
pop esi
mov fs:[0], ecx
add esp, 14h
retn
?RequestExPacketHook@@YAXXZ ENDP
Credits: Kryptr