예제 #1
0
DWORD __fastcall RecvHook(void* thisPTR, void* /* dummy */, void* param1, CDataStore* dataStore, void* param3)
{
    WORD opcodeSize = buildNumber <= WOW_MOP_16135 ? 2 : 4;
    // packet dump
    DumpPacket(SMSG, 0, opcodeSize, dataStore);

    // unhooks the recv function
    HookManager::UnHook(recvAddress, defaultMachineCodeRecv);

    // calls client's function so it can processes the packet
    DWORD returnValue = 0;
    if (buildNumber <= WOW_TBC_8606) // different prototype
        returnValue = RecvProto8606(recvAddress)(thisPTR, param1, dataStore);
    else
        returnValue = RecvProto(recvAddress)(thisPTR, param1, dataStore, param3);

    // hooks again to catch the next incoming packets also
    HookManager::ReHook(recvAddress, machineCodeHookRecv);

    if (!recvHookGood)
    {
        printf("Recv hook is working.\n");
        recvHookGood = true;
    }

    return returnValue;
}
예제 #2
0
DWORD __fastcall RecvHook_PreWOD(void* thisPTR,
                                 void* /* dummy */,
                                 void* param1,
                                 void* param2,
                                 void* param3)
{
    // 2 bytes before MOP, 4 bytes after MOP
    WORD packetOpcodeSize = buildNumber <= WOW_MOP_16135 ? 2 : 4; 

    DWORD buffer = *(DWORD*)((DWORD)param2 + 4);

    DWORD packetOcode = packetOpcodeSize == 2 ? *(WORD*)buffer // 2 bytes
                                              : *(DWORD*)buffer; // or 4 bytes

    DWORD packetSize = *(DWORD*)((DWORD)param2 + 16); // totalLength, writePos

    WORD initialReadOffset = packetOpcodeSize;
    // packet dump
    PacketDump::DumpPacket(logPath,
                           binPath,
                           PacketDump::PACKET_TYPE_S2C,
                           packetOcode,
                           packetSize - packetOpcodeSize,
                           buffer,
                           initialReadOffset);

    // unhooks the recv function
    HookManager::UnHook(recvAddress, defaultMachineCodeRecv);

    // calls client's function so it can processes the packet
    DWORD returnValue = 0;
    if (buildNumber <= WOW_TBC_8606) // different prototype
        returnValue = RecvProto8606(recvAddress)(thisPTR, param1, param2);
    else
        returnValue = RecvProto(recvAddress)(thisPTR, param1, param2, param3);

    // hooks again to catch the next incoming packets also
    HookManager::ReHook(recvAddress, machineCodeHookRecv);

    if (!recvHookGood)
    {
        printf("Recv hook is working.\n");
        recvHookGood = true;
    }

    return returnValue;
}
예제 #3
0
DWORD __fastcall RecvHook(void* thisPTR,
                          void* /* dummy */,
                          void* param1,
                          void* param2,
                          void* param3)
{
    DWORD buffer = *(DWORD*)((DWORD)param2 + 4);
    DWORD packetOcode = *(DWORD*)buffer;
    DWORD packetSize = *(DWORD*)((DWORD)param2 + 16); // totalLength, writePos

    // packet dump
    PacketDump::DumpPacket(logPath,
                           binPath,
                           PacketDump::PACKET_TYPE_S2C,
                           packetOcode,
                          packetSize - (buildNumber == WOW_CLASS_5875 ? 2 : 4),
                           buffer);

    // unhooks the recv function
    HookManager::UnHook(recvAddress, defaultMachineCodeRecv);

    // calls client's function so it can processes the packet
    DWORD returnValue = 0;
    if (buildNumber <= WOW_TBC_8606) // different prototype
        returnValue = RecvProto8606(recvAddress)(thisPTR, param1, param2);
    else
        returnValue = RecvProto(recvAddress)(thisPTR, param1, param2, param3);

    // hooks again to catch the next incoming packets also
    HookManager::ReHook(recvAddress, machineCodeHookRecv);

    if (!recvHookGood)
    {
        printf("Recv hook is working.\n");
        recvHookGood = true;
    }

    return returnValue;
}