📄 frmrcvall.frm
字号:
VERSION 5.00
Begin VB.Form frmrcvall
Caption = "SIO_RCVALL"
ClientHeight = 6570
ClientLeft = 60
ClientTop = 345
ClientWidth = 9600
LinkTopic = "Form1"
ScaleHeight = 6570
ScaleWidth = 9600
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdClear
Caption = "Clear Capture Window"
Height = 615
Left = 240
TabIndex = 18
Top = 5400
Width = 2055
End
Begin VB.ListBox List2
BeginProperty Font
Name = "System"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4620
Left = 2520
TabIndex = 17
Top = 1680
Width = 6975
End
Begin VB.CommandButton cmdStop
Caption = "Stop Capturing"
Height = 615
Left = 240
TabIndex = 16
Top = 4680
Width = 2055
End
Begin VB.CommandButton cmdStart
Caption = "Start Capturing"
Height = 615
Left = 240
TabIndex = 15
Top = 3960
Width = 2055
End
Begin VB.Frame Frame2
Caption = "Filter On"
Height = 1335
Left = 3600
TabIndex = 6
Top = 120
Width = 5055
Begin VB.TextBox txtusDestPort
Height = 285
Left = 3960
TabIndex = 10
Top = 840
Width = 735
End
Begin VB.TextBox txtUiDestAddr
Height = 285
Left = 1080
TabIndex = 9
Top = 840
Width = 1455
End
Begin VB.TextBox txtusSourcePort
Height = 285
Left = 3960
TabIndex = 8
Top = 360
Width = 735
End
Begin VB.TextBox txtuiSourceAddr
Height = 285
Left = 1080
TabIndex = 7
Top = 360
Width = 1455
End
Begin VB.Label Label11
Caption = "Dest Port"
Height = 255
Left = 3060
TabIndex = 14
Top = 840
Width = 795
End
Begin VB.Label Label10
Caption = "Dest IP"
Height = 375
Left = 120
TabIndex = 13
Top = 840
Width = 735
End
Begin VB.Label Label9
Caption = "Source Port"
Height = 255
Left = 2880
TabIndex = 12
Top = 375
Width = 975
End
Begin VB.Label Label8
Caption = "Source IP"
Height = 255
Left = 120
TabIndex = 11
Top = 360
Width = 735
End
End
Begin VB.ListBox List1
Height = 1620
Left = 120
TabIndex = 4
Top = 1800
Width = 2175
End
Begin VB.Frame Frame1
Caption = "Capture Option"
Height = 855
Left = 120
TabIndex = 0
Top = 120
Width = 3255
Begin VB.OptionButton optMC
Caption = "Multicast"
Height = 375
Left = 2150
TabIndex = 3
Top = 360
Width = 975
End
Begin VB.OptionButton optIGMP
Caption = "IGMP"
Height = 360
Left = 1080
TabIndex = 2
Top = 360
Width = 735
End
Begin VB.OptionButton optIP
Caption = "IP"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 615
End
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 1560
Top = 3480
End
Begin VB.Label Label7
Caption = "Select Local Inteface to Capture On:"
Height = 375
Left = 120
TabIndex = 5
Top = 1320
Width = 2655
End
End
Attribute VB_Name = "frmrcvall"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
' Project: vbrcvall
'
' Description:
' This application illustrates the use of the ioctl commands SIO_RCVALL,
' SIO_RCVALL_MCAST, and SIO_RCVALL_IGMPMCAST. These are three new ioctl
' commands available in Windows 2000 that may be set on a raw IP socket
' which can then be used to read the raw IP packets off of the network.
' This app provides a simple GUI for setting the various options
' available with these ioctls.
'
Option Explicit
Option Base 0
Dim dwIoControlCode As Long
Dim dwProtocol As Long
Dim dwInterface As Long
Dim LocalIPList(12) As sockaddr 'max 12 local interface
Dim uiSourceAddr As Long
Dim uiDestAddr As Long
Dim usSourcePort As Long
Dim usDestPort As Long
Dim optval As Long
Dim sockAll As Long
Dim hEvent As Long
Dim dwRet As Long, dwRc As Long, dwBytesRet As Long
Dim RetMsg(MAX_IP_SIZE) As Byte
'
' Subroutine: cmdClear_Click
'
' Description:
' This routine is the callback for the "Clear Capture Window".
' It simply clears the data window.
'
Private Sub cmdClear_Click()
List2.Clear
End Sub
'
' Subroutine: cmdStart_Click
'
' Description:
' This function initiates the IP datagram capture. This routine check
' to see if a filter is set and then initiates the timer. When the
' timer is triggered then we check to see if data is present.
'
Private Sub cmdStart_Click()
List2.Clear
cmdStart.Enabled = False
cmdStop.Enabled = True
'
' See if we're filtering on ports or addresses
'
If bFilter = True Then
If txtUiDestAddr.Text <> "" Then
uiDestAddr = GetHostByNameAlias(txtUiDestAddr.Text)
Else
uiDestAddr = 0
End If
If txtuiSourceAddr.Text <> "" Then
uiSourceAddr = GetHostByNameAlias(txtuiSourceAddr.Text)
Else
uiSourceAddr = 0
End If
If txtusDestPort.Text <> "" Then
usDestPort = CLng(txtusDestPort.Text)
Else
usDestPort = 0
End If
If txtusSourcePort.Text <> "" Then
usSourcePort = CLng(txtusSourcePort.Text)
Else
usSourcePort = 0
End If
End If
If uiDestAddr = 0 And uiSourceAddr = 0 And usDestPort = 0 And usSourcePort = 0 Then
bFilter = False
Else
bFilter = True
End If
Timer1.Enabled = True
End Sub
'
' Subroutine: cmdStop_Click
'
' Description:
' This routine stops the application from reading packets.
'
Private Sub cmdStop_Click()
cmdStart.Enabled = True
cmdStop.Enabled = False
If sockAll <> INVALID_SOCKET Then
closesocket sockAll
sockAll = INVALID_SOCKET
Timer1.Enabled = False
End If
End Sub
'
' Subroutine: Form_Load
'
' Description:
' This routine is called upon form load, and it sets up default
' values.
'
Private Sub Form_Load()
dwIoControlCode = SIO_RCVALL
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -