• Welcome to Valhalla Legends Archive.
 

What do i do next?

Started by BaDDBLooD, March 04, 2004, 11:07 PM

Previous topic - Next topic

ChR0NiC

#15
Quote from: BaDDBLooD on March 06, 2004, 05:01 PM
nm, i don't send 0x25

So i don't NEED to Respond to 0x25, but i need to Recieve it?

Well once you send 0x50, you will first receive 0x25 then 0x50.
It is not essential to respond to 0x25 but you always receive it whether you like it or not. It is essential to respond to 0x50 otherwise you won't connect.

Instead of making....2nd posts just edit your post please....

Perhaps we should talk on AIM or MSN because this is filling up the forum and I'm sure it would be appreciated if we kept this off the forums, because I am basically holding your hand through the BNET connection.

Eric

#16
Quote from: BaDDBLooD on March 06, 2004, 08:30 PM
Forum admin's, you can Remove this topic now ;p

Admin's don't delete topics that could provide someone with help later on, but since not many people know how to use or even where to find the 'Search' button, it won't help much in a month or so.

ChR0NiC

No offense to badd blood, but it seems like he is on purposely posting alot of replies instead of editing on purpose in order to increase his number of posts. Well, not that I even give a !@$&, but it's something I noticed.  ;D

UserLoser.

Quote from: ChR0NiC on March 06, 2004, 04:10 PM
Quote from: BaDDBLooD on March 06, 2004, 03:56 PM
k, What do i send to Tell Bnet what i am using, game, chat, or ftp?

And can i get a "Layout" for 0x50.. BNETDOC's Doesn't explain it very well, in my opinion that is...

Form1.WinsockBNET.SendData Chr(1) is using Game, I have not done Chat or FTP, but I am guessing they are similar.

0x50 is quite simple, but I won't do it for you.

(DWORD)       Protocol ID (0)
(DWORD)       Platform ID
(DWORD)       Program 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

I can TRY walk you through this.....

BNET's protocol ID = SID_NULL or in VB terms &H0
Platform ID = A DWORD specifying the client's platform (Macintosh, PC, etc).  "6X8I" is usually used for this and the Program ID is your product EG: "PXES"
Version Byte =  the verbyte which you retrieved from BNLS using a DWORD.
Product language = can be ignored by using SID_NULL (&H0)
Local IP for NAT compatibility* = can be ignored by using SID_NULL (&H0
Time zone bias* = can be ignored by using SID_NULL (&H0)
Locale ID* = can be ignored by using SID_NULL (&H0)
Language ID* = can be ignored by using SID_NULL (&H0)
Country abreviation = "USA" or the country of your choice's abbreviated
Country = "United States" or the country of your choice.
Then  of course you once you combine all the data together you send it with the Packet ID of 0x50.
Buffer.SendPacket &H50

well.....I said I wouldn't do it for you, but it looks like I pretty much did lol....
There are ways to to do Time Zone, Locale ID, Language ID and other ones, but since you are just trying to get connected there is no use on trying to figure those out until you learn more.

You seem to be confused on what exactly SID_NULL is

Adron

SID_NULL is obviously a different version of the C/C++ NULL value, suitable for use in battle.net applications. You have to use the right one always.

BaDDBLooD

#20
Yeah... now i have a new problem

Parse BNET:



Public Sub ParseBNET(data As String)

Dim PacketID As String
   PacketID = Asc(Mid(data, 2, 1))

Select Case PacketID
   
   Case &H25
       With buffer
           .InsertNonNTString Mid(data, 5, 4)
           .SendPacket &H25
       End With

   Case &H50
       Servers = Val("&h" & StrToHex(StrReverse(Mid(data, 9, 4))))
       MPQName = Mid(data, 25, 12)
       ExeHash = Mid(data, 38, Len(data) - 2)
       MPQName2 = Val(Mid(MPQName, 8, 1))
           With buffer
               .InsertDWORD GetBNLSByte()
               .InsertDWORD CLng(MPQName2)
               .InsertNTString ExeHash
               .SendBNLSPacket &H9
           End With
           
   Case &H51
       Select Case GetWORD(Mid(data, 5, 2))
       
           Case &H0
               AddChat vbGreen, "BNET: ", vbYellow, "Version and CDKeys Passed."
               
           Case &H101
               AddChat vbRed, "BNET: ", vbYellow, "Incorrect Game Version."
               
           Case &H200
               AddChat vbRed, "BNET: ", vbYellow, "Incorrect Cdkey(s)"
               
           Case &H100
               AddChat vbRed, "BNET: ", vbYellow, "Incorrect Game Version"
               
           Case &H203
               AddChat vbRed, "BNET: ", vbYellow, "Incorrect Cdkey for this product."
               
           Case &H202
               AddChat vbRed, "BNET: ", vbYellow, "Current Cdkey is banned from battle.net"
               
           Case &H201
               AddChat vbYellow, "BNET: ", vbYellow, "Current cdkey is in use by: " & Mid(data, 9, Len(data) - 9)
               
       End Select

   End Select

End Sub



PACKET: 0x50



Public Sub Packet0x50()

With buffer
   .InsertDWORD &H0
   .InsertNonNTString "68XI" & Product()
   .InsertDWORD VerByte
   .InsertDWORD &H0
   .InsertDWORD &H0
   .InsertDWORD &H0
   .InsertDWORD &H0
   .InsertDWORD &H0
   .InsertNTString "USA"
   .InsertNTString "United States"
   .SendPacket &H50
End With

AddChat vbGreen, "BNET: Sent Packet: 0x50!"
   
End Sub



PACKET: 0x51



Public Sub Packet0x51()

AddChat vbGreen, "BNET: ", vbYellow, "Sending.. Cdkey, Checksum, Version..."

With buffer
   .InsertDWORD Token
   .InsertDWORD ExeVersion
   .InsertDWORD ExeChecksum
   .InsertDWORD &H1
   .InsertDWORD &H0
   .InsertNonNTString CdkeyHash
   .InsertNTString ExeInfo
   .InsertNTString BnetBot.Username
   .SendPacket &H51
End With

AddChat vbGreen, "BNET: Sent Packet: 0x51"
   
End Sub



Parse BNLS:



Public Sub ParseBNLS(data As String)

Select Case Asc(Mid(data, 3, 1))
   
       Case &HE
           AddChat vbYellow, "BNLS: Sending Authorization"
           Dim key As Long, key2 As Long
               key2 = GetDWORD(Mid(data, 4, 4))
               key = BNLSChecksum("Secret", key2)
                   With buffer
                       .InsertDWORD key
                       .SendBNLSPacket &HF
                   End With
                       
       Case &HF
           AddChat vbGreen, "BNLS: Autorization Accepted"
           With buffer
               .InsertDWORD GetBNLSByte()
               .SendBNLSPacket &H10
           End With
       
       Case &H10
           VerByte = GetDWORD(Mid(data, 8, 4))
           Main.WinsockBNET.Close
           Main.WinsockBNET.Connect BnetBot.Server, 6112
           AddChat vbYellow, "BNET: Connecting To Server: " & BnetBot.Server & ":6112"
           
       Case &H9
           ExeVersion = Val("&H" & StrToHex(StrReverse(Mid(data, 8, 4))))
           ExeVersion = CLng(ExeVersion)
           ExeChecksum = Val("&H" & StrToHex(StrReverse(Mid(data, 12, 4))))
           ExeChecksum = CLng(Checksum)
           ExeInfo = Mid(data, 16, Len(data) - 16)
               With buffer
                   .InsertDWORD Servers
                   .InsertNTString BnetBot.Cdkey
                   .SendBNLSPacket &H1
               End With
           
       Case &H1
           CdkeyHash = Mid(data, 12)
           Token = Val("&H" & StrToHex(StrReverse(Mid(data, 8, 4))))
           Token = CLng(Token)
           Packet0x51
       
   End Select
   
End Sub



DECLARES:



Public buffer As New PacketBuffer
Public Version As String
Public VarProduct As String
Public VerByte As Long
Public MPQName As String
Public MPQName2 As Long
Public ExeInfo As String
Public ExeVersion As Long
Public ExeHash As String
Public Token As Long
Public Servers As Long
Public ExeChecksum As Long
Public CdkeyHash As String





Public Type BotData
   Username As String
   Password As String
   HomeChannel As String
   Cdkey As String
   Server As String
   BNLSServer As String
   Product As String
End Type
Public BnetBot As BotData



I Get a Invalid Game Version Response from 0x51... not sure what is wrong!



There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

MyndFyre

What are you sending as the game version, and for which product?
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

BaDDBLooD

#22
i am sending RATS, for starcraft..



Private Function Product() As String

Select Case BnetBot.Product

   Case "0"
       Product = "RATS"
   Case "1"
       Product = "PXES"
   Case "2"
       Product = "NB2W"
   Case "3"
       Product = "VD2D"
   Case "4"
       Product = "PX2D"
   Case "5"
       Product = "3RAW"
End Select

End Function





Public Function GetBNLSByte() As Long
Select Case BnetBot.Product
   Case "0"
       GetBNLSByte = &H1
   Case "1"
       GetBNLSByte = &H2
   Case "2"
       GetBNLSByte = &H3
   Case "3"
       GetBNLSByte = &H4
   Case "4"
       GetBNLSByte = &H5
   Case "5"
       GetBNLSByte = &H7
   Case Else
       AddChat vbRed, "Invalid Client version! Setting version as Starcraft!"
       GetBNLSByte = &H1
End Select
End Function

There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.