Well, I think this has passed from a coffee chat since I cant fix this f*** sh**
@DarkstaR you told me by chat that I should do this to make it work
1)Freeze tibia's main thread
2)Change the thread's instruction pointer to the address of my cave code
3)Storing orginal data
4)Resume thread
5)After returning from the call, inside my code cave I have to restore the original data
6)Change the instruction pointer to the original location
It sounds perfectly logic, but my code makes it in a different way and I'd like to know whats the difference
I do: (for packet sending)
1) Freeze tibia's main thread
2) Save OutgoingDataLen and AutgoingDataBuffer
3)Write new len and buffer values
4)Create a new thread and ejecute my code cave in it
5)Restore old Len and Buffer values
6)Resume main thread
(this makes tibia crash after many executions)
So, my questions are:
If I open a new thread inside tibia process the new thread and the main thread share the registers or if I modify a register in the new thread it won't modify in the main thread?
(If the register are shared)Then it means that I have to copy and restore every register that SendOutgoinPacket touchs? If so why in't allready that in TibiaSocket's code?
Thanks!!