void my_SendChat (const void **s1, const bool s2, const char **s3) { // GameType::c2sSendChat(bool global, StringPtr message) // get the stack pointer asm("movl %ebp, o_esp"); // Execute payload ChatHandler(s2, s3); // 1. correct frame pointer // 2. push s1 and s2 on stack // 3. push old_String + n bytes on stack // 4. ret // prolog of my_SendChat asm("sub $0x8,%esp"); asm("mov 0xffffffe8(%ebp),%ebx"); asm("leave"); // execute head of original function asm("push %ebp"); asm("mov %esp, %ebp"); asm("push %ebx"); asm("sub $0x64, %esp"); asm("mov 0x0C(%ebp), %eax"); // jmp back to original function asm("mov o_SendChat, %eax"); asm("push %eax"); asm("ret"); }