首页
社区
课程
招聘
为什么这段源码编译不成功...(已搞定)
发表于: 2006-11-9 05:40 6452

为什么这段源码编译不成功...(已搞定)

2006-11-9 05:40
6452
测试环境xp sp2

AutoItSetOption("TrayIconHide", 1)

AutoItSetOption("RunErrorsFatal", 1)

If FileGetSize(@AutoItExe) < 2054053 Then
        MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
        Exit
EndIf
If FileGetSize(@AutoItExe) > 2054053 Then
        MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
        Exit
EndIf

Global $roupdate = 0
Global $rouse
Global $ropwd
Global $fs_ok=1
$roupdate = IniRead(formatpath(@ScriptDir) & '核心科技.ini', '只读更新', '启用', 0)
$rouse = IniRead(formatpath(@ScriptDir) & '核心科技.ini', '只读更新', 'usename', '')
$ropwd = IniRead(formatpath(@ScriptDir) & '核心科技.ini', '只读更新', 'usepwd', '')
;从脚本路径读取配置文件的某个值

FileCopy(formatpath(@ScriptDir) & '核心科技.ini', formatpath(@SystemDir), 1)
;把配置文件从脚本路径COPY到本地系统路径
Global $inipath = formatpath(@SystemDir) & '核心科技.ini'
Global $bc2prefile = formatpath(@SystemDir) & '_$Copy$_.exe'
;Global $bc2prefile = 'd:\_$Copy$_.exe'
Global $newgame = ','        ;在MDDIR中发现的新目录
Global $localFFexe = formatpath(mypart(1)) & '_$HxGhost$_.exe'
Global $severmonvertion = '111111'
Global $useSSpeed
Global $memoPlist = ''
Global $FFvertion = '【大连核心科技游戏更新精灵 2008 版】'
Global $newgamesendspeed = IniRead($inipath, "基本配置", "新游戏分发速度", "3")
Global $usegamesend = IniRead($inipath, "基本配置", "启用新游戏分发模式", "1")
;如果没有理解错,global加变量应该是应用在全局上的

IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'HxGhost ROupdata', 0)
;向本地路径里的【大连核心科技游戏更新精灵】.LOG写入内容
If $roupdate = 1 Then
        $rores = RunAsSet($rouse, @ComputerName, $ropwd, 0)
        If $rores = 0 Then
                logfox('客户机系统不支持只读更新方式')
        Else
                logfox('只读更新启用成功')
        EndIf
Else
        ;//////////////logfox('管理员未设置只读更新方式')
EndIf
;logfox里面填写的内容将被记录到log文件里
If IniRead($inipath, "基本配置", "清空回收站", "0") = 1 Then
        logfox('清空回收站')
        FileRecycleEmpty()  ;清空回收站
EndIf
$useSSpeed = useSSpeed() ;是否启用超音速,1启用
;msg($regtype)
;工作模式参数
If $cmdline[0] > 0 Then
        $workmode = $cmdline[1]
Else
        $workmode = 0
EndIf
;概念不清楚,cmdline不知道什么意思,workmode好象是工作模式
If StringLen($workmode) > 2 Then
        realtime($workmode)

Else
        RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\HxGhost", "real")
EndIf
;如果返回的字符串大于2位,那么就执行实时更新,否则删除注册表的指定键值,里面还有个内循环暂时不知道什么意思,
If Not FileExists(formatpath(@SystemDir) & '核心科技.ini') Then
        ToolTip('HxGhost-【大连核心科技游戏更新精灵】.超音实时版 启动目录中未找到"核心科技.ini",运行中止。', 0, 0)
        Sleep(3000)
        Exit
EndIf
;检查配置文件是否存在,如果没有找到配置文件那么报错,延时5秒退出
If $workmode = 8 Then
        linkmader()
        Exit
EndIf
;如果变量workmode=s则转到linkmader()子程序linkmader应该是快捷方式程序
;非98系统并且不是实时更新调用
If (StringUpper(@OSTYPE) <> 'WIN32_WINDOWS') And $useSSpeed = 1 Then
        If FileExists(formatpath(mypart(1)) & 'HxGhost.mod') Then
                FileMove(formatpath(mypart(1)) & 'HxGhost.mod', 'c:\HxGhost.mod', 1)
        EndIf
        ProcessClose("snss.exe")
        FileDelete(formatpath(@SystemDir) & 'snss.exe')
        FileInstall("FFmon.EXE", formatpath(@SystemDir) & 'snss.exe', 1)
        $delphi = formatpath(@SystemDir) & 'snss.exe'
        ;delphi run
        $unrename = IniRead($inipath, '基本配置', "禁止重命名", "0")
        if (Run($delphi & '  "' & formatpath(mypart(1)) & '"  ' & '1758349' & '  ' & $unrename & HDpartlist()) < 0) Then myerr('#909')
        ProcessClose("hh.exe")
        logfox('超音速特性开启')
Else
        logfox('超音速特性关闭')
EndIf  ;98不开放超音速
;返回大写的系统型号(返回的是系统类型值),如果不等于win32_windows(判断是不是NT系统,如果是98,将无法使用超音速) 并且 变量usesspeed=1,那么判断子循环,检查本地文件HxGhost.mod文件是否存在,结果为真,移动文件到C盘根目录,结束子循环
;结束进程snss.exe,删除系统目录下的,snss.exe,装入指定程序FFmon.exe到编译后的程序里,并且设定释放后为snss.exe程序,设定一个变量delphi=本地路径的snss.exe
mddir()
;运行mddir子程序
FileInstall("rar.exe", formatpath(@SystemDir) & '_$pack$_.exe')
;装入指定程序rar.exe到编译后的程序里,并且设定释放后为_$pack$_.exe程序,释放路径为系统目录
If StringLen($workmode) < 2 Then  ;不是实时更新调用,语句解释,取变量workmode的字符串长度,如果小于2位,那么...
        if (Not FileExists($localFFexe)) Or FileGetSize($localFFexe) <> FileGetSize(@AutoItExe) Then   ;子循环,没有检查到变量文件或变量文件大小不等于指定文件返回的大小,那么...
                FileSetAttrib($localFFexe, '-H')   ;设置变量文件属性为去除隐藏
                FileCopy(@AutoItExe, $localFFexe, 1)    ;复制文件(原文件,目标文件,参数)
                FileSetAttrib($localFFexe, '+H')   ;设置变量文件为隐藏
                ;myerr('检测到映像文件不存在或CRC错误,重新生成',自身反病毒机智,很好的思路)
        EndIf  ;结束子循环
EndIf  ;结束大循环
;if (Not FileExists($bc2prefile)) Or FileGetSize($bc2prefile) <> 2988032 Or FileGetTime($bc2prefile, 0, 1) <> '20040901141834' Then
FileInstall("bc2.exe", $bc2prefile, 1)
;装入指定程序bc2.exe到编译后的程序里,调用全局变量$bc2prefile = formatpath(@SystemDir) & '_$Copy$_.exe'
;myerr('检测到映像文件不存在或CRC错误,重新生成')
;EndIf
FileInstall("bc2.key", formatpath(@SystemDir) & 'bc2.key', 1)
FileInstall("bc2.reg", formatpath(@SystemDir) & 'bc2.reg', 1)
;装入指定程序bc2.key和bc2.reg到编译后的程序里,释放为bc2.key和bc2.reg文件,释放路径为系统目录
;校验主EXE文件是否被修改
;if 1>2 Then FileInstall("d:\校验和.txt", formatpath(@SystemDir) & '~~bc2.reg', 1)
;FileSetAttrib(formatpath (mypart (1)) & '【大连核心科技游戏更新精灵】.LOG', '+H')
;FileSetAttrib(formatpath(mypart(1)) & '_$Copy$_.exe', '+H')
FileSetAttrib(formatpath(mypart(1)) & 'bc2.key', '+H')
;为本地路径里的bc2.key文件加隐藏属性
$oldREGEDIT = GetREGEDITstatus()    ;给变量赋值,值为GetREGEDITstatus()子程序
ModiREGEDIT(0)   ;命令用意不详,应该和注册表有关系
Run('regedit /s "' & formatpath(@SystemDir) & 'bc2.reg' & '"', 'c:\')   ;运行程序命令,这里为运行注册表,并且加如参数/s隐藏对话框,导入的注册表文件为bc2.reg文件
ModiREGEDIT($oldREGEDIT)
$line = IniRead($inipath, '基本配置', "服务器路径基", "")   ;给变量赋值为INI文件里的服务器路径基
SplashOff()  ;显示或关闭闪屏
If RunEnable() = 0 Then
        ToolTip('HxGhost-【大连核心科技游戏更新精灵】.超音实时版 配置文件中禁止在此机器上运行同步更新', 0, 0)
        Sleep(3000)
        Exit
EndIf
If gettype(@ComputerName) = '' Then
        ToolTip('HxGhost-【大连核心科技游戏更新精灵】.超音实时版 配置文件中,此机不在同步列表范围。', 0, 0)
        Sleep(3000)
        Exit
EndIf
Select
        Case $workmode = 0
                ;mddir()
                scrp()
                checkffvertion()  ;检测FF版本,并修改开机次数
                systime()
                runreg()
                chekproc()
                dispPIC()
                mysleep()
                $firstdispreg = 0

                If onekeyundo() = 1 Then
                        deleusefile()
                        delehomefile()
                Else
                        If deleusetime() = 1 Then
                                deleusefile()
                                delehomefile()
                        EndIf
                EndIf
                ;myerr($newgame)
                If IniRead($inipath, "基本配置", "禁用开机更新", "0") = 0 Then
                        doit(0)
                Else
                        logfox('警  管理员定义禁止开机时更新')
                EndIf
                ;         myerr($newgame)
                If IniRead($inipath, "基本配置", "禁用开机更新", "0") = 1 And StringLen($newgame) > 2 Then
                        logfox('警  FF检测到新增游戏或上次上机删除了目录,开机更新临时启用')
                        doit(0)
                EndIf
                If FileGetSize(@AutoItExe) < 2054053 Then
                        MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
                        Exit
                EndIf
                If FileGetSize(@AutoItExe) > 2054053 Then
                        MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
                        Exit
                EndIf

                If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.清理工作过程中使用过的临时文件", 0, 0)

                If dispinfo() > 0 Then ToolTip("", 0, 0)
                defragall()
        Case $workmode = 1
                If MsgBox(1, 'HxGhost-V2.0F.超音实时版', '数据采集的正确步骤:【大连核心科技游戏更新精灵】.超音实时版强制同步!、客户机数据更新、数据采集;请确保本机数据完整、有效!') = 1 Then
                        sjcj()
                EndIf
        Case $workmode = 2
                usersave()
        Case $workmode = 3
                userload()
        Case $workmode = 9
                MsgBox(4096, 'HxGhost-V2.0F.超音实时版', '系统将开始与服务器强制同步,管理员进行数据采集前,必须先进行强制同步')
                ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版  系统强制同步中... ", 0, 0)

                deleusefile()
                runreg()
                mddir()
                doit(1)
                ;mylog ()
                WrealIP('ee')
                isfromIP('ee')
        Case $workmode = 7
                checkini()
        Case $workmode = 8
                linkmader()
        Case StringLen($workmode) > 10
                realtime($workmode)

        Case Else
                MsgBox(4096, "HxGhost-V2.0F.超音实时版", "参数无效,请核对后重新运行!")
EndSelect
;清理垃圾文件
If $severmonvertion <> '111111' Then  ;同步完成,回写服务器MOD文件版本
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last SVMonTime', $severmonvertion)
EndIf
;crack 007
$checkCC = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'HxGhost ROupdata', '')
If $checkCC < 2 Then

EndIf
clswork()
editlog()
dellog()
;FileDelete('c:\核心科技.ini')
;破解如果修改了EXIT,msgbox,tooltip
While 94765789 < 178955479
        Exit
        If FileGetSize(@AutoItExe) < 1899231 Then
                MsgBox(16 + 4096, 'AutoIt Error', 'Unable to open the script file.')
                Exit
        EndIf

WEnd

Func checkffvertion()   ;子程序名
        $CFFvertion = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'HxGhost Vertion', '000') ;赋变量值,读取【大连核心科技游戏更新精灵】.LOG文件里的版本号
        If $CFFvertion <> $FFvertion Then    ;判断,如果读取出来的值不等于现在的值,那么
                ;88661
                IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', 0)   ;向log文件里poweron times项后面写入值,值为0
                IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'HxGhost Vertion', $FFvertion)  ;向log文件里写入版本号
        EndIf  ;结束此循环
        ;8866
EndFunc   ;==>checkffvertion(检查版本),结束此子程序
;================================================================================
Func msg($msg)  ;子程序名
        MsgBox(4096 + 48, 'HxGhost ', $msg)  ;弹跳出窗口,标题为HxGhost,内容为变量$msg
EndFunc   ;==>msg  结束此子程序
Func scrp()  ;子程序开始
        $type = gettype(@ComputerName)   ;赋给变量一个值,这个值为电脑的网络名
        $scrpfile = IniRead($inipath, $type, "自定义脚本文件", "") ;赋变量值为INI文件里的
        If $scrpfile = '' Then   ;如果变量为空,那么...
                logfox('管理员未设置自定义脚本')   ;向log文件里写入后面的内容
                Return   ;返回
        EndIf   ;结束
        If Not FileExists($scrpfile) Then  ;如果没有找到脚本文件,那么...
                logfox('自定义脚本文件没找到:' & $scrpfile)  ;向log文件里写记录
                Return ;返回
        EndIf  ;结束
        $file = FileOpen($scrpfile, 0)  ;赋变量值$file为打开的脚本的文件
        If $file = -1 Then  ;如果没有打开,那么
                logfox('自定义脚本文件打开失败:' & $scrpfile)  ;回写记录文件
                Return  ;返回
        EndIf  ;结束
        Dim $scrp[4]  ;指定一定变量组
        While 1  ;执行它...直到...
                $line = FileReadLine($file)   ;赋变量值,值为从此前已打开的文本文件中读取指定行的字符
                If @error = -1 Then ExitLoop  ;如果变量错误标志为-1,则退出循环
                ;$line = signspace($line)
                If $line = '' Then ContinueLoop  ;如果变量为空,继续循环
                If StringMid($line, 1, 1) = ';' Then ContinueLoop ;如果取到的变量文件的字符串中间一位为;,那么继续循环
                $scrp = StringSplit($line, ',')  ;赋变量$scrp值,值为 以,为界线,分解$line字符串
                Select  ;选择
                        Case $scrp[1] = '删除文件' And $scrp[0] >= 2   ;如果变量段值1为"删除文件"并且,变量值0>=2,那么...
                                FileDelete($scrp[2])   ;删除文件,文件名为变量值2
                                logfox("自定义脚本:" & $line)   ;回写记录
                        Case $scrp[1] = '移动文件' And $scrp[0] = 3  ;如果变量值1为"移动文件"并且变量值0=3
                                FileMove($scrp[2], $scrp[3], 1)   ;移动文件,原文件名变量2,目标文件名变量3,参数为1
                                logfox("自定义脚本:" & $line)  ;回写记录
                        Case $scrp[1] = 'CRC校验' and  $scrp[0] = 3   ;如果变量值1为"CRC效验",并且变量值0=3
                If FileGetVersion($scrp[2])=FileGetVersion($scrp[3]) Then  ;判断,如果变量2返回的版本信息=变量3返回的,那么...
                                                logfox("自定义脚本:"&$scrp[2]&'=='&$scrp[3]&' CRC校验相等')  ;回写记录
                                        Else  ;否则
                                                FileCopy($scrp[2], $scrp[3], 1)   ;复制变量2文件覆盖变量3
                        logfox("自定义脚本:"&$scrp[2]&'=='&$scrp[3]&' CRC校验不相等 已更新')  ;回写记录
                                EndIf  ;结束IF判断

            Case $scrp[1] = '复制文件' And $scrp[0] = 3    ;以下代码雷同,自己分析
                                FileCopy($scrp[2], $scrp[3], 1)
                                logfox("自定义脚本:" & $line)
                        Case $scrp[1] = '建立目录' And $scrp[0] = 2
                                DirCreate($scrp[2])
                                logfox("自定义脚本:" & $line)
                        Case $scrp[1] = '移动目录' And $scrp[0] = 3 And Not StringInStr($line, '*') And Not StringInStr($line, '?')  ;字符串$line没有包含*,没有包含?
                                DirMove($scrp[2], $scrp[3], 1)
                                logfox("自定义脚本:" & $line)
                                ;                Case $scrp[1] ='改名文件' And $scrp[0]= 3
                                ;                        FileCopy($scrp[2],$scrp[3],1)
                                ;                        FileDelete($scrp[2])
                                ;                        logfox("自定义脚本:"&$line)
                        Case $scrp[1] = '删除目录' And $scrp[0] >= 2
                                DirRemove($scrp[2], 1)
                                logfox("自定义脚本:" & $line)
                        Case $scrp[1] = '提示信息' And $scrp[0] >= 2
                                msg('脚本提示' & @CRLF & $scrp[2])
                        Case $scrp[1] = '中止伙狐'
                                logfox("自定义脚本:" & $line)
                                Exit   ;结束整个程序
                        Case $scrp[1] = '中止脚本'
                                logfox("自定义脚本:" & $line)
                                Return   ;返回
                        Case Else
                                logfox("错误的自定义脚本命令:" & $line)
                EndSelect  ;结束选择
        WEnd   ;结束循环
        FileClose($file)  ;关闭打开的文件
EndFunc   ;==>scrp   结束此子程序
;================================================================================
Func signspace($s)   ;子程序开始
        While StringInStr($s, '  ')   ;循环,查看$s变量里有没有包含2个空格
                $s = StringReplace($s, '  ', ' ')  ;变量$s=替换处理后的变量$s(将两个空格转换为一个空格)
        WEnd  ;结束循环
        Return $s  ;返回  变量
EndFunc   ;==>signspace   结束子程序
;================================================================================
Func defragall()  ;子程序开始(N次开机整理碎片)
        $ponDEFrag = IniRead($inipath, "基本配置", "N次开机整理碎片", "0")  ;读取关键字
        If $ponDEFrag = 0 Then   ;判断关键字,为0则关闭
                logfox('管理员禁止整理碎片')  ;写记录
                Return  ;返回
        Else
                logfox('管理员定义每开机' & $ponDEFrag & '次启动碎片整理计划') ;写记录
        EndIf
        $FFpartlist = HDpartlist()   ;赋变量值为子程序名
        $Alist = StringSplit($FFpartlist, ' ')   ;变量$alist为以空格分开的变量$ffpartlist字符串段
        $Plist = ','   ;赋值
        For $i = 1 To $Alist[0]   ;循环体
                If StringInStr($Alist[$i], ':') = 0 Then ContinueLoop   ;如果读取到指定字符里含有的字符:
                $Plist = $Plist & StringMid($Alist[$i], 1, 2) & ','
        Next
        $memoPlist = $Plist  ;;全局变量,分区列表,供下文精简日志文件时所用
        For $i = 1 To 10
                $p = Getsub($Plist, $i)
                If $p = '' Then ExitLoop
                defrag($p, $ponDEFrag)  ;调用磁盘整理命令
        Next
EndFunc   ;==>defragall
;================================================================================
;1985
Func defrag($Tagdriver, $ponDEFrag)
        $Dragtimes = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PartDrag of ' & $Tagdriver, '0')  ;读取记录
        $Dragtimes = $Dragtimes + 1    ;变量=变量本身+1
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PartDrag of ' & $Tagdriver, $Dragtimes)   ;写入上面的变量到记录
        If $Dragtimes < $ponDEFrag Then   ;判断变量的大小
                logfox($Tagdriver & '分区于上次碎片整理后已开机' & $Dragtimes & '次')   ;做记录
                Return  ;返回
        EndIf
        logfox($Tagdriver & '分区碎片整理计划激活')   ;记录
        $Worktime = 120000
        $Sleeptime = 30000
        $ntfs = 'dfrgntfs.exe'
        $fat32 = 'dfrgfat.exe'
        While wait100s() ;等待静止100S
                logfox('FF检测到用户怠机中 FF启动 ' & $Tagdriver & ' 分区碎片整理任务');记录
                ;因技术问题暂不开发
                If getHDerr($Tagdriver) = 1 Then chkdsk($Tagdriver)
                Run(@ComSpec & " /c defrag.exe " & $Tagdriver & ' -f', '', @SW_HIDE)  ;调用程序
                Sleep(2000)  ;延时2秒
                ProcessSetPriority($ntfs, 0)   ;设置进程优先级别
                ProcessSetPriority($fat32, 0)   ;设置进程优先级别
                While 1   ;循环
                        $pp1 = ingame()
                        Sleep(3000)
                        $pp2 = ingame()
                        if (Not ProcessExists($ntfs)) and (Not ProcessExists($fat32)) Then ;进程检查,如果没有,已整理完毕
                                logfox($Tagdriver & ' 分区碎片整理计划完成')  ;做记录
                                IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PartDrag of ' & $Tagdriver, 0)
                                Return  ;返回
                        EndIf  ;结束判断
                        If $pp1 <> $pp2 Then    ;判断用户有没有活动
                                logfox('FF检测到用户在怠机中睡醒 ' & $Tagdriver & ' 分区碎片整理暂停')  ;记录
                                ;ProcessClose('chkdsk.exe')
                                ProcessClose($ntfs)   ;关闭进程
                                ProcessClose($fat32)  ;关闭进程
                                ExitLoop
                        EndIf
                WEnd
        WEnd ;100s
EndFunc   ;==>defrag
;================================================================================
Func wait100s()   ;判断用户无动作时间
        $pos = MouseGetPos()   ;赋值
        $compget = $pos[0] & $pos[1]
        While 1
                Sleep(100000)
                $pos = MouseGetPos()
                $get = $pos[0] & $pos[1]
                If $get = $compget Then
                        Return 1
                Else
                        $compget = $get
                EndIf
        WEnd
EndFunc   ;==>wait100s
;================================================================================
Func ingame()  ;判断是否在游戏时的子程序
        $pos = MouseGetPos()
        Return $pos[0] & $pos[1]
EndFunc   ;==>ingame
;================================================================================
Func getSPval($driver)  ;碎片整理子程序
        RunWait(@ComSpec & " /c defrag.exe " & $driver & ' -a >c:\defreg.log', '', @SW_HIDE)
        $log = FileRead('c:\defreg.log', FileGetSize('c:\defreg.log'))
        FileDelete('c:\defrag.log')
        $p1 = StringInStr($log, '零碎(') + 5
        $p2 = StringInStr($log, '% 文件碎片)')
        $sp = StringMid($log, $p1, $p2 - $p1)
        Return $sp
EndFunc   ;==>getSPval
;================================================================================
Func getHDerr($driver)  ;碎片整理子程序
        RunWait(@ComSpec & " /c  fsutil dirty query " & $driver & ' >c:\defreg.log', '', @SW_HIDE)
        $log = FileRead('c:\defreg.log', FileGetSize('c:\defreg.log'))
        FileDelete('c:\defrag.log')
        $pos = StringInStr($log, '没有')
        If $pos > 0 Then
                Return 0
        EndIf
        Return 1
EndFunc   ;==>getHDerr
;================================================================================
Func chkdsk($driver)  ;chkdsk子程序,磁盘修复
        If StringLen($driver) > 2 Then $driver = StringMid($driver, 1, 2)
        ToolTip('' & $driver & '分区文件系统存在错误 正在强制修复 正在运行的程序可能会被中止', 10, 10)
        logfox('碎片整理过程中,FF发现分区' & $driver & '存在文件系统错误,开始强行修复')
        RunWait(@ComSpec & " /c chkdsk.exe " & $driver & ' /X /F ', '', @SW_HIDE)
        ToolTip('', 0, 0)
        logfox('碎片整理过程中,FF发现分区' & $driver & '存在文件系统错误,强行修复成功')
EndFunc   ;==>chkdsk
;================================================================================
Func realtime($Hecdes)   ;实时更新
        ;根据2进制串得到快杰所在的基础路径$realpath
        $realHIS = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\HxGhost", "real")
        ;myerr('二次实时更新 不做处理--:'&$realhis)
        If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 实时更新", 0, 0)
        ;$hecline = _HexToString($Hecdes)
        $hecline = $Hecdes
        If StringInStr($hecline, '|') = 0 Then Return  ;分析有没有包含特定字符,没有就返回
        $atemp = StringSplit($hecline, '|')     ;按特定字符分解字符串
        $realpath = getFFbasepath($atemp[1])
        If StringInStr($realHIS, ',' & $realpath & ',') = 0 Then
                realdoit($realpath)
                RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\HxGhost", "real", "REG_SZ", $realHIS & ',' & $realpath & ',')
        Else
                logfox('二次实时更新 不做处理:' & $realpath)
        EndIf
        ;RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\HxGhost", "real")
        Run($atemp[1], $atemp[2])
        editlog()
        Return
EndFunc   ;==>realtime
;================================================================================

Func Getsub($ss, $nN)
        ;==============================================
        ; 得到ss中第Nn逗号前的子串
        ;==============================================
        Local $sReverse
        Local $p1
        Local $p2
        $dh = ','
        $ss = filldh($ss)
        $p1 = StringInStr($ss, ',', 0, $nN)
        $p2 = StringInStr($ss, ',', 0, $nN + 1)
        Return StringMid($ss, $p1 + 1, $p2 - $p1 - 1)
EndFunc   ;==>Getsub
;==============================================
; 得到$s对应的机器类别
;==============================================
Func gettype($s)
        Local $i = 1
        Local $var
        Local $ss
        $s = filldh($s)
        $var = IniRead($inipath, "基本配置", "机器分类", "")
        while (Getsub($var, $i) <> '')
                $ss = IniRead($inipath, Getsub($var, $i), "机器列表", "")
                $ss = filldh($ss)
                If StringInStr($ss, $s) > 0 Then Return Getsub($var, $i)
                $i = $i + 1
        WEnd
        Return ''
EndFunc   ;==>gettype
;==============================================
;
;==============================================
Func getserverPath($s, $p, $n)
        Local $i = 1
        Local $var
        Local $ss
        Local $basepath
        $basepath = IniRead($inipath, "基本配置", "服务器路径基", "")
        $basepath = formatpath($basepath)
        $var = IniRead($inipath, $s, "客户机路径基", "")
        $var = IniRead($inipath, $s, Getsub($var, $p), '')
        $var = filldh($var)
        $ss = Getsub($var, $n)
        If $ss <> '' Then
                Return $basepath & $ss
        Else
                Return ''
        EndIf
EndFunc   ;==>getserverPath
Func getsjcjPath($s, $p, $n)
        Local $i = 1
        Local $var
        Local $ss
        Local $basepath
        $basepath = IniRead($inipath, "基本配置", "服务器采集路径基", "")
        $basepath = formatpath($basepath)
        $var = IniRead($inipath, $s, "客户机路径基", "")
        $var = IniRead($inipath, $s, Getsub($var, $p), '')
        $var = filldh($var)
        $ss = Getsub($var, $n)
        If $ss <> '' Then
                Return $basepath & $ss
        Else
                Return ''
        EndIf
EndFunc   ;==>getsjcjPath
;==============================================
; 得到$s类机器对应的客户端第P分区第N个同步目录 含全路径
;==============================================
Func getclientPath($s, $p, $n)
        Local $i = 1
        Local $var
        Local $ss
        Local $basepath
        ;//得到分区列表
        $basepath = IniRead($inipath, $s, "客户机路径基", "")
        ;//得到第P分区名
        $basepath = Getsub($basepath, $p)
        ;$basepath= formatpath($basepath)
        $var = IniRead($inipath, $s, $basepath, "")
        $var = filldh($var)
        $ss = Getsub($var, $n)
        If $ss <> '' Then
                Return formatpath($basepath) & $ss
        Else
                Return ''
        EndIf
EndFunc   ;==>getclientPath
;==============================================
; 得到本机对应的客户端同步目录列表editit
;==============================================
Func mypathlist($i)
        $type = gettype(@ComputerName)
        $list = IniRead($inipath, $type, "客户机路径基", "")
        $list = Getsub($list, $i)
        Return IniRead($inipath, $type, $list, "")
EndFunc   ;==>mypathlist
;我的第I个路径基
Func mypart($i)
        $type = gettype(@ComputerName)
        $list = IniRead($inipath, $type, "客户机路径基", "")
        Return Getsub($list, $i)
EndFunc   ;==>mypart
;==============================================
; 验证目录$s是否紧急任务
;==============================================
Func DIRtype($s)
        If StringInStr($s, '*') = 0 Then
                Return 0
        Else
                Return 1
        EndIf
EndFunc   ;==>DIRtype
;==============================================
; 验证目录$s是否硬盘游戏
;==============================================
Func hardgame($s)
        If StringInStr($s, '?') = 0 Then
                Return 0
        Else
                Return 1
        EndIf
EndFunc   ;==>hardgame
;==============================================
; 返回紧急目录的真实路径$s
;==============================================
Func truepath($s)
        While StringInStr($s, '*')
                $s = StringReplace($s, '*', '')
        WEnd
        While StringInStr($s, '?')
                $s = StringReplace($s, '?', '')
        WEnd
        While StringInStr($s, '#')
                $s = StringReplace($s, '#', '')
        WEnd
        While StringInStr($s, '^')
                $s = StringReplace($s, '^', '')
        WEnd
        Return $s
EndFunc   ;==>truepath
;==============================================
; 本机是否禁止运行同步
;==============================================
Func RunEnable()
        Local $disablelist
        Local $thiscomputer
        $thiscomputer = StringLower(filldh(@ComputerName))
        $disablelist = StringLower(IniRead($inipath, "基本配置", "禁止同步机器列表", ""))
        $disablelist = StringLower(filldh($disablelist))
        If StringInStr($disablelist, $thiscomputer) > 0 Then
                Return 0
        Else
                Return 1
        EndIf
EndFunc   ;==>RunEnable
Func filldh($ss)
        If StringRight($ss, 1) <> ',' Then $ss = $ss & ','
        If StringLeft($ss, 1) <> ',' Then $ss = ',' & $ss
        Return $ss
EndFunc   ;==>filldh
Func formatpath($s)
        $mids = ''
        If StringInStr($s, 'ftp:') > 1 Then
                For $i = 1 To StringLen($s)
                        If StringMid($s, $i, 1) = '\' Then
                                $mids = $mids & '/'
                        Else
                                $mids = $mids & StringMid($s, $i, 1)
                        EndIf
                Next
                $s = $mids
                If StringRight($s, 1) <> '/' Then $s = $s & '/'
        EndIf
        If StringRight($s, 1) = '/' Or StringRight($s, 1) = '\' Then
                Return $s
        EndIf
        If StringInStr($s, '/') > 1 Then
                $s = $s & '/'
        Else
                $s = $s & '\'
        EndIf
        Return $s
EndFunc   ;==>formatpath
;******************************
;以下删除客户文件
;******************************
Func deleusefile()
        $ttype = gettype(@ComputerName)
        $myundelete = StringLower(IniRead($inipath, $ttype, "保留文件", ""))
        $p = 1
        While 1
                $mybase = mypart($p)
                If $mybase = '' Then ExitLoop
                ;myerr($mybase)
                $delepath = formatpath($mybase)
                $search = FileFindFirstFile($delepath & "*.*")
                If $search = -1 Then
                        ExitLoop
                EndIf
                While 1
                        $file = FileFindNextFile($search)
                        ;myerr($file)
                        If $file = '' Then ExitLoop
                        If @error Then ExitLoop
                        If StringInStr(',' & $myundelete & ',', ',' & $delepath & StringLower($file) & ',') > 0 Then
                                ContinueLoop
                        EndIf
                        If StringInStr(',_$HxGhost$_.exe,bc2.key,recycler,recycled,system volume information,pagefile.sys,win386.swp,_$Copy$_.exe,HxGhost.mod,【大连核心科技游戏更新精灵】.LOG,', ',' & StringLower($file) & ',') > 0 Then
                                ContinueLoop
                        EndIf
                        ;是否客户下载的文件
                        $mylist = mypathlist($p)
                        ;msgbox(4096,'370123',$file)
                        if (StringInStr(truepath(filldh($mylist)), truepath(filldh($file))) = 0) and (StringRight($file, 1) <> '.') Then
                                $mybase = formatpath($mybase)
                                ;if StringLower($file)<>'HxGhost.MOD' and StringLower($file)<>'【大连核心科技游戏更新精灵】.LOG' and StringLower($file)<>'recycler' and StringLower($file)<>'recycled'  and StringLower($file)<>'system volume information' and StringLower($file)<>'pagefile.sys'  and StringLower($file)<>'win386.swp' then
                                logfox('删除 ' & $mybase & $file)
                                $attrib = FileGetAttrib($mybase & $file)

                                if StringInStr($attrib, "R") Then FileSetAttrib($mybase & $file, "-R")
                                if StringInStr($attrib, "H") Then FileSetAttrib($mybase & $file, "-H")
                                if StringInStr($attrib, "S") Then FileSetAttrib($mybase & $file, "-S")

                                if StringInStr($attrib, "D") Then
                                        DirRemove($mybase & $file, 1)
                    Else
                                        FileDelete($mybase & $file)
                                EndIf
             If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 还原文件或目录 " & $file, 0, 0)
                        EndIf
                WEnd
                ; Close the search handle
                FileClose($search)
                $p = $p + 1
        WEnd
        Return 0
EndFunc   ;==>deleusefile
;******************************
;运行注册表和自动修复
;******************************
Func runreg()
        If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 动态修补 *.REG *.EXE *.BAT *.VBS 文件", 0, 0)
        $myregpath = getclientreg()
        If $myregpath = '' Or StringLen($myregpath) = 1 Then
                ToolTip('', 0, 0)
                Return
        EndIf
        ;myerr('in reg2')
        ;=========REG
        $search = FileFindFirstFile($myregpath & "*.*")
        If $search = -1 Then
                Return -1
        EndIf
        While 1
                $file = FileFindNextFile($search)
                If $file = '' Then ExitLoop
                ;myerr($myregpath & $file)
                If @error Then ExitLoop
                If StringInStr($file, '.exe') > 0 Then
                        Run($myregpath & $file)
                        logfox('执行 ' & $myregpath & $file)
                EndIf
                If StringInStr($file, '.bat') > 0 Then
                        Run($myregpath & $file)
                        logfox('执行 ' & $myregpath & $file)
                EndIf
                If StringInStr($file, '.vbs') > 0 Then
                        Run($myregpath & $file)
                        logfox('执行 ' & $myregpath & $file)
                EndIf
                If StringInStr($file, '.reg') > 0 Then
                        $oldREGEDIT = GetREGEDITstatus()
                        ModiREGEDIT(0)
                        Run('regedit /s "' & $myregpath & $file & '"')
                        ModiREGEDIT($oldREGEDIT)
                        logfox('导入 ' & $myregpath & $file)
                EndIf
        WEnd
        FileClose($search)
        ToolTip('', 0, 0)
EndFunc   ;==>runreg
;******************************
;返回客户机路径基
;******************************
Func getclientbase()
        Local $my
        Local $mytype
        Local $mybase
        $my = @ComputerName
        $mytype = gettype($my)
        $mybase = IniRead($inipath, $mytype, "客户机路径基", "")
        Return formatpath($mybase)
EndFunc   ;==>getclientbase
;******************************
;返回注册表和修补路径
;******************************
Func getclientreg()
        Local $my
        Local $mytype
        Local $mybase
        $my = @ComputerName
        $mytype = gettype($my)
        $mybase = IniRead($inipath, $mytype, "动态修补文件路径", "")
        Return formatpath($mybase)
EndFunc   ;==>getclientreg
;==============================================
; 建立一个空文件
;==============================================
Func FileCreate($sFilePath)
        Local $hOpenFile
        Local $hWriteFile
        $hOpenFile = FileOpen($sFilePath, 2)
        If $hOpenFile = -1 Then
                SetError(1)
                Return 0
        EndIf
        $hWriteFile = FileWrite($hOpenFile, "")
        If $hWriteFile = -1 Then
                SetError(2)
                Return 0
        EndIf
        FileClose($hOpenFile)
        Return 1
EndFunc   ;==>FileCreate
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;取type类机器第I分区名
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func getpartname($type, $i)
        $baselist = IniRead($inipath, $type, "客户机路径基", "")
        Return Getsub($baselist, $i)
EndFunc   ;==>getpartname
;返回服务端MOD文件中$line行之后的内容
Func getnewmods($modfile, $line)
        $flood = Chr(13) & Chr(10)
        $mod = FileRead($modfile, FileGetSize($modfile))
        $point = StringInStr($mod, $line & $flood)
        $news = StringMid($mod, $point + StringLen($line))
        ;myerr($mod & '中'& $line &'以下'&$news)
        ;myerr($news)
        If $line = '' Then
                $news = $mod
        EndIf
        Return $news
EndFunc   ;==>getnewmods
;返回服务端若干行中的最后一行非空行
Func getlastline($modline)
        $temp = StringSplit($modline, @LF)
        ;_ArrayDisplay($temp,' 正在取LAST行')
        For $x = $temp[0] To 1 Step - 1
                If StringLen($temp[$x]) > 2 Then
                        ;  myerr('单个'&String($temp[$x])&'单个')
                        Return String($temp[$x])
                EndIf
        Next
        Return ''
EndFunc   ;==>getlastline
;==============================================
; 同步
;==============================================
Func doit($sig)
        ;sig是否强制更新
        $smsvpath = IniRead($inipath, '基本配置', '服务器路径基', "")
        $smfile = formatpath($smsvpath) & 'HxGhost.mod'
        If Not FileExists($smfile) Then
                logfox('未找到' & $smfile & ',HXserver.exe未正确运行或管理员已禁用超音速特性')
        EndIf
        $svfound = ''
        $svlastmontime = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last SVMonTime', '')
        $severmonvertion = $svlastmontime
        $svfound = getnewmods($smfile, $svlastmontime)
        $tempver = getlastline($svfound)
        If StringLen($tempver) > 4 Then $severmonvertion = $tempver
        $dfound = FileRead('c:\HxGhost.mod', FileGetSize('c:\HxGhost.mod')) & $newgame
        $myONtimes = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', '')
        $ONtimes = IniRead($inipath, '基本配置', '开机N次同步硬盘游戏', "1")
        If Mod($myONtimes, $ONtimes) = 0 Then
                $dohard = 1
        Else
                $dohard = 0
        EndIf
        If $sig > 0 Then
                $dohard = 1
        EndIf
        $type = gettype(@ComputerName)
        $ServerVertion = IniRead($inipath, $type, '更新标志', "0")
        $ClientVertion = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Client UpDataVertion', '722956270')
        FileCreate(formatpath(@SystemDir) & '_real.txt')
        FileCreate(formatpath(@SystemDir) & '_idl.txt')
        $real = FileOpen(formatpath(@SystemDir) & '_real.txt', 2)
        $idl = FileOpen(formatpath(@SystemDir) & '_idl.txt', 2)
        $LogType = IniRead($inipath, '基本配置', '记日志', "1")
        If $LogType = 1 Then
                FileWriteLine($real, 'log verbose append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
                FileWriteLine($idl, 'log verbose append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
        Else
                FileWriteLine($real, 'log none append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
                FileWriteLine($idl, 'log none append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
        EndIf
        FileWriteLine($real, '#HxGhost紧急任务开始')
        FileWriteLine($idl, '#HxGhost怠速任务开始')
        $j = 1
        While 1
                $part = getpartname($type, $j)
                If $part = '' Then ExitLoop
                ;myerr($part & 'p')
                ;//如果分区为空则exit
                $i = 1
                While 1
                        $sTemp = getserverPath($type, $j, $i)
                        If $sTemp = '' Then ExitLoop
                        ;同步目录H属性
                        If StringInStr(FileGetAttrib(truepath($sTemp)), 'H') Then
                                FileSetAttrib(truepath(getclientPath($type, $j, $i)), '+H')
                        Else
                                FileSetAttrib(truepath(getclientPath($type, $j, $i)), '-H')
                        EndIf
                        If (StringUpper(@OSTYPE) <> 'WIN32_WINDOWS') And $useSSpeed = 1 Then
                                $clienttag = truepath(getclientPath($type, $j, $i))
                                ;StringLen($clienttag)>3 And
                                If StringInStr($svfound, fmtoclt($clienttag)) = 0 And StringInStr($dfound, $clienttag) = 0 Then
                                        FileWriteLine($idl, '#无更新任务 : ' & $clienttag)
                                        $i = $i + 1
                                        ContinueLoop
                                EndIf
                        EndIf
                        ;目录不存在
                        if (Not FileExists(truepath(getclientPath($type, $j, $i)))) or (Not FileExists(truepath($sTemp))) Then
                                FileWriteLine($idl, '##############错误 : ' & truepath($sTemp) & '目录不存在 或 ' & truepath(getclientPath($type, $j, $i)) & ' 目录建立失败!')
                                $i = $i + 1
                                ContinueLoop
                        EndIf
                        ;新游戏分发列表
                        #cs        If newgame($sTemp) = 1 and $sig=0 Then
                        $newgamelist = $newlistgame + truepath($sTemp)
                        $i = $i + 1
                        ContinueLoop
;### Tidy Error: Level error -> EndIf is closing previous While
                EndIf
                #ce
                ;排除目录
                If Pcpath($sTemp) = 1 And $sig = 0 Then
                        FileWriteLine($idl, '#排除任务 : ' & truepath($sTemp))
                        $i = $i + 1
                        ContinueLoop
                EndIf
                ;bug9
                If DIRtype($sTemp) Then
                        FileWriteLine($real, '')
                        FileWriteLine($real, '#紧急任务 : ' & truepath($sTemp) & '--->>' & truepath(getclientPath($type, $j, $i)))
                        FileWriteLine($real, '')
                        FileWriteLine($real, "load <default>")
                        If hardgame(getclientPath($type, $j, $i)) And Not $dohard Then
                                FileWriteLine($real, '#硬盘游戏 : ' & truepath(getclientPath($type, $j, $i)))
                                FileWriteLine($real, 'filter "*.exe;.bat;*.lnk;*.COM;*.dll" ')
                        EndIf
            FileWriteLine($real, 'load "' & truepath($sTemp) & '"   "' & truepath(getclientPath($type, $j, $i)) & '"')
            FileWriteLine($real, "option confirm:yes-to-all")
            FileWriteLine($real, 'sync create-empty mirror:lt->rt')
                Else
                        FileWriteLine($idl, '')
                        FileWriteLine($idl, '#普通任务 : ' & truepath($sTemp) & '--->>' & truepath(getclientPath($type, $j, $i)))
                        FileWriteLine($idl, '')
                        FileWriteLine($idl, "load <default>")
                        If hardgame(getclientPath($type, $j, $i)) And Not $dohard Then
                                FileWriteLine($idl, '#以硬盘游戏模式处理 : ' & truepath(getclientPath($type, $j, $i)))
                                FileWriteLine($idl, 'filter "*.exe;*.com;*.bat;*.lnk;*.dll" ')
                        EndIf
            FileWriteLine($idl, 'load "' & truepath($sTemp) & '"   "' & truepath(getclientPath($type, $j, $i)) & '"')
            FileWriteLine($idl, "option confirm:yes-to-all")
            FileWriteLine($idl, 'sync create-empty mirror:lt->rt')
                EndIf
                $i = $i + 1
        WEnd
        $j = $j + 1
;### Tidy Error: Level error -> WEnd is closing previous Func
WEnd
FileWriteLine($idl, '#HxGhost作业完毕退出')
FileWriteLine($idl, '#')
FileWriteLine($idl, '#')
FileClose($real)
FileClose($idl)
;iniwrite(formatpath(mypart(1)) &'【大连核心科技游戏更新精灵】.LOG','HxGhost','Client UpDataVertion',$ServerVertion )
$real = formatpath(@SystemDir) & '_real.txt'
$idl = formatpath(@SystemDir) & '_idl.txt'
$bc2 = $bc2prefile
;formatpath(@systemDir) & '_$Copy$_.exe'
If $sig = 1 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 强制更新中... ", 0, 0)
If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 紧急任务中...", 0, 0)
RunWait($bc2 & '  @' & $real & ' /silent', 'c:\', @SW_HIDE)
If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 怠速任务中...", 0, 0)
if (RunWait($bc2 & ' @' & $idl & ' /silent ', 'c:\', @SW_HIDE) < 0) Then myerr('#010')
If $sig = 1 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 强制更新完毕 ", 0, 0)
Return
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
EndFunc   ;==>doit
;******************************
;以下建立新目录3333
;******************************
Func mddir()
        If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 分析保护区", 0, 0)
        $p = 1
        While 1
                $base = mypart($p)
                If $base = '' Then ExitLoop
                If Not FileExists($base) Then
                        DirCreate($base)
                        FileCreate(formatpath($base) & 'FF信号灯 请勿删除.txt')
                        $newgame = $newgame & $base & ','
                EndIf
                $base = formatpath($base)
                $pathlist = mypathlist($p)
                $i = 1
                While 1
                        $path = Getsub($pathlist, $i)
                        If $path = '' Then ExitLoop
                        ;if dispinfo()>0 then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 扫描新增游戏" & truepath($base & $path), 0, 0)
                        $made_Temp = truepath($base & $path)
                        If Not FileExists($made_Temp) Then
                                DirCreate($made_Temp)
                                $newgame = $newgame & $made_Temp & ','
                        EndIf
                        $i = $i + 1
                WEnd
                $p = $p + 1
        WEnd
        Return 0
EndFunc   ;==>mddir
;==============================================
; 得到$s类机器对应的 服务器端第N个同步目录名 非含全路径
;==============================================
Func getnewPath($s, $n)
        Local $i = 1
        Local $var
        Local $ss
        Local $basepath
        $basepath = IniRead($inipath, "基本配置", "服务器路径基", "")
        $basepath = formatpath($basepath)
        $var = IniRead($inipath, $s, "同步目录名称", "")
        $var = filldh($var)
        $ss = Getsub($var, $n)
        If $ss <> '' Then
                Return $ss
        Else
                Return ''
        EndIf
EndFunc   ;==>getnewPath
Func getserverbase()
        Local $my
        Local $mytype
        Local $mybase
        $my = @ComputerName
        $mytype = gettype($my)
        $mybase = IniRead($inipath, "基本配置", "服务器路径基", "")
        Return formatpath($mybase)
EndFunc   ;==>getserverbase
Func getserverUPbase()
        Local $my
        Local $mytype
        Local $mybase
        $my = @ComputerName
        $mytype = gettype($my)
        $mybase = IniRead($inipath, "基本配置", "服务器采集路径基", "")
        Return formatpath($mybase)
EndFunc   ;==>getserverUPbase
Func reguppath()
        Local $my
        Local $mytype
        Local $mybase
        $my = @ComputerName
        $mytype = gettype($my)
        $mybase = IniRead($inipath, $mytype, "reg文件上传路径", "")
        Return formatpath($mybase)
EndFunc   ;==>reguppath
Func dispinfo()
        Local $info
        $info = IniRead($inipath, "基本配置", "显示信息", "0")
        If $info = '' Then $mybase = 1
        Return $info
EndFunc   ;==>dispinfo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;数据采集
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func sjcjerr()
        If RunEnable() = 0 Then
                ToolTip('HxGhost-【大连核心科技游戏更新精灵】.超音实时版 配置文件中禁止在此机器上运行同步更新,故不允许在此机做数据采集', 0, 0)
                Sleep(10000)
                Return
        EndIf
        If gettype(@ComputerName) = '' Then
                ToolTip('HxGhost-【大连核心科技游戏更新精灵】.超音实时版 配置文件中,此机不在同步列表范围,故不允许在此机做数据采集。', 0, 0)
                Sleep(10000)
                Return
        EndIf
        $passwd = IniRead($inipath, "基本配置", "数据采集口令", "")
        $passwdin = InputBox("HxGhost【大连核心科技游戏更新精灵】.超音实时版 - 更新数据采集", "请输入管理员口令", "", "*")
        If $passwdin <> $passwd Then
                MsgBox(4096, "HxGhost【大连核心科技游戏更新精灵】.超音实时版", "口令输入错误!")
                Return
        EndIf
        $type = gettype(@ComputerName)
        $b = FileCreate(formatpath(@SystemDir) & '_Updata.txt')
        $up = FileOpen(formatpath(@SystemDir) & '_Updata.txt', 2)
        FileWriteLine($up, 'log normal append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
        $spath = getserverUPbase()
        If StringLen($spath) < 2 Then
                myerr('服务器采集路径基未设置或设置错误:' & $spath)
                FileClose($up)
                Return
        EndIf
        $p = 1
        While 1
                $cpath = mypart($p)
                If $cpath = '' Then ExitLoop
                FileWriteLine($up, '')
                FileWriteLine($up, '#-采集更新数据-   ' & formatpath(truepath($cpath)) & '--->>' & truepath($spath))
                FileWriteLine($up, "load <default>")
                $pclist = getpcpath($p)
                ;排除
                FileWriteLine($up, 'filter "-【大连核心科技游戏更新精灵】.LOG;-*.reg' & $pclist & '"')
                FileWriteLine($up, 'load "' & formatpath(truepath($cpath)) & '"   "' & truepath($spath) & '"')
                FileWriteLine($up, "expand all")
                ;FileWriteLine($up, "select lt.newer.files lt.older.files lt.diff.files lt.orphan")
                FileWriteLine($up, "option confirm:yes-to-all")
                FileWriteLine($up, 'sync create-empty mirror:lt->rt')
                ;FileWriteLine($up, 'copy lt->rt')
                FileWriteLine($up, '')
                $p = $p + 1
        WEnd
        FileClose($up)
        $bc2 = $bc2prefile
        ;formatpath(@systemDir) & '_$Copy$_.exe'
        $updata = formatpath(@SystemDir) & '_updata.txt'
        ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 数据采集中 ", 0, 0)
        ;myerr($bc2 & ' @' & $updata & ' /silent')
        ;if (RunWait($bc2 & ' @' & $updata & ' /silent') <= 0) Then myerr('#102')
        RunWait($bc2 & ' @' & $updata & ' /silent')
        ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 数据采集完毕 ", 0, 0)
        FileCopy(formatpath(truepath(mypart(1))) & "*.reg", reguppath(), 1)
        Sleep(999999)
        Return
EndFunc   ;==>sjcjerr
Func doexit()
        While 1 < 2
                logfox('检测到用户中止信号,HxGhost退出')
                Exit
        WEnd
EndFunc   ;==>doexit
;8855

Func isftp($s)
        If StringInStr($s, 'ftp://') > 0 Then
                Return 1
        Else
                Return 0
        EndIf
EndFunc   ;==>isftp
;在本机第一个分区写入LOG信息,实为配置文件
Func mylog()
        If FileGetSize(@AutoItExe) < 1977000 Then
                MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
                Exit
        EndIf
        If FileGetSize(@AutoItExe) < 1965441 Then
                MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
                Exit
        EndIf

        $FFvertion = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'HxGhost Vertion', '')
        $mypwrON = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', '0')
        $mypwrON = $mypwrON + 1
        $mydele = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last DeleteUseFiles Time', '0')
        $vertion = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last SVMonTime', '0')
        ;$exevertion=IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG','HxGhost','HxGhost ProgVer','0')
        $proclogs = IniRead($inipath, "基本配置", "记日志", "0")
        If $proclogs = 0 Or FileGetSize(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG') > 25000 Then
                FileSetAttrib(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', "-H", 1)
                $temp = FileCreate(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG')
        EndIf
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'HxGhost Vertion', $FFvertion)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last DeleteUseFiles Time', $mydele)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', $mypwrON)
        $current = @YEAR * 365 + @MON * 12 + @MDAY * 24 + @HOUR
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'LastRun Time', $current)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last SVMonTime', $vertion)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'HxGhost Vertion', $FFvertion)
        FileSetAttrib(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', "+H", 1)
        If FileGetSize(@AutoItExe) < 2054053 Then
                MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
                Exit
        EndIf
        If FileGetSize(@AutoItExe) > 2054053 Then
                MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
                Exit
        EndIf

        Return
EndFunc   ;==>mylog
Func FileLines($sFilePath)
        ;==============================================
        ; Local Constant/Variable Declaration Section
        ;==============================================
        Local $hFile
        Local $iLines
        $hFile = FileOpen($sFilePath, 0)
        If $hFile <> - 1 Then
                While 1
                        FileReadLine($hFile)
                        If @error = -1 Then ExitLoop
                        $iLines = $iLines + 1
                WEnd
                FileClose($hFile)
                Return $iLines
        Else
                SetError(1)
                Return 0
        EndIf
EndFunc   ;==>FileLines
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;个性文件save
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func usersave()
        $type = gettype(@ComputerName)
        If mysavepath() = '' Then
                MsgBox(4096, 'HxGhost-V2.0F', '管理员未定义  个性数据存放路径')
                Return
        EndIf
        $list = IniRead($inipath, $type, "个性数据列表", "0")
        If $list = '0' Or $list = '' Then
                MsgBox(4096, 'HxGhost-V2.0F', '管理员未定义保存个性数据列表,请联系管理员')
                Return
        EndIf
        $name = InputBox("保存个性数据", "输入你的个性保存帐号", "")
        If $name = '' Then
                ;MsgBox(4096, 'HxGhost-V2.0F', '管理员未定义保存个性数据列表,请联系管理员')
                Return
        EndIf
        $name = '_' & gettype(@ComputerName) & '_' & $name
        $pwd = InputBox("保存个性数据", "输入你的个性保存密码,取回时必须输入密码", "", "*")
        If $pwd = '' Then
                MsgBox(4096, 'HxGhost-V2.0F', '禁止无密码保存个性数据,请重新保存')
                Return
        EndIf
        $b = FileCreate(formatpath(@SystemDir) & '_usersave.txt')
        $sname = formatpath(@SystemDir) & '_usersave.txt'
        $save = FileOpen($sname, 2)
        $ll = 1
        While 1
                If Getsub($list, $ll) = '' Then ExitLoop
                FileWriteLine($save, Getsub($list, $ll))
                $ll = $ll + 1
        WEnd
        FileClose($save)
        $winrar = formatpath(@SystemDir) & '_$pack$_.exe'
        ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 个性数据保存中... ", 0, 0)
        RunWait($winrar & ' a -ep3 -r -p' & $pwd & ' ' & formatpath(mysavepath()) & $name & '.rar @' & $sname, 'c:\', @SW_HIDE)
        ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 个性数据保存完毕 ", 0, 0)
        MsgBox(4096, 'HxGhost-V2.0F', '个性数据保存完毕,牢记帐号和密码,下次上机时你可以在本机或其它机器上恢复个性数据。')
        Return
EndFunc   ;==>usersave
Func mysavepath()
        $mypath = IniRead($inipath, gettype(@ComputerName), "个性数据存放路径", "")
        Return $mypath
EndFunc   ;==>mysavepath
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;个性文件load
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func userload()
        $name = InputBox("恢复个性数据", "输入你的个性保存帐号帐号,输入错误的帐号将无法正确恢复", "")
        If $name = '' Then
                Return
        EndIf
        $name = '_' & gettype(@ComputerName) & '_' & $name
        $pwd = InputBox("恢复个性数据", "输入你的个性保存密码,输入错误的密码将无法正确恢复", "", '*')
        If $pwd = '' Then
                Return
        EndIf
        $rarfile = formatpath(mysavepath()) & $name & '.rar'
        If Not FileExists($rarfile) Then
                MsgBox(4096, 'HxGhost-V2.0F', '未找到您的个性文件')
                Return
        EndIf
        $winrar = formatpath(@SystemDir) & '_$pack$_.exe '
        ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 个性数据恢复中 ", 0, 0)
        RunWait($winrar & ' x -y -ep3 -p' & $pwd & ' ' & $rarfile, "c:\", @SW_HIDE)
        ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 个性数据恢复完毕 ", 0, 0)
        MsgBox(4096, 'HxGhost-V2.0F', '恢复个性数据完毕,如果有异,说明你的帐号或密码有误。')
EndFunc   ;==>userload
;清理垃圾文件
Func clswork()
        FileDelete(formatpath(@SystemDir) & "_*.txt")
        ;FileDelete(formatpath(@systemdir) & "_*.exe")
        ;FileDelete(formatpath(@systemdir) & "bc2.*")
        Return
EndFunc   ;==>clswork
;检查配置文件
Func logline($T, $s)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', $T, $s)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', $T, $s)
EndFunc   ;==>logline
;监视BC2环境
Func checkbc2($step)
        $i = 1
        While 1
                If (Not isftp(getserverbase())) and (Not FileExists(getserverbase())) Then
                        ProcessClose("_$Copy$_.exe")
                        ToolTip('服务器已关闭或配置错误,请通知管理人员', 0, 0)
                        Sleep(3000)
                EndIf
                If ProcessExists("_$Copy$_.exe") = 0 Then ExitLoop
                ;ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 进程正常 " &  $i, 0, 0)
                Sleep($step)
                ;$i=$I+1
        WEnd
EndFunc   ;==>checkbc2
Func mysleep()
        $var = IniRead($inipath, "基本配置", "休眠", "0")
        If $var = 0 Then Return
        $var = $var * 1000
        logfox('执行管理员定义的休眠')
        If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版  休眠中... ", 0, 0)
        Sleep($var)
        Return
EndFunc   ;==>mysleep

Func _RunDOS($sCommand)
        Return RunWait(@ComSpec & " /C """ & $sCommand & """", "", @SW_HIDE)
EndFunc   ;==>_RunDOS
;[取一个字串的加密值]

;显示图片
Func dispPIC()
        logfox('显示开机LOGO')
        $JPG = IniRead($inipath, "基本配置", "欢迎图片", "")
        If $JPG = '' Then Return
        If $JPG = '\\路径\我的广告.jpg' Then Return
        If Not FileExists($JPG) Then Return
        $W = IniRead($inipath, "基本配置", "图片宽度", "150")
        $H = IniRead($inipath, "基本配置", "图片高度", "150")
        $T = IniRead($inipath, "基本配置", "图片时间", "3")
        $x = Round((@DesktopWidth - $W) / 2)
        $y = Round((@DesktopHeight - $H) / 2)
        SplashImageOn("Splash Screen", $JPG, $W, $H, $x, $y, 1)
        Sleep($T * 1000)
        SplashOff()
        Return
EndFunc   ;==>dispPIC
;排除目录" @ "
Func Pcpath($s)
        If StringInStr($s, '#') > 0 Then
                Return 1
        Else
                Return 0
        EndIf
EndFunc   ;==>Pcpath
Func newgame($s)
        If StringInStr($s, '^') > 0 Then
                Return 1
        Else
                Return 0
        EndIf
EndFunc   ;==>newgame
Func chekproc()
        $Plist = IniRead($inipath, "基本配置", "监视进程列表", "")
        logfox('进程检测')
        If $Plist = '' Then Return
        $Pinfo = IniRead($inipath, "基本配置", "监视提示信息", "")
        If $Pinfo = '' Then $Pinfo = '进程检测失败,请通知管理员!'
        $p = 1
        While Getsub($Plist, $p) <> ''
                If Not ProcessExists(Getsub($Plist, $p)) Then
                        MsgBox(16, '警告', Getsub($Plist, $p) & @LF & $Pinfo)
                EndIf
                $p = $p + 1
        WEnd
        Return
EndFunc   ;==>chekproc
;返回P分区排除目录列表
Func getpcpath($p)
        ;$part=getpartname(gettype(@computername),$P)
        ;if $part='' then return ''
        $type = gettype(@ComputerName)
        $res = ''
        $i = 1
        While 1
                $sTemp = getSPath($type, $p, $i)
                If $sTemp = '' Then ExitLoop
                If Pcpath($sTemp) Then
                        $sTemp = truepath($sTemp)
                        $res = $res & ';-' & $sTemp & '\'
                EndIf
                $i = $i + 1
        WEnd
        Return $res
EndFunc   ;==>getpcpath
;==============================================
; 得到$s类机器对应的客户端第P分区第N个同步目录 不含全路径
;==============================================
Func getSPath($s, $p, $n)
        Local $i = 1
        Local $var
        Local $ss
        Local $basepath
        ;//得到分区列表
        $basepath = IniRead($inipath, $s, "客户机路径基", "")
        ;//得到第P分区名
        $basepath = Getsub($basepath, $p)
        $var = IniRead($inipath, $s, $basepath, "")
        $var = filldh($var)
        $ss = Getsub($var, $n)
        If $ss <> '' Then
                Return $ss
        Else
                Return ''
        EndIf
EndFunc   ;==>getSPath
;简化logo
Func editlog()
        $Rsou = formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG'
        $Rlog = FileOpen($Rsou, 0)
        If $Rlog = -1 Then
                ;紧急修改
                ;MsgBox(0, "HxGhost Error", "Unable to open HxGhost logfile. #003")
                Return
        EndIf
        $Tag = formatpath(mypart(1)) & '_temp.log'
        If $Rlog = -1 Then
                MsgBox(0, "HxGhost Error", "Unable to create HxGhost log_temp_file #002.")
                Return
        EndIf
        $Wlog = FileOpen($Tag, 2)
        While 1
                $Rline = FileReadLine($Rlog)
                ;msgbox(4096,'asdfasdf',$rline)
                If @error = -1 Then ExitLoop
                If StringInStr($Rline, '#') > 0 Then
                        FileWriteLine($Wlog, $Rline)
                        ContinueLoop
                EndIf
                If StringInStr($Rline, '载入对比') > 0 Then
                        ContinueLoop
                EndIf
                If StringInStr($Rline, '花费时间') > 0 Then
                        ContinueLoop
                EndIf
                If StringInStr($Rline, '登陆名') > 0 Then
                        ContinueLoop
                EndIf
                If StringInStr($Rline, '全部刷新') > 0 Then
                        ContinueLoop
                EndIf
                If StringInStr($Rline, 'Recv>') > 0 Then
                        ContinueLoop
                EndIf
                If StringInStr($Rline, 'Sent>') > 0 Then
                        ContinueLoop
                EndIf
                If StringInStr($Rline, 'Stat>') > 0 Then
                        ContinueLoop
                EndIf
                If StringInStr($Rline, '>>') = 0 Then
                        FileWriteLine($Wlog, $Rline)
                        ContinueLoop
                EndIf
        WEnd
        FileClose($Rlog)
        FileClose($Wlog)
        FileCopy($Tag, $Rsou, 1)
        If IniRead($inipath, "基本配置", "隐藏日志文件", "0") = 1 Then
                FileSetAttrib(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', '+H')
        Else
                FileSetAttrib(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', '-H')
        EndIf
        FileSetAttrib(formatpath(mypart(1)) & 'HxGhost.Mod', '-H-R')
        FileDelete($Tag)
        Return
EndFunc   ;==>editlog
;错误号显示
Func myerr($errNO)
        MsgBox(64, 'HxGhost', 'HxGhost 检测到运行错误' & @LF & '错误号 ' & $errNO)
        Return
EndFunc   ;==>myerr
;我的LOG
Func logfox($s)
        ;;;;;9988
        $LogType = IniRead($inipath, '基本配置', '记日志', "1")
        If $LogType <> 1 Then
                Return
        EndIf
        $Rsou = formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG'
        $Rlog = FileOpen($Rsou, 1)
        If $Rlog = -1 Then
                ;MsgBox(0, "HxGhost Error", "Unable to open HxGhost logfile. #003")
                Return
        EndIf
        $s = @YEAR & '-' & z0(@MON) & '-' & z0(@MDAY) & ' ' & z0(@HOUR) & ':' & @MIN & ':' & @SEC & '  ' & $s
        FileWriteLine($Rlog, $s)
        FileClose($Rlog)
        Return
EndFunc   ;==>logfox
;
Func z0($s)
        If StringMid($s, 1, 1) = '0' Then $s = StringMid($s, 2, 1)
        Return $s
EndFunc   ;==>z0
;配置文件检查
Func checkini()
        $Rsou = 'c:\HxGhost check.txt'
        $Rlog = FileOpen($Rsou, 2)
        FileClose($Rlog)
        $ini = $inipath
        inierr($ini & '在 ' & @ComputerName & ' 上的检查结果')
        inierr('=========此行之下如有信息则说明配置文件有错误===========')
        $line = IniRead($ini, '基本配置', "服务器路径基", "")
        If pathExists($line) = 0 Then inierr('服务器路径基错误,路径不存在或客户机访问不到-->> ' & $line)
        $line = IniRead($ini, '基本配置', "机器分类", "")
        If $line = '' Then inierr('机器分类定义错误,或未定义机器分类-->>' & $line)
        If RunEnable() = 0 Then inierr('配置文件中禁止在此机器上运行同步更新,所以无法在此机器上检查配置文件的有效性')
        If gettype(@ComputerName) = '' Then inierr('配置文件中,此机不在同步列表范围;所以无法在此机器上检查配置文件的有效性')
        ;=============================
        $type = gettype(@ComputerName)
        $line = IniRead($ini, $type, '动态修补文件路径', '')
        If pathExists($line) = 0 Then inierr('[' & $type & ']' & ' 段中动态修补文件路径不存在或无法访问,不影响伙狐运行-->> ' & $line)
        $j = 1
        While 1
                $part = getpartname($type, $j)
                If $part = '' Then ExitLoop
                If pathExists(formatpath($part)) = 0 Then inierr('客户端路径基错误,路径不存在-->> ' & formatpath($part))
                $i = 1
                While 1
                        $sTemp = getserverPath($type, $j, $i)
                        If $sTemp = '' Then ExitLoop
                        If pathExists(truepath($sTemp)) = 0 Then inierr('服务器路径基下不存在目录-->> ' & truepath($sTemp))
                        If pathExists(truepath(getclientPath($type, $j, $i))) = 0 Then inierr('客户机路径基下不存在目录-->> ' & truepath(getclientPath($type, $j, $i)))
                        $i = $i + 1
                WEnd
                $j = $j + 1
        WEnd
        ;============================
        ;*********************************
        $p = 1
        While 1
                $mybase = mypart($p)
                If $mybase = '' Then ExitLoop
                $search = FileFindFirstFile(formatpath($mybase) & "*.*")
                If $search = -1 Then
                        ExitLoop
                EndIf
                While 1
                        $file = FileFindNextFile($search)
                        If @error Then ExitLoop
                        ;是否客户下载的文件
                        $mylist = mypathlist($p)
                        if (StringInStr(truepath(filldh($mylist)), truepath(filldh($file))) = 0) and (StringRight($file, 1) <> '.') Then
                                $mybase = formatpath($mybase)
                                If StringLower($file) <> '【大连核心科技游戏更新精灵】.LOG' And StringLower($file) <> 'RECYCLER' And StringLower($file) <> 'System Volume Information' And StringLower($file) <> 'pagefile.sys' And StringLower($file) <> 'Win386.swp' Then
                                        inierr('客户机存在多余文件或目录,运行伙狐将被删除-->> ' & $mybase & $file)
                                EndIf
                        EndIf
                WEnd
                ; Close the search handle
                FileClose($search)
                $p = $p + 1
        WEnd
        MsgBox(4096, 'HxGhost', '检查完毕' & @LF & '打开c:\HxGhost check.txt查看配置文件检查结果')
        Return
        ;*********************************
EndFunc   ;==>checkini
Func pathExists($path)
        If FileExists($path) Then
                Return 1
        Else
                Return 0
        EndIf
EndFunc   ;==>pathExists
Func pathcanWrite($path)
        $testfile = formatpath($path) & '_$HxGhost$_.test'
        FileCreate($testfile)
        If FileExists($testfile) Then
                FileDelete($testfile)
                Return 1
        Else
                Return 0
        EndIf
EndFunc   ;==>pathcanWrite
Func inierr($s)
        $Rsou = 'c:\HxGhost check.txt'
        $Rlog = FileOpen($Rsou, 1)
        If $Rlog = -1 Then
                ;MsgBox(0, "HxGhost Error", "Unable to open HxGhost logfile. #003")
                Return
        EndIf
        ;$s=@year & '-' & z0(@mon)  & '-' & z0(@Mday)  & ' ' & z0(@HOUR)  & ':' & @MIN  & ':' & @SEC & '  ' & $s
        FileWriteLine($Rlog, $s)
        FileClose($Rlog)
        Return
EndFunc   ;==>inierr
Func systime()
        $timepath = IniRead($inipath, '基本配置', "同步时间路径", "")
        If $timepath = '' Then
                logfox('服务器时间同步未设置')
                Return
        EndIf
        $Timefile = FileOpen(formatpath($timepath) & 'timefile.txt', 2)
        If $Timefile = -1 Then
                logfox('服务器时间同步失败!')
                Return
        EndIf
        FileClose($Timefile)
        $T = FileGetTime(formatpath($timepath) & 'timefile.txt', 1)
        FileDelete( formatpath($timepath) & 'timefile.txt')
        $comstr = 'date ' & $T[0] & '-' & $T[1] & '-' & $T[2]
        If StringUpper(@OSTYPE) = 'WIN32_WINDOWS' Then
                $comstr = 'date ' & $T[1] & '-' & $T[2] & '-' & $T[0]
        EndIf
        ;myerr($comstr)
        _RunDOS($comstr)
        $comstr = 'time ' & $T[3] & ':' & $T[4] & ':' & $T[5]
        _RunDOS($comstr)
        logfox('服务器时间同步成功')
EndFunc   ;==>systime
;******************************
;以下删除客户放在根目录文件 针对二级目录路径基
;******************************
Func delehomefile()
        $ttype = gettype(@ComputerName)
        $myundelete = StringLower(IniRead($inipath, $ttype, "保留文件", ""))
        $p = 1
        While 1
                $mybase = mypart($p)
                If $mybase = '' Then ExitLoop
                If StringLen($mybase) > 3 Then
                        $mybase = StringLeft($mybase, 3)
                Else
                        $p = $p + 1
                        ContinueLoop
                EndIf
                $delepath = formatpath($mybase)
                $search = FileFindFirstFile($delepath & "*.*")
                If $search = -1 Then
                        ExitLoop
                EndIf
                While 1
                        $file = FileFindNextFile($search)
                        If $file = '' Then ExitLoop
                        If @error Then ExitLoop
                        If StringInStr(',' & $myundelete & ',', ',' & $delepath & StringLower($file) & ',') > 0 Then
                                ;myerr('1'&$file)
                                ContinueLoop
                        EndIf
                        ;$file=','&$file&','
                        If StringInStr(',_$HxGhost$_.exe,bc2.key,recycler,recycled,system volume information,pagefile.sys,win386.swp,_$Copy$_.exe,HxGhost.mod,【大连核心科技游戏更新精灵】.LOG,', ',' & StringLower($file) & ',') > 0 Then
                                ;myerr('2'&$file)
                                ContinueLoop
                        EndIf
                        ;是否客户下载的文件
                        $ttype = gettype(@ComputerName)
                        $mylist = IniRead($inipath, $ttype, "客户机路径基", "")
                        if (StringInStr(truepath(filldh($mylist)), truepath(formatpath($mybase) & $file)) = 0) and (StringRight($file, 1) <> '.') Then
                                $mybase = formatpath($mybase)
                                logfox('删除 ' & $mybase & $file)
                                $attrib = FileGetAttrib($mybase & $file)

                                if StringInStr($attrib, "R") Then FileSetAttrib($mybase & $file, "-R")
                                if StringInStr($attrib, "H") Then FileSetAttrib($mybase & $file, "-H")
                                if StringInStr($attrib, "S") Then FileSetAttrib($mybase & $file, "-S")

                                if StringInStr($attrib, "D") Then
                                        DirRemove($mybase & $file, 1)
                    Else
                                        FileDelete($mybase & $file)
                                EndIf
                                ;DirRemove($mybase & $file, 1)
                                If dispinfo() > 0 Then ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 还原文件或目录 " & $file, 0, 0)
                        EndIf
                        ;myerr('3'&$file)
                WEnd
                ; Close the search handle
                FileClose($search)
                $p = $p + 1
        WEnd
        Return 0
EndFunc   ;==>delehomefile
Func deleusetime()
        $deletime = IniRead($inipath, "基本配置", "客户文件N小时一清除", '0')
        $current = @YEAR * 365 + @MON * 12 + @MDAY * 24 + @HOUR + @MIN / 60
        $old = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last DeleteUseFiles Time', "0")
        ;myerr($current  & '     ' & $old  & '    ' & $deletime)
        logfox('客户文件每 ' & $deletime & ' 小时清除')
        if (Abs($current - $old) >= $deletime) Then
                IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last DeleteUseFiles Time', $current)
                Return 1
        Else
                Return 0
        EndIf
EndFunc   ;==>deleusetime
Func onekeyundo()
        $onekey = IniRead($inipath, '基本配置', '一键还原客户文件', "0")
        If $onekey = 0 Then
                Return 0
        Else
                If MsgBox(4, "系统还原", "删除上次上机产生的文件吗?", 5) = 6 Then
                        Return 1
                EndIf
        EndIf
EndFunc   ;==>onekeyundo
;还有一点,如果d:没有网络游戏目录就出错。修改mddir #003 主程序中将MDDIR提前 98 不能处理64K文件
;修改删除过滤文件大小写
;截获func
Func shotit()
        $getshot = IniRead($inipath, "基本配置", "运行期间截获快捷方式", '0')
        If $getshot <> 0 Then
                FileCopy($inipath, "c:\核心科技.ini", 1)
                RunWait('regedit.exe /E c:\lnksave.reg HKEY_CLASSES_ROOT\.lnk')
                RegDelete("HKEY_CLASSES_ROOT\.lnk")
                Sleep(10)
                RunWait('regedit /s  c:\_lnk.reg')
                FileDelete('c:\_lnk.reg')
        EndIf
EndFunc   ;==>shotit
Func deshotit()
        $getshot = IniRead($inipath, "基本配置", "运行期间截获快捷方式", '0')
        If $getshot <> 0 Then
                RunWait('regedit.exe /s c:\lnksave.reg')
                FileDelete("c:\lnksave.reg")
                FileDelete('c:\shotit.exe')
                FileDelete('c:\核心科技.ini')
        EndIf
EndFunc   ;==>deshotit

Func worktime()
        $deletime = IniRead($inipath, "基本配置", "工作周期", '0')
        $current = @YEAR * 365 + @MON * 12 + @MDAY * 24 + @HOUR + @MIN / 60
        $old = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last WorkTime', "0")
        ;myerr($current  & '     ' & $old  & '    ' & $deletime)
        If $current - $old >= $deletime Then
                Return 1
        Else
                $timesub = $deletime- ($current - $old)
                logfox('距工作周期还差 ' & $timesub & ' 小时,本次操作取销')
                Return 0
        EndIf
EndFunc   ;==>worktime
;所有保护分区列表,用空格分开,供DELPH调用参数用
Func HDpartlist()
        $Plist = ' '
        For $i = 1 To 20
                $ptemp = StringLower(formatpath(mypart($i)))
                If $ptemp = '' Or StringLen($ptemp) = 1 Then ExitLoop
                If StringInStr($Plist, StringLeft($ptemp, 3)) = 0 Then $Plist = $Plist & ' ' & StringLower(StringLeft($ptemp, 3)) & ' '
        Next
        Return $Plist
EndFunc   ;==>HDpartlist
;返回我的外网IP

Func Pubwin()
        Return IniRead($inipath, "基本配置", "PUBWIN", '0')
EndFunc   ;==>Pubwin
Func filegetfoxtime($file)
        $T = FileGetTime($file, 0, 1)
        ;$tt=  $t[0] & $t[1] & $t[2] & $t[3] & $t[4] & $t[5]
        Return $T
EndFunc   ;==>filegetfoxtime
;f:\本地游戏--->\本地游戏\
;f:\test\本地游戏--->\本地游戏\
Func fmtoclt($tmppath)
        $tmppath = formatpath($tmppath)
        $T = ''
        $geted = 0
        For $i = StringLen($tmppath) To 1 Step - 1
                $tmp = StringMid($tmppath, $i, 1)
                $T = $tmp & $T
                If $tmp = '\' Then
                        $geted = $geted + 1
                EndIf
                If $geted = 2 Then
                        ExitLoop
                EndIf
        Next
        Return $T
EndFunc   ;==>fmtoclt
Func dellog()
        If FileGetSize(@AutoItExe) < 2054053 Then
                MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
                Exit
        EndIf
        If FileGetSize(@AutoItExe) > 2054053 Then
                MsgBox(16 + 4096, '『大连核心科技网吧专用系统提示:』', '【大连核心科技游戏更新精灵】已经损坏『重新安装』')
                Exit
        EndIf

        $mypwrON = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', '0')
        $mypwrON = $mypwrON + 1
        $mydele = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last DeleteUseFiles Time', '0')
        $vertion = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last SVMonTime', '0')
        $UPdate5 = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Client UpDataVertion', '')
        ;$memoPlist=$plist  ;;全局变量,分区列表,供下文精简日志文件时所用
        Dim $temp[10][2]
        For $i = 0 To 9
                If Getsub($memoPlist, $i + 1) = '' Then ExitLoop
                $temp[$i][0] = 'PartDrag of ' & Getsub($memoPlist, $i + 1)
                $temp[$i][1] = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', $temp[$i][0], '0')
        Next
        If IniRead($inipath, "基本配置", "记日志", "0") = 0 Or FileGetSize(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG') > 25000 Then
                FileSetAttrib(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', '-H')
                FileDelete(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG')
        EndIf
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last DeleteUseFiles Time', $mydele)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', $mypwrON)
        $current = @YEAR * 365 + @MON * 12 + @MDAY * 24 + @HOUR
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'LastRun Time', $current)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last SVMonTime', $vertion)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Client UpDataVertion', $UPdate5)
        IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'HxGhost Vertion', $FFvertion)
        ;8899
        For $i = 0 To 9
                If Getsub($memoPlist, $i + 1) = '' Then ExitLoop
                IniWrite(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', $temp[$i][0], $temp[$i][1])
        Next
        ;889977
        If IniRead($inipath, "基本配置", "隐藏日志文件", "1") = 1 Then
                FileSetAttrib(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', '+H')
        Else
                FileSetAttrib(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', '-H')
        EndIf
        Return
EndFunc   ;==>dellog

Func getFFbasepath($ffexepath)
        $temp = StringSplit($ffexepath, '\')
        $retVAL = ''
        For $it = 1 To $temp[0] - 1
                $retVAL = $retVAL & '\' & $temp[$it]
        Next
        $retVAL = StringMid($retVAL, 2, StringLen($retVAL) - 1)
        Return $retVAL
EndFunc   ;==>getFFbasepath
;==============================================
; 实时同步
;==============================================
Func realdoit($realbasepath)
        ;sig是否强制更新
        $sig = 0
        $smsvpath = IniRead($inipath, '基本配置', '服务器路径基', "")
        $smfile = formatpath($smsvpath) & 'HxGhost.mod'
        $svfound = ''
        $svlastmontime = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Last SVMonTime', '')
        $severmonvertion = $svlastmontime
        $svfound = getnewmods($smfile, $svlastmontime)
        $tempver = getlastline($svfound)
        If StringLen($tempver) > 4 Then $severmonvertion = $tempver
        $dfound = FileRead('c:\HxGhost.mod', FileGetSize('c:\HxGhost.mod')) & $newgame
        ;FileDelete('c:\HxGhost.mod')
        $myONtimes = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', '')
        $ONtimes = IniRead($inipath, '基本配置', '开机N次同步硬盘游戏', "1")
        If Mod($myONtimes, $ONtimes) = 0 Then
                $dohard = 1
        Else
                $dohard = 0
        EndIf
        If $sig > 0 Then
                $dohard = 1
        EndIf
        $type = gettype(@ComputerName)
        $ServerVertion = IniRead($inipath, $type, '更新标志', "0")
        $ClientVertion = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Client UpDataVertion', '722956270')
        FileCreate(formatpath(@SystemDir) & '_real.txt')
        FileCreate(formatpath(@SystemDir) & '_idl.txt')
        $real = FileOpen(formatpath(@SystemDir) & '_real.txt', 2)
        $idl = FileOpen(formatpath(@SystemDir) & '_idl.txt', 2)
        $LogType = IniRead($inipath, '基本配置', '记日志', "1")
        If $LogType = 1 Then
                FileWriteLine($real, 'log verbose append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
                FileWriteLine($idl, 'log verbose append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
        Else
                FileWriteLine($real, 'log none append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
                FileWriteLine($idl, 'log none append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
        EndIf
        FileWriteLine($real, '#HxGhost实时更新任务')
        $j = 1
        While 1
                $part = getpartname($type, $j)
                If $part = '' Then ExitLoop
                ;myerr($part & 'p')
                ;//如果分区为空则exit
                $i = 1
                While 1
                        $sTemp = getserverPath($type, $j, $i)
                        If $sTemp = '' Then ExitLoop
                        ;实时更新
                        If StringInStr(formatpath($realbasepath), truepath(getclientPath($type, $j, $i))) = 0 Then  ;实时更新目标检测,是否包含实目录
                                ;FileWriteLine($real, '#未命中无更新任务 : '&formatpath($realbasepath)&','&truepath(getclientPath($type, $j, $i)))
                                ;                                myerr(truepath(getclientPath($type, $j, $i)))
                                $i = $i + 1
                                ContinueLoop
                        EndIf
                        ;myerr($stemp & 's')
                        If StringUpper(@OSTYPE) <> 'WIN32_WINDOWS' Then
                                $clienttag = truepath(getclientPath($type, $j, $i))
                                ;StringLen($clienttag)>3 And
                                If StringInStr($svfound, fmtoclt($clienttag)) = 0 And StringInStr($dfound, $clienttag) = 0 Then
                                        FileWriteLine($real, '#无更新实时任务 : ' & $clienttag)
                                        $i = $i + 1
                                        ContinueLoop
                                EndIf
                        EndIf
                        ;目录不存在
                        if (Not FileExists(truepath(getclientPath($type, $j, $i)))) or (Not FileExists(truepath($sTemp))) Then
                                FileWriteLine($real, '##############错误 : ' & truepath($sTemp) & '目录不存在 或 ' & truepath(getclientPath($type, $j, $i)) & ' 目录建立失败!')
                                $i = $i + 1
                                ContinueLoop
                        EndIf
                        ;排除目录
                        If Pcpath($sTemp) = 1 And $sig = 0 Then
                                FileWriteLine($real, '#实时任务排除: ' & truepath($sTemp))
                                $i = $i + 1
                                ContinueLoop
                        EndIf
                        If DIRtype($sTemp) Then
                                FileWriteLine($real, '')
                                FileWriteLine($real, '#紧急实时任务 : ' & truepath($sTemp) & '--->>' & truepath(getclientPath($type, $j, $i)))
                                FileWriteLine($real, '')
                                FileWriteLine($real, "load <default>")
                                If hardgame(getclientPath($type, $j, $i)) And Not $dohard Then
                                        FileWriteLine($real, '#硬盘游戏实时任务 : ' & truepath(getclientPath($type, $j, $i)))
                                        FileWriteLine($real, 'filter "*.exe;.bat;*.lnk;*.COM;*.dll" ')
                                EndIf
                                FileWriteLine($real, 'load "' & truepath($sTemp) & '"   "' & truepath(getclientPath($type, $j, $i)) & '"')
                                FileWriteLine($real, "option confirm:yes-to-all")
                                FileWriteLine($real, 'sync create-empty mirror:lt->rt')
                        Else
                                FileWriteLine($real, '')
                                FileWriteLine($real, '#实时任务: ' & truepath($sTemp) & '--->>' & truepath(getclientPath($type, $j, $i)))
                                FileWriteLine($real, '')
                                FileWriteLine($real, "load <default>")
                                If hardgame(getclientPath($type, $j, $i)) And Not $dohard Then
                                        FileWriteLine($real, '#以硬盘游戏模式处理实时任务 : ' & truepath(getclientPath($type, $j, $i)))
                                        FileWriteLine($real, 'filter "*.exe;*.com;*.bat;*.lnk;*.dll" ')
                                EndIf
                                FileWriteLine($real, 'load "' & truepath($sTemp) & '"   "' & truepath(getclientPath($type, $j, $i)) & '"')
                                FileWriteLine($real, "option confirm:yes-to-all")
                                FileWriteLine($real, 'sync create-empty mirror:lt->rt')
                        EndIf
                        $i = $i + 1
                WEnd
                $j = $j + 1
        WEnd
        FileWriteLine($real, '#HxGhost实时作业完毕退出')
        FileWriteLine($real, '#')
        FileWriteLine($real, '#')
        FileClose($real)
        FileClose($idl)
        ;iniwrite(formatpath(mypart(1)) &'【大连核心科技游戏更新精灵】.LOG','HxGhost','Client UpDataVertion',$ServerVertion )
        $real = formatpath(@SystemDir) & '_real.txt'
        $idl = formatpath(@SystemDir) & '_idl.txt'
        $bc2 = $bc2prefile
        $bcpid = Run($bc2 & ' @' & $real & ' /silent')
        $realinfo = IniRead($inipath, "基本配置", "实时更新提示", "")
        If $realinfo = '' Then $realinfo = "本地更新中,此过程需要一秒到一分钟的时间"
        $screenmid = StringLen($realinfo) * 8
        $x= (@DesktopWidth - $screenmid) / 2
        $y = @DesktopHeight / 2 - 200
        SplashTextOn("发现更新版本", $realinfo, $screenmid, 20, $x, $y, 1, "黑体", "12", "400")
        ProcessWaitClose($bcpid)
        SplashOff()
        Return
EndFunc   ;==>realdoit
Func linkmader()
        ;功能:提供制作和还原快捷方式两种功能,如此以来可以直接复盖原快杰方式
        ;说明项为是否FF加工后的快杰方式标志,建议用户不要自行修改
        $work = MsgBox(3 + 32, "HxGhost 快捷方式维护工具", "选“是”生成HxGhost方式的快捷方式" & @LF & @LF & "选“否”还原HxGhost方式的快捷方式到原快捷方式", 0)
        ;MsgBox(4096,'u choose',$work)
        If $work = 2 Then Exit
        ;$FFexe = @AutoItExe
        $FFexe = $localFFexe
        ;FileOpenDialog('请指定HxGhost客户端主程序,主程序应在网络共享目录', "", "HxGhost 主程序 (*.Exe)", 1 + 4)
        $message = "HxGhost 请选择快捷方式,支持多选"
        $var = FileOpenDialog($message, "", "快捷方式 (*.Lnk)", 1 + 4)
        If @error Then Exit
        If StringInStr($var, '|') = 0 Then
                If $work = 6 Then
                        madeFFlnk($var, $FFexe)
                Else
                        ExFFlnk($var)
                EndIf
        Else
                $LnkArray = StringSplit($var, "|")
                ;_ArrayDisplay($lnkarray,'')
                For $ii = 2 To $LnkArray[0]
                        $LnkArray[$ii] = $LnkArray[1] & '\' & $LnkArray[$ii]
                        If $work = 6 Then
                                madeFFlnk($LnkArray[$ii], $FFexe)
                        EndIf
                        If $work = 7 Then
                                ExFFlnk($LnkArray[$ii])
                        EndIf
                Next
                MsgBox(4096, "HxGhost 快捷方式维护工具", '处理完毕。')
        EndIf
        Return
EndFunc   ;==>linkmader
Func ExFFlnk($lnk)
        $details = FileGetShortcut($lnk)
        ;MsgBox(0, "说明", $details[3])
        If StringInStr($details[3], 'HxGhost') = 0 Then
                MsgBox(16, '错误', $lnk & @LF & @LF & '不是HxGhost方式的快捷方式!不能还原')
                Return
        EndIf
        ;$Hecinrem = StringMid($details[3], StringInStr($details[3], '|') + 1, 500)
        ;$oldinfo = _HexToString($details[2] & $Hecinrem)
        $oldinfo = $details[2]
        $oldinfo = StringReplace($oldinfo, '"', '')
        $oldinfoa = StringSplit($oldinfo, '|')
        If $oldinfoa[0] < 7 Then
                MsgBox(4096, 'HxGhost 2.0', $lnk & @LF & '源路径超出限制深度,还原失败,请手工处理')
        Else
                _ArrayDelete($oldinfoa, 0)
                FileCreateShortcut($oldinfoa[0], $lnk, $oldinfoa[1], $oldinfoa[2], $oldinfoa[3], $oldinfoa[4], '', $oldinfoa[5], $oldinfoa[6])
        EndIf
EndFunc   ;==>ExFFlnk
Func madeFFlnk($lnk, $ffexepath)
        $temp = $lnk
        $dets = FileGetShortcut($temp)
        If @error = 1 Then
                MsgBox(0, "错误", $lnk)
                Return
        EndIf
        If $dets[4] = '' Then
                $dets[4] = $dets[0]
        EndIf
        If StringInStr($dets[3], 'HxGhost') > 0 Then
                MsgBox(16, '错误', $lnk & @LF & @LF & '已经是HxGhost方式的快捷方式!不能再次生成。')
                Return
        EndIf
        $sourlnkstring = $dets[0] & '|' & $dets[1] & '|' & $dets[2] & '|' & $dets[3] & '|' & $dets[4] & '|' & $dets[5] & '|' & $dets[6]
        $pp = '"'
        $ffexeSpath = getFFbasepath($ffexepath)
        ;myerr($ffexepath)
        $lnkedtype = StringLower(StringRight($dets[0], 4))
        ;myerr($lnkedtype)
        $hecline = _StringToHex($sourlnkstring)
        $hecmid = Round(StringLen($hecline) / 2)
        $hecleft = StringMid($hecline, 1, $hecmid)
        $hecR = StringMid($hecline, $hecmid + 1, 500)
        If $lnkedtype = '.exe' Then
                ;FileCreateShortcut($pp & $ffexepath & $pp, $lnk, $ffexeSpath, $hecleft, "HxGhost Link Mode 请勿自行修改  |" & $hecR, $dets[4], "", $dets[5], $dets[6])
                FileCreateShortcut($pp & $ffexepath & $pp, $lnk, $ffexeSpath, $pp & $sourlnkstring & $pp, "HxGhost Link Mode 请勿自行修改", $dets[4], "", $dets[5], $dets[6])
        EndIf
EndFunc   ;==>madeFFlnk
Func sjcj()
        If RunEnable() = 0 Then
                ToolTip('HxGhost-【大连核心科技游戏更新精灵】.超音实时版 配置文件中禁止在此机器上运行同步更新,故不允许在此机做数据采集', 0, 0)
                Sleep(10000)
                Return
        EndIf
        If gettype(@ComputerName) = '' Then
                ToolTip('HxGhost-【大连核心科技游戏更新精灵】.超音实时版 配置文件中,此机不在同步列表范围,故不允许在此机做数据采集。', 0, 0)
                Sleep(10000)
                Return
        EndIf
        $passwd = IniRead($inipath, "基本配置", "数据采集口令", "")
        $passwdin = InputBox("HxGhost【大连核心科技游戏更新精灵】.超音实时版 - 更新数据采集", "请输入管理员口令", "", "*")
        If $passwdin <> $passwd Then
                MsgBox(4096, "HxGhost【大连核心科技游戏更新精灵】.超音实时版", "口令输入错误!")
                Return
        EndIf
        If IniRead($inipath, "基本配置", "服务器采集路径基", "") = '' Then
                myerr('配置文件中未设置 服务器采集路径基')
                Return
        EndIf
        $smsvpath = IniRead($inipath, '基本配置', '服务器路径基', "")
        $smfile = formatpath($smsvpath) & 'HxGhost.mod'
        ;$smfile = 'd:\test\HxGhost.mod'
        $svfound = ''
        $dfound = FileRead('c:\HxGhost.mod', FileGetSize('c:\HxGhost.mod')) & $newgame
        ;FileDelete('c:\HxGhost.mod')
        $myONtimes = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', '')
        $ONtimes = IniRead($inipath, '基本配置', '开机N次同步硬盘游戏', "1")
        $dohard = 1
        $type = gettype(@ComputerName)
        $ServerVertion = IniRead($inipath, $type, '更新标志', "0")
        $ClientVertion = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'Client UpDataVertion', '722956270')
        FileCreate(formatpath(@SystemDir) & '_real.txt')
        FileCreate(formatpath(@SystemDir) & '_idl.txt')
        $real = FileOpen(formatpath(@SystemDir) & '_real.txt', 2)
        $idl = FileOpen(formatpath(@SystemDir) & '_idl.txt', 2)
        $LogType = IniRead($inipath, '基本配置', '记日志', "1")
        If $LogType = 1 Then
                FileWriteLine($real, 'log verbose append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
                FileWriteLine($idl, 'log verbose append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
        Else
                FileWriteLine($real, 'log none append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
                FileWriteLine($idl, 'log none append:"' & formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG' & '"')
        EndIf
        FileWriteLine($real, '#HxGhost数据采集任务开始')
        $j = 1
        While 1
                $part = getpartname($type, $j)
                If $part = '' Then ExitLoop
                $i = 1
                While 1
                        $sTemp = getsjcjPath($type, $j, $i)
                        If $sTemp = '' Then ExitLoop
                        ;目录不存在
                        if (Not FileExists(truepath(getclientPath($type, $j, $i)))) or (Not FileExists(truepath($sTemp))) Then
                                FileWriteLine($real, '##############错误 : ' & truepath($sTemp) & '目录不存在 或 ' & truepath(getclientPath($type, $j, $i)) & ' 目录不存在!')
                                myerr('错误 : ' & truepath($sTemp) & '目录不存在 或 ' & truepath(getclientPath($type, $j, $i)) & ' 目录不存在')
                                $i = $i + 1
                                ContinueLoop
                        EndIf
                        ;排除目录
                        If DIRtype($sTemp) Then
                                FileWriteLine($real, '')
                                FileWriteLine($real, '#采集: ' & truepath($sTemp) & '<<---' & truepath(getclientPath($type, $j, $i)))
                                FileWriteLine($real, '')
                                FileWriteLine($real, "load <default>")
                                FileWriteLine($real, 'load "' & truepath($sTemp) & '"   "' & truepath(getclientPath($type, $j, $i)) & '"')
                                FileWriteLine($real, "option confirm:yes-to-all")
                                FileWriteLine($real, 'sync create-empty mirror:rt->lt')
                        Else
                                FileWriteLine($real, '')
                                FileWriteLine($real, '#采集: ' & truepath($sTemp) & '<<---' & truepath(getclientPath($type, $j, $i)))
                                FileWriteLine($real, '')
                                FileWriteLine($real, "load <default>")
                                FileWriteLine($real, 'load "' & truepath($sTemp) & '"   "' & truepath(getclientPath($type, $j, $i)) & '"')
                                FileWriteLine($real, "option confirm:yes-to-all")
                                FileWriteLine($real, 'sync create-empty mirror:rt->lt')
                        EndIf
                        $i = $i + 1
                WEnd
                $j = $j + 1
        WEnd
        FileWriteLine($real, '#HxGhost数据采集完毕退出')
        FileWriteLine($real, '#')
        FileWriteLine($real, '#')
        FileClose($real)
        FileClose($idl)
        ;iniwrite(formatpath(mypart(1)) &'【大连核心科技游戏更新精灵】.LOG','HxGhost','Client UpDataVertion',$ServerVertion )
        $real = formatpath(@SystemDir) & '_real.txt'
        $idl = formatpath(@SystemDir) & '_idl.txt'
        $bc2 = $bc2prefile
        ;formatpath(@systemDir) & '_$Copy$_.exe'
        ToolTip("HxGhost-【大连核心科技游戏更新精灵】.超音实时版 数据采集中...", 0, 0)
        RunWait($bc2 & ' @' & $real & ' /silent')
        ;Sleep(50000)
        Return
EndFunc   ;==>sjcj
Func useSSpeed()
        ;FF启用初期考虑客户机与服务器可能存在在搓别,所以禁止超音速
        $myONtimes = IniRead(formatpath(mypart(1)) & '【大连核心科技游戏更新精灵】.LOG', 'HxGhost', 'PowerON Times', '0')
        If $myONtimes < 3 Then
                $lefttime = 3 - $myONtimes
                logfox('稳妥启用原则,超音速特性将在FF再运行' & $lefttime & '次后启用')
                Return 0
        EndIf
        $ss = IniRead($inipath, "基本配置", "启用超音速", "1")
        ;776655
        If $ss = 1 Then Return 1
        Return 0
EndFunc   ;==>useSSpeed

Func GetREGEDITstatus()
        $status = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools")
        If $status = 1 Then
                Return 1
        Else
                Return 0
        EndIf
EndFunc   ;==>GetREGEDITstatus
Func ModiREGEDIT($status)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "REG_DWORD", $status)
EndFunc   ;==>ModiREGEDIT

请各位指教

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 0
支持
分享
最新回复 (5)
雪    币: 202
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
这么早...自己顶下
2006-11-9 05:58
0
雪    币: 329
活跃值: (343)
能力值: ( LV10,RANK:170 )
在线值:
发帖
回帖
粉丝
3
我们又不是编译器……
2006-11-9 11:04
0
雪    币: 202
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
忘了说了...呵呵...是au3源码啊
但是无法生成执行文件啊
2006-11-9 15:01
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
FriendFOX明明是狐伙的源码改的嘛
2007-1-5 00:34
0
雪    币: 342
活跃值: (323)
能力值: ( LV9,RANK:450 )
在线值:
发帖
回帖
粉丝
6
编译器总有错误提示的吧。
2007-1-5 22:33
0
游客
登录 | 注册 方可回帖
返回
//