Packet Senden crash?

02/21/2016 19:22 forsatus#16
Quote:
Originally Posted by WalrossGreat View Post
@forsatus
Why he should take care about this? Since he set the char* i don't see any profits from know the char size

@blackout617
Please post fully code on pastebin, with the DLLMain and the CreateThread if you can.

EDIT:
@forsatus
It's not about this, there isn't only one function that you have to call if you want send packet.
sorry i forgot to post the second part, so, full code :

Code:
DWORD sendpacketfunc = 0x052BC0C

void Send(CHAR* packet)
{
	DWORD _i32_SendPacketFunc = 0x0052BBC0;

	__asm
	{
		MOV EAX, DWORD PTR DS : [0x0068120C]
		MOV EAX, DWORD PTR DS : [EAX]
		MOV EDX, packet
		CALL sendpacketfunc
	}
}

class NostaleString
{
	private:
		CHAR* _i8_string;
		DWORD _i32_length;

	public:
		NostaleString(CHAR* _i8_string)
		{
			this->_i32_length = strlen(_i8_string);

			this->_i8_string = (CHAR*)malloc(this->_i32_length + 8 + 1);

			*(DWORD*)(this->_i8_string + 0x00) = 1;
			*(DWORD*)(this->_i8_string + 0x04) = this->_i32_length;

			memcpy(this->_i8_string + 0x08, _i8_string, this->_i32_length);

			*(this->_i8_string + this->_i32_length + 8) = '\0';
		}

		CHAR* get()
		{
			return this->_i8_string + 0x08;
		}

		DWORD length()
		{
			return this->_i32_length;
		}
};

char packettosend[50] = "say hello";
NostaleString str = packettosend;

Send(str.get());
and it work.
02/21/2016 19:42 blackout617#17
Quote:
Originally Posted by forsatus View Post
sorry i forgot to post the second part, so, full code :

Code:
DWORD sendpacketfunc = 0x052BC0C

void Send(CHAR* packet)
{
	DWORD _i32_SendPacketFunc = 0x0052BBC0;

	__asm
	{
		MOV EAX, DWORD PTR DS : [0x0068120C]
		MOV EAX, DWORD PTR DS : [EAX]
		MOV EDX, packet
		CALL sendpacketfunc
	}
}

class NostaleString
{
	private:
		CHAR* _i8_string;
		DWORD _i32_length;

	public:
		NostaleString(CHAR* _i8_string)
		{
			this->_i32_length = strlen(_i8_string);

			this->_i8_string = (CHAR*)malloc(this->_i32_length + 8 + 1);

			*(DWORD*)(this->_i8_string + 0x00) = 1;
			*(DWORD*)(this->_i8_string + 0x04) = this->_i32_length;

			memcpy(this->_i8_string + 0x08, _i8_string, this->_i32_length);

			*(this->_i8_string + this->_i32_length + 8) = '\0';
		}

		CHAR* get()
		{
			return this->_i8_string + 0x08;
		}

		DWORD length()
		{
			return this->_i32_length;
		}
};

char packettosend[50] = "say hello";
NostaleString str = packettosend;

Send(str.get());
and it work.
Yeah thanks this works now with 0x0052BBC0, but i dont understand why the other method not worked to terminate the string correctly, and i dont understand much from that class that you have posted i think its creating a char* and putting 1 and then the length and then the packet strin. Its a bit confusing and i think it will be like a little weird using a class that i dont understand what it exactly does but ok for now it works thanks :)
Should i put any credits ?
02/21/2016 19:49 forsatus#18
Quote:
Originally Posted by blackout617 View Post
Should i put any credits ?
i'm happy for you, the send function is from me, and the NostaleString is from OMG
(you can use thanks button :p)
02/21/2016 20:43 WalrossGreat#19
You can write your own simple class that using only memcpy and terminate the string with '/0', for me it works.