精睿ESET ID自动获取填写工具(ESET_VC52_AUTOID_v1.7.8.4_x64)开源

#NoTrayIcon
 #Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
 #AutoIt3Wrapper_icon=d:\161.ico
 #AutoIt3Wrapper_outfile=c:\ESET_VC52_AUTOID_v1.7.8.4_x64.exe
 #AutoIt3Wrapper_Compression=4
 #AutoIt3Wrapper_Res_Comment=ESET ID自动获取填写工具(适用所有版本-支持32/64位ESETv5)
 #AutoIt3Wrapper_Res_Description=ESET ID自动获取填写工具(适用所有版本-支持32/64位ESETv5),本程序先验证电脑里的ID,无效就自动读取网上ID发布页下载ID,验证后写入注册表。内置数条线路,如要自定义升级ID网址可在软件目录或C盘创建list.txt这个文本文件加入你的升级ID网址。
 #AutoIt3Wrapper_Res_Fileversion=1.7.8.4
 #AutoIt3Wrapper_Res_LegalCopyright=kaidashi(开达石)
 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
 ;AutoItSetOption("MustDeclareVars", 1) ;42个变量错误
 ;6.0 ID输入窗口306, 243
 ;#include <Array.au3>
 #Include <Constants.au3>
 ;#requireadmin

Opt("WinTitleMatchMode", 4)
 Opt("WintextMatchMode", 2)
 Opt("WinDetectHiddenText", 1)
 Opt("TrayOnEventMode", 1)
 Opt("TrayMenuMode", 1)

Dim $PassBytesA[10] = ["61", "D4", "DD", "FB", "5B", "35", "B7", "19", "EC", "2B" ], $iNumDays[15], $F5handle
 Dim $PassBytesB[10] = ["D6", "E9", "F0", "F2", "64", "AD", "C8", "75", "31", "BC" ], $checknum = 40, $idnum, $cherset
 Dim $r, $i, $k, $p[46], $n[46], $service, $regrandom = 0, $swap1, $swap2, $isnod = 0, $regcheck = 0, $listfile, $ui[20], $csall[45], $cs, $PageMode
 Dim $tx, $newver, $oldver, $uplive, $newreadme, $autolive, $nouplive, $checkautorun, $proxy, $downfilesize, $address, $lid, $GraphicMode
 Dim $random, $filesize, $username, $password, $password2, $t, $tem, $tep, $tex, $tmp, $j = 0, $listout = 0, $s = 0, $type, $upservice, $domain1, $domain2
 Dim $y, $m, $d, $dateerr = 0, $dateout, $dateoutname, $nowdate, $hidemode, $hidetmp[20], $processlist, $traysize, $taskup = 0, $falsecs = 0, $qqdoctor = 0, $qqdoctorpath
 Global $myweb, $txt, $mytxt, $myser, $er, $ver, $eid, $esetlan, $oldID, $idver, $installdir, $esetver, $allservice, $ESETstatus, $esetnum, $numyear, $nummon, $numday, $numhour, $nummin, $numsec
 Dim $PassA = '', $passtmp = "", $BassA = "MmXQCeTPpzOGijklIWZSFwRVAhYDKfgoqNraUnbExJdstcBuvLyH", $BassB = "", $PassB, $PassC = "", $exdate, $yearday, $un, $pw, $idyear
 Dim $nowdec, $nowh, $nowm, $nows, $packageID, $esetname, $udpnum = 1, $timeservice = "", $data, $nowms, $unsignedHexValue, $value, $udptmp, $status, $socket, $glfile
 Dim $neturl, $murl = "", $in1url, $in2url, $incheck = 0, $HTMLSource, $ver, $F5handle, $inputhandle, $upiddir, $handle, $var, $masks

If FileExists(@TempDir & "\autoidup.bat") Then
 $taskup = 1
 FileDelete(@TempDir & "\autoidup.bat")
 EndIf
 $er = "HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Plugins"
 $ver = "ESET_VC52_AUTOID_v1.7.8.4"
 If IsAdmin() Then
 $eid = "HKLM64\SOFTWARE\ESET_ID"
 Else
 $eid = "HKCU64\SOFTWARE\ESET_ID"
 EndIf
 $type = RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\info", "ProductType")
 $packageID = RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Info", "PackageID")
 $esetlan = RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Info", "LanguageId")
 $oldID = RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\LicenseInfo", "Username")
 Dim $TimeZoneKeyName = RegRead("HKLM64\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "TimeZoneKeyName")
 If $TimeZoneKeyName == "" Then $TimeZoneKeyName = RegRead("HKLM64\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "StandardName")
 If RegRead("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\" & $TimeZoneKeyName, "std") == "" Then
 If RegRead("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\China Standard Time", "std") == $TimeZoneKeyName Then $TimeZoneKeyName = "China Standard Time"
 EndIf
 $idver = StringLeft(@ScriptName, StringLen(@ScriptName) - 4)
 $oldver = FileGetVersion(@ScriptName)
 $GraphicMode = RegRead("HKCU64\Software\Eset\ESET Security\CurrentVersion\Client", "GraphicMode")
 $installdir = RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Info", "InstallDir")
 $upiddir = StringMid($installdir, 1, StringInStr($installdir, "\", 0, -2)) & "ESET_VC52_AUTOID\"
 $esetver = StringLeft(RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Info", "ProductVersion"), 1)
 If $esetver >= 4 Then
 If StringLower(StringLeft($type, 3)) == "eav" Then $esetname = "ESET NOD32 Antivirus"
 If StringLower(StringLeft($type, 3)) == "ess" Then $esetname = "ESET Smart Security"
 If $esetlan == "2052" Then
 $lid = "密"
 Else
 $lid = "assword"
 If $esetlan == "1028" Then $lid = "密"
 EndIf
 EndIf
 If StringMid($oldver, 7, 1) == 0 Then
 $oldver = StringLeft($oldver, 5)
 If StringMid($oldver, 5, 1) == 0 Then $oldver = StringLeft($oldver, 3)
 EndIf

$ui[1] = "http://u1.nod32cn.com"
 $ui[2] = "http://u1.eset.com.cn"
 $ui[3] = "http://u2.nod32cn.com"
 $ui[4] = "http://u2.eset.com.cn"
 $ui[5] = "http://u7.eset.com.cn"
 If StringInStr($CmdLineRaw, "/hide") Then $hidemode = 1
 $processlist = ProcessList()
 For $i = 1 To $processlist[0][0]
 If StringInStr($processlist[$i][0], "_autoid") > 0 And $processlist[$i][1] <> @AutoItPID Then
 If $hidemode <> 1 Then MsgBox(0, $ver & " 提示:", "貌似另一个我正在运行,另一个我将在5秒后被强制退出。", 5)
 ProcessClose($processlist[$i][0])
 EndIf
 Next
 #cs
 While 1
 $traysize = ControlGetPos("classname=Shell_TrayWnd", "", "ToolbarWindow321")
 If @error == 1 Then ExitLoop
 For $i = 7 To $traysize[2] Step 18
 ControlClick("classname=Shell_TrayWnd", "", "ToolbarWindow321", "middle", 1, $i, 10)
 Next
 ExitLoop
 WEnd
 #ce

$regcheck = RegRead($eid, "regcheck")
 If $regcheck == "" Then $regcheck = 0
 $csall[0] = 0
 For $i = 0 To 29
 $tem = RegRead($er & "\01000400\Settings", "DefaultServer" & $i)
 If @error <> 0 Then ExitLoop
 $csall[0] = $i + 1
 $csall[$i + 1] = StringMid($tem, 8, StringInStr($tem, "/", 0, 3) - 8)
 If $i > 1 Then fileswap($csall[1], $csall[Random(1, $i, 1)])
 Next

If $csall[0] > 0 Then
 $cs = $csall[Random(1, $csall[0], 1)]
 Else
 $csall = StringSplit("93.184.71.27|um12.eset.com|89.202.157.227|um14.eset.com|62.67.184.68|um16.eset.com|90.183.101.10|um18.eset.com", "|")
 $cs = $csall[Random(1, $csall[0], 1)]
 EndIf
 ;$cs="89.202.149.36"
 ;If $cs = '' Then $regcheck = 1
 ;_ArrayDisplay($csall,$csall[0])

;TraySetIcon("NETSHELL.dll",196)
 $autoliveitem = TrayCreateItem("自动升级")
 $autolive = RegRead($eid, "autolive")
 If $autolive <> "1" Then TrayItemSetState($autoliveitem, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "regautolive")

$autoExclusionitem = TrayCreateItem("自动排除")
 $autoExclusion = RegRead($eid, "autoExclusion")
 If $autoExclusion <> "1" Then TrayItemSetState($autoExclusionitem, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "regautoExclusion")

$autoENGINEitem = TrayCreateItem("自动更新ESET")
 $autoENGINE = RegRead($eid, "autoengine")
 If $autoENGINE == "1" Then TrayItemSetState($autoENGINEitem, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "regautoengine")

$checkautorun = ""
 $autorun = TrayCreateMenu("开机启动")
 $startautorun = TrayCreateItem("普通模式(有提示有托盘图标)", $autorun, -1, 1)
 TrayItemSetOnEvent(-1, "startautorun")
 $regautorun = TrayCreateItem("静默模式(无提示无托盘图标)", $autorun, -1, 1)
 TrayItemSetOnEvent(-1, "regautorun")
 ;TrayCreateItem("", $autorun)
 $taskautorun = TrayCreateItem("服务器模式(每12小时计划运行)", $autorun, -1, 1)
 TrayItemSetOnEvent(-1, "taskautorun")
 TrayCreateItem("", $autorun)
 $clearautorun = TrayCreateItem("取消开机启动", $autorun)
 TrayItemSetOnEvent(-1, "clearautorun")

If FileExists(@StartupCommonDir & "\ESET_vc52_autoid.lnk") Then
 $hidetmp = FileGetShortcut(@StartupCommonDir & "\ESET_vc52_autoid.lnk")
 If StringInStr($hidetmp[2], "/hide") > 0 Then
 $checkautorun = 2
 TrayItemSetState($regautorun, $TRAY_CHECKED)
 Else
 $checkautorun = 1
 TrayItemSetState($startautorun, $TRAY_CHECKED)
 EndIf
 Else
 If FileExists(@StartupCommonDir & "\ESET_vc52_autoid*.lnk") Then
 $checkautorun = 1
 TrayItemSetState($startautorun, $TRAY_CHECKED)
 EndIf
 EndIf
 If FileExists(@WindowsDir & "\tasks\ESET_AUTOID_HOUR.job") Or FileExists(@SystemDir & "\Tasks\ESET_AUTOID_HOUR") Then
 $checkautorun = 3
 TrayItemSetState($taskautorun, $TRAY_CHECKED)
 EndIf

TrayCreateItem("")
 If RegRead($eid, "random") == 1 Then
 $regrandom = 1
 Else
 $regrandom = 0
 EndIf
 $randomitem0 = TrayCreateMenu("ID选取方式")
 $randomitem1 = TrayCreateItem("顺序选取", $randomitem0, -1, 1)
 If $regrandom == 0 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "writenorandom")
 $randomitem2 = TrayCreateItem("随机选取", $randomitem0, -1, 1)
 If $regrandom == 1 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "writerandom")

$IDcheck = TrayCreateMenu("ID验证方式")
 TrayCreateItem("验证方式 1", $IDcheck, -1, 1)
 If $regcheck == 0 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "check1")
 TrayCreateItem("验证方式 2", $IDcheck, -1, 1)
 If $regcheck == 1 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "check2")
 TrayCreateItem("验证方式 3", $IDcheck, -1, 1)
 If $regcheck == 2 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "check3")

$upservice = RegRead($eid, "upservice")
 If $upservice == "" Then $upservice = 0
 $upserviceitem = TrayCreateMenu("升级服务器")
 If $esetver < 4 Then
 $upserviceitem1 = TrayCreateItem($ui[1], $upserviceitem, -1, 1)
 TrayItemSetOnEvent(-1, "upservice1")
 If $upservice == 1 Then upservice1()
 $upserviceitem2 = TrayCreateItem($ui[2], $upserviceitem, -1, 1)
 TrayItemSetOnEvent(-1, "upservice2")
 If $upservice == 2 Then upservice2()
 EndIf
 $upserviceitem0 = TrayCreateItem("自动选择", $upserviceitem, -1, 1)
 TrayItemSetOnEvent(-1, "upservice0")
 If $upservice == 0 Then upservice0()
 TrayCreateItem("", $upserviceitem)
 $upserviceitem3 = TrayCreateItem("自定义ESET升级服务器。", $upserviceitem, -1, 1)
 TrayItemSetOnEvent(-1, "upservice3")
 If $upservice == 3 Then TrayItemSetState($upserviceitem3, $TRAY_CHECKED)

$proxy = RegRead($eid, "proxy")
 If $proxy == "" Then $proxy = 0
 If RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable") == 0 Then $proxy = 0
 $proxy0 = TrayCreateMenu("其它设置项")

If StringInStr($TimeZoneKeyName, "china") > 0 Then
 $datecheck = RegRead($eid, "datecheck")
 $datecheckitem = TrayCreateItem("自动校对时间", $proxy0)
 If $datecheck == 1 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "datecheck")
 EndIf

$proxycheckitem = TrayCreateItem("", $proxy0)
 $proxyitem = TrayCreateItem("启用局域网代理", $proxy0)
 If $proxy == 1 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "proxy")
 $proxycheck = RegRead($eid, "proxycheck")
 $proxycheckitem = TrayCreateItem("间接式ID验证方法", $proxy0)
 If $proxycheck == 1 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "proxycheck")

$netwait = RegRead($eid, "netwait")
 $netwaititem = TrayCreateItem("间接式网络检测方法", $proxy0)
 If $netwait == 1 Then TrayItemSetState(-1, $TRAY_CHECKED)
 TrayItemSetOnEvent(-1, "netwait")

TrayCreateItem("")
 TrayCreateItem("还原默认值")
 TrayItemSetOnEvent(-1, "restore")
 TrayCreateItem("精睿原帖")
 TrayItemSetOnEvent(-1, "vc52")
 TrayCreateItem("我的网盘")
 TrayItemSetOnEvent(-1, "myie")
 TrayCreateItem("关于")
 TrayItemSetOnEvent(-1, "aboutevent")
 TrayCreateItem("")
 TrayCreateItem("退出")
 TrayItemSetOnEvent(-1, "ExitEvent")
 TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "tooltipx")
 If $hidemode <> 1 Then TraySetState()
 TraySetClick(16)
 TraySetToolTip($ver & " 提示:" & @CRLF & "无法检测到连网状态,我只能等待。")
 decpass()
 encpass()
 ;MsgBox(0,"ESET ID自动获取填写工具(测试版)提示:__kaidashi"," 此程序是ESET ID自动获取填写工具v1.7.8.4的测试版。用于帮助作者测试的用户所用。正式版会没有此对话框。如果下载的是正式版但是出现此对话框的话请重新下载正式版。")
 ;-----类型判断------d
 typecheck()
 Func typecheck()
 Select
 Case StringLower(StringLeft($type, 3)) == "ess"
 If $regcheck == 0 Then $address = $cs & "/v6-rel-sta/mod_008_epfw/em008_32_l0.nup"
 If $regcheck == 1 Then $address = "update.eset.com/v6-rel-sta/mod_008_epfw/em008_32_l0.nup"
 If $regcheck == 2 Then $address = "update.eset.com/v3-rel-sta/mod_008_epfw/em008_32_l0.nup"
 Case StringLower(StringLeft($type, 3)) == "eav"
 If $regcheck == 0 Then $address = $cs & "/v6-rel-sta/mod_000_loader/em000_32_l0.nup"
 If $regcheck == 1 Then $address = "update.eset.com/v6-rel-sta/mod_000_loader/em000_32_l0.nup"
 If $regcheck == 2 Then $address = "update.eset.com/v3-rel-sta/mod_000_loader/em000_32_l0.nup"

Case Else
 $installdir = RegRead("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Info", "InstallDir")
 If StringInStr($installdir, ":\") <> 0 Then
 $isnod = 1
 If $regcheck == 0 Then $address = $cs & "v3-rel-sta/mod_000_loader/em000_32_l0.nup"
 If $regcheck == 1 Then $address = "update.eset.com/v3-rel-sta/mod_008_epfw/em008_32_l0.nup"
 If $regcheck == 2 Then $address = "update.eset.com/v3-rel-sta/mod_000_loader/em000_32_l0.nup"
 Else
 If $hidemode <> 1 Then MsgBox(0, $ver & "运行出错", "你没有安装ESET的杀毒软件或你卸载了ESET杀毒软件,本程序会在 5 秒钟后自动卸载。", 5)
 uninstall()
 EndIf
 EndSelect
 EndFunc ;==>typecheck
 If StringInStr($CmdLineRaw, "/install") Then
 install()

Else
 If StringInStr($CmdLineRaw, "/uninstall") Then uninstall()
 If StringInStr(@ScriptFullPath, "\temp\") > 0 Then
 $tem = MsgBox(4, $ver & " 开机启动提示", "  你现在是在临时文件夹里运行本软件,为了提供更便捷的方式软件将把会复制到C盘根目录下然后设置“开机启动”" & @CRLF & @CRLF & "选择“是”软件将开启“开始菜单启动项”," & @CRLF & "选择“否”将跳过设置开机启动。")
 If $tem <> 7 Then
 FileCopy(@ScriptFullPath, "c:\" & @ScriptName, 1)
 clearautorun()
 FileCreateShortcut("c:\" & @ScriptName, @StartupCommonDir & "\" & StringLeft(@ScriptName, StringLen(@ScriptName) - 4) & ".lnk", "", "", "Eset 3.x ID自动获取填写工具v" & $oldver)
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 1&start c:\" & @ScriptName, "", @SW_HIDE)
 Exit
 EndIf
 EndIf
 EndIf
 ;-----删除eset_vc52_autoid.tmp------
 If $esetver >= 4 And StringInStr($CmdLineRaw, "/updatedir") > 0 Then
 If $esetver == 4 Then
 geli("")
 FileCopy(@ScriptFullPath, $installdir & "ESET_VC52_AUTOID.exe", 1)

If RegRead($eid, "qqdoctor") == "1" Then
 RegDelete($eid, "qqdoctor")
 Run(RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "QQDoctorRTP"))
 EndIf

If FileGetSize($installdir & "ESET_vc52_autoid.exe") == FileGetSize(@ScriptFullPath) Then
 TrayTip($ver & " 提示:", "软件更新成功,现在将以新版本启动。", 10)
 Sleep(2000)
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 3|del """ & $installdir & "ESET_vc52_autoid.tmp""&start /d """ & $installdir & """ eset_vc52_autoid.exe", "", @SW_HIDE)
 Exit
 Else
 TrayTip($ver & " 提示:", "软件更新失败,软件将退出。因为软件的“自我保护”功能的原因,使我无法更新。", 10)
 Sleep(3000)
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 2|del """ & $installdir & "ESET_vc52_autoid.tmp""", "", @SW_HIDE)
 Exit
 EndIf
 Else
 FileCopy(@ScriptFullPath, $upiddir & "ESET_VC52_AUTOID.exe", 9)
 TrayTip($ver & " 提示:", "软件更新成功,现在将以新版本启动。", 10)
 Sleep(2000)
 Run(@ComSpec & " /c " & 'ping 127.0.0.1 -n 1&start /d "' & $upiddir & '" ESET_VC52_AUTOID.exe', $upiddir, @SW_HIDE)
 Exit
 EndIf

EndIf

$tem = RegRead($eid, "autorun")
 Select
 Case $tem = 1
 startautorun()
 RegDelete($eid, "autorun")
 Case $tem = 2
 regautorun()
 RegDelete($eid, "autorun")
 Case $tem = 3
 taskautorun()
 RegDelete($eid, "autorun")
 EndSelect

If $proxy == 1 Then
 HttpSetProxy(2, RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer"))
 Else
 HttpSetProxy(1)
 EndIf
 TraySetToolTip($ver & " 提示:" & @CRLF & "无法检测到连网状态,我只能等待。")

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
 waiteset()
 Func waiteset()
 If Not ProcessExists("egui.exe") And $isnod <> 1 Then
 TrayTip($ver & " 提示", "正在等待ESET启动运行。", 10)
 If FileExists($installdir & "egui.exe") Then
 Run($installdir & "egui.exe /waitservice")
 $ESETstatus = 5
 $i = 0
 While 1
 If $esetver > 4 Then
 If $esetver>5 Then
 WinSetState("classname=ESET Client Frame", "",@SW_SHOW)
 WinActivate("classname=ESET Client Frame", "")
 ControlClick("classname=ESET Client Frame", "", "ESET Menu Window1", "left", 1, 70, 51)
 If ControlCommand("classname=ESET Client Frame", "", "CStaticII4","IsVisible", "") Then ExitLoop
 EndIf
 ControlClick("classname=ESET Client Frame", "", "ESET Menu Window1", "left", 1, 53, 43)
 If WinExists("classname=ESET Client Frame", "Web ") == 1 Then ExitLoop
 Else
 If $esetver = 4 Then
 ControlClick("classname=ESET Client Frame", "", "ESET Menu Window1", "left", 1, 49, 41)
 If WinExists("classname=ESET Client Frame", " (20") == 1 Then ExitLoop
 Else
 ControlClick("classname=ESET Client Frame", "", "ESET Menu Window1", "left", 1, 66, 224)
 If WinWait("classname=ESET Client Frame", "SysInspector", 1) == 1 Then ExitLoop
 EndIf
 EndIf
 If $i > 20 Then
 MsgBox(0, $ver & "出错提示:", "自动启动ESET失败,请手动打开 ESET 后再运行本程序。", 5)
 Exit
 EndIf
 TrayTip($ver & " 提示", "正在等待ESET启动运行。" & 20 - $i & "秒后退出。", 10)
 $i += 1
 Sleep(1000)
 WEnd
 For $i = 5 To 1 Step - 1
 TrayTip($ver & " 提示", "正在等待ESET启动运行。剩下 " & $i & " 秒后继续运行本程序。" & @CRLF & "请不要退出本程序,软件正在等待写入ID。", 10)
 Sleep(1000)
 Next
 EndIf
 Else
 EndIf
 EndFunc ;==>waiteset
 $PageMode=ControlCommand("classname=ESET Client Frame", "","ESET Product Window1","IsVisible", "")
 If $isnod <> 1 Then
 If $esetlan == "2052" Then
 $esetop1 = "默认("
 $esetop2 = "排除("
 $esetop3 = "病毒和间谍软件防护|排除"
 Else
 If $esetlan == "1033" Then
 $esetop1 = "&Default"
 $esetop2 = "&Exclusion:"
 $esetop3 = "Antivirus and antispyware|Exclusions"
 Else
 If $esetlan == "1028" Then
 $esetop1 = "預設值("
 $esetop2 = "排除("
 $esetop3 = "病毒及間諜程式防護|排除"
 Else
 TrayTip("", "Your ESET Language is not English or Chinese, I can't Exclusion.", 10)
 Sleep(3000)
 Exit
 EndIf
 EndIf
 EndIf
 EndIf
 ;-----解除对内置域名的阻止-----------
 Func waitF5()
 $i = 0
 $inputhandle = ""
 $F5handle = ""
 ;BlockInput(1)
 TrayTip($ver & "提示:", "因为需要对ESET进行高级设置,程序正在等待ESET完全启动,请稍候。此步骤只需运行一次。", 10)
 Do
 $txt = WinGetText("classname=ESET Client Frame", "")
 If ControlCommand("classname=ESET Client Frame", "","ESET Menu Window1","IsEnabled", "") Then
 ;If $txt <> "0" And $txt <> "" Then
 ControlSend("classname=ESET Client Frame", "", "ESET Menu Window1", "{f5}")
 Sleep(50)
 If $packageID <> "" And $packageID <> "1759227785" Then
 Sleep(100)
 ControlSend("classname=#32770", $lid, "Edit1", $PassC & "{enter}")
 EndIf
 Sleep(50)
 $var=WinList("classname=#32770",'')
 For $i = 1 to $var[0][0]
 If $var[$i][0] <> "" Then
 ;MsgBox(0, "详情"&ControlTreeView($var[$i][1],'',"SysTreeView321","Exists", "#0|#0" ), "标题=" & $var[$i][0] & @LF & "句柄=" & $var[$i][1]&@CRLF&WinGetText($var[$i][0],''))
 ;If ControlTreeView($var[$i][1],'',"SysTreeView321","Exists", "#0|#0") Then
 If StringInStr(WinGetText($var[$i][1],''),"ThreatSense") Then
 $F5handle=$var[$i][1]
 WinSetTrans($F5handle, '', 0)
 ExitLoop
 EndIf
 EndIf
 Next
 if ControlTreeView($F5handle,'',"SysTreeView321","Exists", "#0|#0" ) then ExitLoop
 EndIf
 Sleep(100)
 $i += 1
 Until $i > 400
 If $F5handle == "" Or $F5handle == 0 Then
 MsgBox(0, $ver & "出错提示:", "对不起,我识别不了开高级设置,请再次运行本程序,如果还出现这个对话框请你手动打开排除本程序,或反馈错误给作者。", 1)
 Exit
 EndIf

EndFunc ;==>waitF5
 $masks = RegRead($eid, "masks")
 If $masks == "" Then $masks = 0
 ;MsgBox(0,$masks,RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Plugins\01000200\Profiles\@My profile\UrlSets\Node_00000000", "Masks"))

If StringInStr(RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Plugins\01000200\Profiles\@My profile\UrlSets\Node_00000000", "Masks"), "autoid?.*") == 0 And $masks < 3 And $isnod <> 1 Then
 $timex = TimerInit()
 TrayTip($ver & "提示:", "程序正在解除ESET对本软件的检测线路限制,请等待。", 10)
 If $esetver > 3 Then

waitF5()
 ;MsgBox(0,"",$F5handle)

WinActivate($F5handle, "")
 If $esetver >= 5 Then
 If StringLower(StringLeft($type, 3)) == "eav" then
 ControlTreeView($F5handle, "", "SysTreeView321", "Select", "#1|#1|#1")
 Else
 If ControlTreeView($F5handle, "", "SysTreeView321", "GetItemCount", "#2") == 3 or ControlTreeView($F5handle, "", "SysTreeView321", "GetItemCount", "#2") == 4 Then
 ControlTreeView($F5handle, "", "SysTreeView321", "Select", "#2|#1|#1")
 Else
 ControlTreeView($F5handle, "", "SysTreeView321", "Select", "#3|#1|#1")
 EndIf
 EndIf
 ;MsgBox(0,$esetver,ControlTreeView($F5handle, "", "SysTreeView321", "GetItemCount", "#2"))
 EndIf
 If $esetver == 4 Then
 ControlTreeView($F5handle, "", "SysTreeView321", "Select", "#0|#3|#0|#0")
 EndIf

ControlSend($F5handle, "", "", "!a")
 $i = 1
 Do
 If WinExists("输入", '"https://"') Then $inputhandle = WinGetHandle("输入", '"https://"')
 If WinExists("輸入", '"https://"') Then $inputhandle = WinGetHandle("輸入", '"https://"')
 If WinExists("enter a Mask", '"https://"') Then $inputhandle = WinGetHandle("enter a Mask", '"https://"')
 If WinExists("Enter a mask", '"https://"') Then $inputhandle = WinGetHandle("Enter a mask", '"https://"')
 If WinExists("输入", 'domain.com') Then $inputhandle = WinGetHandle("输入", 'domain.com')
 If WinExists("輸入", 'domain.com') Then $inputhandle = WinGetHandle("輸入", 'domain.com')
 If WinExists("enter a Mask", 'domain.com') Then $inputhandle = WinGetHandle("enter a Mask", 'domain.com')
 If WinExists("Enter a mask", 'domain.com') Then $inputhandle = WinGetHandle("Enter a mask", 'domain.com')
 If $inputhandle <> "" Then ExitLoop
 Sleep(50)
 $i += 1
 Until $i > 60

If $inputhandle <> "" Then
 ;WinSetTrans($inputhandle, '', 0)
 $tem = ClipGet()
 ClipPut("http://autoid?.*")
 ControlSend($inputhandle, '', "Edit1", "^v{enter}")
 RegDelete($eid, "masks")
 Else
 WinKill($F5handle, "")
 RegWrite($eid, "masks", "reg_sz", $masks + 1)
 If $hidemode <> 1 Then MsgBox(0, $ver & "出错提示:", "对不起,没有等到输入对话框,程序将跳过此过程。5 秒后自动下一步。" & @CRLF & @CRLF & "注意:如果连续出现此对话框说明你的ESET版本不支持本软件的“检测线路阻止解除功能”," & @CRLF & "ESET可能会把本软件的检测线路阻止使软件无法正常工作。" & @CRLF & @CRLF & 3 - $masks & " 次后自动禁用“检测线路阻止解除功能”。", 5)
 EndIf
 BlockInput(0)
 Exclusion()
 ControlTreeView($F5handle, "", "SysTreeView321", "Select", "#0")
 ControlSend($F5handle, "", "", "{enter}")
 $F5handle = ""
 Else
 If $esetver >= 3 Then
 $tem = RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Plugins\01000200\Profiles\@My profile", "HttpUrlExcludeList")
 If StringInStr($tem, "autoid?.*") == 0 Then
 If $tem == "" Then
 RegWrite("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Plugins\01000200\Profiles\@My profile", "HttpUrlExcludeList", "reg_sz", "autoid?.*")
 Else
 RegWrite("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Plugins\01000200\Profiles\@My profile", "HttpUrlExcludeList", "reg_sz", $tem & "|autoid?.*")
 EndIf
 EndIf
 EndIf
 EndIf

Opt("WinTitleMatchMode", 4)
 Else
 Exclusion()
 EndIf
 ;-----网络等待------
 TrayTip($ver & "提示:", "解除ESET对本软件的检测线路限制完毕,等待线路检测。", 10)

dateout()
 $begin = TimerInit()
 $domain1 = 0

$in1url = "http://www.baidu.com/s?q1=%D3%C3%BB%A7%C3%FB%3AEAV-+%C3%DC%C2%EB&q2=&q3=&q4=&rn=50&lm=1&ct=0&ft=&q5=&q6=&tn=baiduadv*http://www.baidu.com/s?q1=" & $y & "+" & $m & "+" & $d & "+%22%D3%C3%BB%A7%C3%FB%3ATRIAL-%22+%C3%DC%C2%EB&q2=&q3=&q4=&rn=50&lm=1&ct=0&ft=&q5=&q6=&tn=baiduadv*http://www.soso.com/q?pid=s.idx&w=username%3AEAV-&nqr=0&sf=0&sd=2&nqr=0*http://search.aol.com/aol/search?s_it=advancedSearch&v_t=comsearch50ct6&as_q=EAV-+username+password&count_override=20&as_qdr=d*http://search.yahoo.com/search?n=40&ei=UTF-8&p=username:eav- password&btf=w*http://www.sogou.com/web?query=%D3%C3%BB%A7%C3%FB%3AEAV-+%C3%DC%C2%EB+%22"&$y&"%C4%EA"&$m&"%D4%C2%22&tsn=2&num=50*http://www.sogou.com/web?query=%D3%C3%BB%A7%C3%FB%3ATRIAL-+%C3%DC%C2%EB&tsn=2&pid=&duppid=1&num=40"
 $in2url = "http://www.shaduren.com/NOD32/NOD32shengjiID/*http://www.shanyaoba.cn/list.php?cid=12*http://www.nod32jihuoma.info/*http://www.nod32home.com/nod32-id/*http://www.nod32fan.com/nod32-username-password/*http://www.hackace.net/search.asp?m=1&s=0&word=NOD32&x=19&y=7*http://www.871020.com/category/nod32id-upgrade*http://www.hackhy.com/search.asp?m=1&s=0&word=NOD32&x=20&y=10*http://www.90hncker.com/search.asp?m=1&s=0&word=NOD32&x=28&y=19*http://www.woody8.com/activation/nod32/"
 ;$allservice = $myser & "*http://www.baidu.com/s?q1=%D3%C3%BB%A7%C3%FB%3AEAV-+%C3%DC%C2%EB&q2=&q3=&q4=&rn=50&lm=1&ct=0&ft=&q5=&q6=&tn=baiduadv*http://www.baidu.com/s?q1=" & $y & "+" & $m & "+" & $d & "+%22%D3%C3%BB%A7%C3%FB%3ATRIAL-%22+%C3%DC%C2%EB&q2=&q3=&q4=&rn=50&lm=1&ct=0&ft=&q5=&q6=&tn=baiduadv*http://www.soso.com/q?w=%D3%C3%BB%A7%C3%FB%3Aeav-&ch=w.tf&sf=0&sd=1&nqr=0*http://www.soso.com/q?pid=s.idx&w=username%3ATRIAL-&nqr=0&sf=0&sd=2&nqr=0*http://www.youdao.com/search?q=%E7%94%A8%E6%88%B7%E5%90%8D%3Aeav-&ue=utf8&keyfrom=web.index&lm=1*http://www.youdao.com/search?q=%E7%94%A8%E6%88%B7%E5%90%8D%3Atrial-&ue=utf8&keyfrom=web.index&lm=7*http://aim.search.aol.com/aol/search?s_it=advancedSearch&v_t=nscpsearch&as_q=trial-+username+password&count_override=20*http://search.yahoo.com/search?n=20&vd=m3&vc=&fp_ip=cn&p=username%3Atrial-&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-701*http://www.sogou.com/web?query=%D3%C3%BB%A7%C3%FB%3AEAV-+%C3%DC%C2%EB&tsn=1&pid=&duppid=1&num=50*http://www.sogou.com/web?query=%D3%C3%BB%A7%C3%FB%3ATRIAL-+%C3%DC%C2%EB&tsn=2&pid=&duppid=1&num=40*http://naoz.cn*http://www.shanyaoba.cn/list.php?cid=12*http://www.ie210.cn/plus/list.php?tid=98*http://www.nod32sj.cn/*http://www.share-key.com/*http://www.nodsj.com*http://www.cnfree.org/html/id/id_5/*"
 ;*http://www.wfsky.com/cms/DianNaoJiShu/还可以用但是速度慢
 ;*http://www.nod32id.org/
 If $murl <> "" Then
 Switch $incheck
 Case 0
 $allservice = $myser & "*" & $murl & "*"
 Case 1
 $allservice = $myser & "*" & $murl & "*" & $in1url & "*" & $in2url & "*"
 Case 2
 $allservice = $myser & "*" & $in1url & "*" & $in2url & "*" & $murl & "*"
 Case 3
 $allservice = $myser & "*" & $in1url & "*" & $murl & "*"
 Case Else
 $allservice = $myser & "*" & $murl & "*"
 EndSwitch
 Else
 $allservice = $myser & "*" & $in1url & "*" & $in2url & "*"
 EndIf
 $tem = ""
 $tex = ""
 If FileExists(FileGetShortName(@ScriptDir) & "\list.txt") Then
 $listfile = FileOpen(FileGetShortName(@ScriptDir) & "\list.txt", 0)
 While 1
 $tem = FileReadLine($listfile)
 If @error == "-1" Then ExitLoop
 If StringInStr($tem, "http://") <> 0 Then $tex = $tex & $tem & "*"
 WEnd
 $allservice = $tex & $allservice
 Else
 If FileExists("c:\list.txt") Then
 $listfile = FileOpen("c:\list.txt", 0)
 While 1
 $tem = FileReadLine($listfile)
 If @error == "-1" Then ExitLoop
 If StringInStr($tem, "http://") <> 0 Then $tex = $tex & $tem & "*"
 WEnd
 $allservice = $tex & $allservice
 EndIf
 EndIf

$service = StringSplit($allservice, "*")

;_ArrayDisplay($service,"")
 If RegRead($eid, "random") == 1 Then
 $regrandom = 1
 For $i = 1 To $service[0] - 1
 fileswap($service[$i], $service[Random(1, $service[0] - 1, 1)])
 Next

Else
 $regrandom = 0
 $tem = RegRead($eid, "randomnum")
 If StringLen($tem) > 4 Or $tem < 0 Then $tem = 1
 If $tem <> "" Then
 $tmp = $service[$tem]
 For $i = $tem - 1 To 1 Step - 1
 $service[$i + 1] = $service[$i]
 Next
 $service[1] = $tmp
 Else
 ;RegDelete($eid, "randomnum")
 EndIf
 EndIf
 ;_ArrayDisplay($service,"")

If $esetver == 3 Then ;-----ESET v3增加二版科技服务器------
 $tex = ""
 $tem = 0
 For $i = 0 To 15
 $tex = $tex & "*" & RegRead($er & "\01000400\UI_Settings\Servers", "server_" & $i)
 If @error <> 0 Then ExitLoop
 $tem = $i
 Next
 $i = 1
 Do
 RegEnumVal($er & "\01000400\UI_Settings\Servers", 1)
 If @error <> 0 Then
 RegWrite($er & "\01000400\UI_Settings\Servers", "Server_0", "REG_SZ", $ui[1])
 RegWrite($er & "\01000400\UI_Settings\Servers", "Server_1", "REG_SZ", $ui[2])
 ExitLoop
 EndIf

If StringInStr(StringLower($tex), $ui[$i]) > 0 Then
 ExitLoop
 Else
 $tem += 1
 RegWrite($er & "\01000400\UI_Settings\Servers", "Server_" & $tem, "REG_SZ", $ui[$i])
 EndIf
 $i += 1
 Until $ui[$i] == ""
 EndIf

;TrayTip("正在读取ID网站", $service[$s], 10)
 TraySetToolTip("ESET ID自动获取工具 " & $ver & " -- kaidashi" & @CRLF & "正在验证电脑里的ID。")
 If $regcheck == 1 Then $cs = "官方下载线路--1"
 If $regcheck == 2 Then $cs = "官方服务器--2"
 $iddec = RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\LicenseInfo", "ExpirationDate")
 If @error <> 0 Then $iddec = 5555555555
 ;MsgBox(0, '', Int($iddec / 60 / 60 / 24 )&@CRLF&$nowdec)
 ;If $tem < 0 Then $tem = 3650
 If $isnod <> 1 And Int($iddec / 60 / 60 / 24) - $nowdec < 16 Then
 RegDelete($er & "\01000400\Profiles\@My profile", "password")
 RegDelete($er & "\01000400\Profiles\@My profile", "username")
 RegDelete("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings", "password")
 RegDelete("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings", "username")
 Else
 If $isnod = 0 Then
 $username = RegRead($er & "\01000400\Profiles\@My profile", "username")
 $password2 = RegRead($er & "\01000400\Profiles\@My profile", "password")
 Else
 $username = RegRead("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings", "username")
 $password2 = RegRead("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings", "password")
 EndIf
 ;MsgBox(0,$password2,StringMid($password2,3))
 If @error == "0" Then
 $password = DecodePassword(StringMid($password2,3))
 Do
 $stime = TimerInit()
 TrayTip($ver & " 提示:", "正在验证电脑中的ID" & @CRLF & $username & " -- " & $password & @CRLF & $cs, 10)
 If $proxycheck == 1 Then
 $hDownload=InetGet("http://" & $username & ":" & $password & "@" & $address, @TempDir & "\tem.tmp", 1, 1)

While InetGetInfo($hDownload, 2)==0
 If InetGetInfo($hDownload, 0) > 512 Then
 InetGet("abort")
 $filesize = 4096
 ExitLoop
 EndIf
 WEnd
 Else
 $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
 $oHTTP.Open("HEAD", "http://" & $address, 0)
 ;$oHTTP.Option(6)=1
 $oHTTP.setTimeouts(5000, 5000, 5000, 5000)
 $oHTTP.SetCredentials($username, $password, 0)
 $oHTTP.Send()
 If $oHTTP.status == 401 Then ExitLoop
 If (($oHTTP.status = 200 And $oHTTP.getResponseHeader("content-length") == "") Or TimerDiff($stime) > 5000) And $regcheck == 0 Then
 $oHTTP = 0
 $falsecs += 1
 $cs = $csall[$falsecs]
 If $falsecs > $csall[0] Then
 $regcheck = 1
 EndIf
 typecheck()
 ContinueLoop
 EndIf
 $filesize = $oHTTP.getResponseHeader("content-length")
 If $filesize = "" Or ($filesize > 0 And StringInStr($oHTTP.getResponseHeader("content-Type"), "text")) Then $filesize = 0
 $oHTTP = 0
 EndIf

;$filesize = InetGetSize("http://" & $username & ":" & $password & "@" & $address)
 If $regcheck <> 0 Then ExitLoop
 Until TimerDiff($stime) < 5000
 If $filesize > 500 Then
 ;Exclusion()
 If $esetver >= 4 And StringLower(@ScriptFullPath) == StringLower($installdir & "ESET_VC52_AUTOID.tmp") Then Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 2|del " & FileGetShortName(@ScriptFullPath), "", @SW_HIDE)
 If $autoENGINE == 1 Then
 TrayTip($ver & " 提示:", "你电脑里的ID有效!" & @CRLF & $username & " -- " & $password & @CRLF & "正在启动更新ESET病毒库。", 10)
 upengine()
 EndIf
 $exdate = ""
 If $oldID == $username Then
 $esetnum = RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\LicenseInfo", "ExpirationDate")
 datechange()
 $exdate = Int($esetnum / 60 / 60 / 24) - $nowdec & " 天后到期:" & StringFormat("%04d/%02d/%02d", $numyear, $nummon, $numday)
 EndIf
 TrayTip($ver & " 提示:", "你电脑里的ID有效!" & @CRLF & $username & " -- " & $password & @CRLF & $exdate & @CRLF & "完成任务,将在3秒后退出。", 10)
 Sleep(4000)
 Exit
 EndIf
 EndIf
 EndIf

TraySetToolTip("ESET ID自动获取工具 " & $ver & " -- kaidashi" & @CRLF & "正在获取网上ID并验证ID的有效性。")

If $service[$s] == $myser Then
 TrayTip($ver & " 提示:", "作者ID发布页 正在连接中" & @CRLF & "电脑里的ID无效或快过期。正在连接ESET升级服务器:" & @CRLF & $cs, 10)
 Else
 ;TrayTip($service[$s]&" 正在连接中" ,"电脑里的ID无效或快过期。正在连接ESET升级服务器:"&@CRLF & $cs, 10)
 TrayTip($ver & " 提示:", "ID发布页 --" & StringMid($random, $s, 1) & " 正在连接中" & @CRLF & "电脑里的ID无效或快过期。正在连接ESET升级服务器:" & @CRLF & $cs, 10)
 EndIf
 $password = ""
 $password2 = ""

;$cs="89.202.149.36"
 ;typecheck()
 ;MsgBox(0,IsArray($k),$j)
 While 1

If ($j > $checknum) Or StringMid($random, $j + 1, 1) == "" Or IsArray($k) == 0 Then
 $j = 0
 $s += 1
 tenID()
 ContinueLoop
 EndIf
 $username = $n[Asc(StringMid($random, $j + 1, 1)) - 64]
 $password = $p[Asc(StringMid($random, $j + 1, 1)) - 64]
 Do
 $stime = TimerInit()
 Select
 Case $service[$s] == $myser
 TrayTip($ver & " 提示:", "作者ID发布页" & " 正在验证中" & @CRLF & $username & " -- " & $password & @CRLF & $cs, 10)

Case Else
 TrayTip($ver & " 提示:", "ID发布页 --" & StringMid($random, $s, 1) & " 正在验证中" & @CRLF & $username & " -- " & $password & @CRLF & $cs, 10)
 EndSelect

If $proxycheck == 1 Then
 $hDownload=InetGet("http://" & $username & ":" & $password & "@" & $address, @TempDir & "\tem.tmp", 1, 1)
 While InetGetInfo($hDownload, 2)==0
 If InetGetInfo($hDownload, 0) > 512 Then
 InetGet("abort")
 $filesize = 4096
 ExitLoop
 EndIf
 Sleep(100)
 WEnd
 Else
 $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
 $oHTTP.setTimeouts(5000, 5000, 5000, 5000)
 $oHTTP.Open("HEAD", "http://" & $address, 0)
 ;$oHTTP.Open("HEAD", "http://89.202.149.36/download/engine3/em000_32_l0.nup", 0)
 ;$oHTTP.Option(6)=0
 $oHTTP.SetCredentials($username, $password, 0)
 $oHTTP.Send()
 ;MsgBox(0,$cs,timerDiff($stime))
 If $oHTTP.status == 401 Then ExitLoop
 If (($oHTTP.status = 200 And $oHTTP.getResponseHeader("content-length") == "") Or TimerDiff($stime) > 5000) And $regcheck == 0 Then
 $oHTTP = 0
 $falsecs += 1
 $cs = $csall[$falsecs]
 If $falsecs > $csall[0] Then
 $regcheck = 1
 EndIf
 typecheck()
 ContinueLoop
 EndIf

$filesize = $oHTTP.getResponseHeader("content-length")
 If $filesize = "" Or ($filesize > 0 And StringInStr($oHTTP.getResponseHeader("content-Type"), "text")) Then $filesize = 0
 $oHTTP = 0
 ;$filesize = InetGetSize("http://" & $username & ":" & $password & "@" & $address)
 EndIf
 If $regcheck <> 0 And $filesize > 0 Then ExitLoop

Until TimerDiff($stime) < 5000
 ;MsgBox(0,"",$filesize)
 If $username == $oldID Then $filesize = 0
 If $filesize > 0 Then
 If StringInStr($mytxt, "idcheck:") > 0 Then
 $domain1 = 3
 TrayTip($ver & " 提示:", "本ID有效!用时" & Int(TimerDiff($begin) + 200) / 1000 & "秒" & @CRLF & $username & " -- " & $password & @CRLF & "正在查询此ID的有效期。", 10)
 If StringInStr($mytxt, ":idcheck") == 0 Then
 $tem = "http://exp02.eset.com/getlicexp"
 Else
 $tem = StringMid($mytxt, StringInStr($mytxt, "idcheck:") + 8, StringInStr($mytxt, ":idcheck") - StringInStr($mytxt, "idcheck:") - 8)
 EndIf

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
 $oHTTP.Open("POST", $tem)
 $oHTTP.SetTimeouts(5000, 5000, 5000, 5000)
 If $proxy == 1 Then $oHTTP.SetProxy(2, RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer"))
 $oHTTP.Send('<?xml version="1.0" encoding="utf-8"?><GETLICEXP><SECTION ID="1000103"><LICENSEREQUEST><NODE NAME="UsernamePassword" VALUE="' & NodEncode($username, $password) & '" TYPE="STRING" /><NODE NAME="Product" VALUE="eav" TYPE="STRING" /><NODE NAME="Version" VALUE="' & RegRead("HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Info", "ProductVersion") & '" TYPE="STRING" /><NODE NAME="Language" VALUE="409" TYPE="DWORD" /><NODE NAME="UpdateTag" VALUE="" TYPE="STRING" /><NODE NAME="System" VALUE="5.1" TYPE="STRING" /></LICENSEREQUEST></SECTION></GETLICEXP>')
 $HTMLSource = $oHTTP.Responsetext
 $oHTTP = 0
 $domain1 = 0
 $esetnum = Dec(StringMid($HTMLSource, StringInStr($HTMLSource, 'expirationdate" value="') + 23, 8)) + 8 * 3600
 datechange()
 If $esetnum <> "28800" And Int($esetnum / 60 / 60 / 24) > $nowdec + 16 Then
 $exdate = "此ID还可用" & Int($esetnum / 60 / 60 / 24) - $nowdec & "天,有效期至:" & StringFormat("%04d/%02d/%02d", $numyear, $nummon, $numday)
 TrayTip($ver & " 提示", "本ID有效!用时" & Int(TimerDiff($begin) + 200) / 1000 & "秒" & @CRLF & $username & " -- " & $password & @CRLF & $exdate & @CRLF & "正在把ID写入到ESET中。", 10)
 ExitLoop
 Else
 $exdate = ""
 If Int($esetnum / 60 / 60 / 24) > $nowdec And Int($esetnum / 60 / 60 / 24) < $nowdec + 16 Then
 TrayTip($ver & " 提示:", "本ID有效!用时" & Int(TimerDiff($begin) + 200) / 1000 & "秒" & @CRLF & $username & " -- " & $password & @CRLF & "此ID的有效期至:" & StringFormat("%04d/%02d/%02d", $numyear, $nummon, $numday) & @CRLF & "ID已经进入黄眼期,重新获取ID。", 10)
 $j += 1
 ContinueLoop
 EndIf
 EndIf
 Else
 $exdate = ""
 EndIf
 ExitLoop
 EndIf
 $j += 1

WEnd

If $s > 2 And $regrandom = 0 Then ;把有效的ID发布页放到前面
 $tem = Asc(StringMid($random, $s - 1, 1)) - 64
 RegWrite($eid, "randomnum", "reg_sz", $tem)
 EndIf
 $password2 = EncodePassword($password)
 ;MsgBox(0,$password,$password2)
 If $isnod = 0 Then
 If $esetver >= "4" Then
 If $esetlan == "2052" Then
 $lid = "密"
 Else
 $lid = "assword"
 If $esetlan == "1028" Then $lid = "密"
 EndIf
 Opt("WinWaitDelay", 10)
 ;$ESETstatus = WinGetState("classname=ESET Client Frame", "")
 ;BlockInput(1)
 If $GraphicMode == 0 Then WinSetState("classname=ESET Client Frame", "", @SW_SHOWDEFAULT) ;不能用winative不然在win7会卡住
 ControlSend("classname=ESET Client Frame", "", "ESET Menu Window1", "^u")
 Sleep(50)
 If $packageID <> "" And $packageID <> "1759227785" Then
 Sleep(100)
 ControlSend("classname=#32770", $lid, "Edit1", $PassC & "{enter}")
 EndIf

$inputhandle=""
 for $tmp= 1 to 40
 if WinExists("授權詳情","密碼") then $inputhandle=WinGetHandle("授權詳情","密碼")
 if $inputhandle<>"" then ExitLoop
 if WinExists("License details","assword") then $inputhandle=WinGetHandle("License details","assword")
 if $inputhandle<>"" then ExitLoop
 if WinExists("classname=#32770","密") and WinGetTitle("classname=#32770","密")==$esetname then $inputhandle=WinGetHandle("classname=#32770","密")
 if $inputhandle<>"" then ExitLoop
 if WinExists("classname=#32770","assword") and WinGetTitle("classname=#32770","assword")==$esetname then $inputhandle=WinGetHandle("classname=#32770","assword")
 if $inputhandle<>"" then ExitLoop
 if WinExists("许可证详细信息","密码") then $inputhandle=WinGetHandle("许可证详细信息","密码")
 if $inputhandle<>"" then ExitLoop
 Sleep(50)
 Next
 if $inputhandle=="" or $inputhandle==0 then
 $var=WinList("classname=#32770","密")
 For $i = 1 To $var[0][0]
 ControlCommand($var[$i][0],'密',"Edit2","IsVisible", "")
 if @error<>1 then
 $inputhandle=WinGetHandle($var[$i][0],'密')
 ExitLoop
 EndIf
 Next
 EndIf
 $tem = ClipGet()
 ClipPut($username)
 ControlSend($inputhandle, "", "Edit1", "^v{tab}")
 ClipPut($password)
 ControlSend($inputhandle, "", "Edit2", "^v{enter}")
 ClipPut($tem)
 ;WinWaitClose("classname=#32770", $lid, 6)
 BlockInput(0)
 ;WinSetOnTop("classname=ESET Client Frame", "", 0)
 Sleep(50)
 If WinExists($inputhandle, "") Then ControlClick($inputhandle, "", "Button1")
 Else
 RegWrite($er & "\01000400\Profiles\@My profile", "password", "REG_BINARY", "0x"&$password2)
 RegWrite($er & "\01000400\Profiles\@My profile", "username", "REG_SZ", $username)

EndIf
 Else
 RegWrite("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings", "password", "REG_BINARY", "0x"&$password2)
 RegWrite("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings", "username", "REG_SZ", $username)

EndIf
 ;Exclusion()
 If $esetver >= 4 And StringLower(@ScriptFullPath) == StringLower($installdir & "ESET_VC52_AUTOID.tmp") Then Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 2|del " & FileGetShortName(@ScriptFullPath), "", @SW_HIDE)
 TrayTip($ver & " 提示", "本ID有效!用时" & Int(TimerDiff($begin) + 200) / 1000 & "秒" & @CRLF & $username & " -- " & $password & @CRLF & $exdate & @CRLF & "正在启动更新ESET病毒库。", 10)
 upengine()
 TrayTip($ver & " 提示", "本ID有效!总用时" & Int(TimerDiff($begin) + 200) / 1000 & "秒" & @CRLF & $username & " -- " & $password & @CRLF & $exdate & @CRLF & "完成任务,将在3秒后退出。", 10)
 Sleep(4000)
 Exit

;------------------------------------------------;

Func fileswap(ByRef $swap1, ByRef $swap2)
 $tmp = $swap1
 $swap1 = $swap2
 $swap2 = $tmp
 EndFunc ;==>fileswap
 Func tenID()
 If $service[$s] == "" Then
 If $hidemode <> 1 Then MsgBox(0, "提示", "内置线路搜索完了,请确认你有连接上网,或你的系统无法支持本软件。", 5)
 Exit
 EndIf
 $i = 0
 ;MsgBox(0,$s,$service[$s])
 Do
 If $service[$s] <> $myser Then
 If $netwait <> 1 Then
 $HTMLSource = getHTTPPage($service[$s])
 Else
 InetGet($service[$s], @TempDir & "\tem.tmp")
 $HTMLSource = FileRead(@TempDir & "\tem.tmp")
 EndIf
 $txt = StringStripWS($HTMLSource, 8)
 Else
 $txt = $mytxt
 $service[$s] = $myser
 ExitLoop
 EndIf
 ;MsgBox(0,$s,$service[$s])
 Select
 Case $service[$s] = "http://www.ljack.cn/rss.xml"
 If StringInStr($txt, 'http://www.ljack.cn/post/') > 0 Then
 $t = StringRegExp($txt, 'http://www.ljack.cn/post/\d{2,3}.html', 3)
 $service[$s] = $t[0]
 For $tx = 1 To 10
 If $t[$tx] > $service[$s] Then $service[$s] = $t[$tx]
 Next
 EndIf
 Case $service[$s] = "http://www.share-key.com/a/ESET_NOD32shengji/"
 If StringInStr($txt, 'href="/a/ESET_NOD32shengji/20') > 0 Then
 $t = StringRegExp($txt, '/a/ESET_NOD32shengji/\d{4}/\d{4}/\d{2,3}.html', 3)
 ;_ArrayDisplay( $t,"")
 $service[$s] = "http://www.share-key.com" & $t[0]
 For $tx = 1 To 10 ;此循环是解决顶置的问题。
 If $t[$tx] > $service[$s] Then $service[$s] = $t[$tx]
 Next
 EndIf
 Case $service[$s] = "http://www.woody8.com/activation/nod32/"
 If StringInStr($txt, 'href="/activation/nod32/') > 0 Then
 $t = StringRegExp($txt, '/activation/nod32/\d{5}.html', 3)
 ;_ArrayDisplay( $t,"")
 $service[$s] = "http://www.woody8.com" & $t[0]
 EndIf
 Case $service[$s] = "http://naoz.cn/nod32id/"
 If StringInStr($txt, 'href="/nod32id/201') > 0 Then
 $t = StringRegExp($txt, '/nod32id/201\d{5}_\d{1,3}', 3)
 $service[$s] = "http://naoz.cn" & $t[0]
 For $tx = 1 To 10
 If $t[$tx] > $service[$s] Then $service[$s] = $t[$tx]
 Next
 EndIf

Case Else
 $i += 1
 EndSelect

Until $i > 0
 $txt = StringReplace($txt, ":", ":")
 $txt = StringReplace($txt, "</font>", "")
 $txt = StringReplace($txt, "<!--red_end-->", "")
 $txt = StringReplace($txt, "</b>", "")
 $txt = StringReplace($txt, "<b>", "")
 $txt = StringReplace($txt, "</em>", "")
 $txt = StringReplace($txt, "<em>", "")
 $txt = StringReplace($txt, "</span>", "")
 $txt = StringReplace($txt, "</strong>", "")

;MsgBox(0,'',$txt)
 ;FileDelete("c:\1.txt")
 ;FileWrite("c:\1.txt",$txt)

$k = StringRegExp($txt, '(EAV-\d{8,10}|TRIAL-\d{8,10})(?:.*?\:)(\w{10})', 3)
 $t = StringRegExp($txt, '(EAV-\d{8,10}|TRIAL-\d{8,10})(\w{10})', 3)

$tem = UBound($k)
 If IsArray($k) == 0 Then
 If IsArray($t) <> 0 Then
 $k = $t
 Else
 Return
 EndIf
 Else
 If IsArray($t) <> 0 Then
 ReDim $k[UBound($k) + UBound($t)]
 For $i = 1 To UBound($t)
 $k[$i + $tem - 1] = $t[$i - 1]
 Next
 EndIf
 EndIf

;_ArrayDisplay( $k, $random&"--"&$service[$s]) ;*

#region ;重新排序去重复

For $inum = 1 To UBound($k) / 2 - 1
 For $i = 0 To $inum - 1
 If $k[$inum * 2] == $k[$i * 2] Then
 $k[$inum * 2] = ""
 $k[$inum * 2 + 1] = ""
 EndIf
 If $k[$inum * 2] > $k[$i * 2] Then
 fileswap($k[$inum * 2], $k[$i * 2])
 fileswap($k[$inum * 2 + 1], $k[$i * 2 + 1])
 EndIf
 Next
 Next
 ; _ArrayDisplay( $k, $random&"--"&$service[$s])

$tem = 0
 $tmp = 1
 $idnumsplit = -1
 For $i = 0 To UBound($k) - 2 Step 2
 If StringInStr($k[$i], "EAV-") Then ;tmp
 If $idnumsplit = -1 Then $idnumsplit = $i / 2
 ;MsgBox(0,Number(StringMid($k[$i], 5)),Number(StringMid($k[$idnumsplit * 2], 5)) )
 If Number(StringMid($k[$i], 5)) + 15000000 < Number(StringMid($k[$idnumsplit * 2], 5)) Then
 $k[$i] = ""
 $k[$i + 1] = ""
 Else
 $n[$tmp]=$k[$i]

$p[$tmp]=$k[$i+1]
 $tmp += 1
 EndIf
 EndIf
 Next
 For $i = 0 To UBound($k) - 2 Step 2
 If StringInStr($k[$i], "TRIAL-") Then ;tem
 If Number(StringMid($k[$i], 7)) + 1000000 < Number(StringMid($k[0], 7)) Then
 $k[$i] = ""
 $k[$i + 1] = ""
 Else
 $n[$tmp]=$k[$i]

$p[$tmp]=$k[$i+1]
 $tmp += 1
 EndIf
 EndIf
 Next
 ; _ArrayDisplay( $k, $random&"--"&$service[$s])
 ReDim $n[$tmp+1]
 ReDim $p[$tmp+1]
 ;_ArrayDisplay( $n, "")
 ;_ArrayDisplay( $p, $tmp)

$random = StringLeft("ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh", $tmp)
 If RegRead($eid, "random") == 1 Then
 For $i = 1 To 20
 $tem = Random(1, $tmp, 1)
 $random = StringRight($random, $tmp - $tem) & StringMid($random, $tem, 1) & StringLeft($random, $tem - 1)
 Next
 EndIf
 ;MsgBox(0,'',$random)

;_ArrayDisplay( $n, "")
 ;_ArrayDisplay( $p, "")
 ;MsgBox(0,$tem,$tmp)
 #endregion

EndFunc ;==>tenID
 Func writenorandom()
 RegWrite($eid, "random", "REG_SZ", "0")
 EndFunc ;==>writenorandom

Func writerandom()
 RegWrite($eid, "random", "REG_SZ", "1")
 EndFunc ;==>writerandom
 Func aboutevent()
 MsgBox(64, "ESET ID自动获取填写工具 " & $ver & "--kaidashi", "本程序仅供学习用,请勿用于商业用途。" & @CRLF & "本程序可连接到ID发布页搜索可用ID,经验证后自动更新电脑里 ESET 的ID。" & @CRLF & "精睿.网络安全(bbs.vc52.cn)出品")
 EndFunc ;==>aboutevent
 Func tooltipx()
 MsgBox(0, "ESET_VC52_AUTOID 选项", "点我干什么?这个功能下个大版本才有。不过我太懒了,此功能还得等些时日。")
 EndFunc ;==>tooltipx

Func ExitEvent()
 Exit
 EndFunc ;==>ExitEvent

Func myie()
 Run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE http://kds.ys168.com")
 EndFunc ;==>myie

Func vc52()
 Run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE http://bbs.vc52.cn/thread-28750-1-1.html")
 EndFunc ;==>vc52

Func check1()
 RegWrite($eid, "regcheck", "REG_SZ", "0")
 EndFunc ;==>check1

Func check2()
 RegWrite($eid, "regcheck", "REG_SZ", "1")
 EndFunc ;==>check2

Func check3()
 RegWrite($eid, "regcheck", "REG_SZ", "2")
 EndFunc ;==>check3

Func regautolive()
 $autolive = RegRead($eid, "autolive")
 If $autolive == 1 Then
 RegWrite($eid, "autolive", "REG_SZ", "0")
 TrayItemSetState($autoliveitem, $TRAY_CHECKED)
 Else
 RegWrite($eid, "autolive", "REG_SZ", "1")
 TrayItemSetState($autoliveitem, $TRAY_unCHECKED)
 EndIf

EndFunc ;==>regautolive
 Func autouplive()
 $uplive = StringInStr($txt, "自动升级:")
 While $uplive <> 0
 testdir()
 If FileExists($installdir & "ESET_VC52_AUTOID.tmp") Then
 MsgBox(0, $ver & " 自动升级提示:", "自动升级准备失败。软件无法删除上次自动升级时的残留文件。请定你是以管理员身份登陆系统。或去除ESET的“自我保护”功能后再运行本软件。", 5)
 ExitLoop
 EndIf
 ;if $domain==1 then RegDelete($eid,"domainfail")
 $newver = StringMid($txt, StringInStr($txt, "自级版本:") + 5, StringInStr($txt, ":升级版本") - StringInStr($txt, "自级版本:") - 5)
 If $newver = $oldver Then ExitLoop
 If $newver < $oldver And StringInStr($txt, "noupnew") Then ExitLoop
 $r = StringSplit(StringMid($txt, StringInStr($txt, "版本说明:") + 5, StringInStr($txt, ":版本说明") - StringInStr($txt, "版本说明:") - 5), "。")
 $downfilesize = StringMid($txt, StringInStr($txt, "文件大小:") + 5, StringInStr($txt, ":文件大小") - StringInStr($txt, "文件大小:") - 5)

For $i = 1 To $r[0] - 1
 $newreadme = $newreadme & $r[$i] & "。" & @CRLF
 Next
 $nouplive = MsgBox(36, "ESET_VC52_AUTOID_v" & $oldver & "提醒你,有新的版:" & $newver, "是否要下载:(请注意,点“否”会关闭自动升级功能)" & @CRLF & "版本说明:" & @CRLF & $newreadme, 5)
 If $nouplive == 7 Then
 MsgBox(0, "提示", "自动升级将关闭")
 RegWrite($eid, "autolive", "REG_SZ", "1")
 TrayItemSetState($autoliveitem, $TRAY_unCHECKED)
 ExitLoop
 EndIf
 If ProcessExists("qqdoctorrtp.exe") Then
 TrayTip($ver & " 自动升级提示:", "你的系统正在运行QQ医生,软件无法正常更新,软件会结束QQ医生,请选择QQ医生提示的“允许”后点“确定”。软件更新后会自动运行QQ医生。", 20)
 ProcessClose("qqdoctor.exe")
 ProcessClose("qqdoctorrtp.exe")
 $qqdoctor = 1
 RegWrite($eid, "QQdoctor", "REG_SZ", "1")
 $qqdoctorpath = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "QQDoctorRTP")
 EndIf

$hDownload=InetGet(StringMid($txt, $uplive + 5, StringInStr($txt, ":自动升级") - $uplive - 5), @ScriptDir & "\ESET_VC52_AUTOID.tmp", 1, 1)
 While InetGetInfo($hDownload, 2)==0
 TrayTip("下载中", "已下载 = " & InetGetInfo($hDownload, 0), 10)
 Sleep(200)
 If WinExists("classname=ESET Alert Window", "") Then
 $handle = WinGetHandle("classname=ESET Alert Window", "")
 If StringInStr(ControlGetText($handle, "", "Static2"), "http://") Then ControlClick($handle, "", "ESET Button Window2")
 If StringInStr(ControlGetText($handle, "", "Static2"), "[1].") Then ControlClick($handle, "", "ESET Button Window3")
 If StringInStr(ControlGetText($handle, "", "Static2"), "ESET_VC52_AUTOID.tmp") Then ControlClick($handle, "", "ESET Button Window3")
 EndIf
 WEnd
 If InetGetInfo($hDownload, 4) >0 Then
 MsgBox(32, "出错", "连接不到下载文件,请下次更新,这是正常现象,因为文件放在网络上,有时会连不上。", 3)
 FileDelete("ESET_VC52_AUTOID.tmp")
 Exit
 Else

Select
 Case FileExists(@StartupCommonDir & "\ESET*autoid*.lnk")
 If FileExists(@StartupCommonDir & "\ESET_vc52_autoid.lnk") Then
 $hidetmp = FileGetShortcut(@StartupCommonDir & "\ESET_vc52_autoid.lnk")
 If StringInStr($hidetmp[2], "/hide") > 0 Then
 $checkautorun = 2
 clearautorun()
 FileCreateShortcut(StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe", @StartupCommonDir & "\ESET_VC52_AUTOID.lnk", "", "/hide", "ESET v" & $esetver & ".x 专用ID自动获取填写工具v" & $newver & " 静默模式。")
 TrayItemSetState($regautorun, $TRAY_CHECKED)
 If InetGetInfo($hDownload, 0) == $downfilesize Then MsgBox(32, StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe v" & $newver & "版下载完成,", "该文件大小为:" & InetGetInfo($hDownload, 0) & @CRLF & "新版本已经替换旧版本随电脑启动。", 3)

Else
 $checkautorun = 1
 clearautorun()
 FileCreateShortcut(StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe", @StartupCommonDir & "\ESET_VC52_AUTOID.lnk", "", "", "ESET v" & $esetver & ".x 专用ID自动获取填写工具v" & $newver)
 TrayItemSetState($startautorun, $TRAY_CHECKED)
 If InetGetInfo($hDownload, 0) == $downfilesize Then MsgBox(32, StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe v" & $newver & "版下载完成,", "该文件大小为:" & InetGetInfo($hDownload, 0) & @CRLF & "新版本已经替换旧版本随电脑启动。", 3)
 EndIf
 Else
 If FileExists(@StartupCommonDir & "\ESET_vc52_autoid*.lnk") Then
 $checkautorun = 1
 clearautorun()
 FileCreateShortcut(StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe", @StartupCommonDir & "\ESET_VC52_AUTOID.lnk", "", "", "ESET v" & $esetver & ".x 专用ID自动获取填写工具v" & $newver)
 TrayItemSetState($startautorun, $TRAY_CHECKED)
 If InetGetInfo($hDownload, 0) == $downfilesize Then MsgBox(32, StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe v" & $newver & "版下载完成,", "该文件大小为:" & InetGetInfo($hDownload,0) & @CRLF & "新版本已经替换旧版本随电脑启动。", 3)
 EndIf
 EndIf

Case FileExists(@WindowsDir & "\tasks\ESET_AUTOID_HOUR.job")
 $checkautorun = 3
 TrayItemSetState($taskautorun, $TRAY_CHECKED)

RegWrite($eid, "autorun", "reg_sz", 3)

Case Else
 MsgBox(32, StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe v" & $newver & "版下载完成,", "该文件大小为:" & InetGetInfo($hDownload, 0), 3)
 EndSelect
 FileChangeDir(@ScriptDir)
 If InetGetInfo($hDownload, 0) == $downfilesize Then
 If FileExists(StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "eset_vc52_autoid.tmp") Then
 If $esetver >= 4 And StringLower($installdir) == StringLower(@ScriptDir & "\") Then
 FileDelete(@TempDir & "\autoidup.bat")
 FileWriteLine(@TempDir & "\autoidup.bat", "ping 127.0.0.1 -n 4")
 FileWriteLine(@TempDir & "\autoidup.bat", "start /d """ & @ScriptDir & """ eset_vc52_autoid.tmp /updatedir")
 Else
 if $esetver>4 then
 FileDelete(@TempDir & "\autoidup.bat")
 FileWriteLine(@TempDir & "\autoidup.bat", "ping 127.0.0.1 -n 4")
 FileWriteLine(@TempDir & "\autoidup.bat", "del """ & @ScriptFullPath & """")
 FileWriteLine(@TempDir & "\autoidup.bat", "del """ & StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe""")
 FileWriteLine(@TempDir & "\autoidup.bat", "rename """ & StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "eset_vc52_autoid.tmp"" ESET_VC52_AUTOID.exe")
 FileWriteLine(@TempDir & "\autoidup.bat", "start /d """ & @ScriptDir & """ eset_vc52_autoid.exe")
 Else
 FileDelete(@TempDir & "\autoidup.bat")
 FileWriteLine(@TempDir & "\autoidup.bat", "ping 127.0.0.1 -n 4")
 FileWriteLine(@TempDir & "\autoidup.bat", "del """ & @ScriptFullPath & """")
 FileWriteLine(@TempDir & "\autoidup.bat", "copy /y """ & StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "eset_vc52_autoid.tmp"" """ & StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "ESET_VC52_AUTOID.exe""")
 FileWriteLine(@TempDir & "\autoidup.bat", "del """ & StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "eset_vc52_autoid.tmp""")
 FileWriteLine(@TempDir & "\autoidup.bat", "start /d """ & @ScriptDir & """ eset_vc52_autoid.exe")
 EndIf
 If $qqdoctor == 1 And $qqdoctorpath <> "" Then
 FileWriteLine(@TempDir & "\autoidup.bat", "start " & FileGetShortName(StringMid($qqdoctorpath, 2, StringLen($qqdoctorpath) - 2)))
 RegDelete($eid, "qqdoctor")
 EndIf
 EndIf
 Run(@TempDir & "\autoidup.bat", "", @SW_HIDE)
 TrayTip($ver & "自动升级提示", "下载成功,软件将退出后自动更新:" & $newver, 10)
 Sleep(2000)
 Exit
 EndIf
 Else
 TrayTip("自动升级出错提示", "下载文件的大小不附,自动升级中止,请稍后再试或手动升级。", 10)
 FileDelete("eset_vc52_autoid.tmp")
 Sleep(3000)
 EndIf
 EndIf
 ExitLoop
 WEnd
 EndFunc ;==>autouplive
 Func startautorun()
 $checkautorun = 1
 checkautorun()
 EndFunc ;==>startautorun

Func regautorun()
 $checkautorun = 2
 checkautorun()
 EndFunc ;==>regautorun

Func taskautorun()
 $checkautorun = 3
 checkautorun()
 EndFunc ;==>taskautorun

Func checkautorun()
 If $checkautorun == 1 Then
 clearautorun()
 FileCreateShortcut(@ScriptFullPath, @StartupCommonDir & "\ESET_VC52_AUTOID.lnk", "", "", "ESET v" & $esetver & ".x 专用ID自动获取填写工具v" & $oldver)
 TrayItemSetState($startautorun, $TRAY_CHECKED)
 TrayItemSetState($clearautorun, $TRAY_ENABLE)
 TrayTip($ver & " 开机启动设置提示", "普通模式(开始菜单启动项)开机自启动设置成功。", 10)
 EndIf
 If $checkautorun == 2 Then
 clearautorun()
 FileCreateShortcut(@ScriptFullPath, @StartupCommonDir & "\ESET_VC52_AUTOID.lnk", "", "/hide", "ESET v" & $esetver & ".x 专用ID自动获取填写工具v" & $oldver & " 静默模式。")
 TrayItemSetState($regautorun, $TRAY_CHECKED)
 TrayItemSetState($clearautorun, $TRAY_ENABLE)
 TrayTip($ver & " 开机启动设置提示", "静默模式(开始菜单启动项)开机自启动设置成功。", 10)
 EndIf

If $checkautorun == 3 Then
 $tasktmp = -1
 If $hidemode <> 1 And $taskup == 0 Then $tasktmp = MsgBox(3, $ver & " 服务器模式设置提示", "你是否要以静默(无提示无对话框)的方式运行“服务器模式”(每天的00:00和12:00自动运行。)" & @CRLF & "是 :以静默模式运行“服务器模式”。" & @CRLF & "否 :以普通模式运行“服务器模式”。(10秒后自动选择此模式)" & @CRLF & "取消:退出,不设置“服务器模式”。", 10)
 If $tasktmp == -1 Then
 If FileExists(@SystemDir & "\Tasks\ESET_AUTOID_HOUR") Then
 $i = FileOpen(@SystemDir & "\Tasks\ESET_AUTOID_HOUR", 16)
 Else
 $i = FileOpen(@WindowsDir & "\tasks\ESET_AUTOID_HOUR.job", 16)
 EndIf
 $tem = FileRead($i)
 If @error <> 1 Then
 If StringInStr($tem, "2f006800690064006500") > 0 Then
 $tasktmp = 6
 Else
 $tasktmp = 7
 EndIf
 Else
 $tasktmp = 7
 EndIf
 FileClose($i)
 EndIf
 $tem = 0

If $tasktmp <> 2 Then
 clearautorun()
 If $tasktmp == 6 Then
 $taskmode = " /hide"
 Else
 $taskmode = ""
 EndIf
 RunWait(@ComSpec & " /c " & "sc config schedule start= auto&sc start schedule", "", @SW_HIDE)

FileDelete(FileGetShortName(@TempDir) & "\task.tmp")
 RegWrite("HKLM64\SYSTEM\CurrentControlSet\Control\Lsa", "limitblankpassworduse", "reg_dword", "0x0")
 RunWait(@ComSpec & " /c " & "echo.|SCHTASKS /CREATE /SC HOURLY /MO 12 /ST 00:00:00 /TN ESET_AUTOID_HOUR /TR """ & FileGetShortName(@ScriptFullPath) & $taskmode & """>" & FileGetShortName(@TempDir) & "\task.tmp", "", @SW_HIDE)
 $tasktmp = FileRead(FileGetShortName(@TempDir) & "\task.tmp")

If StringInStr($tasktmp, """ ") > 0 Then
 RegDelete($eid, "autorun")
 $taskpw = InputBox("服务器模式设置出错提示:", "你的系统可能设置了登陆密码而使“服务器模式”无法运行,如果你还想设置“服务器模式”请输入你登陆密码。" & @CRLF & "输入密码只是运行计划任务的需要,如果你不相信请不要使用“服务器模式”。", "", "*", Default, Default, Default, Default)
 FileDelete(FileGetShortName(@TempDir) & "\task.tmp")
 FileDelete(@WindowsDir & "\tasks\ESET_AUTOID_HOUR.job")
 RunWait(@ComSpec & " /c " & "echo " & $taskpw & "|SCHTASKS /CREATE /SC HOURLY /MO 12 /ST 00:00:00 /TN ESET_AUTOID_HOUR /TR """ & FileGetShortName(@ScriptFullPath) & $taskmode & """>" & FileGetShortName(@TempDir) & "\task.tmp", "", @SW_HIDE)
 $tasktmp = FileRead(FileGetShortName(@TempDir) & "\task.tmp")
 If StringInStr($tasktmp, """ ") > 0 Then
 $tem = MsgBox(4, "服务器模式设置失败:", "软件还是无法运行“服务器模式”,请确认你软件的密码和登陆密码一样。" & @CRLF & "注意!程序因为无法设置“服务器模式”会改为“开始菜单启动”模式下的开机启动模式。" & @CRLF & "是 :为“开始菜单启动”模式下的开机启动模式。" & @CRLF & "否 :取消开机启动。")
 If $tem == 6 And $taskmode == "" Then startautorun()
 If $tem == 6 And $taskmode == " /hide" Then regautorun()
 If $tem == 7 Then clearautorun()
 EndIf
 EndIf
 TrayItemSetState($taskautorun, $TRAY_CHECKED)
 TrayItemSetState($clearautorun, $TRAY_ENABLE)
 If $taskmode == " /hide" And $tem == 0 Then TrayTip($ver & " 开机启动设置提示", "静默方式的“服务器模式”设置成功。", 10)
 If $taskmode == "" And $tem == 0 Then TrayTip($ver & " 开机启动设置提示", "普通方式的“服务器模式”设置成功。", 10)
 EndIf

EndIf

If $checkautorun == "" Then clearautorun()
 EndFunc ;==>checkautorun

Func clearautorun()
 RegDelete("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "eset_vc52_autoid")
 TrayItemSetState($startautorun, $TRAY_unCHECKED)
 TrayItemSetState($regautorun, $TRAY_unCHECKED)
 TrayItemSetState($taskautorun, $TRAY_unCHECKED)
 ;TrayItemSetState($clearautorun, $TRAY_disable)
 RunWait(@ComSpec & " /c " & 'SCHTASKS /delete /TN "ESET_AUTOID_HOUR" /f', "", @SW_HIDE)
 FileDelete(@StartupCommonDir & "\ESET*autoid*.lnk")
 FileDelete(@ProgramsCommonDir & "\ESET\" & $esetname & "\精睿ESET ID自动获取填写工具.lnk")
 FileDelete(@WindowsDir & "\tasks\ESET_AUTOID_HIDE.job")
 FileDelete(@WindowsDir & "\tasks\ESET_AUTOID_HOUR.job")
 EndFunc ;==>clearautorun

Func upservice1()
 RegWrite($eid, "upservice", "reg_sz", "1")
 RegWrite($er & "\01000400\Profiles\@My profile", "SelectedServer", "REG_SZ", $ui[1])
 TrayItemSetState($upserviceitem1, $TRAY_CHECKED)
 ;RegWrite($eid, "regcheck", "REG_SZ", "2")
 EndFunc ;==>upservice1

Func upservice2()
 RegWrite($eid, "upservice", "reg_sz", "2")
 RegWrite($er & "\01000400\Profiles\@My profile", "SelectedServer", "REG_SZ", $ui[2])
 TrayItemSetState($upserviceitem2, $TRAY_CHECKED)
 ;RegWrite($eid, "regcheck", "REG_SZ", "2")
 EndFunc ;==>upservice2

Func upservice0()
 RegDelete($eid, "upservice")
 RegWrite($er & "\01000400\Profiles\@My profile", "SelectedServer", "REG_SZ", "AUTOSELECT")
 TrayItemSetState($upserviceitem0, $TRAY_CHECKED)
 ;RegWrite($eid, "regcheck", "REG_SZ", "0")
 EndFunc ;==>upservice0

Func upservice3()
 RegWrite($eid, "upservice", "reg_sz", "3")
 TrayItemSetState($upserviceitem0, $TRAY_CHECKED)
 ;RegWrite($eid, "regcheck", "REG_SZ", "0")
 EndFunc ;==>upservice3
 Func restore()
 If FileExists(@StartupCommonDir & "\ESET*autoid*.lnk") Or FileExists(@WindowsDir & "\tasks\ESET_AUTOID_HOUR.job") Then
 $i = MsgBox(259, "提示", "还原默认值的功能是让软件还原默认的值,然后删除ID后重新运行本软件获取新的ID。" & @CRLF & "你有安装开机启动功能,是否也要删除它?" & @CRLF & "是:完全还原默认值。" & @CRLF & "否:保留开机启动功能,其他功能还原。" & @CRLF & "取消:不运行“还原默认值”。")
 Else
 $i = MsgBox(1, "提示", "还原默认值的功能是让软件还原默认的值,然后删除ID后重新运行本软件获取新的ID。" & @CRLF & "你确定要运行?")
 EndIf
 If $i <> 2 Then
 $tem = ""
 If ProcessExists("qqdoctorrtp.exe") Then
 TrayTip($ver & " 自动升级提示:", "你的系统正在运行QQ医生,软件无法正常更新,软件会结束QQ医生,请选择QQ医生提示的“允许”后点“确定”。软件更新后会自动运行QQ医生。", 20)
 ProcessClose("qqdoctor.exe")
 ProcessClose("qqdoctorrtp.exe")
 $qqdoctor = 1
 $qqdoctorpath = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "QQDoctorRTP")
 $tem = "&start " & FileGetShortName(StringMid($qqdoctorpath, 2, StringLen($qqdoctorpath) - 2))
 EndIf
 RegDelete($eid)
 RegDelete($er & "\01000400\Profiles\@My profile", "password")
 RegDelete($er & "\01000400\Profiles\@My profile", "username")
 RegDelete("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings", "password")
 RegDelete("HKLM64\SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings", "username")
 If $i == 6 Then clearautorun()
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 2&start /d """ & @ScriptDir & """ " & @ScriptName & $tem, "", @SW_HIDE)
 Exit
 EndIf

EndFunc ;==>restore

Func proxy()
 While 1
 $proxy = RegRead($eid, "proxy")

If $proxy == 1 Then
 RegDelete($eid, "proxy")
 $proxy = 0
 TrayItemSetState($proxyitem, $TRAY_unCHECKED)
 Else
 If RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer") == "" Then
 MsgBox(0, "提示", "你没有设置局域网代理,我无法处理。")
 ExitLoop
 EndIf
 RegWrite($eid, "proxy", "reg_sz", "1")
 TrayItemSetState($proxyitem, $TRAY_CHECKED)
 $proxy = 1
 EndIf
 ExitLoop
 WEnd
 EndFunc ;==>proxy

Func proxycheck()
 $proxycheck = RegRead($eid, "proxycheck")
 If $proxycheck == 1 Then
 RegDelete($eid, "proxycheck")
 $proxycheck = 0
 TrayItemSetState($proxycheckitem, $TRAY_unCHECKED)
 Else
 RegWrite($eid, "proxycheck", "reg_sz", "1")
 TrayItemSetState($proxycheckitem, $TRAY_CHECKED)
 $proxycheck = 1
 EndIf
 EndFunc ;==>proxycheck

Func datecheck()
 $datecheck = RegRead($eid, "datecheck")
 If $datecheck == 1 Then
 RegDelete($eid, "datecheck")
 $datecheck = 0
 TrayItemSetState($datecheckitem, $TRAY_unCHECKED)
 Else
 RegWrite($eid, "datecheck", "reg_sz", "1")
 TrayItemSetState($datecheckitem, $TRAY_CHECKED)
 $datecheck = 1
 EndIf
 EndFunc ;==>datecheck

Func MyErrFunc()
 If $dateerr == 1 Then
 MsgBox(0, "提示", "对不起,无法连接到校对网页,软件无法进行。", 5)
 Exit
 EndIf
 If Hex($oMyError.number, 8) == "8007007E" Then
 MsgBox(0, $ver & '提示:', "软件用于读取发布页的com控件(winhttp.dll)无法使用。" & @CRLF & "出现这样的问题可能有以下的原因:" & @CRLF & "1、你的系统里没有 winhttp.dll 这个文件,或这个文件损坏而无法被软件使用。" & @CRLF & "2、你的系统没有IE5.0以上的版本或IE有损坏。" & @CRLF & "3、软件被防火墙阻止或类似“小红伞”之类的软件阻止。")
 Exit
 EndIf

If $domain1 == 0 And $service[$s] == $myser Then
 ; MsgBox(0,$oMyError.number,$oMyError.Description&@CRLF&$oMyError.source&@CRLF&$oMyError.helpfile&@CRLF&$oMyError.helpcontext) ;The requested header was not found
 $domain1 = 1
 TrayTip("ESET_VC52_AUTOID自动升级提示", "连接不到升级服务器,请重新运行软件或到论坛看看,等作者解决问题。", 10)
 Sleep(3000)
 Exit
 EndIf

$_eventerror = 1
 EndFunc ;==>MyErrFunc
 Func upengine()
 TraySetToolTip("ESET启动中,等待ESET启动完后更新。")
 If $isnod <> 1 Then
 $tem="Updfiles"
 FileDelete("C:\Users\All Users\ESET\ESET Smart Security\"&$tem&"\*.ver")
 FileDelete("C:\Users\All Users\ESET\ESET NOD32 Antivirus\"&$tem&"\*.ver")
 FileDelete(@AppDataCommonDir & "\ESET\ESET Smart Security\"&$tem&"\*.ver")
 FileDelete(@AppDataCommonDir & "\ESET\ESET NOD32 Antivirus\"&$tem&"\*.ver")
 DirRemove(@AppDataCommonDir & "\ESET\ESET Smart Security\"&$tem&"\reverse", 1)
 DirRemove(@AppDataCommonDir & "\ESET\ESET NOD32 Antivirus\"&$tem&"\reverse", 1)
 DirRemove(@AppDataCommonDir & "\ESET\ESET Smart Security\"&$tem&"\base_nonnups", 1)
 DirRemove(@AppDataCommonDir & "\ESET\ESET NOD32 Antivirus\"&$tem&"\base_nonnups", 1)
 If $esetver > 4 Then
 WinSetTrans("classname=ESET Client Frame", "", 0)
 ;WinSetState("classname=ESET Client Frame", "", @SW_SHOW)
 Run(FileGetShortName($installdir) & "ecmd.exe /update", "", @SW_HIDE)
 Sleep(500)
 WinSetState("classname=ESET Client Frame", "", @SW_HIDE)
 WinSetTrans("classname=ESET Client Frame", "", 255)
 Return
 EndIf
 If $esetver == 4 Then
 ;下面是V4的更新

WinSetTrans("classname=ESET Client Frame", "", 0)
 WinSetState("classname=ESET Client Frame", "", @SW_SHOW)
 Run(FileGetShortName($installdir) & "ecmd.exe /update", "", @SW_HIDE)

;WinSetOnTop("classname=ESET Client Frame", "", 1)
 If ControlCommand("classname=ESET Client Frame", "","ESET Product Window1","IsVisible", "") == 0 Then

WinMove("classname=ESET Client Frame", "", -850, Default)
 WinSetState("classname=ESET Client Frame", "", @SW_SHOW)
 WinActivate("classname=ESET Client Frame", "")
 SendKeepActive("classname=ESET Client Frame", "")
 Send("^m")
 EndIf
 ControlClick("classname=ESET Client Frame", "", "ESET Menu Window1", "left", 1, 44, 130)
 WinWait("classname=ESET Client Frame", " (20", 2)
 WinSetTrans("classname=ESET Client Frame", "", 0)
 ;If WinActive("classname=ESET Client Frame", "") == 0 Then BlockInput(1)

WinSetState("classname=ESET Client Frame", "", @SW_RESTORE)
 WinActivate("classname=ESET Client Frame", "")
 ControlFocus("classname=ESET Client Frame", "", "Static1")
 ControlSend("classname=ESET Client Frame", "", "Static1", "{enter}")
 BlockInput(0)
 ;WinSetOnTop("classname=ESET Client Frame", "", 0)
 WinSetState("classname=ESET Client Frame", "", @SW_HIDE)

If $PageMode <>ControlCommand("classname=ESET Client Frame", "","ESET Product Window1","IsVisible", "") Then ControlSend("classname=ESET Client Frame", "", "ESET Menu Window1", "^m")
 WinMove("classname=ESET Client Frame", "", 150, Default)

WinSetTrans("classname=ESET Client Frame", "", 255)
 Else
 ;下面是V3的ESET更新
 If $esetver < 4 Then
 $updnowreg = "HKLM64\SOFTWARE\ESET\ESET Security\CurrentVersion\Scheduler"
 RegDelete($updnowreg & "\100", "LastExec")
 RegDelete($updnowreg & "\101", "LastExec")
 RegDelete($updnowreg & "\102", "LastExec")
 RunWait(@ComSpec & " /c " & "taskkill /f /im ekrn.exe", '', @SW_HIDE)
 EndIf
 EndIf
 EndIf
 EndFunc ;==>upengine

Func regautoengine()
 $autoENGINE = RegRead($eid, "autoengine")
 If $autoENGINE == 1 Then
 RegDelete($eid, "autoengine")
 TrayItemSetState($autoENGINEitem, $TRAY_unCHECKED)
 Else
 RegWrite($eid, "autoengine", "REG_SZ", "1")
 TrayItemSetState($autoENGINEitem, $TRAY_CHECKED)
 EndIf
 EndFunc ;==>regautoengine

Func Exclusion()
 If $autoExclusion <> 1 And IsAdmin() And StringInStr(@ScriptFullPath, "\temp\") == 0 And StringInStr(@ScriptFullPath, "\Temporary Internet Files\") == 0 Then
 ;waiteset()
 If $esetver == "3" Then
 RegWrite($er & "\01000600\Profiles\@My profile\Excludes\Node_00010000", "Flags", "REG_DWORD", "0x0")
 RegWrite($er & "\01000600\Profiles\@My profile\Excludes\Node_00010000", "Infiltration", "REG_SZ", "")
 RegWrite($er & "\01000600\Profiles\@My profile\Excludes\Node_00010000", "path", "reg_sz", @ScriptFullPath)
 EndIf
 If $esetver >= "4" Then
 $tmp = ""
 $tem = ""
 For $i = 0 To 50
 If StringLen($i) == 1 Then $i = "0" & $i
 $tem = RegRead($er & "\01000600\Profiles\@My profile\Excludes\Node_000000" & $i, "path")
 If @error <> 0 Then ExitLoop
 If StringLower($tem) == StringLower(@ScriptFullPath) Then $tmp = $tem
 Next
 If StringLower($tmp) <> StringLower(@ScriptFullPath) And StringInStr(@ScriptFullPath, "\temp\") == 0 Then
 ;TrayTip($ver & " 提示:", "你是第一次运行本软件或运行的路径和上次不同,软件正在加入ESET的排除列表中请等待。", 10)

;waiteset()
 TrayTip($ver & " 提示:", "你是第一次运行本软件或运行的路径和上次不同,软件正在加入ESET的排除列表中。" & @CRLF & "--等待ESET启动。", 10)
 TraySetToolTip($ver & " 提示:你是第一次运行本软件或运行的路径和上次不同,软件正在加入ESET的排除列表中。" & @CRLF & "--等待ESET启动中。")

If $F5handle == '' Then
 waitF5()
 EndIf

TrayTip($ver & " 提示:", "你是第一次运行本软件或运行的路径和上次不同,软件正在加入ESET的排除列表中。" & @CRLF & "自动排除第1步。请不要点击鼠标和键盘,不然排除会失败。", 10)

;ControlSend($F5handle, '', "SysTreeView321", "{pgup}")
 If $esetver == 4 Then
 $tem = controlTreeView($F5handle, '', "SysTreeView321", "GetItemCount", "#0")
 ;MsgBox(0,'',$tem)
 If $tem >= 7 Then
 ControlTreeView($F5handle, '', "SysTreeView321", "Select", "#0|#5")
 Else
 ControlTreeView($F5handle, '', "SysTreeView321", "Select", "#1|#5")
 EndIf
 EndIf
 If $esetver == 6 Then
 ControlTreeView($F5handle, '', "SysTreeView321", "Select", "#0|#0|#5")
 EndIf
 If $esetver == 5 Then
 ;ControlTreeView($F5handle, '', "SysTreeView321", "Exists", "#0|#0|#0|#0")
 For $i = 0 To 6
 If ControlTreeView($F5handle, '', "SysTreeView321", "Exists", "#" & $i & "|#0|#0|#0") Then
 If ControlTreeView($F5handle, '', "SysTreeView321", "Exists", "#" & $i & "|#0|#4") Then
 ControlTreeView($F5handle, '', "SysTreeView321", "Select", "#" & $i & "|#0|#4")
 Else
 ControlTreeView($F5handle, '', "SysTreeView321", "Select", "#" & $i & "|#0|#3")
 EndIf
 EndIf
 Next
 ;Sleep(5000)
 ;WinMove($F5handle, "", 150, Default)
 ;WinSetTrans($F5handle,"",255)
 EndIf
 Opt("WinDetectHiddenText", 0)
 If WinWait($F5handle, StringMid($esetop3, StringInStr($esetop3, "|") + 1), 5) == 0 Then
 BlockInput(0)
 If $hidemode <> 1 Then MsgBox(0, $ver & " 出错:", "自动排除第1步,无法设置ESET排除,请手动设置。", 5)
 WinKill($F5handle, '')
 Exit
 EndIf
 Opt("WinDetectHiddenText", 1)
 ; MsgBox(0,",",$esetop3)
 ;WinMove($F5handle, '', -1050, Default)
 TrayTip($ver & " 提示:", "你是第一次运行本软件或运行的路径和上次不同,软件正在加入ESET的排除列表中。" & @CRLF & "自动排除第2步。请不要点击鼠标和键盘,不然排除会失败。", 10)
 ;Sleep(50)
 $tem = 0
 $tem = ControlListView($F5handle, '', "SysListView321", "GetItemCount", "#0")
 ;MsgBox(0,WinGetTitle($F5handle,''),$tem)
 ;BlockInput(1)
 WinActivate($F5handle, "")
 ;WinSetOnTop($F5handle, "",1)
 ControlSend($F5handle, "", "", "!a")
 ;MsgBox(0,"",$F5handle)
 $inputhandle = ""
 $i = 1
 Do
 If WinExists("Add exclusion", $esetop2) Then
 $inputhandle = WinGetHandle(WinGetTitle("Add exclusion", $esetop2))
 WinSetTrans($inputhandle, '', 0)
 ExitLoop
 EndIf
 If WinExists("排除", $esetop2) Then
 $inputhandle = WinGetHandle(WinGetTitle("排除", $esetop2))
 WinSetTrans($inputhandle, '', 0)
 ExitLoop
 EndIf
 If WinExists("新增排除", $esetop2) Then
 $inputhandle = WinGetHandle(WinGetTitle("新增排除", $esetop2))
 WinSetTrans($inputhandle, '', 0)
 ExitLoop
 EndIf
 If WinExists("classname=#32770", $esetop2) Then
 $inputhandle = WinGetHandle(WinGetTitle("classname=#32770", $esetop2))
 WinSetTrans($inputhandle, '', 0)
 ExitLoop
 EndIf
 Sleep(50)
 $i += 1
 Until $i > 60

If $inputhandle <> "" Then
 ;If WinActive($inputhandle, "") == 0 Then BlockInput(1)
 TrayTip($ver & " 提示:", "你是第一次运行本软件或运行的路径和上次不同,软件正在加入ESET的排除列表中。" & @CRLF & "自动排除第3步。请不要点击鼠标和键盘,不然排除会失败。", 10)
 $tem = ClipGet()
 ClipPut(@ScriptFullPath)
 ControlSend($inputhandle, "", "Edit1", "^v{enter}")
 ClipPut($tem)
 ;WinActivate($inputhandle, "")
 ;ControlSend($inputhandle, "", "SysTreeView321", "!o")
 $tmp = ControlListView($F5handle, '', "SysListView321", "GetItemCount", "#0")
 Sleep(50)
 ControlSend($F5handle, '', "SysTreeView321", "{enter}")
 BlockInput(0)
 ;DllCall("user32.dll", "int", "SendMessageTimeout", "hwnd", 65535, "int", 26, "int", 0, "int", 0, "int", 0, "int", 1000, "str", "dwResult")
 Else
 BlockInput(0)
 WinKill($F5handle, "")
 If $hidemode <> 1 Then MsgBox(0, $ver & " 出错:", "自动排除第2步,无法设置ESET排除,请手动设置。", 5)
 EndIf

;WinMove($inputhandle , $esetop2, -1050, Default)

TrayTip($ver & " 提示:", "软件设置ESET排除成功。3秒后继续运行。", 10)
 EndIf
 EndIf
 EndIf
 EndFunc ;==>Exclusion

Func dateout()
 $dateoutname = "eset_autoid:"
 $domin = "http://error.1x9y.cn"
 $i = 0
 $domain1 = 3
 $tem = 0
 $tmp = Random(0, 4, 1)
 If StringInStr($CmdLineRaw, "/test") Then
 If Not FileExists("c:\esetlive.txt") Then
 MsgBox(0, "出错:", "你没有测试文件“esetlive.txt”。软件将退出。")
 Exit
 EndIf
 $myweb = "127.0.0.1"
 $myser = $myweb
 $txt = FileRead("c:\esetlive.txt")
 $mytxt = $txt
 Else
 While 1
 If Mod($i, 6) == 0 Then $myweb = "http://autoid1.kickme.to"
 If Mod($i, 6) == 1 Then $myweb = "http://autoid1.tk"
 If Mod($i, 6) == 2 Then $myweb = "http://au1.me.cc"
 If Mod($i, 6) == 3 Then $myweb = "http://autoid2.kickme.to"
 If Mod($i, 6) == 4 Then $myweb = "http://autoid2.tk"
 If Mod($i, 6) == 5 Then $myweb = "http://au2.me.cc"
 If Mod($i, 12) == 11 Then $myweb = "http://1.1x9y.cn"
 ;if mod($i, 5) == $tmp then $myweb = "http://autoid1.stkds.cn"

;TrayTip($i,$myweb,10)
 ;$myweb="http://autoid1.tk"
 If $netwait <> 1 Then
 $HTMLSource = getHTTPPage($myweb)
 Else
 FileDelete(@TempDir & "\tem.tmp")
 If InetGet($myweb, @TempDir & "\tem.tmp") == 0 Then
 If Mod($i, 4) == 3 Then InetGet("http://www.baidu.com", @TempDir & "\tem.tmp")
 EndIf
 $HTMLSource = FileRead(@TempDir & "\tem.tmp")
 EndIf
 Select
 Case StringInStr($HTMLSource, $dateoutname) > 0
 ExitLoop
 Case StringInStr($myweb, ".me.cc")
 $myweb = StringMid($HTMLSource, StringInStr($HTMLSource, '<p><a href="') + 12, StringInStr($HTMLSource, '">Click') - StringInStr($HTMLSource, '<p><a href="') - 12)
 ;MsgBox(0,'me.cc',$myweb)
 If $myweb <> "" Then ExitLoop
 Case StringInStr($myweb, ".kickme.to")
 $myweb = StringMid($HTMLSource, StringInStr($HTMLSource, 'a href="') + 8, StringInStr($HTMLSource, '">here') - StringInStr($HTMLSource, 'a href="') - 8)
 ; MsgBox(0,'ddddddddd',$myweb)
 If $myweb <> "" Then ExitLoop
 Case StringInStr($myweb, ".tk")
 $myweb = StringMid($HTMLSource, StringInStr($HTMLSource, '</head>') + 6)
 ;MsgBox(0,$myweb,$HTMLSource)
 $myweb = StringMid($myweb, StringInStr($myweb, 'src="') + 5, StringInStr($myweb, '" name') - StringInStr($myweb, 'src="') - 5)
 ;MsgBox(0,'com.nu',$myweb)
 If $myweb <> "" Then ExitLoop
 Case StringLen($HTMLSource) > 410 And $i > 8
 ExitLoop
 EndSelect
 If $i < 20 Then
 Sleep(1000)
 Else
 Sleep(5000)
 EndIf
 If $i >= 250 Then
 If Ping("www.sina.com.cn") > 10 Then
 If $hidemode <> 1 Then MsgBox(0, $ver & " 提示:", "真的很不幸,你已经上网,但是所有域名无法连接,软件将退出,请关注说明。", 5)
 Exit
 EndIf
 EndIf
 $i += 1
 WEnd
 $tem = RegRead($eid, "uninstall")
 If StringInStr($myweb, "error") Or (StringInStr($HTMLSource, "?error:") And StringInStr($HTMLSource, ":error")) Then
 If StringInStr($HTMLSource, "?error:") And StringInStr($HTMLSource, ":error") Then $myweb = StringMid($HTMLSource, StringInStr($HTMLSource, "?error:") + 7, StringInStr($HTMLSource, ":error") - StringInStr($HTMLSource, "?error:") - 7)
 If $tem <> "1" Then
 MsgBox(0, $ver & '出错提示:', "对不起,作者已经把软件关闭,详细原因请看原贴或网盘。", 10)
 RegWrite($eid, "uninstall", "reg_sz", "1")
 Run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE " & $myweb)
 Exit
 Else
 $tmp = MsgBox(3, $ver & '出错提示:', "对不起,作者已经把软件关闭,详细原因请看原贴或网盘。" & @CRLF & "软件装在10秒后自动退出,下次启动时再弹出此对话框。请自行卸载软件。" & @CRLF & @CRLF & "“是”:卸载本软件。" & @CRLF & "“否”:退出后打开作者关闭软件说明的网页。" & @CRLF & "“取消”:直接退出本软件,下次启动时再弹出此对话框。", 10)
 If $tmp == 2 Then
 Exit
 Else
 If $tmp == 6 Then
 uninstall()
 Exit
 Else
 Run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE " & $myweb)
 Exit
 EndIf
 Exit
 EndIf
 EndIf
 EndIf
 TraySetToolTip($ver & " 提示:" & @CRLF & "已经检测到连网状态,等待连接自动升级服务器。")
 $tem = $myweb
 $i = 0
 While 1
 If StringInStr($HTMLSource, $dateoutname) > 0 Then
 $txt = StringStripWS($HTMLSource, 8)
 ExitLoop
 EndIf

Select
 Case $i == 0 Or $i == 5
 $myweb = $tem
 TrayTip($ver & " 提示:", "正在连接服务器线路 -- 1", 15)
 Case $i == 1 Or $i == 6
 $myweb = "http://autoid3.chickenkiller.com"
 TrayTip($ver & " 提示:", "正在连接服务器线路 -- 2", 15)
 Case $i == 2 Or $i == 7
 $myweb = "http://3.1x9y.cn" ;autoid2.chickenkiller.com
 TrayTip($ver & " 提示:", "正在连接服务器线路 -- 3", 15)
 Case $i == 3 Or $i == 8
 $myweb = "http://1.kds.80.hk"
 TrayTip($ver & " 提示:", "正在连接服务器线路 -- 4", 15)
 Case $i == 4 Or $i == 9
 ContinueCase
 ;$myweb = $domin
 TrayTip($ver & " 提示:", "正在连接服务器线路 -- 5", 10)
 Case $i > 15
 TrayTip("清除提示", "", 4)
 MsgBox(0, $ver & " 出错提示:", "连接不到检测服务器,软件无法运行。", 10)
 Exit
 EndSelect
 If $netwait <> 1 Then
 $HTMLSource = getHTTPPage($myweb)
 Else
 InetGet($myweb, @TempDir & "\tem.tmp")
 $HTMLSource = FileRead(@TempDir & "\tem.tmp")
 EndIf

$txt = StringStripWS($HTMLSource, 8)
 If StringInStr($txt, $dateoutname) > 0 Then ExitLoop
 $i += 1
 Sleep(1000)
 WEnd
 $myser = $myweb
 $mytxt = $txt
 EndIf
 If StringInStr($txt, "自定网址:") Then
 $murl = StringMid($txt, StringInStr($txt, "自定网址:") + 5, StringInStr($txt, ":自定网址") - StringInStr($txt, "自定网址:") - 5)
 If StringLower(StringLeft($murl, 1)) <> "h" Then
 $incheck = Number(StringLeft($murl, 1))
 $murl = StringMid($murl, 2)
 EndIf
 ;MsgBox(0,$incheck,$murl)
 EndIf
 ;-----自动更新------
 If StringInStr(@ScriptFullPath, "\temp\") == 0 Then
 If $autolive <> "1" And IsAdmin() Then
 TrayTip($ver & " 提示:", "软件正在检查更新。", 10)
 Sleep(1000)
 autouplive()
 EndIf
 EndIf
 TrayTip($ver & " 提示:", "正在连接服务器。" & @CRLF & " ", 15)
 ;Sleep(1000)
 $dateout = StringMid($txt, StringInStr($txt, $dateoutname) + StringLen($dateoutname), 8)
 If StringInStr($mytxt, "datecheck") > 0 Then

Else
 $esetnum = 0
 UDPStartup()
 $data = ""
 $tx = StringSplit("cuckoo.nevada.edu,clock.via.net,time.nist.gov,time-a.nist.gov,time-b.nist.gov,utcnist.colorado.edu,time-nw.nist.gov,nist1.datum.com,cuckoo.nevada.edu,ntp.nblug.org,timekeeper.isi.edu", ",")
 For $i = 1 To 20
 $tex = Random(1, $tx[0], 1)
 $tem = $tx[1]
 $tx[1] = $tx[$tex]
 $tx[$tex] = $tem
 Next
 If $timeservice <> "" Then
 $tx[$tx[0]] = $tx[1]
 $tx[1] = $timeservice
 EndIf
 ;_ArrayDisplay( $tx,"")
 Dim $ntperror
 $ntperror = RegRead($eid, "ntperror")
 ;MsgBox(0,'',$ntperror)
 If @error <> 0 Then $ntperror = 0
 $udptmp = TimerInit()
 Do
 If $ntperror > 2 Then $udpnum = 20

If $udpnum > $tx[0] Then

If StringInStr($mytxt, "checkdate") > 0 Then
 If $netwait <> 1 Then
 $i = 1
 Do
 If $i == 1 Then $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
 If $i == 2 Then $oHTTP = ObjCreate('MSXML2.ServerXMLHTTP.5.0')
 If $i == 3 Then $oHTTP = ObjCreate("Msxml2.XMLHTTP")
 If $i == 4 Then $oHTTP = ObjCreate("Microsoft.XMLHTTP")

;MsgBox(0,'',$oHTTP)

If IsObj($oHTTP) == 1 Then
 ExitLoop
 EndIf
 $i += 1
 Until $i > 4
 $tmp = TimerInit()
 $oHTTP.Open("GET", "http://www.time.ac.cn/times/timefairy.aspx", False)
 ;$oHttp.open("GET", "http://www.msn.com", false)
 If $proxy == 1 And $i < 3 Then $oHTTP.SetProxy(2, RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer"))
 ;$oHttp.setRequestHeader("Range","bytes=-1")
 $oHTTP.Send()
 ;$status=$oHTTP.readystate
 ;MsgBox(0,'',$oHttp.getallResponseHeaders("Date"))
 $HTMLSource = $oHTTP.Responsetext
 $oHTTP = 0
 Else
 FileDelete(@TempDir & "\tem.tmp")
 InetGet("http://www.time.ac.cn/times/timefairy.aspx", @TempDir & "\tem.tmp", 1, 0)
 $HTMLSource = FileRead(@TempDir & "\tem.tmp")
 FileDelete(@TempDir & "\tem.tmp")
 EndIf
 $tem = StringInStr($HTMLSource, "op40")
 If $tem > 0 Then
 $tem += 4
 $y = "20" & Chr(Asc(StringMid($HTMLSource, $tem, 1)) - 7) & Chr(Asc(StringMid($HTMLSource, $tem + 1, 1)) - 1)
 $m = Chr(Asc(StringMid($HTMLSource, $tem + 3, 1)) + 4) & Chr(Asc(StringMid($HTMLSource, $tem + 4, 1)) - 2)
 $d = Chr(Asc(StringMid($HTMLSource, $tem + 6, 1)) - 7) & Chr(Asc(StringMid($HTMLSource, $tem + 7, 1)) - 1)
 $nowh = Chr(Asc(StringMid($HTMLSource, $tem + 9, 1)) + 4) & Chr(Asc(StringMid($HTMLSource, $tem + 10, 1)) - 2)
 $nowm = Chr(Asc(StringMid($HTMLSource, $tem + 12, 1)) - 7) & Chr(Asc(StringMid($HTMLSource, $tem + 13, 1)) - 1)
 $nows = Chr(Asc(StringMid($HTMLSource, $tem + 15, 1)) + 4) & Chr(Asc(StringMid($HTMLSource, $tem + 16, 1)) - 2)
 $nowms = Chr(Asc(StringMid($HTMLSource, $tem + 18, 1)) - 7) & Chr(Asc(StringMid($HTMLSource, $tem + 19, 1)) - 1) & Chr(Asc(StringMid($HTMLSource, $tem + 20, 1)) - 7)
 $i = $nowms + $nows * 1000 + $nowm * 60000 + $nowh * 3600000 + Int(TimerDiff($tmp)) + 800
 $nowms = Mod($i, 1000)
 $nows = Int(Mod($i, 60000) / 1000)
 $nowm = Int(Mod($i, 3600000) / 60000)
 $nowh = Int($i / 3600000)

For $i = 1970 To $y - 1
 If Mod($i, 4) = 0 Then
 $tem = 366
 Else
 $tem = 365
 EndIf
 $nowdec += $tem
 Next
 $iNumDays = StringSplit("31,28,31,30,31,30,31,31,30,31,30,31", ",")
 If Mod($i, 4) = 0 Then $iNumDays[2] = "29"
 For $i = 1 To $m - 1
 $nowdec += $iNumDays[$i]
 Next
 $nowdec += $d - 1
 ;MsgBox(0,'',$nowdec)
 RegWrite($eid, "ntperror", "reg_sz", $ntperror + 1)
 ExitLoop
 EndIf
 Else
 If $netwait <> 1 Then
 $i = 1
 Do
 If $i == 1 Then $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
 If $i == 2 Then $oHTTP = ObjCreate('MSXML2.ServerXMLHTTP.5.0')
 If $i == 3 Then $oHTTP = ObjCreate("Msxml2.XMLHTTP")
 If $i == 4 Then $oHTTP = ObjCreate("Microsoft.XMLHTTP")

;MsgBox(0,'',$oHTTP)

If IsObj($oHTTP) == 1 Then
 ExitLoop
 EndIf
 $i += 1
 Until $i > 4
 $tmp = TimerInit()
 $oHTTP.Open("GET", "http://www.myip.cn/judge.php", False)
 ;$oHttp.open("GET", "http://www.msn.com", false)
 If $proxy == 1 And $i < 3 Then $oHTTP.SetProxy(2, RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer"))
 ;$oHttp.setRequestHeader("Range","bytes=-1")
 $oHTTP.Send()
 ;$status=$oHTTP.readystate
 ;MsgBox(0,'',$oHttp.getallResponseHeaders("Date"))
 $HTMLSource = $oHTTP.Responsetext
 $oHTTP = 0
 Else
 FileDelete(@TempDir & "\tem.tmp")
 InetGet("http://www.myip.cn/judge.php", @TempDir & "\tem.tmp", 1, 0)
 $HTMLSource = FileRead(@TempDir & "\tem.tmp")
 FileDelete(@TempDir & "\tem.tmp")
 EndIf
 If StringInStr($HTMLSource, "REQUEST_TIME = ") Then
 $esetnum = Number(StringMid($HTMLSource, StringInStr($HTMLSource, "REQUEST_TIME = ") + 15, 10)) + (8 * 3559 + 1)
 RegWrite($eid, "ntperror", "reg_sz", $ntperror + 1)
 ExitLoop
 EndIf
 EndIf

If $hidemode <> 1 Then MsgBox(4096, "错误", "连接时间校对服务器失败!请稍候后试。" & @CRLF & "请确认你电脑中的“123”端口是打开的。", 10)
 Exit
 EndIf
 $socket = UDPOpen(TCPNameToIP($tx[$udpnum]), 123)
 If @error <> 0 Then
 $udpnum += 1
 ContinueLoop
 EndIf
 TrayTip($ver & " 提示:", "正在连接时间校验服务器:" & @CRLF & $tx[$udpnum], 10)

$status = UDPSend($socket, MakePacket("0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"))
 ;$status = UDPSend($socket, MakePacket("0b00000"))

If $status = 0 Then
 $udpnum += 1
 ContinueLoop
 EndIf
 $data = ""
 $i = 0
 While $data = ""
 $i += 1
 $data = UDPRecv($socket, 100)
 If $i = 5 Then ExitLoop
 ;TrayTip("",$i,10)
 Sleep(100)
 WEnd
 If $udpnum > $tx[0] Then
 If $hidemode <> 1 Then MsgBox(4096, "错误", "连接时间校对服务器失败!请稍候后试。" & @CRLF & "请确认你电脑中的“123”端口是打开的。", 10)
 Exit
 Else
 $udpnum += 1
 EndIf

Until $data <> ""

UDPCloseSocket($socket)
 UDPShutdown()
 If StringInStr($HTMLSource, "op40") == 0 Then
 If $esetnum == 0 Then
 $unsignedHexValue = StringMid($data, 83, 8); Extract time from packet. Disregards the fractional second.
 $value = UnsignedHexToDec($unsignedHexValue)
 $esetnum = $value + 8 * 3600 - 2208988800 + Int(TimerDiff($udptmp) / 1000 + 1.5)
 RegDelete($eid, "ntperror")
 EndIf

;MsgBox(0,'',$esetnum)
 datechange()

$y = $numyear
 $m = StringFormat("%02d", $nummon)
 $d = StringFormat("%02d", $numday)
 $nowh = $numhour
 $nowm = $nummin
 $nows = $numsec
 $nowdec = Int($esetnum / 60 / 60 / 24)
 EndIf
 EndIf

If StringInStr($TimeZoneKeyName, "china") > 0 And $datecheck == 1 Then
 ;If $nows < 59 Then $nows = $nows + 1
 If $y & $m & $d <> @YEAR & @MON & @MDAY Or Number($nowh * 24 * 60 + $nowm * 60 + $nows) > Number(@HOUR * 24 * 60 + @MIN * 60 + @SEC) + 10 Or Number($nowh * 24 * 60 + $nowm * 60 + $nows) < Number(@HOUR * 24 * 60 + @MIN * 60 + @SEC) - 10 Then Run(@ComSpec & " /c " & "date " & $y & "-" & $m & "-" & $d & "& time " & $nowh & ":" & $nowm & ":" & $nows, '', @SW_HIDE)
 ;MsgBox(0,Number($nowh*24*60+$nowm*60+$nows-1),Number(@HOUR*24*60+@MIN*60+@SEC))
 EndIf

$nowdate = $y & $m & $d

If $nowdate > $dateout Then
 If $hidemode <> 1 Then MsgBox(0, "提示", "对不起,软件已于(" & $dateout & ")停止使用,请留意是否有新版本。详细原因请看原贴或网盘。", 5)
 Run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE " & $domin)
 Exit
 EndIf
 EndFunc ;==>dateout

Func datechange()
 Dim $iNumDays[12], $numdate = 0
 $yearday = 0
 For $i = 0 To 100
 $tem = 365
 If Mod($i, 4) = 2 Then $tem = 366
 ;If $i == (@YEAR - 1970) Then $idyear = Int($esetnum / 60 / 60 / 24) - $yearday
 If $tem + $yearday > Int($esetnum / 60 / 60 / 24) Then ExitLoop
 $yearday = $yearday + $tem
 Next
 $iNumDays = StringSplit("31,28,31,30,31,30,31,31,30,31,30,31", ",")
 If Mod($i, 4) = 2 Then $iNumDays[2] = "29"
 $numyear = $i + 1970
 For $i = 1 To 12
 $numdate = $numdate + $iNumDays[$i]
 If $numdate >= Int($esetnum / 60 / 60 / 24) - $yearday + 1 Then
 $numday = $iNumDays[$i] - ($numdate - (Int($esetnum / 60 / 60 / 24) - $yearday + 1))
 $nummon = $i
 $numhour = Mod(Int($esetnum / 60 / 60), 24)
 $nummin = Mod(Int($esetnum / 60), 60)
 $numsec = Mod($esetnum, 60)
 ExitLoop
 EndIf
 Next
 EndFunc ;==>datechange

Func regautoExclusion()

$autoExclusion = RegRead($eid, "autoExclusion")
 If $autoExclusion == "1" Then
 RegDelete($eid, "autoExclusion")
 TrayItemSetState($autoExclusionitem, $TRAY_CHECKED)
 $autoExclusion = ""
 Exclusion()
 Else
 RegWrite($eid, "autoExclusion", "REG_SZ", "1")
 TrayItemSetState($autoExclusionitem, $TRAY_unCHECKED)
 ClipPut(@ScriptFullPath)
 MsgBox(0, $ver & " 自动排除提示:", "你选择取消“自动排除”功能,软件已经把软件所在的文件位置复制到剪贴板,现在可以手动向ESET排除列表中粘贴文件位置添加对本软件的排除。")
 EndIf

EndFunc ;==>regautoExclusion

Func testdir()
 Dim $glcount
 If $esetver >= 4 Then
 ;If StringLower(@ScriptFullPath) == StringLower($installdir & "ESET_VC52_AUTOID.exe") Then
 FileDelete($installdir & "ESET_VC52_AUTOID.tmp")
 If FileExists($installdir & "ESET_VC52_AUTOID.tmp") Then
 geli($installdir & "ESET_VC52_AUTOID.tmp")
 EndIf
 ;EndIf
 EndIf
 EndFunc ;==>testdir

Func netwait()
 $netwait = RegRead($eid, "netwait")
 If $netwait == 1 Then
 RegDelete($eid, "netwait")
 TrayItemSetState($netwaititem, $TRAY_unCHECKED)
 Else
 RegWrite($eid, "netwait", "REG_SZ", "1")
 TrayItemSetState($netwaititem, $TRAY_CHECKED)
 EndIf
 EndFunc ;==>netwait

Func decpass()
 $PassA = ""
 If $packageID == "" Or $packageID == "1759227785" Then
 RegDelete($eid, "esetpass")
 Return
 EndIf
 If RegRead($eid, "esetpass") == "" Or $packageID <> RegRead($eid, "PackageID") Then
 $PassA = InputBox("ESET保护密码输入框", "你的ESET设置了保护密码。请输入ESET的保护密码,如果取消,软件会退出。", Default, "*", Default, Default, Default, Default)
 If $PassA == "" Then Exit
 RegWrite($eid, "PackageID", "reg_sz", $packageID)
 EndIf
 If $PassA == "" Then Return
 $tem = Random(1, StringLen($BassA), 1)
 $BassB = StringMid($BassA, $tem + 1) & StringMid($BassA, 1, $tem)
 $PassB = Chr(128) & $PassA
 $passtmp = ""
 For $i = 1 To StringLen($PassB)
 $passtmp = $passtmp & Hex(BitXOR(Asc(StringMid($BassB, $i, 1)), Asc(StringMid($PassB, $i, 1)), 3), 2)
 Next
 RegWrite($eid, "esetpass", "reg_sz", $passtmp)
 EndFunc ;==>decpass

Func encpass()
 $passtmp = RegRead($eid, "esetpass")
 If $passtmp = "" Then Return
 For $i = 1 To StringLen($BassA)
 If BitXOR(Asc(StringMid($BassA, $i, 1)), 128, 3) == Dec(StringLeft($passtmp, 2)) Then ExitLoop
 Next
 $BassB = ""
 $BassB = StringMid($BassA, $i) & StringMid($BassA, 1, $i - 1)
 ;MsgBox(0,$i,$BassB)
 $tem = ""
 For $i = 1 To StringLen($passtmp) / 2
 $tem = $tem & Chr(BitXOR(Asc(StringMid($BassB, $i, 1)), Dec(StringMid($passtmp, $i * 2 - 1, 2)), 3))
 Next
 $PassC = StringMid($tem, 2)
 EndFunc ;==>encpass

Func NodEncode($un, $pw)
 Const $Base16A = "QAPLWSMKCDIJEFBH"
 Const $Base16B = "ZCBMKHFSQETUOXVN"
 Dim $unlen = StringLen($un)
 Dim $pwlen = StringLen($pw)
 Dim $outstr = ""
 Dim $enk = 0
 Dim $enj = 0
 Dim $env = 16
 Dim $i, $m
 If ($unlen = 0 Or $pwlen = 0) Then Return (0)
 For $i = 0 To 15 Step 2
 $m = BitXOR(Asc(StringMid($pw, $enk + 1, 1)), BitXOR(Int(Asc(StringMid($un, $enj + 1, 1))), Int($i * (2 ^ (BitAND(Asc(StringMid($pw, $enk + 1, 1)), 3))))))
 If ($i + 1) < 81 Then
 $outstr = $outstr & StringMid($Base16A, $m / 16 + 1, 1)
 $outstr = $outstr & StringMid($Base16B, BitAND($m, Dec("F")) + 1, 1)
 EndIf
 $enj = Mod(($enj + 1), $unlen)
 $enk = Mod(($enk + 1), $pwlen)
 Next
 For $i = 0 To $unlen - 1
 If $i > 31 Then ExitLoop
 If ($env + 1) < 81 Then
 $outstr = $outstr & StringMid($Base16B, Asc(StringMid($un, $i + 1, 1)) / 16 + 1, 1)
 $outstr = $outstr & StringMid($Base16A, BitAND(Asc(StringMid($un, $i + 1, 1)), Dec("F")) + 1, 1)
 EndIf
 $env = $env + 2
 Next
 If $env < 81 Then Return (StringStripWS($outstr, 3))
 EndFunc ;==>NodEncode

Func DecodePassword($pwarr)
 Dim $DecodePassword = ""
 For $i = 0 To UBound($PassBytesA) - 1
 If $i * 2 > StringLen($pwarr) Then ExitLoop
 $DecodePassword = $DecodePassword & Chr(BitXOR(Dec(StringMid($pwarr, $i * 4 + 1, 2)), Dec($PassBytesA[$i])))
 Next
 Return ($DecodePassword)
 EndFunc ;==>DecodePassword

Func EncodePassword(ByRef $pwstr)
 Dim $binarr[(StringLen($pwstr) - 1) * 2 + 2], $EncodePassword = ""

For $i = 0 To UBound($PassBytesA)
 $EncodePassword = $EncodePassword & Hex(BitXOR(Asc(StringMid($pwstr, $i + 1, 1)), Dec($PassBytesA[$i])), 2) & $PassBytesB[$i]
 If $i + 1 >= StringLen($pwstr) Then ExitLoop
 Next
 Return ($EncodePassword)
 EndFunc ;==>EncodePassword

Func install()
 If StringInStr($CmdLineRaw, "/installhide") Then
 $tem = 6
 Else
 $tem = MsgBox(3, "精睿ESET ID自动获取填写工具(" & $ver & ")安装程序", '1、本工具运行时先验证电脑里ESET的ID(支持所有版本。包括5.0),无效就自动申请ID验证后写入ESET。' & @CRLF & _
 '2、内置数条线路,如要自定义升级ID网址可在软件相同目录或C盘根目录创建list.txt这个文本文件加入你的升级ID网址,本工具会优先读取。' & @CRLF & _
 '3、可以在任意目录里实现开机自动运行。' & @CRLF & _
 '4、可在开机启动选项里实现“普通模式”(有提示有托盘图标)、“静默模式”(无提示无托盘图标)或“服务器模式”(每12小时运行一次)。' & @CRLF & _
 '5、如果可以上网但是本程序检测不到网络可以启用:间接网络检测方式,' & @CRLF & _
 '6、如果验证ID有问题可以更换验证方式2、验证方式3,或启用间接ID验证方式' & @CRLF & _
 '7、随机选取ID网站然后随机验证前40个ID的功能,和顺序选取两种模式可任意更改,默认是顺序选取(可以系统托盘图标更改)。' & @CRLF & _
 '8、ID在到期的16天前会更换新的ID。' & @CRLF & _
 '9、自动添加到ESET的排除列表中。(ESET v4.x不用关闭“自我保护”就可以添加。)' & @CRLF & _
 '10、在获取ID后立即更新ESET的病毒库。' & @CRLF & _
 '11、ID发布页智能排列的功能(只限顺序读取),当排在前面的发布页无效时会把有效获取到ID的发布页排列到前面,在以后就会优先获取这个发布页。' & @CRLF & _
 '12、中国时区的日期时间校对功能(相差10秒就校对,误差1秒),需手动打开。' & @CRLF & _
 '13、对已经获取的ID有效期的查询功能。' & @CRLF & _
 '14、可以打开区域网代理功能,直接读取IE浏览器的区域网代理选项让本软件工作在代理模式。' & @CRLF & _
 '15、软件本身有自动升级的功能。当新版本稳定就会让用户自动升级到最新版' & @CRLF & _
 '16、使用 /uninstall 参数可以完全卸载本程序。' & @CRLF & _
 '--------------------------------------------------------------------------' & @CRLF & _
 '您是否要安装本程序:(本程序默认是以“普通模式”安装在开始菜单启动项中。)' & @CRLF & @CRLF & _
 '确定安装请按“是”。 不安装直接运行一次请点按“否”。 退出请点“取消”。')
 EndIf
 If $tem == 2 Then
 Exit
 Else
 If $tem == 6 Then
 If $esetver <= 4 Then
 $tem = $installdir
 Else
 $tem = $upiddir
 ;DirCreate($upiddir)
 EndIf
 clearautorun()
 RegDelete($eid)
 If StringInStr(@ScriptFullPath, $installdir) == 0 Then
 FileDelete($installdir & "ESET_VC52_AUTOID.exe")
 If $esetver == 4 And FileExists($installdir & "ESET_VC52_AUTOID.exe") Then geli("")
 If $esetver > 4 Then
 If Not FileExists($upiddir) Then DirCreate($upiddir)
 FileCopy(@ScriptFullPath, $tem & "ESET_VC52_AUTOID.exe", 9)
 If Not FileExists($tem & "ESET_VC52_AUTOID.exe") Then
 MsgBox(0, $ver & '出错提示:', "对不起,ESET_VC52_AUTOID目录已经被ESET锁定,请你重新启动电脑后再运行本程序。")
 Exit
 EndIf
 EndIf
 EndIf
 FileCopy(@ScriptFullPath, $tem & "ESET_VC52_AUTOID.exe", 9)
 FileCreateShortcut($tem & "eset_vc52_autoid.exe", @StartupCommonDir & "\ESET_VC52_AUTOID.lnk", "", "", "ESET v" & $esetver & ".x 专用ID自动获取填写工具v" & $oldver)
 TrayItemSetState($startautorun, $TRAY_CHECKED)
 TrayItemSetState($clearautorun, $TRAY_ENABLE)
 If Not FileExists(@ProgramsCommonDir & "\ESET\ESET_VC52_AUTOID") Then DirCreate(@ProgramsCommonDir & "\ESET\ESET_VC52_AUTOID")
 FileCreateShortcut($tem & "eset_vc52_autoid.exe", @ProgramsCommonDir & "\ESET\ESET_VC52_AUTOID\精睿ESET ID自动获取填写工具.lnk", "", "", "精睿ESET ID自动获取填写工具(" & $ver & ")")
 FileCreateShortcut($tem & "eset_vc52_autoid.exe", @ProgramsCommonDir & "\ESET\ESET_VC52_AUTOID\卸载-精睿ESET ID自动获取填写工具.lnk", "", " /uninstall", "卸载精睿ESET ID自动获取填写工具(" & $ver & ")", @SystemDir & "\shell32.dll", "", 32)
 TrayTip($ver & " 开机启动设置提示", "普通模式(开始菜单启动项)开机自启动设置成功。", 10)
 If $esetver > 4 Then
 ;MsgBox(0,'', "ping 127.0.0.1 -n 1|start /d """ & $upiddir & """ eset_vc52_autoid.exe")
 Run(@ComSpec & " /c " & 'ping 127.0.0.1 -n 1&start /d "' & $upiddir & '" ESET_VC52_AUTOID.exe', $upiddir, @SW_HIDE)
 Else
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 1&start /d """ & $installdir & """ eset_vc52_autoid.exe", "", @SW_HIDE)
 EndIf
 Exit
 EndIf
 EndIf
 EndFunc ;==>install

Func uninstall()
 If StringInStr($installdir, ":\") == 0 Then
 clearautorun()
 DirRemove(@ProgramsCommonDir & "\ESET", 1)
 FileDelete(StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "list.txt")
 FileDelete("c:\list.txt")
 FileDelete(@ScriptDir & "\eset_vc52_autoid.tmp")
 $tem = FileFindFirstFile(@ScriptDir & "\*.*")
 $i = 0
 While 1
 FileFindNextFile($tem)
 If @error Or $i >= 2 Then ExitLoop
 $i += 1
 WEnd
 FileClose($tem)
 $tmp = StringMid(@ScriptFullPath, 1, StringInStr(@ScriptFullPath, "\", 0, -2))
 If $tmp <> "" Then
 $tem = FileFindFirstFile($tmp & "*.*")
 $j = 0
 While 1
 FileFindNextFile($tem)
 If @error Or $j >= 2 Then ExitLoop
 $j += 1
 WEnd
 FileClose($tem)
 EndIf
 FileChangeDir(@TempDir)
 If $i == 1 Then
 If $j == 1 Then
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 2|del " & FileGetShortName(@ScriptFullPath) & "|rd /q /s " & FileGetShortName($tmp) & "|rd /q /s " & FileGetShortName($upiddir), "c:\", @SW_HIDE)
 Exit
 Else
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 2|del " & FileGetShortName(@ScriptFullPath) & "|rd /q /s " & FileGetShortName(@ScriptDir) & "|rd /q /s " & FileGetShortName($upiddir), "c:\", @SW_HIDE)
 Exit
 EndIf
 EndIf
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 2|del " & FileGetShortName(@ScriptFullPath) & "|rd /q /s " & FileGetShortName($upiddir), "c:\", @SW_HIDE)
 Exit
 Else
 If StringInStr(@ScriptFullPath, $installdir) > 0 Then
 FileCopy(@ScriptFullPath, @TempDir & "\ESET_VC52_AUTOID.exe", 1)
 Run(@TempDir & "\ESET_VC52_AUTOID.exe /uninstall")
 Exit
 EndIf
 $tem = MsgBox(4, "精睿ESET ID自动获取填写工具(" & $ver & ")卸载程序", "你选择了卸载了本软件,确定卸载请按“是”,取消卸载请按“否”。")
 If $tem == 6 Then
 clearautorun()
 DirRemove(@ProgramsCommonDir & "\ESET\ESET_VC52_AUTOID", 1)
 RegDelete($eid)
 FileDelete(StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - StringLen(@ScriptName)) & "list.txt")
 FileDelete("c:\list.txt")
 If $installdir <> '' Then
 FileDelete($installdir & "ESET_VC52_AUTOID.exe")
 If $esetver == 4 And FileExists($installdir & "ESET_VC52_AUTOID.exe") Then geli("")
 If $esetver > 4 Then DirRemove($upiddir, 1)
 EndIf
 FileChangeDir("c:")
 Run(@ComSpec & " /c " & "ping 127.0.0.1 -n 2|del """ & @ScriptFullPath & """&del """ & $upiddir & """", "", @SW_HIDE)
 Exit
 Else
 Exit
 EndIf
 EndIf
 EndFunc ;==>uninstall

Func geli($glfile)
 If $glfile == "" Then $glfile = $installdir & "ESET_VC52_AUTOID.exe"
 Dim $glcount
 TrayTip($ver & " 自动更新提示:", "--等待ESET启动。", 10)
 TraySetToolTip($ver & " 自动更新提示:" & @CRLF & "--等待ESET启动中。")

waiteset()

TrayTip($ver & " 提示:", "软件正在更新ESET安装目录的旧版本软件,请等待 5 秒左右。", 10)
 TraySetToolTip($ver & " 提示:软件正在更新ESET安装目录的旧版本软件,请等待一下。")
 If FileExists($installdir & "ESET_vc52_autoid.exe") == 1 Then
 $i = 0
 WinSetState("classname=ESET Client Frame", "", @SW_SHOWDEFAULT)
 WinMove("classname=ESET Client Frame", "", -870, Default)
 If $esetver >= "4" Then
 If $PageMode == 0 Then
 ControlSend("classname=ESET Client Frame", "", "ESET Menu Window1", "^m")
 Sleep(100)
 EndIf
 ControlSend("classname=ESET Client Frame", "", "ESET Menu Window1", "^q")
 Else
 Do
 If WinActive("classname=ESET Client Frame", "") == 0 Then WinActivate("classname=ESET Client Frame", "")
 ControlSend("classname=ESET Client Frame", "", "", "{TAB}")
 Sleep(50)
 Until ControlGetFocus("classname=ESET Client Frame") = "Static4"
 ControlSend("classname=ESET Client Frame", "", "Static4", "{enter}")
 EndIf
 Sleep(200)
 $i = 0
 Do
 ControlSend("classname=ESET Client Frame", "", "ESET Menu Window1", "!q")
 If WinExists("classname=#32770", ".exe,*") Then
 WinMove("classname=#32770", ".exe,*", -1050, Default)
 $glcount = ControlListView("classname=ESET Client Frame", "", "SysListView321", "GetItemCount")
 ControlSetText("classname=#32770", ".exe,*", "Edit1", $glfile)
 WinWait("classname=#32770", $glfile, 3)
 ControlClick("classname=#32770", ".exe,*", "Button2", "left")
 ExitLoop
 EndIf
 Sleep(50)
 $i += 1
 Until $i > 50
 $i = 1
 Do
 If $i > 100 Then ExitLoop
 $i += 1
 Sleep(50)
 Until $glcount < ControlListView("classname=ESET Client Frame", "", "SysListView321", "GetItemCount")

ControlClick("classname=ESET Client Frame", "", "SysListView321", "left", 1, 25, 25)
 ControlSend("classname=ESET Client Frame", "", "SysListView321", "{del}")
 If $packageID <> "" And $packageID <> "1759227785" Then
 Sleep(100)
 ControlSend("classname=#32770", $lid, "Edit1", $PassC & "{enter}")
 EndIf
 Sleep(100)
 ControlSend("classname=#32770", "&D", "Button1", "!d!y")
 BlockInput(0)
 ControlClick("classname=ESET Client Frame", "", "ESET Menu Window1", "left", 1, 49, 41)
 WinMove("classname=ESET Client Frame", "", 150, Default)
 WinSetState("classname=ESET Client Frame", "", @SW_HIDE)
 If FileExists($glfile) Then
 TrayTip($ver & " 提示:", "你的系统不是以管理员登陆,软件无法自动升级替换," & @CRLF & "请用管理员登陆后再运行,或先关闭“自我保护”功能后再运行本软件。5秒后退出。", 10)
 Sleep(10000)
 Exit
 EndIf
 EndIf

EndFunc ;==>geli
 Func getHTTPPage($url)
 $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
 If IsObj($oHTTP) <> 1 Then $oHTTP = ObjCreate('MSXML2.ServerXMLHTTP.5.0')
 $oHTTP.Open("GET", $url, False)
 $oHTTP.SetTimeouts(5000, 10000, 5000, 5000)
 If $proxy == 1 Then $oHTTP.SetProxy(2, RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer"))
 $oHTTP.Send()

;$tem=$oHTTP.responsetext
 ;MsgBox(0,'',$oHTTP.getallResponseHeaders);*
 Local $ttext = $oHTTP.responsetext
 Local $tbody = $oHTTP.responsebody
 Local $tstatus = $oHTTP.status
 Local $theaders = $oHTTP.getallResponseHeaders
 $oHTTP.abort(0);
 $oHTTP = 0
 ;MsgBox(0,@ScriptLineNumber&$url,$theaders&@CRLF&$ttext);*
 If StringInStr($theaders, "charset=") == 0 Then
 If StringInStr(StringStripWS($ttext, 8), "charset=UTF-8") Or StringInStr(StringStripWS($ttext, 8), 'charset="UTF-8') Then
 ;FileWrite("c:\2.txt",BytesToBstr($oHTTP.responsebody,'UTF-8'))
 Return (BytesToBstr($tbody, "UTF-8"))
 Else
 Return (BytesToBstr($tbody, ''))
 EndIf
 Else
 Return ($ttext)
 EndIf

EndFunc ;==>getHTTPPage

Func BytesToBstr($body, $cherset)
 Dim $objstream
 If $cherset == "" Then $cherset = "GB2312"
 $objstream = ObjCreate("adodb.stream")
 $objstream.Type = 1
 $objstream.Mode = 3
 $objstream.Open
 $objstream.Write($body)
 $objstream.Position = 0
 $objstream.Type = 2
 $objstream.Charset = $cherset
 Return ($objstream.ReadText)
 $objstream.Close
 $objstream = ""
 EndFunc ;==>BytesToBstr

Func MakePacket($d)
 Local $p = ""
 While $d
 $p &= Chr(Dec(StringLeft($d, 2)))
 $d = StringTrimLeft($d, 2)
 WEnd
 Return $p
 EndFunc ;==>MakePacket

Func UnsignedHexToDec($i)
 Dim $ones
 $ones = StringRight($i, 1)
 $i = StringTrimRight($i, 1)
 Return Dec($i) * 16 + Dec($ones)
 EndFunc ;==>UnsignedHexToDec
THE END
喜欢就支持一下吧
点赞9 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容