• Welcome to Valhalla Legends Archive.
 

War3 protocol/sid_auth_info help

Started by SteelSide, May 27, 2008, 10:53 AM

Previous topic - Next topic

SteelSide

So, uhm, .. I'm stuck at connecting. I got the verbyte alright from bnls (0x15), so I'm set for connecting to bnet, i thought.

This is what my client sends (58 bytes):
0040  ff 50 3a 00 00 00  00 00 36 38 58 49 50 58   ...P:... ..68XIPX
0050  33 57 15 00 00 00 53 55  6e 65 c0 a8 02 1b 88 ff   3W....SU ne......
0060  ff ff 09 04 00 00 09 04  00 00 55 53 41 00 55 6e   ........ ..USA.Un
0070  69 74 65 64 20 53 74 61  74 65 73 00               ited Sta tes. 

And my bot:

50 00 00 00 00 00 00 00     P . . . . . . .
36 38 58 49 33 52 41 57     6 8 X I 3 R A W
15 00 00 00 00 00 00 00     . . . . . . . .
00 00 00 00 c4 ff ff ff            . . . . . . . .
00 00 00 00 00 00 00 00     . . . . . . . .
53 57 45 00 53 77 65 64     S W E . S w e d
65 6e 00                              e n .

Now to the questions: What is that ff at the start? Is it like that for all wc3 packets?
3a is 58, so i figure that's the length, but how long is it datawise?
Why does my client send 68XI PX3W ?
Where can i find more in-depth info about the wc3 protocol? Cause the bnet docs do not mention them (what i have found anyway)

Edit: Now i made it send this instead
ff 50 3a 00 00 00 00 00     . P : . . . . .
36 38 58 49 33 52 41 57     6 8 X I 3 R A W
15 00 00 00 00 00 00 00     . . . . . . . .
00 00 00 00 c4 ff ff ff     . . . . . . . .
00 00 00 00 00 00 00 00     . . . . . . . .
55 53 41 00 55 6e 69 74     U S A . U n i t
65 64 20 53 74 61 74 65     e d   S t a t e
73 00                       s .
But server won't reply. Can you spot anything wrong with it ;)?

        sendBuffer.add((unsigned char)0xff);
sendBuffer.add((unsigned char)SID_AUTH_INFO);
sendBuffer.add((unsigned char)0x3a);
sendBuffer.add((unsigned char)0x0);

sendBuffer.add((unsigned long)0);

sendBuffer.add((unsigned char)'6');
sendBuffer.add((unsigned char)'8');
sendBuffer.add((unsigned char)'X');
sendBuffer.add((unsigned char)'I');


sendBuffer.add((unsigned char)'3');
sendBuffer.add((unsigned char)'R');
sendBuffer.add((unsigned char)'A');
sendBuffer.add((unsigned char)'W');


sendBuffer.add((unsigned long)0x15);
sendBuffer.add((unsigned long)0);
sendBuffer.add((unsigned long)0);
sendBuffer.add((unsigned long)(long)-60); // +1*-60
sendBuffer.add((unsigned long)0);
sendBuffer.add((unsigned long)0);
//sendBuffer.add("SWE\0");
//sendBuffer.add("Sweden\0");
sendBuffer.add("USA\0");
sendBuffer.add("United States\0");

Hdx

Humm, Someone didn't transfer over the protocol headders. So Here you go:
http://www.bnetdocs.org/?op=doc&did=16

Also, the format for 0x50 is as such:
http://www.bnetdocs.org/?op=packet&pid=279
Should be all the information you need.

That site has everything you need to understand the protocol.

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

SteelSide

Thanks, that's what I've been using. It could use some touchups thou, the MPQ locale ID part confuses me, as it haven't got any place in the message :>?

Hdx

Quote(DWORD) Protocol ID (0)
(DWORD) Platform ID
(DWORD) Product ID
(DWORD) Version Byte
(DWORD) Product language
(DWORD) Local IP for NAT compatibility*
(DWORD) Time zone bias*
(DWORD) Locale ID*
(DWORD) Language ID*
(STRING) Country abreviation
(STRING) Country
?
And ya, the entire site seeds touch ups, but it shouldn't be hard to figure out what everything is.

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

SteelSide

Quote from: Hdx on May 27, 2008, 02:24 PM
Quote(DWORD) Protocol ID (0)
(DWORD) Platform ID
(DWORD) Product ID
(DWORD) Version Byte
(DWORD) Product language
(DWORD) Local IP for NAT compatibility*
(DWORD) Time zone bias*
(DWORD) Locale ID*
(DWORD) Language ID*
(STRING) Country abreviation
(STRING) Country
?

And ya, the entire site seeds touch ups, but it shouldn't be hard to figure out what everything is.
Well the data format up there looks like that, but the description lower down has got it mixed up.

Oh and i really gotta start using wireshark more. The problem was not in my code, for what it was worth (after i added the bncs headers), but i sent a 4byte 01 00 00 00 instead of 1 :>

I also have some old battle.net documentation which says that pretty much all of those fields can be 0, yet the new docs don't..

Hdx

Bnet dosnt mind if the fields are 0'd But you should be using the proper values.
This is one of the simplest packets IMO. It has no crypt at all.

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

SteelSide

How about endianness? Some fields explicitly say networkbyteorder, while others don't mention it.
Are they in little endian?

Hdx

Unless otherwise stated everything is little endian.
Anything that is labeled 'network byte order' is more then likely a IP address, or a port number.
They corrospond to specific APIs that require them in diffrent formats.

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Camel

Quote from: Hdx on May 27, 2008, 02:49 PM
Bnet dosnt mind if the fields are 0'd But you should be using the proper values.
This is one of the simplest packets IMO. It has no crypt at all.

To clarify, battle.net doesn't reject 0 values because it can't accommodate for all possible languages, locations, etc. If you do not specify a recognized value, it will assume you live in the US, speak English, etc. It's best to ask the OS what these values should be, since you wouldn't want to, for example, force a Korean user of your bot to interact with Battle.net in English when it's so simple to send the correct values.