What are some of the things that could be wrong when you get wrong product ver when you code your own bot?
Public Sub StartConnection(Product As String, Index As Integer)
Select Case Product
Case "STAR", "SEXP"
VerByte = "CD"
GameFile(1) = App.Path & "\Hash Files\STAR\Starcraft.exe"
GameFile(2) = App.Path & "\Hash Files\STAR\Storm.dll"
GameFile(3) = App.Path & "\Hash Files\STAR\Battle.snp"
Case "W2BN"
VerByte = "4F"
GameFile(1) = App.Path & "\Hash Files\W2BN\Warcraft II BNE.exe"
GameFile(2) = App.Path & "\Hash Files\W2BN\Storm.dll"
GameFile(3) = App.Path & "\Hash Files\W2BN\Battle.snp"
Case "D2DV"
VerByte = "A"
GameFile(1) = App.Path & "\Hash Files\D2DV\Game.exe"
GameFile(2) = App.Path & "\Hash Files\D2DV\Bnclient.dll"
GameFile(3) = App.Path & "\Hash Files\D2DV\D2Client.dll"
Case "D2XP"
VerByte = "A"
GameFile(1) = App.Path & "\Hash Files\D2XP\Game.exe"
GameFile(2) = App.Path & "\Hash Files\D2XP\Bnclient.dll"
GameFile(3) = App.Path & "\Hash Files\D2XP\D2Client.dll"
Case "WAR3", "W3XP"
VerByte = 11
GameFile(1) = App.Path & "\War3.exe"
GameFile(2) = App.Path & "\Storm.dll"
GameFile(3) = App.Path & "\Game.dll"
Case Else
AddC frmMain.RichTextBox(Index), vbRed, "Unsupported Product '" & Product & "'"
frmMain.sckBNCS(Index).Close
AddC frmMain.RichTextBox(Index), vbRed, "Disconnected."
Exit Sub
End Select
Select Case Index
Case "1"
Verbyte1 = VerByte
GameFile1(1) = GameFile(1)
GameFile1(2) = GameFile(2)
GameFile1(3) = GameFile(3)
Case "2"
Verbyte2 = VerByte
GameFile2(1) = GameFile(1)
GameFile2(2) = GameFile(2)
GameFile2(3) = GameFile(3)
Case "3"
Verbyte3 = VerByte
GameFile3(1) = GameFile(1)
GameFile3(2) = GameFile(2)
GameFile3(3) = GameFile(3)
End Select
With PBuffer
.InsertDWORD &H0
.InsertNonNTString "68XI" & StrReverse(Product)
.InsertDWORD "&H" & VerByte
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertNTString "USA"
.InsertNTString "United States"
.SendPacket &H50, Index
End With
End Sub
Private Sub Parse0x51(Data As String)
Select Case PBuffer.GetDWORD(Mid(Data, 5, 4))
Case &H0: AddC vbGreen, "Successful CDkey and Version Check."
If BNCS.Product = "WAR3" Or BNCS.Product = "W3XP" Then
AccountLogon (BNCS.Username)
Else
Sendlogin
End If
Case &H100: AddC vbGreen, "Game version must be upgraded with the MPQ specified in" & PBuffer.KillNull(Mid(Data, 9)): frmMain.sckBNCS.Close
Case &H101: AddC vbGreen, "Game version is invalid": frmMain.sckBNCS.Close
Case &H102: AddC vbGreen, "Game version must be downgraded with the MPQ specified" & PBuffer.KillNull(Mid(Data, 9)): frmMain.sckBNCS.Close
Case &H200: AddC vbGreen, "CDkey is invalid": frmMain.sckBNCS.Close
Case &H201: AddC vbGreen, "CDKey In Use By " & PBuffer.KillNull(Mid(Data, 9)): frmMain.sckBNCS.Close
Case &H202: AddC vbGreen, "CDkey is disabled": frmMain.sckBNCS.Close
Case &H203: AddC vbGreen, "Wrong Product": frmMain.sckBNCS.Close
Case &H210: AddC vbGreen, "Invalid Expansion CDKey: " & BNCS.ExpCdKey: frmMain.sckBNCS.Close
Case &H211: AddC vbGreen, "Expansion CDKey In Use By " & PBuffer.KillNull(Mid(Data, 9)): frmMain.sckBNCS.Close
Case &H212: AddC vbGreen, "Banned Expansion CDKey: " & BNCS.ExpCdKey: frmMain.sckBNCS.Close
Case &H213: AddC vbGreen, "Wrong Expansion Product": frmMain.sckBNCS.Close
End Select
End Sub
Did notice one thing.
Quote Case "STAR", "SEXP"
VerByte = "CD"
GameFile(1) = App.Path & "\Hash Files\STAR\Starcraft.exe"
GameFile(2) = App.Path & "\Hash Files\STAR\Storm.dll"
GameFile(3) = App.Path & "\Hash Files\STAR\Battle.snp"
Starcraft: Brood War Cannot run off of normal Starcraft's hashes.
Also: War3/W3xp is 0x12 not 0x11
Well that's not the problem, any other suggestions?
Yes, edited it while you were replying.
Your warcraft 3 version byte is off. It's 0x12, not 0x11.
Also, why not just declare VerByte as a long and set it to &HCD, &H12, etc.
Ok I'm connecting by STAR, or SEXP and thx for the warcraft III verbyte and IIRC you can connect both star and sexp with same hashes anyways jsut in case I was neither star or sexp connect
As to your edited last post.. this works just fine.
Can you please give more detail to your problem?
Is it replying with 0x101 "Invalid Game Version", when you try and connect with Star/Sexp?
No.. its replying with &H203 which means Wrong product hence the post name. :P and I'm trying to figure out some of the causes of getting &H203 so I can try to fix them.. sry I suck at typing today.
Your CD-Key decoding functions are most likely erroneous.
' Copyright (C) 2005 Eric Evans ([email protected])
Option Explicit
Private Function DecodeStarCraftKey(ByVal strKey As String, ByRef lngGmeID As Long, ByRef lngPubVal As Long, ByRef lngPrivVal As Long, ByVal blnVerifyKey As Boolean) As Long
Dim arrKey(0 To 12) As String
Dim i As Integer
Dim eax As Long
Dim ebx As Long
Dim ecx As Long
Dim edx As Long
Dim edi As Long
Dim esi As Long
Dim al As Byte
Dim bl As Byte
Dim cl As Byte
Dim dl As Byte
' Check CD-Key length
If (Len(strKey) <> 13) Then
Exit Function
End If
' Store CD-Key in array
For i = 0 To 12
arrKey(i) = Mid$(strKey, (i + 1), 1)
Next i
' CD-Key verification
If (blnVerifyKey = True) Then
eax = 3
For ecx = 0 To 11 Step 1
edx = arrKey(ecx)
If ((Asc(edx) < Asc("0")) Or _
(Asc(edx) > Asc("9"))) Then
Exit Function
End If
edx = (Asc(edx) - Asc("0"))
' esi = (eax + eax)
' Optimization:
esi = modGlobals.LShift(eax, 1)
edx = (edx Xor esi)
eax = (eax + edx)
Next ecx
eax = ((eax Mod &HA) + Asc("0"))
If (eax <> Asc(arrKey(12))) Then
Exit Function
End If
End If
' CD-Key shuffling
esi = 11
ecx = &HC2
Do:
eax = ecx
edx = (eax Mod &HC)
bl = arrKey(esi)
dl = arrKey(edx)
arrKey(esi) = dl
arrKey(edx) = bl
' Decrease loop counters
ecx = (ecx - &H11)
esi = (esi - 1)
Loop Until (ecx < &H7)
edx = &H13AC9741
ecx = 11
Do:
al = arrKey(ecx)
If (Asc(al) > Asc("7")) Then
dl = ((ecx And 1) Xor al)
arrKey(ecx) = dl
ElseIf (Asc(al) < Asc("A")) Then
dl = (edx And &HFF)
dl = ((dl And 7) Xor al)
edx = modGlobals.RShift(edx, 3)
arrKey(ecx) = dl
End If
ecx = (ecx - 1)
Loop Until (ecx < 0)
strKey = Join(arrKey(), vbNullString)
lngGmeID = Val(Left$(strKey, 2))
lngPubVal = Val(Mid$(strKey, 3, 7))
lngPrivVal = Val(Mid$(strKey, 10, 3))
DecodeStarCraftKey = 1
Erase arrKey()
End Function
Have fun.
In more detail, that error means 'Cdkey is for a different game.',
I'd check your C->S 0x51 / Cdkey hashing
*Edit*: Oops, was posting while lord posted :P
Quote from: Elneroth on July 14, 2005, 09:31 PM
In more detail, that error means 'Cdkey is for a different game.',
I'd check your C->S 0x51 / Cdkey hashing
*Edit*: Ooh, didn't see Lord's post.
Failing to properly hash the CD-Key would result in an invalid CD-Key error.
I don't think I'm hashing it wrong because I'm using the same decode functions for all 3 bots and bot #2 connects and bot #1 dosen't, maybe something is wrong with my indexing :o it has to be before recieving 0x51 so here's my send 0x51
Private Sub Send0x51(Index As Integer)
Dim Product As String, CDKey As String, ExpCDKey As String
Dim Version As Long, CheckRevision As Long, CheckSum As Long
Dim ExeInfo As String, dblKey As Long
Dim accounthash As String, dblProdID As Double, dblValue1 As Double
Dim dblValue2 As Double, lngProdID As Long, lngValue1 As Long, lngValue2 As Long
Select Case Index
Case "1"
Product = GetStuff("Bot One", "Product")
CDKey = GetStuff("Bot One", "Key")
ExpCDKey = GetStuff("Bot One", "Expansion Key")
Case "2"
Product = GetStuff("Bot Two", "Product")
CDKey = GetStuff("Bot Two", "Key")
ExpCDKey = GetStuff("Bot Two", "Expansion Key")
Case "3"
Product = GetStuff("Bot Three", "Product")
CDKey = GetStuff("Bot Three", "Key")
ExpCDKey = GetStuff("Bot Three", "Expansion Key")
End Select
dblKey = GetTickCount()
ExeInfo = Space(256)
CheckRevision = Z(GameFile(1), GameFile(2), GameFile(3), HashCommand, Version, CheckSum, ExeInfo, MPQName)
If CheckRevision = 0 Then
AddC frmMain.RichTextBox(Index), vbRed, "Hashes did not pass CheckRevision."
frmMain.sckBNCS(Index).Close
Exit Sub
End If
ExeInfo = PBuffer.KillNull(ExeInfo)
PBuffer.InsertDWORD dblKey
PBuffer.InsertDWORD Version
PBuffer.InsertDWORD CheckSum
If Product = "D2XP" Then
PBuffer.InsertDWORD &H2
Else
PBuffer.InsertDWORD &H1
End If
PBuffer.InsertDWORD &H0
DecodeCDKey CDKey, dblProdID, dblValue1, dblValue2
lngProdID = CLng(dblProdID)
lngValue1 = CLng(dblValue1)
lngValue2 = CLng(dblValue2)
ServerToken = CLng(ServerToken)
accounthash = String(5 * 4, vbNullChar)
C accounthash, ServerToken, lngProdID, lngValue1, lngValue2, dblKey
PBuffer.InsertDWORD Len(CDKey)
PBuffer.InsertDWORD CLng(dblProdID)
PBuffer.InsertDWORD CLng(dblValue1)
PBuffer.InsertDWORD &H0
PBuffer.InsertNonNTString accounthash
If Product = "D2XP" Then
DecodeCDKey ExpCDKey, dblProdID, dblValue1, dblValue2
lngProdID = CLng(dblProdID)
lngValue1 = CLng(dblValue1)
lngValue2 = CLng(dblValue2)
ServerToken = CLng(ServerToken)
accounthash = String(5 * 4, vbNullChar)
C accounthash, ServerToken, lngProdID, lngValue1, lngValue2, dblKey
PBuffer.InsertDWORD Len(CDKey)
PBuffer.InsertDWORD CLng(dblProdID)
PBuffer.InsertDWORD CLng(dblValue1)
PBuffer.InsertDWORD &H0
PBuffer.InsertNonNTString accounthash
End If
PBuffer.InsertNTString ExeInfo
PBuffer.InsertNTString "Tass Ownz You"
PBuffer.SendPacket &H51, Index
End Sub
Like Lord said, the problem would most likely reside in your "DecodeCDKey CDKey, dblProdID, dblValue1, dblValue2",
You're sending 0x51 probably doesn't help much.
Then explain to me why it would work for one bot and not the other? >:/ heh
Is this other bot not made by you?
If not, make sure you're transfering it over right, a slight variable could screw it all up.
(Code looks familiar, too :P)
Oh and by the way I fixed it beacuse when I sent 0x51 I was using the wrong select case stuff..