22-10-2006, 08:31 PM
After a short talk to Verrigan through PMs. I've decided to understand/code byte arrays. And after checking out his source now. Im starting to get a idea how its made.
To start with, he used this to give the arrays a name:
That is called from Sub InitServer(). Pretty logical.
This is were it become complicated, this code:
Is the part that checks what packet is recieved. But I don't understand how that part can run a sub through:
So if somebody knows that, please fill me in.
And after that, it's basicly just to copy the whole modBuffer to your game, and simply start changing the packets.
But now we have another odd thing, how can the program know what Parse belongs to which: GetIntegerFromBuffer(Buffer, True)
I give you a example how I mean:
The two bold texts are two different string. Which are used for two different variables. Msg and MsgTo, and how come Msg doesnt get the MsgTo information? And vise versa. How does the buffer know which one to give what information. The same goes for when there are two or more integers that is being sent, how does the buffer know which one should be the Index and which one to be the itemnumber for example?
If I end up in success, I might make a small tutorial that will help you to convert the packets (this is if Verrigan dont mind). Cause I know he don't want everybody to get things served on a silver plate, but to actually understand what they'r doing.
To start with, he used this to give the arrays a name:
Code:
Public Sub InitMessages()
HandleDataSub(SMsgGetClasses) = GetAddress(AddressOf HandleGetClasses)
...
End Sub
That is called from Sub InitServer(). Pretty logical.
This is were it become complicated, this code:
Code:
Sub HandleData(ByVal Index As Long, ByRef Buffer() As Byte)
On Error Resume Next
Dim MsgType As Byte
Dim StartAddr As Long
MsgType = GetByteFromBuffer(Buffer, True)
StartAddr = 0
If aLen(Buffer) > 0 Then StartAddr = VarPtr(Buffer(0))
If MsgType > SMSG_COUNT Then
Call HackingAttempt(Index, "Packet Manipulation")
Else
Call CallWindowProc(HandleDataSub(MsgType), Index, StartAddr, aLen(Buffer), 0)
End If
If Err.Number 0 Then
Call HackingAttempt(Index, "Packet Manipulation")
End If
End Sub
Code:
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal Index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long) As Long
And after that, it's basicly just to copy the whole modBuffer to your game, and simply start changing the packets.
But now we have another odd thing, how can the program know what Parse belongs to which: GetIntegerFromBuffer(Buffer, True)
I give you a example how I mean:
Code:
Private Sub HandlePlayer(ByVal Index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long)
Dim Buffer() As Byte
Dim MsgTo As Long
Dim Msg As String
Buffer = FillBuffer(StartAddr, ByteLen)
If ValidateMessage(Index, Buffer) = 1 Then
MsgTo = FindPlayer([b]GetStringFromBuffer(Buffer, True)[/b])
If MsgTo Index Then
If MsgTo > 0 Then
Msg = [b]GetStringFromBuffer(Buffer, True)[/b]
Call AddLog(GetPlayerName(Index) & " tells " & GetPlayerName(MsgTo) & ", '" & Msg & "'", PLAYER_LOG)
Call PlayerMsg(MsgTo, GetPlayerName(Index) & " tells you, '" & Msg & "'", TellColor)
Call PlayerMsg(Index, "You tell " & GetPlayerName(MsgTo) & ", '" & Msg & "'", TellColor)
Else
Call PlayerMsg(Index, "Player is not online.", White)
End If
Else
Call AddLog("Map #" & GetPlayerMap(Index) & ": " & GetPlayerName(Index) & " begins to mumble to himself, what a weirdo...", PLAYER_LOG)
Call MapMsg(GetPlayerMap(Index), GetPlayerName(Index) & " begins to mumble to himself, what a weirdo...", Green)
End If
End If
End Sub
The two bold texts are two different string. Which are used for two different variables. Msg and MsgTo, and how come Msg doesnt get the MsgTo information? And vise versa. How does the buffer know which one to give what information. The same goes for when there are two or more integers that is being sent, how does the buffer know which one should be the Index and which one to be the itemnumber for example?
If I end up in success, I might make a small tutorial that will help you to convert the packets (this is if Verrigan dont mind). Cause I know he don't want everybody to get things served on a silver plate, but to actually understand what they'r doing.