Hey all. I know this is a rather old thread but IDK where else to post so whatever. I'm having some issues detour the packet funcion, here's the code. Note I'm using Sinners DetourXS.
I'm not familiar with fastcall hooks, so any help would be nice! Thanks.
Code:
/*
void __fastcall sub_A82A50(int a1, int a2, signed int a3)
call example
.text:00C37B8E mov edx, 0Ah
.text:00C37B93 mov ecx, eax
.text:00C37B95 call sub_A82A50
*/
typedef VOID (__thiscall *tPacketEncrypt)(VOID* pThis, int bufferSize, VOID* pBuffer, VOID* pTargetBuffer);
tPacketEncrypt oPacketEncrypt;
VOID __fastcall m_PacketEncrypt(VOID* pThis, VOID* Unused, int bufferSize, VOID* pBuffer, VOID* pTargetBuffer)
{
// note EDX, ECX, *
// use inline asm ???
return oPacketEncrypt( pThis, bufferSize, pBuffer, pTargetBuffer );
}
void init_hooks()
{
// todo: sig scans
oPacketEncrypt = (tPacketEncrypt)DetourCreate( (void*)0x00A82A50, m_PacketEncrypt, DETOUR_TYPE_JMP, 0x5 );
}
This code crashes almost instantly and brings up the send report dialog.