Jump to content
Sign in to follow this  

DllCall Mess

Recommended Posts


Ok, I have a Dll that exports some functions which I need, I have no clue how to do this, and a critcally need these functions.



Declare Sub GamePacketSize Lib "D2GS.dll" (ByVal Data$, ByRef Size&, ByRef OffSet&)

Declare Function GamePacketDecode& Lib "D2GS.dll" (ByVal InData$, ByVal InSize&, ByVal OutData$, ByVal OutMax&, ByRef OutSize&)

Declare Function GamePacketEncode& Lib "D2GS.dll" (ByVal InData$, ByVal InSize&, ByVal OutData$)

Declare Function GamePacketHeader& Lib "D2GS.dll" (ByVal Size&, ByVal Out$)

Public Sub MakePacketHeader(Data As String)

Dim tmpData$, tmpHdl&, InSize&

tmpData = String(2, 0)

InSize = Len(Data)

intHdl = GamePacketHeader(InSize, tmpData)

Data = Left(tmpData, intHdl) & Data

End Sub

Public Sub EncodePacket(Data As String)

Dim OutData$, tmpData$, InSize&, tmpLng&

OutData = String(1024, 0)

tmpData = Data

InSize = Len(tmpData)

tmpLng = GamePacketEncode(tmpData, InSize, OutData)

'add header from this function

Data = Left(OutData, tmpLng)

End Sub

Public Function GetPacketSize(Data As String) As Long

Dim tmpData$, RetSize&, OffSet&

tmpData = Data

Call GamePacketSize(tmpData, RetSize, OffSet)

Data = Mid(Data, 1 + OffSet)'Remove Lengh header

GetPacketSize = RetSize

End Function

Public Function DecodePacket(Data As String, ByVal pSize As Long, OutData As String) As Long

Dim SizeReturn&, OutBuf$, tmpData$

OutBuf = String(pSize * 3 + 250, 0)

tmpData = Left(Data, pSize)

DecodePacket = GamePacketDecode(tmpData, Len(tmpData), OutBuf, Len(OutBuf), SizeReturn)

OutData = Left(OutBuf, SizeReturn)

End Function


I seriously need this, I have no idea how to do with with structs and pointers and ughh.

Share this post

Link to post
Share on other sites

Func Decompress($str)
    $dll = DllOpen("d2gs.dll")
    Local $OutSize, $OutData
$result = DllCall($dll, "int", "GamePacketDecode", "str", $str, "int", StringLen($str), "int", 0, "str", 0)
MsgBox(1, "", $result)
Return $OutData

This is what I tried. It just crashes now.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this