MAC地址问题
用论坛上的MAC地址获得函数,IP10.120.197.1-10.120.197.192都是错的,10.12.197.193开始才对,为啥的,求高手指教Func _GetMAC($sIP)Local $MAC, $MACSize
Local $i, $s, $r, $iIP
$MAC = DllStructCreate("byte")
$MACSize = DllStructCreate("int")
DllStructSetData($MACSize, 1, 6)
$r = DllCall("Ws2_32.dll", "int", "inet_addr", "str", $sIP)
$iIP = $r
$r = DllCall("iphlpapi.dll", "int", "SendARP", "int", $iIP, "int", 0, "ptr", DllStructGetPtr($MAC), "ptr", DllStructGetPtr($MACSize))
$s = ""
For $i = 0 To 5
If $i Then $s = $s & "-"
$s = $s & Hex(DllStructGetData($MAC, 1, $i + 1), 2)
Next
Return $s
EndFunc ;==>_GetMAC
Func _StringIsIP($strIP)
$str = StringSplit($strIP, ".")
If $str <> 4 Then
Return ("")
ElseIf StringIsDigit($str) <> 1 Or StringIsDigit($str) <> 1 Or StringIsDigit($str) <> 1 Or StringIsDigit($str) <> 1 Then
Return ("")
ElseIf $str > 255 Or $str > 255 Or $str > 255 Or $str > 255 Then
Return ("")
Else
$strIP = Int($str) & "." & Int($str) & "." & Int($str) & "." & Int($str)
Return $strIP
EndIf
EndFunc IP10.120.197.1-10.120.197.192都是错的, 10.12.197.193开始才对
不是一个网段情况下,ARP广播不到的。 谢谢俄,因该是这个问题
页:
[1]