Author | Message | Time |
---|---|---|
Arthas | So, I read the thing onBnet Docs about 0x79, but I have a problem. Where it says: (DWORD) Cookie? Do I just enter in giberrish? EG: &H1 or &H0 Here's my response, that dosnt seem the work right. With pBuffer .InsertDWORD &H0 .InsertDWORD ClanTag .InsertNTString ClanCheiftain .InsertBYTE &H6 .SendPacket frmMain.sckBnet, &H79 End With I'm seriously confused about the clan tag part. How would I convert the tag to a dword? | December 17, 2003, 4:54 AM |
Spht | [quote author=Arthas link=board=17;threadid=4303;start=0#msg35931 date=1071636880] So, I read the thing onBnet Docs about 0x79, but I have a problem. Where it says: (DWORD) Cookie? Do I just enter in giberrish? EG: &H1 or &H0 Here's my response, that dosnt seem the work right. With pBuffer .InsertDWORD &H0 .InsertDWORD ClanTag .InsertNTString ClanCheiftain .InsertBYTE &H6 .SendPacket frmMain.sckBnet, &H79 End With [/quote] Since BNCS messages are handled asynchronously, a "cookie" or "query value" is needed to know which query the server is replying to. You can use whatever value you like (I suggest incrementing a tick with each sent query). The server will reply with the same "cookie" so you know which message the response is applying to so you can accurately display the necessary information. [quote author=Arthas link=board=17;threadid=4303;start=0#msg35931 date=1071636880]I'm seriously confused about the clan tag part. How would I convert the tag to a dword?[/quote] I'm not sure what you mean here. The clan's tag can be a maximum of 4 characters. The tag should already be a DWORD (32 bits), and should be handled that way interally because that is how it is handled on Battle.net. So no conversion should be needed anywhere. | December 17, 2003, 5:09 AM |
Arthas | I guess my real confusion is on how to extract the DWORD from the packet... I've been doing it the newbie way all my life, and I'd like to know the best way to extract that dword. If you could tell me that'd be swell :) Thanks, -Arthas | December 17, 2003, 6:08 AM |
Myndfyr | The DWORD is the same as using the PacketBuffer's .InsertNonNTString(String) subroutine. On Battle.net, you end up seeing a lot of backward strings that look like DWORD (or 32-bit numbers). Here's why: Battle.net was probably programmed in C or C++ with a compiler that allows them to use multi-character literals (in C-based languages, you define a string literal with double quotes, e.g., "This is a string.", whereas a character literal uses single quotes, e.g., 'A'). C strings are always terminated with a null (0x00) byte. A character literal is not, so let's say you have these two things defined in C: [code] char *ptr = "0123"; char val = '0123'; [/code] The first one would be encoded in memory like this: [code] 30 31 32 33 00 0123. [/code] The second one, as displayed, is: [code] 30 31 32 33 0123 [/code] But because of Intel byte-order, the compiler reverses it and treats it like a 32-bit integer: [code] 33 32 31 30 3210 [/code] So when you see a DWORD that seems like it should a string, that's what they mean. The VB PacketBuffer class doesn't automatically reverse your string, so if you wanted the clan tag, for example, pIsS, you'd need to call .InsertNonNTString("SsIp") Cheers, --Rob | December 17, 2003, 6:14 AM |
Arthas | With pBuffer .InsertDWORD Cookie? .InsertNonNTString StrReverse(ClanTag) .InsertNTString Trim(Cheiftain) .InsertBYTE &H6 .SendPacket frmMain.sckBnet, &H79 End With and this should work well? But it isnt... So :P - Confused. | December 17, 2003, 6:53 AM |
Arthas | Nvm, figured it out. With pBuffer .InsertNonNTString Cookie .InsertNonNTString StrReverse(Text1.text) .InsertNTString Trim(Text3.text) .InsertBYTE &H6 .SendPacket frmMain.sckBnet, &H79 End With Thanks Myndefyre :D | December 17, 2003, 6:55 AM |