22-10-2006, 09:32 PM
Yes, when you change from winsock to IOCP, you dont need the winsock anymore so you can remove it. And CallWindowProc uses the memory pointer so its bit compicated to explain it all but basicly:
Buffer() is a ByteArray and you receive it from the Client as a ByteArray. Just in case: I'm considering that averybody knows what an array is. When it receives the packet it get's Buffer(0) which is the "packet ID"("playerdata", etc) and, using GetByteFromBuffer it get's it's ID and Saves into MsgType. Then to make it faster, instead of sending the hole buffer(which is the packet it selfs) to the specific HandleData Sub it saves the StartAddress of the buffer into a variable("StartAddr") and THEN it calls then CallWindowProc. This CallWindowProc just run the specific sub depending of what MsgType you have by checking from the memory IDs you seted in the InitMessages sub.
Plx Verrigan, correct me if I'm wrong but that's what I get from reading the code, I've taked a look a while ago but I never realy used it.
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
Buffer() is a ByteArray and you receive it from the Client as a ByteArray. Just in case: I'm considering that averybody knows what an array is. When it receives the packet it get's Buffer(0) which is the "packet ID"("playerdata", etc) and, using GetByteFromBuffer it get's it's ID and Saves into MsgType. Then to make it faster, instead of sending the hole buffer(which is the packet it selfs) to the specific HandleData Sub it saves the StartAddress of the buffer into a variable("StartAddr") and THEN it calls then CallWindowProc. This CallWindowProc just run the specific sub depending of what MsgType you have by checking from the memory IDs you seted in the InitMessages sub.
Plx Verrigan, correct me if I'm wrong but that's what I get from reading the code, I've taked a look a while ago but I never realy used it.