I acctualy tried that but I didn't figure how to add asm at the very end of my function if I use __asm{} im myFunction() the compiler will add asm code between my asm code and the ret statment and won't work
I mean:
Code:
void __stdcall myFunction()
{
// This function will be called when tibia calls sendpacket I deliver the packet info to the loader via file mapping
*(DWORD*)((LPVOID)(&((CHAR*)filePointer)[1])) = *SendStreamLength; //write the data len in 2nd byte (four bytes)
memcpy((LPVOID)(&((CHAR*)filePointer)[5]), SendStreamData, *SendStreamLength); //write the data buffer in 5th byte (sendStreamLenght bytes)
*(BYTE*)filePointer = 1; //inticates to the loader there's been an update, loader must set this byte to 0 after reading
__asm
{
//asm code to put back the replace asm
}
}