only with my receiving code
Packet* packet =NULL;
unsigned char packetIdentifier;
packet = m_pRakClient->Receive();
if(packet )
{
packetIdentifier = packet->data[0];
Log("server response %d", packetIdentifier);
}
Packet struct
struct Packet
{
/// Server only - this is the index into the player array that this playerId maps to
PlayerIndex playerIndex;
/// The system that send this packet.
PlayerID playerId;
/// The length of the data in bytes
/// \deprecated You should use bitSize.
unsigned int length;
/// The length of the data in bits
unsigned int bitSize;
/// The data from the sender
unsigned char* data;
/// @internal
/// Indicates whether to delete the data, or to simply delete the packet.
bool deleteData;
};
Now the problem comes from accessing packet->data[0], whenever it tries to access it, the program crashs
i went through OllyDbg and debugged it, but it seems that it access the wrong offset
What should be:
mov edx, eax (packet pointer returned by the Receive func) mov ebx, [eax + 14] (data pointer located at 0x14) mov al, [ebx] (the packetIdentifier)
The code goes like:
mov edx, eax (packet pointer returned by the Receive func (correct)) mov ebx, [eax + 10] (it access the length int value instead of data, so ebx = 64) mov al, [ebx] (crash happens (cant do [64]))
i've even tryed to do it that way:
unsigned char *data = *(unsigned char **)packet->data; packetIdentifier = data[0];
but now it goes to [eax + 1A4]
PS: nothing wrong with the packet structure, the Receive function access the "packet->data[0]" and by debugging it, it access the right (0x14) offset
so what do you think ? why does it compiles that way from here, some kind of memory leak ?
Thanks in advance

New Topic/Question
Reply



MultiQuote




|