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