Register for your free account! | Forgot your password?

You last visited: Today at 18:08

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Packet Info.

Discussion on Packet Info. within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old 01/19/2010, 23:05   #16
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
Quote:
Originally Posted by Kiyono View Post
So what would be the correct way of doing it since it looks pretty much the same as your example.

//edit I think that I see what the problem is, uint uses 4 bytes making it 22 bytes total while it was stated before that 20 was the max causing the 2 leftover bytes to be dumped into invalid memory.
This means that ushort had to be used cause that uses 2 bytes which would end up at 20, correct?
Here's an example of how it -should- be done, though this adds another layer ontop of what I do seeing I never do the conversion to a byte[]

Code:
/* extra function which I -don't- use, I use the pointer */
byte[] SafeArray(void* lpMemory, int Size)
{
	byte[] Safe = new byte[Size];
#ifdef _MEMCPY_SUPPORTED_
	fixed (byte* lpSafe = Safe)
		memcpy(lpSafe, lpMemory, Size);
#else
	byte* lpbMemory = (byte*)lpMemory;
	for (int i = 0; i < Size; i++)
		Safe[i] = lpbMemory[i];
#endif
        return Safe;
}

// ....

struct SimplePacket
{
	public ushort Size;
	public ushort Type
	public int Value;
}

// ....
SimplePacket simple = new SimplePacket();
simple.Size = (ushort)sizeof(SimplePacket);
simple.Type = 0x666;
simple.Value = 69;
return SafeArray(&simple, simple.Size);
InfamousNoone is offline  
Old 01/20/2010, 10:07   #17


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by Kiyono View Post
So what would be the correct way of doing it since it looks pretty much the same as your example.

//edit I think that I see what the problem is, uint uses 4 bytes making it 22 bytes total while it was stated before that 20 was the max causing the 2 leftover bytes to be dumped into invalid memory.
This means that ushort had to be used cause that uses 2 bytes which would end up at 20, correct?
Close, in atual fact nothing from the uint would be put into the byte array, since the byte array is of length 20, only values from 0 -> 19 are valid entries, so if you started at offset 20 you would already be outside the array, however your correct in that it would be dumped into invalid memory.

If we started at Offset 18 then only a ushort or smaller would fit because it would populate byte[18] & byte[19], which would be the last 2 values in the array.
Korvacs is offline  
Thanks
1 User
Old 01/20/2010, 12:03   #18
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
Thanks that helped me understand pointers a bit more.
~Yuki~ is offline  
Old 01/20/2010, 18:49   #19

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
Quote:
Originally Posted by InfamousNoone View Post
Here's an example of how it -should- be done, though this adds another layer ontop of what I do seeing I never do the conversion to a byte[]

Code:
/* extra function which I -don't- use, I use the pointer */
byte[] SafeArray(void* lpMemory, int Size)
{
	byte[] Safe = new byte[Size];
#ifdef _MEMCPY_SUPPORTED_
	fixed (byte* lpSafe = Safe)
		memcpy(lpSafe, lpMemory, Size);
#else
	byte* lpbMemory = (byte*)lpMemory;
	for (int i = 0; i < Size; i++)
		Safe[i] = lpbMemory[i];
#endif
        return Safe;
}

// ....

struct SimplePacket
{
	public ushort Size;
	public ushort Type
	public int Value;
}

// ....
SimplePacket simple = new SimplePacket();
simple.Size = (ushort)sizeof(SimplePacket);
simple.Type = 0x666;
simple.Value = 69;
return SafeArray(&simple, simple.Size);
Well thanks for the example.
Quote:
Originally Posted by Korvacs View Post
Close, in atual fact nothing from the uint would be put into the byte array, since the byte array is of length 20, only values from 0 -> 19 are valid entries, so if you started at offset 20 you would already be outside the array, however your correct in that it would be dumped into invalid memory.

If we started at Offset 18 then only a ushort or smaller would fit because it would populate byte[18] & byte[19], which would be the last 2 values in the array.
Well I was close enough but here's another question, your example (previous page) looks really different from Hybrid's example, it there a reason for that or is your example "simplified"?
Kiyono is offline  
Old 01/20/2010, 19:43   #20


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by Kiyono View Post
Well thanks for the example.

Well I was close enough but here's another question, your example (previous page) looks really different from Hybrid's example, it there a reason for that or is your example "simplified"?
My example is a straight up pointer to a byte array, hybrid places values into a structure, thats the main difference.
Korvacs is offline  
Old 01/20/2010, 22:31   #21
 
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
LOTF does packet building fine - all the packets are allocated correctly, if it was wrong you wouldn't get spontaneous exceptions, your program would most likely crash the first time you built in invalid packet.
You wouldn't get a memory leak, it's an access violation.

LOTF's instability is in it's socket system and MySQL connection handling.
_tao4229_ is offline  
Reply


Similar Threads Similar Threads
[Info] XPI (Packet editor) & HS Bypass + MSCRC Bypass for sale!
02/06/2010 - MapleStory Trading - 0 Replies
Irwin(x0r from CEF) from GGCRCBYPASS.com is selling a packet inspector, and will include: MapleStory CRC bypass A generic HackShield bypass(I assume that it'll work for games such as Combat Arms, Mabinogi, Dungeon Fighter, Poptag, etc..) NOTE : Both XPI and the MsCRC bypass should work with other versions of MapleStory like EMS, MSEA, etc. The HackShield bypass should work with other games such as Combat Arms, Dungeon Fighter, Poptag, and Mabinogi. Lifetime updates(as long as he's able...
[question] Packet 0x3b, picking drop. Info about number
01/24/2010 - Kal Online - 9 Replies
Hello, I want to have the item structure with info about amount etc. When I pick up drop and I've already own this kind of item (all countable items) the packet 3b is sent to client when sent pick packet to server. Those packets looks like: ------- size hd ????? ev hh num Recv - 07003b c378 5f 02 da Recv - 07003b b17c 5f 02 db Recv - 07003b 6572 5f 02 dc
[NEED INFO]Packet Editing
10/05/2007 - Dekaron - 3 Replies
i would like to get started on how to packet edit. i know that the packets sent from 2moons server is encrypted. i wanna learn how to decrypt them, edit them, and resend them. anyone that has sites, ideas, or tuts please reply. thanks much. P/S: i know that wpe pro is detectable by gg...i'm trying other options out there.



All times are GMT +2. The time now is 18:09.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.