If Not FileExists(@ScriptDir&"\Config.ini") Then
IniWrite(@ScriptDir&"\Config.ini", "配置", "IP", "")
IniWrite(@ScriptDir&"\Config.ini", "配置", "MAC", "")
EndIf
$ip = IniRead(@ScriptDir&"\Config.ini", "配置", "IP", "")
$mac = IniRead(@ScriptDir&"\Config.ini", "配置", "MAC", "")
If $ip = "" Or $mac = "" Then
MsgBox(32, "提示", "请填写好配置文件后再试~")
Else
While 1
_RunDOS("arp -s "& $ip &" "& $mac)
Sleep(1000)
_ReduceMemory(@AutoItPID)
WEnd
EndIf
Func _ReduceMemory($i_PID = -1) ;<==释放内存函数
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc
Func _RunDOS($sCommand)
Local $nResult = RunWait(@ComSpec & " /C " & $sCommand, "", @SW_HIDE)
Return SetError(@error, @extended, $nResult)
EndFunc ;==>_RunDOS
|