• Welcome to Valhalla Legends Archive.
 

BNLS Warcraft III Login (almost done)

Started by Freeware, October 06, 2003, 04:11 PM

Previous topic - Next topic

Freeware

Well I got myself to recieve the Warcraft III cdkey and seed value, but I am unsure how to send it in 0x51. I have included code below how I *think* you are supposed to do it, any help you give would be great.


Public Function SendPacket0x51(Cdkeyhash as String, Seed as string) As String

    packetbuf.InsertDWORD Seed
    packetbuf.InsertDWORD version
    packetbuf.InsertDWORDCheckSum
    packetbuf.InsertDWORD &H1 ' number of cdkeys
    packetbuf.InsertDWORD &H0 'spawn
    packetbuf.InsertNonNTString CDKeyHash
    packetbuf.InsertNTString exeinfo
    packetbuf.InsertNTString CDOwner
    packetbuf.SendPacket sckBNET, &H51

End Function


Freeware

#2
I received "Invalid Game Version" from battle.net.

Hmmm... This is my BNLS call to get a hashed cdkey, maybe this is wrong?


Public Function GETcdkeyhash(Cdkey As String, SessionKey As Long) As Variant

   InsertDWORD SessionKey
   InsertNTString Cdkey
   SendBNLSPacket sckBNLS, &H1

End Function


Instead of using checkrevision to make my version packet, would using BNLS_VERSIONCHECK (0x09) fix this problem?
(Though I have checked the returns from using BNLS and using BNETAUTH.dll, and they seem to be the same)

Arthas

Quote from: Freeware on October 06, 2003, 04:11 PM
Well I got myself to recieve the Warcraft III cdkey and seed value, but I am unsure how to send it in 0x51. I have included code below how I *think* you are supposed to do it, any help you give would be great.


Public Function SendPacket0x51(Cdkeyhash as String, Seed as string) As String

    packetbuf.InsertDWORD Seed
    packetbuf.InsertDWORD version
    packetbuf.InsertDWORDCheckSum
    packetbuf.InsertDWORD &H1 ' number of cdkeys
    packetbuf.InsertDWORD &H0 'spawn
    packetbuf.InsertNonNTString CDKeyHash
    packetbuf.InsertNTString exeinfo
    packetbuf.InsertNTString CDOwner
    packetbuf.SendPacket sckBNET, &H51

End Function


This looks TOO obvious, but look at this line:
     packetbuf.InsertDWORDCheckSum
I'd change it to:
    packetbuf.InsertDWORD CheckSum

Like I said, maybe to obvious...

Freeware

Quote from: Arthas on October 06, 2003, 04:47 PM
Quote from: Freeware on October 06, 2003, 04:11 PM
Well I got myself to recieve the Warcraft III cdkey and seed value, but I am unsure how to send it in 0x51. I have included code below how I *think* you are supposed to do it, any help you give would be great.


Public Function SendPacket0x51(Cdkeyhash as String, Seed as string) As String

    packetbuf.InsertDWORD Seed
    packetbuf.InsertDWORD version
    packetbuf.InsertDWORDCheckSum
    packetbuf.InsertDWORD &H1 ' number of cdkeys
    packetbuf.InsertDWORD &H0 'spawn
    packetbuf.InsertNonNTString CDKeyHash
    packetbuf.InsertNTString exeinfo
    packetbuf.InsertNTString CDOwner
    packetbuf.SendPacket sckBNET, &H51

End Function


This looks TOO obvious, but look at this line:
     packetbuf.InsertDWORDCheckSum
I'd change it to:
    packetbuf.InsertDWORD CheckSum

Like I said, maybe to obvious...

Just a mistype ignore it.

Skywing

#5
Check that your 'version byte' is correct for SID_AUTH_INFO (0x50).  You can always request the latest version byte using BNLS_REQUESTVERSIONBYTE.

Make sure that you are reading the correct 9 DWORDs (36 bytes) from the BNLS_CDKEY reply.  Note that the client session key ("Seed" in your code) is the first DWORD in the BNLS_CDKEY reply.  Following it are the 9 DWORDs of encrypted CD-key data that you should insert after the spawn flag.

The general layout of SID_AUTH_CHECK is this:
(DWORD) Client session key; this should be retrieved from the BNLS_CDKEY reply.
(DWORD) Version; this should be retrieved from the BNLS_VERSIONCHECK reply.
(DWORD) Checksum; this should be retrieved from the BNLS_VERSIONCHECK reply.
(DWORD) Number of CD-keys following.
(DWORD) Spawn (1 -> enable, 0 -> disable).
FOR EACH  CD-KEY:
(DWORD * 9) CD-key data; this should be retrieved from BNLS_CDKEY.  If you are using a product that involves more than one CD-key (i.e. Diablo II: Lord of Destruction or Warcraft III: The Frozen Throne), then you must use BNLS_CDKEY_EX to encrypt all CD-keys using the same client session key.  Note that there can be 0 or more CD-key blocks transmitted, depending on the product.  Ideally, your code would take an array or some similar structure of CD-key encrypted data blocks and insert each one.  This will ease portability between products.
END FOR
(STRING) Primary game module information; this should be retrieved from the BNLS_VERSIONCHECK reply.
(STRING) Owner of CD-key.

Freeware

#6
Hmm then I must be either sending/recieving the cdkey hash data incorrectly, my version byte is uptodate, and I also packet logged CleanSlateBot vrs MyBNLSControl and cant find much difference. I've posted my code for recieving the warcraft III cdkey hash below, maybe you could check to see If Im doing it right?


Select Case PacketHeader
Case &H1
   Dim CDKeyHash As String
   Dim Seed As Long
   result = MKL(Mid(PacketData, 1, 4))

   If Result = 0 then
   Msgbox "Cdkey Hash Failed!"
   Exit Sub
   End if

  CDKeyHash = Mid(Data, 12)
  Seed = Val("&H" & StrToHex(StrReverse(Mid(Data, 8, 4))))
  Seed = CLng(Seed)

  RaiseEvent GOTcdkeyhash(CDKeyHash, Seed)

End Select


And from here it calls the function I have posted above to send the 0x51 packet.