• Welcome to Valhalla Legends Archive.
 

Ugh...Help 0x1E connection..

Started by Networks, March 05, 2004, 09:42 PM

Previous topic - Next topic

Networks

I got my working with a simple 0x1E connection. I works great and fine at first until I actually start working on it. My first attempt it was really good parsed the wins and all for most clients and added commands and other things. I attempt to conenct it dies and says bnet disconnected right after it attempts to send functions:

   Setup ( selects product)
   SendHeader
   Send1E

I tried to go brand new again with my original source that connected and again it has happened so please tell me why such an event like this is happening its really aggravating to work so much and have it fail and I can't fix it. I think it disconnects after it does the whole sendusernamepassword but it worked fine before and I haven't altered any of the necessary functions accept a places where it parses bnet. Any help at all would be much appreciated.

UserLoser.

Quote from: Networks on March 05, 2004, 09:42 PM
Any help at all would be much appreciated.

You'd have to help us first by showing some code/packet logs so we can help you fix it :P

ChR0NiC

Quote from: Networks on March 05, 2004, 09:42 PM
I got my working with a simple 0x1E connection. I works great and fine at first until I actually start working on it. My first attempt it was really good parsed the wins and all for most clients and added commands and other things. I attempt to conenct it dies and says bnet disconnected right after it attempts to send functions:

   Setup ( selects product)
   SendHeader
   Send1E

I tried to go brand new again with my original source that connected and again it has happened so please tell me why such an event like this is happening its really aggravating to work so much and have it fail and I can't fix it. I think it disconnects after it does the whole sendusernamepassword but it worked fine before and I haven't altered any of the necessary functions accept a places where it parses bnet. Any help at all would be much appreciated.


Heh, just gonna help refresh your memory on how to connect with 0x1E :P

SEND ->  Protocol byte (01)
SEND -> SID_CLIENTID2 (0x1E)
SEND -> SID_LOCALEINFO (0x12)
SEND -> SID_STARTVERSIONING (0x06)
RECV <- SID_LOGONCHALLENGEEX (0x1D)
RECV <- SID_PING (0x25)
RECV <- SID_STARTVERSIONING (0x06)
SEND -> SID_PING (0x25) [Optional]
SEND -> SID_REPORTVERSION (0x07)
RECV <- SID_REPORTVERSION (0x07)
SEND -> SID_UDPPINGRESPONSE (0x14) [Optional]
SEND -> SID_CDKEY2 (0x36)
RECV <- SID_CDKEY2 (0x36)
SEND -> SID_LOGONRESPONSE (0x29)
RECV <- SID_LOGONRESPONSE (0x29)
SEND -> SID_ENTERCHAT (0x0A)

Networks

#3
Thing is I dont know what the problem is. The only problem i know is it won't connect even though it did before. Only thing I can show is how it addchat's Bnet Disconnected right after it sends: send1e, sendheader, and product selection w/ verbyte and files.

Setup (for the client)

Public Sub Setup()
On Error Resume Next
Select Case varProduct
       Case "RATS", "STAR"
           If GetStuff("Version Byte", "Starcraft") = "" Then verByte = "C7" Else verByte = GetStuff("Version Byte", "Starcraft")
           exeN = "starcraft"
           varFiles = App.Path & "\Binaries\STAR\"
       Case "PXES", "SEXP"
           If GetStuff("Version Byte", "Starcraft") = "" Then verByte = "C7" Else verByte = GetStuff("Version Byte", "Starcraft")
           exeN = "starcraft"
           varFiles = App.Path & "\Binaries\STAR\"
       Case "NB2W", "W2BN"
           verByte = "4F"
           exeN = "Warcraft II BNE"
           varFiles = App.Path & "\Binaries\W2BN\"
       Case "VD2D", "D2DV"
           If GetStuff("Version Byte", "Diablo II") = "" Then verByte = "0A" Else verByte = GetStuff("Version Byte", "Diablo II")
           exeN = "Game"
           varFiles = App.Path & "\Binaries\D2DV\"
       Case Else
           verByte = "C7"
           exeN = "starcraft"
           varFiles = App.Path & "\Binaries\STAR\"
   End Select
   AddC vbGreen, verByte
  End Sub


SendHeader

Public Sub SendHeader()
On Error Resume Next
   Form1.winsock.SendData Chr(1)
   AddC vbGreen, "SENDHEADER"
End Sub


Send1E

Public Function Send1E()
On Error Resume Next
   pbuffer.InsertDWORD 0
   pbuffer.InsertDWORD 0
   pbuffer.InsertDWORD 0
   pbuffer.InsertDWORD 0
   pbuffer.InsertDWORD 0
   pbuffer.InsertNTString "."
   pbuffer.InsertNTString "."
   pbuffer.sendPacket &H1E
   pbuffer.InsertNonNTString "68XI" & varProduct
   pbuffer.InsertDWORD "&H" & verByte
   pbuffer.InsertDWORD 0
   pbuffer.sendPacket &H6
   AddC vbGreen, "SEND1E"
End Function


Parsing of b.net

Public Sub parsep(ByVal Data As String)
On Error Resume Next
Dim D As String
Dim tmp As String
Dim mpqend As Long
Dim version As Long
Dim Checksum As Long
Dim ExeInfo As String
Dim Result As Long
   
   PacketId = Asc(Mid(Data, 2, 1))
   Select Case PacketId
       Case &H6
           D = Data
           mpqname = Mid(D, InStr(D, "I"), Len(D) - InStr(InStr(D, "I"), D, Chr(0)))
           mpqend = InStr(InStr(D, "I"), D, Chr(0))
           mpqname = Left(mpqname, InStr(mpqname, Chr(0)) - 1)
           Hash = Mid(D, mpqend + 1, InStr(mpqend + 1, D, Chr(0)) - 1)
           Hash = Left(Hash, InStr(Hash, Chr(0)) - 1)
           
           pbuffer.InsertNonNTString "68XI" & varProduct
           pbuffer.InsertDWORD "&H" & verByte
           
           ExeInfo = Space(256)
           Result = CheckRevision(varFiles & exeN & ".exe", varFiles & "storm.dll", varFiles & "battle.snp", Hash, version, Checksum, ExeInfo, mpqname)
           
           pbuffer.InsertDWORD version
           pbuffer.InsertDWORD Checksum
           
           NullTruncString ExeInfo
           
           pbuffer.InsertNTString ExeInfo
           If ExeInfo = Space(256) Then
               pbuffer.Clear
               AddC vbRed, "CheckRevision call Failed!" & vbNewLine, RGB(45, 109, 59)
               Exit Sub
           End If
           
           pbuffer.sendPacket 7
   
       Case &H25
           If Cons = 1 Or Cons = 3 Or Cons = 5 Then winsock.SendData Data
           
       Case &H7
           strData = Mid(Data, 5, 1)
           
           Select Case strData
   
               Case Chr(2)
                   pbuffer.sendPacket &H2D
                   
                           pbuffer.InsertNonNTString "tenb"
                           pbuffer.sendPacket &H14
               Case Chr(0)
               
                   AddC vbRed, "Battle.net rejected your hash"
                   winsock.Close
                   IsConnected = False
               Case Else
               
                   AddC vbRed, "Unknown Verification Return Value, may need to upgrade game client"
           End Select
         
       Case &H1D
             serverhash = Right(Data, 4)
   
       Case &H2D
           SendCDKey varCDkey
       
       Case &H30, &H36
   
           Select Case Mid(Data, 5, 1)
                   Case Chr(1)
                   SendUsernamePassword
               
                   Case Chr(2)
                   AddC vbRed, "CDKey Invalid!"
                   winsock.Close
                   IsConnected = False
                   
               Case Chr(3)
                   AddC vbRed, "CDKey Invalid - For a Different Product"
                   winsock.Close
                   
               Case Chr(4)
                   
                   AddC vbRed, "CDKey Is Banned from Battle.net"
                   winsock.Close
                   IsConnected = False
               Case Chr(5)
                   
                   AddC vbRed, "CDKey In Use"
                   winsock.Close
           End Select
   
       Case &H29
           If Mid(Data, 5, 1) = Chr(1) Then
               AddC vbGreen, "Logon Passed!"
               pbuffer.InsertNTString varUser
               pbuffer.InsertBYTE 0
               pbuffer.sendPacket &HA
               pbuffer.InsertDWORD 2
               pbuffer.InsertNTString varHome
               pbuffer.sendPacket &HC
               IsConnected = True

           Else
               AddC vbRed, "Logon Failed"
               winsock.Close
               IsConnected = False
           End If
           
       Case &HA

           Dim Spltn() As String
           Spltn() = Split(Data, Chr(0), 5)
           AddC vbGreen, "Logged on as " & Spltn(1)
           varUser = Spltn(1)
           IsConnected = True
           Exit Sub
           
       Case &HF
           chatbot.DispatchMessage Data
           
   End Select
End Sub



I added Addc to see what it sends as you see when you read the code above

This is as far as I get:
[5:18:03 PM] Connecting...
[5:18:04 PM] C7
[5:18:04 PM] Connected!
[5:18:04 PM] SENDHEADER
[5:18:04 PM] SEND1E
[5:18:05 PM] Bnet Disconnected

PaiD

How far does it get in the login before bent disconnects?

Eric

#5
That code looks nearly identical to Zorm's BGATE, and since the source code for BGATE is on your site it only helps validate my claim. :p

Where are your variables being stored? Are they in a the same place as your connection functions? If not, can they be accessed from your connection functions?

If the answer to all those questions are yes, then are you setting the product in the order they would be in as DWORD's? ex: STAR would be RATS, W2BN would be NB2W.

ChR0NiC

Also I am pretty sure you cannot connect to D2 using 0x1E, then again I may be wrong

Eric

Quote from: ChR0NiC on March 06, 2004, 06:43 PM
Also I am pretty sure you cannot connect to D2 using 0x1E, then again I may be wrong

It supports any single CD-Key product.

ChR0NiC

Quote from: ChR0NiC on March 06, 2004, 06:43 PM
Also I am pretty sure you cannot connect to D2 using 0x1E, then again I may be wrong

Quote from: LoRd[nK] on March 06, 2004, 06:45 PM
It supports any single CD-Key product.

So obviously it will support SC, BW, W2, D2, JSTR....
But not D2XP and W3XP (right??)
And won't support WAR3 or will it support W3?

Eric

#9
Quote from: ChR0NiC on March 06, 2004, 06:48 PM
Quote from: ChR0NiC on March 06, 2004, 06:43 PM
Also I am pretty sure you cannot connect to D2 using 0x1E, then again I may be wrong

Quote from: LoRd[nK] on March 06, 2004, 06:45 PM
It supports any single CD-Key product.

So obviously it will support SC, BW, W2, D2, JSTR....
But not D2XP and W3XP (right??)
And won't support WAR3 or will it support W3?

Warcraft III requires NLS-2 which isn't supported in the old logins, so I doubt it.

Networks

#10
I didn't copy bgate's source code and second the variables are being stored a module along with declares.