Valhalla Legends Forums Archive | Battle.net Bot Development | [C++] DarkMinions dyn buffer

AuthorMessageTime
Okee
I've been looking at DM's DynBuffer class for awhile, and decided to try to implement it in with my bot. This is C++, btw. I copied over the header and footer files, etc, and tried testing it by building a sample 0x50 packet. When I send it to bnet, it appears the buffer isn't holding the correct data. Here's my function:

[code]
dBuf.add((int)0);
dBuf.add((int)'IX86');
dBuf.add((int)szLocalAccountInfo.szGameAbbr);
dBuf.add((int)szLocalAccountInfo.lVerByte);
dBuf.add((int)0);
dBuf.add((int)0);
dBuf.add((int)480);
dBuf.add((int)1033);
dBuf.add((int)1033);
dBuf.add("USA");
dBuf.add("United States");
SendBNCSPacket(sckBNCS, SID_AUTH_INFO);
[/code]

szGameAbbr holds the games abbreviation, in this case 'RATS', and the lVerByte holds the version byte. Now, when I packet log this packet this is how it appears...

[quote]
2  Hide  Hide  58  Send 
0000  FF 50 3A 00 00 00 00 00 36 38 58 49 80 0E 44 00    .P:.....68XI..D.
0010  CB 00 00 00 00 00 00 00 00 00 00 00 E0 01 00 00    ................
0020  09 04 00 00 09 04 00 00 55 53 41 00 55 6E 69 74    ........USA.Unit
0030  65 64 20 53 74 61 74 65 73 00                      ed States.
[/quote]

Now, it's easy to see that it's not putting 'RATS' in there. It's putting.. a D? heh. Anyone know why?
June 28, 2005, 2:00 AM
Kp
[quote author=Okee link=topic=12001.msg117824#msg117824 date=1119924040]Now, it's easy to see that it's not putting 'RATS' in there. It's putting.. a D? heh. Anyone know why?[/quote]

Yes.  You told it to put in szGameAbbr, and it did.  Hint: think about the type of szGameAbbr.
June 28, 2005, 2:03 AM
K
Well, guessing from your variable names, "szGameAbbr" is a char*. You're inserting the address of the string as an int instead of inserting the characters.

Edit -- quick response, Kp
June 28, 2005, 2:04 AM
DarkMinion
And for god's sake, at least form the packet properly.....sending constants is always a bad idea.

You're sending a constant time zone, a null IP, etc....form the packet properly.  You never know when they'll start ipbanning for not doing it...

[code]
dBuf.add((int)0); //protocol
dBuf.add((int)'IX86'); //platform
dBuf.add(dwGame); //game
dBuf.add((int)uVersion); //game version byte
dBuf.add((int)0);
struct sockaddr_in sLocalAddr;
int iLocalLen = sizeof(sLocalAddr);
getsockname(sBNET, (struct sockaddr *)&sLocalAddr, &iLocalLen);
dBuf.add((int)sLocalAddr.sin_addr.s_addr); //dword ip
TIME_ZONE_INFORMATION Tzi;
unsigned long dwResult = GetTimeZoneInformation(&Tzi);
dBuf.add(Tzi.Bias + (dwResult == TIME_ZONE_ID_DAYLIGHT ? Tzi.DaylightBias : 0)); //time zone
dBuf.add((int)GetUserDefaultLCID()); //language
dBuf.add((int)GetUserDefaultLangID());
char szBuffer[0x41];
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, szBuffer, 0x40);
dBuf.add(szBuffer);
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGCOUNTRY, szBuffer, 0x40);
dBuf.add(szBuffer);
SendPacket(SID_AUTH_INFO);
[/code]
June 28, 2005, 4:51 AM

Search