• Welcome to Valhalla Legends Archive.
 

0x51 Help

Started by Spilled, February 23, 2005, 09:58 AM

Previous topic - Next topic

Spilled

Hey everyone, need some help with building 0x51.
Ok when i recieve 0x50 i get the mpqname, hash, and ServerToken from it and then i call this sub


Public Sub SendPacket51()
    Dim CheckRev As Long
    Dim ClientToken As Long
    Dim ProductID As Double
    Dim Val1 As Double
    Dim Val2 As Double
    Dim cRev As Long
   
   
    Select Case strProduct
        Case "PX2D" 'D2:LOD Not supported yet.
            Exit Sub
        Case "VD2D"
            Hashing.ExeInfo = Space(256)
            Hash = String(20, vbNullChar)
            CheckRev = z(Files & "Game.exe", Files & "Bnclient.dll", Files & "D2Client.dll", Hashing.Hash, Hashing.VersionID, Hashing.Checksum, Hashing.ExeInfo, Hashing.MpqName)
                If CheckRev = 0 Then
                    AddChat vbRed, "CheckRevion Failed!"
                        CloseConnection
                    Exit Sub
                Else
                    NullTruncString (Hashing.ExeInfo)
                End If
                    ClientToken = GetTickCount
                   
                InsertDWORD ClientToken
                InsertDWORD Hashing.VersionID
                InsertDWORD Hashing.Checksum
                        If strProduct = "PX2D" Then
                            InsertDWORD &H2
                        Else
                            InsertDWORD &H1
                        End If
                InsertDWORD &H0
                Call Connection.DecodeCDKey(strKey, ProductID, Val1, Val2)
                cRev = C(Outbuf, Hashing.ServerToken, ProductID, Val1, Val2, clientoken)
                InsertDWORD (Len(strKey))
                InsertDWORD ProductID
                InsertDWORD Val1
                InsertDWORD &H0
                InsertNonNTString Hashing.Hash
                InsertNTString Hashing.ExeInfo
                InsertNTString "SomeNewb"
                    SendPacket &H51
    End Select
End Sub


First d2 connection and first time working with 0x50 and 0x51 any help is appreciated thanks :D

Edit: ProductID is highlighting also, "ByRef Arguement Type Mismatch"

UserLoser.

Probably because you have it declared as a Long, yet the local variable in that function is a Double.

Spilled

yea after studying that i found that out thx userloser i appreciate it but im still getting disconnected now when i send it, heres my sub take a look:


Public Sub SendPacket51()
    Dim CheckRev As Long
    Dim ClientToken As Long
    Dim ProductID As Double
    Dim Val1 As Double
    Dim Val2 As Double
    Dim cRev As Long
   
    Select Case strProduct
        Case "PX2D" 'D2:LOD Not supported yet.
            Exit Sub
        Case "VD2D"
            Hashing.ExeInfo = Space(256)
            Hash = String(20, vbNullChar)
            CheckRev = z(Files & "Game.exe", Files & "Bnclient.dll", Files & "D2Client.dll", Hashing.Hash, Hashing.VersionID, Hashing.Checksum, Hashing.ExeInfo, Hashing.MpqName)
                If CheckRev = 0 Then
                    AddChat vbRed, "CheckRevion Failed!"
                        CloseConnection
                    Exit Sub
                End If
                    Connection.NullTruncString Hashing.ExeInfo
                    ClientToken = GetTickCount()
                   
                InsertDWORD ClientToken
                InsertDWORD Hashing.VersionID
                InsertDWORD Hashing.Checksum
                        If strProduct = "PX2D" Then
                            InsertDWORD &H2
                        Else
                            InsertDWORD &H1
                        End If
                InsertDWORD &H0
                Call Connection.DecodeCDKey(strKey, ProductID, Val1, Val2)
                cRev = C(Outbuf, Hashing.ServerToken, ProductID, Val1, Val2, ClientToken)
                InsertDWORD (Len(strKey))
                InsertDWORD "&H" & ProductID
                InsertDWORD CLng(Val1)
                InsertDWORD &H0
                InsertNonNTString Hashing.Hash
                InsertNTString Hashing.ExeInfo
                InsertNTString "SomeNewb"
                    SendPacket &H51
    End Select
End Sub


Any help is appreciated, thanks for the help in advance guys!

Warrior

Are you sending the CDKey data for both CDKeys?  (Assuming its LOD)
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Spilled

Quote from: Spilled[DW] on February 23, 2005, 02:43 PM


    Select Case strProduct
        Case "PX2D" 'D2:LOD Not supported yet.
            Exit Sub
        Case "VD2D"



right now im jsut working on d2 connection, LOD will come later

Warrior


InsertDWORD "&H" & ProductID


You can send &H as a string?
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Spilled

hrmm, im not sure could that be why im being disconnected? should it just be InsertDWORD ProductID or would it be insertDWORD clng(ProductID)?

Warrior

your ProdID isn't a long, it's a double. Try .InsertDWORD ProdID
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

R.a.B.B.i.T

Quote from: Warrior on February 23, 2005, 02:58 PM

InsertDWORD "&H" & ProductID


You can send &H as a string?
That should be InsertDWORD Val("&H" & ProductID)but that way sucks, you should just declare ProductID as a long and not deal with converting strings to longs.

tA-Kane

Answer me this, Spilled: Are you still declaring ProductID as a double, even after we've hinted at that being incorrect at least twice? When you said to UserLoser that you had noticed that and posted updated code, it was still being declared as a double.

In either case, ProductID is not a string. You cannot use "&H" & ProductID nor Val("&H" & ProductID) and expect to get any decent results. Use Val("&H" & Hex(ProductID)).
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Spilled

#10
Yes, kane i realize that and i tried what userloser told me and thats where i am now, i changed productid to a long, now im getting another error when i call decodecdkey, productid highlights and says byref mismatch, same error because decodecdkey is expecting a double, let me try that and ill get back to u

tA-Kane

DecodeCDKey expects a double? Why? ProductIDs aren't doubles...
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Spilled

I have no idea, but my decode was expecting a double, fixed that thx for your help on that.

Spilled

Ok, after making the changes, heres what i got:


Public Sub SendPacket51()
    Dim CheckRev As Long
    Dim ClientToken As Long
    Dim ProductID As Long
    Dim Val1 As Long
    Dim Val2 As Long
    Dim cRev As Long
   
    Select Case strProduct
        Case "PX2D" 'D2:LOD Not supported yet.
            Exit Sub
        Case "VD2D"
            Hashing.ExeInfo = Space(256)
            Hash = String(20, vbNullChar)
            CheckRev = z(Files & "Game.exe", Files & "Bnclient.dll", Files & "D2Client.dll", Hashing.Hash, Hashing.VersionID, Hashing.Checksum, Hashing.ExeInfo, Hashing.MpqName)
                If CheckRev = 0 Then
                    AddChat vbRed, "CheckRevion Failed!"
                        CloseConnection
                    Exit Sub
                End If
                    Connection.NullTruncString Hashing.ExeInfo
                    ClientToken = GetTickCount()
                   
                InsertDWORD ClientToken
                InsertDWORD Hashing.VersionID
                InsertDWORD Hashing.Checksum
                        'If strProduct = "PX2D" Then
                        '    InsertDWORD &H2
                        'Else
                            InsertDWORD &H1
                        'End If
                InsertDWORD &H0
                Call Connection.DecodeCDKey(strKey, ProductID, Val1, Val2)
                cRev = C(Outbuf, Hashing.ServerToken, ProductID, Val1, Val2, ClientToken)
                InsertDWORD Len(strKey)
                InsertDWORD Val("&H" & Hex(ProductID))
                InsertDWORD Val1
                InsertDWORD &H0
                InsertNonNTString Hashing.Hash
                InsertNTString Hashing.ExeInfo
                InsertNTString "SomeNewb"
                    SendPacket &H51
    End Select
End Sub


Its still disconnecting me when i send packet 0x51 and resulting in ipb, ideas?

Edit: Sry about double post

tA-Kane

A packetlog would be nice. For now, I'm going to assume that you're sending invalid CD key data.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com