• Welcome to Valhalla Legends Archive.
 

Help with an error

Started by Lenny, June 30, 2003, 09:54 AM

Previous topic - Next topic

Lenny

Public Sub parsep2(ByVal Data As String)
On Error Resume Next
 Dim D As String
   Dim tmp As String
   Dim mpqend 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)
   Dim version As Long
   Dim Checksum As Long
   Dim ExeInfo As String
   Dim Result As Long
   pbuffer2.InsertNonNTString "68XI" & VarProduct
   pbuffer2.InsertDWORD "&H" & verByte
   ExeInfo = Space(256)
   Result = CheckRevision(varFiles & exeN & ".exe", varFiles & "storm.dll", varFiles & "battle.snp", Hash, version, Checksum, ExeInfo, mpqname)
   pbuffer2.InsertDWORD version
   pbuffer2.InsertDWORD Checksum
   NullTruncString ExeInfo
   pbuffer2.InsertNTString ExeInfo
   If ExeInfo = Space(256) Then
           pbuffer2.Clear
           AddC vbRed, "CheckRevision call Failed!", RGB(45, 109, 59)

           Exit Sub
       End If
   pbuffer2.sendPacket 7
   Case &H25
   If Cons = 1 Or Cons = 3 Or Cons = 5 Then winsock2.SendData Data
   Case &H7
   strData = Mid(Data, 5, 1)
    Select Case strData
   
    Case Chr(2)
           pbuffer2.sendPacket &H2D
           If Cons = 2 Or Cons = 4 Then
                   pbuffer2.InsertNonNTString "tenb"
                   pbuffer2.sendPacket &H14
           End If
      Case Chr(0)
           
           AddC vbRed, "Battle.net rejected your hash"
           winsock2.Close
           Pause 2
           winsock2.Connect VarServer, 6112
        Case Else
           
           AddC vbRed, "Unknown Verification Return Value, may need to upgrade game client"
       End Select
   Case &H1D
         serverhash = Right(Data, 4)

   Case &H2D
       Module3.SendCDKey2 varCDkey2
   
   Case &H30, &H36

       Select Case Mid(Data, 5, 1)
       Case Chr(1)
         Module3.SendUsernamePassword2
       
       Case Chr(2)
           
           AddC vbRed, "CDKey Invalid!"
           Open "ErrorLog.txt" For Append As #1
           Print #1, "The key " & List2.List(keys) & " was Invalid."
           Close #1
           List2.RemoveItem (keys)
           winsock2.Close
           AddC vbRed, "CDKey Invalid. Possibly IPBanned. FLooDBoT is now inactive."
       Case Chr(3)
           
           AddC vbRed, "CDKey Invalid - For a Different Product, removing key from list."
           Open "ErrorLog.txt" For Append As #1
           Print #1, "The key " & List2.List(keys) & " was for another product."
           Close #1
           List2.RemoveItem (keys)
           newkey
           winsock2.Close
           Pause 0.5
           winsock2.Connect Server, "6112"
       Case Chr(4)
           
           AddC vbRed, "CDKey Is Banned from Battle.net, removing key from list."
           Open "ErrorLog.txt" For Append As #1
           Print #1, "The key " & List2.List(keys) & " was banned from battle.net"
           Close #1
           List2.RemoveItem (keys)
           newkey
           winsock2.Close
           Pause 0.5
           winsock2.Connect Server, "6112"
       Case Chr(5)
           
           AddC vbRed, "CDKey In Use"
           winsock2.Close
           newkey
           Pause 0.5
           winsock2.Connect VarServer, "6112"
       End Select
 Case &H29
    If Mid(Data, 5, 1) = Chr(1) Then
           
           AddC vbGreen, "Logon Passed!"
           connected1 = True
pbuffer2.InsertNTString varUser2
pbuffer2.InsertBYTE 0
pbuffer2.sendPacket &HA
pbuffer2.InsertDWORD 2
pbuffer2.InsertNTString VarHome
pbuffer2.sendPacket &HC
    Else
           
           AddC vbRed, "Logon Failed, removing name from name list."
           Open "ErrorLog.txt" For Append As #1
           Print #1, "The name and/or password " & List3.List(namesnow) & "/" & List4.List(namesnow) & " was invalid."
           Close #1
           List3.RemoveItem (namesnow)
           List4.RemoveItem (namesnow)
           newname
           winsock2.Close
           If Check4.Value = 0 Then
                   AddC vbRed, "Unable to proceed. Name changing not enabled. FLooDBoT has become inactive."
                   Exit Sub
           End If
           Pause 2
           winsock2.Connect Server, "6112"
   End If
   Case &HA
  Dim spltn() As String
spltn() = Split(Data, Chr(0), 5)
AddC vbGreen, "Logged On as: " & spltn(1) & " using " & Left(spltn(2), 4)
varUser2 = spltn(1)
connected = True
Exit Sub
Case &HF
Module2.DispatchMessage Data
Case &H26
Profile Data
  End Select
End Sub

I've looked at this code for about an hour and cant seem to find the problem...After compiling and connecting bot2 it it says battlenet has rejected my hash...

Btw this is code from LoRd]zer0['s floodbot that was turned into a winbot...

bot1 works fine here is its code:

Public Sub parsep(ByVal Data As String)
On Error Resume Next
 Dim D As String
   Dim tmp As String
   Dim mpqend 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)
   Dim version As Long
   Dim Checksum As Long
   Dim ExeInfo As String
   Dim Result As Long
   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!", 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
           If Cons = 2 Or Cons = 4 Then
                   pbuffer.InsertNonNTString "tenb"
                   pbuffer.sendPacket &H14
           End If
      Case Chr(0)
           
           AddC vbRed, "Battle.net rejected your hash"
           winsock.Close
           Pause 2
           winsock.Connect VarServer, 6112
        Case Else
           
           AddC vbRed, "Unknown Verification Return Value, may need to upgrade game client"
       End Select

Case &H1C
       Select Case Mid(Data, 5, 1)
           Case Chr(0)
               AddC vbMagenta, "1C Received"
               If Auto = 1 Then
                   Call Command5_Click
                   Pause 2
                   Call Command6_Click
                   Auto = Auto + 1
               ElseIf Auto = 2 Then
                   Call Command7_Click
                   Auto = 1
               End If
       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!"
           Open "ErrorLog.txt" For Append As #1
           Print #1, "The key " & List2.List(keys) & " was Invalid."
           Close #1
           List2.RemoveItem (keys)
           winsock.Close
           AddC vbRed, "CDKey Invalid. Possibly IPBanned. FLooDBoT is now inactive."
       Case Chr(3)
           
           AddC vbRed, "CDKey Invalid - For a Different Product, removing key from list."
           Open "ErrorLog.txt" For Append As #1
           Print #1, "The key " & List2.List(keys) & " was for another product."
           Close #1
           List2.RemoveItem (keys)
           newkey
           winsock.Close
           Pause 0.5
           winsock.Connect Server, "6112"
       Case Chr(4)
           
           AddC vbRed, "CDKey Is Banned from Battle.net, removing key from list."
           Open "ErrorLog.txt" For Append As #1
           Print #1, "The key " & List2.List(keys) & " was banned from battle.net"
           Close #1
           List2.RemoveItem (keys)
           newkey
           winsock.Close
           Pause 0.5
           winsock.Connect Server, "6112"
       Case Chr(5)
           
           AddC vbRed, "CDKey In Use"
           winsock.Close
           newkey
           Pause 0.5
           winsock.Connect VarServer, "6112"
       End Select
 Case &H29
    If Mid(Data, 5, 1) = Chr(1) Then
           
           AddC vbGreen, "Logon Passed!"
           connected1 = True
pbuffer.InsertNTString varUser
pbuffer.InsertBYTE 0
pbuffer.sendPacket &HA
pbuffer.InsertDWORD 2
pbuffer.InsertNTString VarHome
pbuffer.sendPacket &HC
    Else
           
           AddC vbRed, "Logon Failed, removing name from name list."
           Open "ErrorLog.txt" For Append As #1
           Print #1, "The name and/or password " & List3.List(namesnow) & "/" & List4.List(namesnow) & " was invalid."
           Close #1
           List3.RemoveItem (namesnow)
           List4.RemoveItem (namesnow)
           newname
           winsock.Close
           If Check4.Value = 0 Then
                   AddC vbRed, "Unable to proceed. Name changing not enabled. FLooDBoT has become inactive."
                   Exit Sub
           End If
           Pause 2
           winsock.Connect Server, "6112"
   End If
   Case &HA
  Dim spltn() As String
spltn() = Split(Data, Chr(0), 5)
AddC vbGreen, "Logged On as: " & spltn(1) & " using " & Left(spltn(2), 4)
varUser = spltn(1)
connected = True
Exit Sub
Case &HF
Module2.DispatchMessage Data
Case &H26
Profile Data
  End Select
End Sub


Edit - Use the integrated [ code ] and [ /code ] tags in the future, please.
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Spht

I don't think anyone is interested in reading through all of that and trying to figure out what could possibly cause an error there.

Tell us what error message you get and what piece of this is causing the error?

Lenny

Sorry maybe I should have separated....
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

DarkMinion

So are you going to separate it or not?

Grok

Do most of the community's VB programmers write code looking like that?  I see a maintenance nightmare.  When you have literal constants as plentiful as you do, it can greatly simplify programming and maintenance to define symbolic constants, even as enumerations.

With such a change, the code pasted above could become readable at a glance.

Lenny

As i Have said this code was given to me to compile, not edit in any way...But after compiling I noticed an error...."Bnet rejected your hash." Was the error message I recieved....

The code seems to have been founded off of LoRd]zer0['s floodbot...Now it has been changed into a winbot but unfortunately the first bot connects fine and the second has the "Bnet rejected your hash." error

I have only just started to learn visual basic...and also Is there a command that can create a text file?...
All i find are commands used to read append and write to them such as :
Open "config.txt" for input as #1
Input #1, username
Close #1
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Grok

Oh well!  Why didn't you say so?  Since it was founded from "LoRd]zer0['s floodbot" volunteers will be lining up to make it work.

Camel

Quote from: Lenny on July 01, 2003, 10:55 PMI have only just started to learn visual basic...and also Is there a command that can create a text file?...
All i find are commands used to read append and write to them such as :
Open "config.txt" for input as #1
Input #1, username
Close #1

IIRC, that will create a text file if it doesn't exist.

UserLoser

No, that wouldn't.  If it was for output it would.