禁PING服务器测试工具端口测速端口扫描工具
面对禁PING的服务器想测试网络稳定是否有丢包情况,很伤脑筋测试不了,而使用网页测速或者软件测试速度又很慢,不能快速获得数据而烦恼,苦思冥想后编写了此款软件。本次软件进一步优化,会自动关闭连接,不会产生大量的连接而导致防火墙误判,和长时间连续测试导致消耗连接数资源问题。
软件特点是比ping强大,可以测试出1ms以下的速度,精确到小数点后2位。
本次升级 增加了端口扫描功能 謝謝樓主分享。 学习力。。。。。。。。。 不错,感谢分享 楼主开源吧! 謝謝樓主分享。 好强大的工具 这个很需要哈哈 不错,点ZAN!!! 禁PING服务器测试工具端口测速端口扫描工具 收藏看看。 如果释放源码的话就爽了 努力学习力。。。。。。。。。 楼主开源咯 或者告诉把关键代码放出来 回复 14# FluxayX
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_icon=C:\WINDOWS\system32\SHELL32.dll|-23
#PRE_Outfile=高速PING工具.exe
#PRE_Res_Comment=QQ:6910930
#PRE_Res_Description=高速PING工具 V2.0
#PRE_Res_Fileversion=1.0.0.10
#PRE_Res_Fileversion_AutoIncrement=p
#PRE_Res_LegalCopyright=Soft by Tvzml
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiIPAddress.au3>
#include <EditConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ProgressConstants.au3>
Opt("GUICloseOnESC", 0)
Opt("TrayMenuMode", 1)
Opt('MustDeclareVars', 1)
Local $ISTEST = False, $IP_Mac_Arrar
Global Const $DONT_FRAGMENT = 2, $IP_SUCCESS = 0, $IP_DEST_NET_UNREACHABLE = 11002, $IP_DEST_HOST_UNREACHABLE = 11003, $IP_DEST_PROT_UNREACHABLE = 11004, $IP_DEST_PORT_UNREACHABLE = 11005, _
$IP_NO_RESOURCES = 11006, $IP_HW_ERROR = 11008, $IP_PACKET_TOO_BIG = 11009, $IP_REQ_TIMED_OUT = 11010, $IP_BAD_REQ = 11011, $IP_BAD_ROUTE = 11012, _
$IP_TTL_EXPIRED_TRANSIT = 11013, $IP_TTL_EXPIRED_REASSEM = 11014, $IP_PARAM_PROBLEM = 11015, $IP_SOURCE_QUENCH = 11016, $IP_BAD_DESTINATION = 11018, _
$IP_GENERAL_FAILURE = 11050, $NO_STATUS = 10000 ;We will use 10000 as the no status indicator since 0 meens successful reply
Global $hPointers, $hkernel32Dll = -1, $hICMPDll, $hICMPDll, $DllData, $PINGJG = -1, $country, $area, $sleep = 0
Local $PING_1 = 5, $PING_2 = 30
Local $pings =
Local $pings_array
Local $pingdata = "x"
Local $timeout = 300
Local $ttl = 255
Local $IPQJ = "192.168.0."
Local $files = @ScriptDir & "\LOLTOOLS.INI"
Local $TT_Main = "高速PING工具 V2.0", $Width = 610, $Height = 490
Local $hGUI = GUICreate($TT_Main, $Width, $Height)
Local $tabx = 131, $taby = 70, $tabw = 472, $tabh = 360
Local $Button3 = GUICtrlCreateButton("点击测试PING", $tabx + 4, 10, $tabw - 8, 60)
GUICtrlSetCursor(-1, 0)
GUICtrlSetFont(-1, 20, 400, "微软雅黑")
Local $hListView = GUICtrlCreateListView("", $tabx + 4, $taby + 23, $tabw - 8, $tabh - 30, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUICtrlSendMsg($hListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
_GUICtrlListView_AddColumn($hListView, "序号", 50)
_GUICtrlListView_AddColumn($hListView, "名称", 170)
_GUICtrlListView_AddColumn($hListView, "IP地址", 110)
_GUICtrlListView_AddColumn($hListView, "状态", 110, 0)
_GUICtrlListView_AddColumn($hListView, "", 0)
_GUICtrlListView_AddColumn($hListView, "", 0)
Local $hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFFFFFF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFFFF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
Local $hGUIEdit = GUICtrlCreateEdit("", $tabx + 4, $taby + $tabh - 5, $tabw - 8, 50, $ES_AUTOVSCROLL)
GUISetState(@SW_SHOW, $hGUI)
Local $progress = GUICtrlCreateProgress($tabx + 4, $taby + 23 - 15, $tabw - 8, 15, $PBS_SMOOTH)
_loadIpList()
While 1
If Not $ISTEST Then _While()
WEnd
Func _While()
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_exit()
Case $Button3
_loadIpList()
EndSwitch
If $sleep > 0 Then
$sleep -= 1
Sleep(50)
EndIf
EndFunc ;==>_While
Func Echo($line = "")
Dim $time, $hGUIEdit_Str, $hGUIEdit_StrSp, $hGUIEdit_StrOK = "", $hGUIEdit_StrMax = 2, $hGUIEdit_StrEnd
$hGUIEdit_Str = GUICtrlRead($hGUIEdit)
If StringInStr($hGUIEdit_Str, @CRLF) Then
$hGUIEdit_StrSp = StringSplit($hGUIEdit_Str, @CRLF, 1)
If IsArray($hGUIEdit_StrSp) Then
Dim $hGUIEdit_Strout = UBound($hGUIEdit_StrSp) - 1
If $hGUIEdit_Strout > $hGUIEdit_StrMax Then
$hGUIEdit_StrMax = $hGUIEdit_Strout - $hGUIEdit_StrMax
Else
$hGUIEdit_StrMax = 1
EndIf
For $i = $hGUIEdit_StrMax To UBound($hGUIEdit_StrSp) - 1
$hGUIEdit_StrOK = StringReplace($hGUIEdit_StrOK, @CRLF, '^')
$hGUIEdit_StrOK = $hGUIEdit_StrOK & $hGUIEdit_StrSp[$i] & '^'
$hGUIEdit_StrOK = StringReplace($hGUIEdit_StrOK, '^^', '^')
Next
EndIf
EndIf
If $hGUIEdit_StrOK <> "" Then
$hGUIEdit_StrEnd = $hGUIEdit_StrOK & '^' & _Time() & " " & $line
Else
$hGUIEdit_StrEnd = _Time() & " " & $line
EndIf
$hGUIEdit_StrEnd = StringReplace($hGUIEdit_StrEnd, '^^', '^')
$hGUIEdit_StrEnd = _TrimStr($hGUIEdit_StrEnd, "^")
$hGUIEdit_StrEnd = StringReplace($hGUIEdit_StrEnd, '^', @CRLF)
GUICtrlSetData($hGUIEdit, $hGUIEdit_StrEnd & @CRLF)
EndFunc ;==>Echo
Func _Time()
Return @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC
EndFunc ;==>_Time
Func _TrimStr($str = "", $delstr = "\")
If StringLeft($str, 1) = $delstr Then $str = StringTrimLeft($str, 1)
If StringRight($str, 1) = $delstr Then $str = StringTrimRight($str, 1)
Return $str
EndFunc ;==>_TrimStr
Func _exit()
Exit
EndFunc ;==>_exit
Func _GetLoLIP($hiurl = "")
If $hiurl <> "" Then
Dim $String
If InetGet($hiurl, @TempDir & "\~ip.tmp") Then
$String = FileRead(@TempDir & "\~ip.tmp", FileGetSize(@TempDir & "\~ip.tmp"))
FileDelete(@TempDir & "\~ip.tmp")
Return _GetStringTrim($String, "@", 1, "@")
EndIf
EndIf
EndFunc ;==>_GetLoLIP
Func _GetStringTrim($String, $Begin, $BeginPosition, $End, $EndPosition = 1)
Local $Point, $String1
$Point = StringInStr($String, $Begin, 0, $BeginPosition)
If $Point > 0 Then
$Point += StringLen($Begin)
$Point = StringInStr($String, $End, 0, $EndPosition, $Point)
If $Point > 0 Then
$String1 = StringMid($String, $Point, $Point - $Point)
$String1 = _decstr($String1, "<br />")
$String1 = _decstr($String1, "</span>")
$String1 = _decstr($String1, '<span style="">')
$String1 = _decstr($String1, ' ')
$String1 = _decstr($String1, " ")
$String1 = StringReplace($String1, "<p>", "|")
$String1 = StringReplace($String1, "</p>", "|")
$String1 = StringReplace($String1, "||", "|")
Return $String1
EndIf
EndIf
Return ""
EndFunc ;==>_GetStringTrim
Func _decstr($String2, $str)
Dim $String3
$String3 = $String2
For $i = 1 To StringLen($String2) / StringLen($str)
If StringInStr($String3, $str) = 0 Then ExitLoop
$String3 = StringReplace($String3, $str, "")
Next
Return $String3
EndFunc ;==>_decstr
Func _loadIpList()
Dim $CC = 0, $PINGJG_str
Dim $PING_1_FILE = IniRead($files, "延迟设置", "内网延迟", "NOT")
If Not $PING_1_FILE = "NOT" Then
$PING_1 = Int($PING_1_FILE)
Else
IniWrite($files, "延迟设置", "内网延迟", $PING_1)
EndIf
Dim $PING_2_FILE = IniRead($files, "延迟设置", "外网延迟", "NOT")
If Not $PING_2_FILE = "NOT" Then
$PING_2 = Int($PING_2_FILE)
Else
IniWrite($files, "延迟设置", "外网延迟", $PING_2)
EndIf
ReDim $IP_Mac_Arrar
Dim $Read_mac = IniReadSection($files, "内网IP")
If IsArray($Read_mac) Then
If UBound($Read_mac) > 1 Then
For $i = 0 To UBound($Read_mac) - 1
If $Read_mac[$i] <> "" Then
Dim $UBound = UBound($IP_Mac_Arrar)
ReDim $IP_Mac_Arrar[$UBound + 1]
;Dim $Mac_ip_sp_SP = StringSplit($Read_mac[$i], ".", 1)
;If IsArray($Mac_ip_sp_SP) Then
;If UBound($Mac_ip_sp_SP) = 5 Then
$IP_Mac_Arrar[$UBound] = $Read_mac[$i]
$IP_Mac_Arrar[$UBound] = $Read_mac[$i]
$IP_Mac_Arrar[$UBound] = "[内网]"
;EndIf
;EndIf
EndIf
Next
EndIf
EndIf
Dim $Read_mac = IniReadSection($files, "外网IP")
If IsArray($Read_mac) Then
If UBound($Read_mac) > 1 Then
For $i = 0 To UBound($Read_mac) - 1
If $Read_mac[$i] <> "" Then
Echo($Read_mac[$i])
Dim $UBound = UBound($IP_Mac_Arrar)
ReDim $IP_Mac_Arrar[$UBound + 1]
;Dim $Mac_ip_sp_SP = StringSplit($Read_mac[$i], ".", 1)
;If IsArray($Mac_ip_sp_SP) Then
;If UBound($Mac_ip_sp_SP) = 5 Then
$IP_Mac_Arrar[$UBound] = $Read_mac[$i]
$IP_Mac_Arrar[$UBound] = $Read_mac[$i]
$IP_Mac_Arrar[$UBound] = "[外网]"
;EndIf
;EndIf
EndIf
Next
EndIf
EndIf
If IsArray($IP_Mac_Arrar) Then
If UBound($IP_Mac_Arrar) > 1 Then
$sleep = Int(UBound($IP_Mac_Arrar)) * 1
GUICtrlSetData($progress, 0)
For $i = 1 To UBound($IP_Mac_Arrar) - 1
If $IP_Mac_Arrar[$i] <> "" Then
$PINGJG = -1
_While()
_PINGALL(_TCPNameToIP($IP_Mac_Arrar[$i]))
$PINGJG_str = ""
If $PINGJG = -1 Then
$PINGJG_str = "故障"
$CC = 3
EndIf
If $PINGJG = 0 Then
$PINGJG_str = "正常(<1ms)"
$CC = 1
EndIf
If $IP_Mac_Arrar[$i] = "[内网]" Then
If $PINGJG > 0 And $PINGJG < $PING_1 + 1 Then
$PINGJG_str = "正常(" & $PINGJG & "ms)"
$CC = 1
EndIf
If $PINGJG > $PING_1 Then
$PINGJG_str = "延迟(" & $PINGJG & "ms)"
$CC = 2
EndIf
EndIf
If $IP_Mac_Arrar[$i] = "[外网]" Then
If $PINGJG > 0 And $PINGJG < $PING_2 + 1 Then
$PINGJG_str = "正常(" & $PINGJG & "ms)"
$CC = 1
EndIf
If $PINGJG > $PING_2 Then
$PINGJG_str = "延迟(" & $PINGJG & "ms)"
$CC = 2
EndIf
EndIf
$IP_Mac_Arrar[$i] = $PINGJG_str
GUICtrlSetData($progress, $i * (100 / UBound($IP_Mac_Arrar)))
Dim $iI = _GUICtrlListView_FindText($hListView, $i, 0)
If $iI = -1 Then
_GUICtrlListView_AddItem($hListView, $i, 0)
_GUICtrlListView_AddSubItem($hListView, $i - 1, $IP_Mac_Arrar[$i], 1)
_GUICtrlListView_AddSubItem($hListView, $i - 1, $IP_Mac_Arrar[$i], 2)
_GUICtrlListView_AddSubItem($hListView, $i - 1, $PINGJG_str, 3, $CC)
Else
_GUICtrlListView_SetItem($hListView, $PINGJG_str, $iI, 3, $CC)
EndIf
EndIf
Next
GUICtrlSetData($progress, 100)
EndIf
EndIf
EndFunc ;==>_loadIpList
Func _PINGALL($pingstr = "")
ReDim $pings_array
$hPointers = DllStructCreate("ptr IcmpCloseHandle;ptr IcmpSendEcho;ptr IcmpCreateFile;ptr ExitThread")
If $hkernel32Dll = -1 Then $hkernel32Dll = DllOpen("kernel32.dll")
Dim $hKrn = _WinAPI_GetModuleHandle("kernel32.dll")
DllStructSetData($hPointers, "ExitThread", GetProcAddress($hKrn, "ExitThread"))
$hICMPDll = LibLoad("ICMP.dll");Iphlpapi.dll")
DllStructSetData($hPointers, "IcmpCloseHandle", GetProcAddress($hICMPDll, "IcmpCloseHandle"))
DllStructSetData($hPointers, "IcmpSendEcho", GetProcAddress($hICMPDll, "IcmpSendEcho"))
DllStructSetData($hPointers, "IcmpCreateFile", GetProcAddress($hICMPDll, "IcmpCreateFile"))
pingThreaded($pingstr, $timeout, $pingdata, $ttl, $DONT_FRAGMENT)
While $pings > 0
_managePings()
WEnd
LibFree($hICMPDll)
If $hkernel32Dll <> -1 Then
DllClose($hkernel32Dll)
$hkernel32Dll = -1
EndIf
EndFunc ;==>_PINGALL
Func pingThreaded($ip_addr, $timeout = 5000, $data = "x", $ttl = 255, $flags = 0)
Local $hexIP = encodeIP($ip_addr)
If $hexIP == 0 Then Return 0
Local $pingID = _addPing($ip_addr)
If IsNumber($ttl) = 0 Or Number($ttl) > 255 Then $ttl = 255
If IsNumber($timeout) = 0 Or Number($timeout) > 5000 Then $timeout = 5000
If StringLen($data) > 256 Then $data = StringTrimRight($data, StringLen($data) - 256)
If IsNumber($flags) = 0 Or Number($flags) > 2 Then $flags = 2
DllStructSetData($pings[$pingID], "datasize", StringLen($data)) ;We may wish to report the data size later
Local $CodeBuffer = DllStructCreate("byte"); Code=154, Data=256, Echo reply Struct + ICMP_OPTIONS Struct = 286
Local $RemoteCode = _MemVirtualAlloc(0, DllStructGetSize($CodeBuffer), $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)
DllStructSetData($CodeBuffer, 1, _
"0x" & _ ;Original Assembly started at 401000
"E889000000" & _ ;Call 0040108E<IcmpCreateFile>
"A3" & SwapEndian($RemoteCode + 410) & _ ;mov dword ptr , eax<hIcmp = IcmpCreateFile Handle>
"C605" & SwapEndian($RemoteCode + 418) & Hex($ttl, 2) & _ ;mov byte ptr , xx <TTL>
"C605" & SwapEndian($RemoteCode + 419) & "00" & _ ;mov byte ptr , 00 <TOS>
"C605" & SwapEndian($RemoteCode + 420) & Hex($flags, 2) & _ ;mov byte ptr , 02 <Flags, 0x02=DF Bit Set>
"C605" & SwapEndian($RemoteCode + 421) & "00" & _ ;mov byte ptr , 00
"C705" & SwapEndian($RemoteCode + 422) & "00000000" & _ ;mov dword ptr , 00000000
"68" & SwapEndian(Dec(Hex($timeout, 4))) & _ ;push 0000xxxx<Timeout>
"681E010000" & _ ;push 0000011E<Size of Echo reply Struct + ICMP_OPTIONS Struct>
"68" & SwapEndian($RemoteCode + 426) & _ ;push 0040302C<icmpReply>
"68" & SwapEndian($RemoteCode + 418) & _ ;push 00403024<icmpOptions>
"6A" & Hex(StringLen($data), 2) & _ ;push 000000xx<Data Size>
"68" & SwapEndian($RemoteCode + 154) & _ ;push 00403000<Data>
"68" & SwapEndian(Dec($hexIP)) & _ ;push <Hex(IP ADDRESS)>
"FF35" & SwapEndian($RemoteCode + 410) & _ ;push dword ptr <hIcmp>
"E839000000" & _ ;Call 00401094<IcmpSendEcho>
"A1" & SwapEndian($RemoteCode + 434) & _ ;mov eax, dword ptr <Get the ms responce time from icmpReply.RoundTripTime>
"A3" & SwapEndian(DllStructGetPtr($pings[$pingID], "reply")) & _ ;mov dword ptr , eax<Store the ms responce time>
"A1" & SwapEndian($RemoteCode + 430) & _ ;mov eax, dword ptr <Get the status from icmpReply.Status>
"A3" & SwapEndian(DllStructGetPtr($pings[$pingID], "status")) & _ ;mov dword ptr , eax<Store the status>
"FF35" & SwapEndian($RemoteCode + 410) & _ ;push dword ptr <hIcmp>
"E80E000000" & _ ;Call 00401088<IcmpCloseHandle>
"6A00" & _ ;push 00000000
"E801000000" & _ ;Call 00401082<ExitThread>
"CC" & _ ;int 03
"FF25" & SwapEndian(DllStructGetPtr($hPointers, "ExitThread")) & _ ;JMP dword ptr<kernel32.ExitThread>
"FF25" & SwapEndian(DllStructGetPtr($hPointers, "IcmpCloseHandle")) & _;JMP dword ptr<ICMP.IcmpCloseHandle>
"FF25" & SwapEndian(DllStructGetPtr($hPointers, "IcmpCreateFile")) & _ ;JMP dword ptr<ICMP.IcmpCreateFile>
"FF25" & SwapEndian(DllStructGetPtr($hPointers, "IcmpSendEcho")) & _;JMP dword ptr<ICMP.IcmpSendEcho>
SwapEndian(StringToBinary($data)) _ ;This is our ping Data, Max 256 bytes of space here.
)
_MemMoveMemory(DllStructGetPtr($CodeBuffer), $RemoteCode, DllStructGetSize($CodeBuffer))
Local $aCall = DllCall($hkernel32Dll, "ptr", "CreateThread", "ptr", 0, "int", 0, "ptr", $RemoteCode, "ptr", 0, "int", 0, "dword*", 0)
Return $aCall
EndFunc ;==>pingThreaded
Func _addPing($ip_addr)
$pings = UBound($pings)
ReDim $pings[$pings + 1]
$pings[$pings] = DllStructCreate("char ip[" & StringLen($ip_addr) & "];ulong reply;ulong status;int datasize");You could add a timeout struct here
DllStructSetData($pings[$pings], "ip", $ip_addr)
DllStructSetData($pings[$pings], "status", $NO_STATUS)
Return $pings
EndFunc ;==>_addPing
Func _removePing($pingID)
If $pingID > $pings Then Return ;Ensure our ID is valid
$pings[$pingID] = 0 ;Free the DLLStruct
_ArrayDelete($pings, $pingID)
$pings -= 1
EndFunc ;==>_removePing
Func _managePings()
Local $pingID, $status
$pingID = 1
While $pingID <= $pings
$status = DllStructGetData($pings[$pingID], "status")
If $status <> $NO_STATUS Then
Switch $status
Case $IP_SUCCESS
Dim $pings_UBound = UBound($pings_array)
ReDim $pings_array[$pings_UBound + 1]
Dim $ipstr = DllStructGetData($pings[$pingID], "ip")
Dim $ipstrSP = StringSplit($ipstr, ".", 1)
If IsArray($ipstrSP) Then
If UBound($ipstrSP) > 4 Then
$pings_array[$pings_UBound - 1] = Int($ipstrSP)
EndIf
EndIf
$pings_array[$pings_UBound - 1] = $ipstr
If DllStructGetData($pings[$pingID], "reply") = 0 Then
;ConsoleWrite("Ping with " & DllStructGetData($pings[$pingID], "datasize") & " byte(s) to " & DllStructGetData($pings[$pingID], "ip") & " replied in <1ms" & @CRLF)
$pings_array[$pings_UBound - 1] = "<1ms"
$PINGJG = 0
Else
;ConsoleWrite("Ping with " & DllStructGetData($pings[$pingID], "datasize") & " byte(s) to " & DllStructGetData($pings[$pingID], "ip") & " replied in " & DllStructGetData($pings[$pingID], "reply") & "ms" & @CRLF)
$pings_array[$pings_UBound - 1] = DllStructGetData($pings[$pingID], "reply") & "ms"
$PINGJG = Number(DllStructGetData($pings[$pingID], "reply"))
EndIf
EndSwitch
_removePing($pingID)
EndIf
$pingID += 1
WEnd
EndFunc ;==>_managePings
Func encodeIP($ip_addr)
Local $ip_addr_temp = $ip_addr
If Not _isIP($ip_addr) Then $ip_addr = TCPNameToIP($ip_addr)
If Not _isIP($ip_addr) Then
ConsoleWrite($ip_addr_temp & " is not a valid IP Address. If you supplied a hostname ensure DNS is available." & @CRLF)
Return 0
EndIf
Return getHexIP($ip_addr)
EndFunc ;==>encodeIP
Func getHexIP($ip_addr)
Return Hex(_getIPOctet($ip_addr, 4), 2) & Hex(_getIPOctet($ip_addr, 3), 2) & Hex(_getIPOctet($ip_addr, 2), 2) & Hex(_getIPOctet($ip_addr, 1), 2)
EndFunc ;==>getHexIP
Func LibLoad($lpLibFileName)
Local $LibHandle = DllCall($hkernel32Dll, "int", "LoadLibraryA", "str", $lpLibFileName)
Return $LibHandle
EndFunc ;==>LibLoad
Func LibFree($DllHandle)
Local $LibFreed = DllCall($hkernel32Dll, "int", "FreeLibrary", "int", $DllHandle)
Return $LibFreed
EndFunc ;==>LibFree
Func GetProcAddress($hModule, $lpProcName)
Local $ProcessAddy = DllCall($hkernel32Dll, "int", "GetProcAddress", "int", $hModule, "str", $lpProcName)
Return $ProcessAddy
EndFunc ;==>GetProcAddress
Func SwapEndian($hex)
Return Hex(Binary($hex))
EndFunc ;==>SwapEndian
Func _getIPOctet($ip_addr, $octet = 1)
Switch $octet
Case 1
Return Int(StringMid($ip_addr, 1, StringInStr($ip_addr, ".")))
Case 4
Return Int(StringMid($ip_addr, StringInStr($ip_addr, ".", 0, 3) + 1))
Case Else
Return Int(StringMid($ip_addr, StringInStr($ip_addr, ".", 0, $octet - 1) + 1, StringInStr($ip_addr, ".", 0, $octet) + 1))
EndSwitch
EndFunc ;==>_getIPOctet
Func _isIP($text)
Return StringRegExp($text, "(((25)|(2)|(1)|(?))\.){3}((25)|(2)|(1)|(?))")
EndFunc ;==>_isIP
Func _TCPNameToIP($str)
Dim $TP_NAMETOIP = $str
If Not StringIsDigit(StringReplace($TP_NAMETOIP, ".", "")) Then
TCPStartup()
$TP_NAMETOIP = TCPNameToIP($str) ;域名转换为IP
TCPShutdown()
EndIf
Return $TP_NAMETOIP
EndFunc ;==>_TCPNameToIP
页:
[1]
2