Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
491 B
2
Indexable
Never
BYTE* get_struct(ENetPacket* packet) {

	const unsigned int packetLenght = (unsigned int)packet->dataLength;

	BYTE* result = nullptr;
	if (packetLenght >= 0x3C) {
		BYTE* packetData = packet->data;
		result = packetData + 4;
		if (*static_cast<BYTE*>(packetData + 16) & 8) {
			if (packetLenght < (unsigned int)*reinterpret_cast<int*>(packetData + 56) + 60)
				result = nullptr;
		}
		else {
			int zero = 0;
			memcpy(packetData + 56, &zero, 4);
		}
	}
	return result;
}
Leave a Comment