首页
社区
课程
招聘
[求助]获得了游戏socket的句柄怎样修改并发送封包
发表于: 2009-2-19 20:41 6950

[求助]获得了游戏socket的句柄怎样修改并发送封包

2009-2-19 20:41
6950
走了很多弯路 问题解决了 怎么结贴
我做了个 vb 小程序 来说明我的意思
  在这个程序中 我用 winsock 控件能发送字符串 但是 如果用 send 这个 api 使用上      
      winsock 控件 的句柄 能发送但是内容不正确

Option Explicit
Private Declare Function Send Lib "wsock32.dll" Alias "send" (ByVal s As Long, buf As Any, ByVal buflen As Long, ByVal flags As Long) As Long
Private Declare Function GetApiEntry Lib "dll.dll" (Modelname As Long, Apiname As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

Private Sub Command1_Click()
Dim l As Long
l = GetApiEntry(ByVal VarPtr("Ws2_32.DLL"), ByVal VarPtr("SEND"))
Debug.Print l
End Sub

Private Sub Command4_Click()
        Dim s As Long
        Dim l As Long
        Dim TheMsg() As Byte
         TheMsg = "hook api ·¢ËÍ"
         l = UBound(TheMsg) - LBound(TheMsg) + 1
         s = Val("&H" & Trim(Text3.Text) & "&")
         MsgBox "hook send ·¢ËÍ"
        Call Send(s, TheMsg(0), l, 0)   '×îºóÒ»¸ö²ÎÊý¾ö¶¨ÊÇ·ñÇå¿Õ »º³åÇø
End Sub

Private Sub Form_Load()
   Winsock3.Close
   Winsock3.LocalPort = 3001
   Winsock3.Listen
   DoEvents
Winsock1.RemoteHost = "127.0.0.1"
Winsock1.RemotePort = 3001
Winsock1.Close
Winsock1.Connect
LoadLibrary "dll.dll"
End Sub
Private Sub Command2_Click()
MsgBox "winsock ·¢ËÍ"
Form1.Winsock2.SendData Form1.Text1.Text & "xxÄ£¿éºÅ"
End Sub

Private Sub Winsock1_Connect()
Text1.Text = "Á¬½Ó³É¹¦"
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  Dim s As String
  Winsock1.GetData s
  Text2.Text = Text2.Text & "w2·¢À´:" & s & vbCrLf
End Sub

Private Sub Winsock3_ConnectionRequest(ByVal requestID As Long)
  Winsock2.Close
   Winsock2.Accept requestID
  Text3.Text = Hex(Winsock2.SocketHandle)
End Sub
源文件下载地址
http://ys-f.ys168.com/?winsock.rar_4s7bs0b9e0e2bs7bs0btr7bt4bsp0cl1bsln1b5bt4bsplmhu14z97f14z

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 1657
活跃值: (291)
能力值: ( LV9,RANK:610 )
在线值:
发帖
回帖
粉丝
2
做外挂啊~~!哎~~没兴趣
2009-2-19 21:40
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
有人知道 吗
2009-2-20 10:14
0
雪    币: 109
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
应该是打开socket句柄,然后发送吧。。。。
2009-2-28 09:40
0
游客
登录 | 注册 方可回帖
返回
//