二话不说.先上图.
#NoTrayIcon #Region ;**** 参数创建于 AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=../../万能GHOST备份&恢复.ico #AutoIt3Wrapper_Outfile=../../万能GHOST备份&恢复.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_Comment=运行参数 /yjbf 静默设置备份 /yjhf 静默设置恢复 /cancel 取消已有的设置 #AutoIt3Wrapper_Res_Description=一键备份&恢复程序 #AutoIt3Wrapper_Res_Fileversion=1.2.0.0 #AutoIt3Wrapper_Res_LegalCopyright=yms #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Icon_Add=../../bf.ico #AutoIt3Wrapper_Res_Icon_Add=../../hf.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> If $CmdLine[0] >= 1 Then If $CmdLine[1] = "/yjbf" Then SplashTextOn("请稍候", Chr(13) & "正在准备……", 250, 50, 10, 10, 2, 10) boot() FileInstall("ymsGH", "C:/") FileInstall("ymsGH.img", "C:/yms/") FileInstall("Ghost.exe", "C:/yms/") $BFGhostIni = FileOpen("C:/yms/ghost.bat", 10) FileWrite($BFGhostIni, "cls" & @CRLF) FileWrite($BFGhostIni, "@echo off" & @CRLF) FileWrite($BFGhostIni, "attrib -r -s -h %s%:/pagefile.sys>nul" & @CRLF) FileWrite($BFGhostIni, "del %s%:/pagefile.sys>nul" & @CRLF) FileWrite($BFGhostIni, "xmsman -c>nul" & @CRLF) FileWrite($BFGhostIni, "Ghost.exe -nousb -clone,mode=pdump,src=1:1,dst=D:/Ghost/winxpsp2.gho -z1 -sure -fro -rb ") FileClose($BFGhostIni) DirCreate("D:/Ghost/") FileInstall("Ghost.exe", "D:/Ghost/Ghost.exe") SplashOff() Exit EndIf If $CmdLine[1] = "/yjhf" Then If FileExists("D:/GHOST/WINXPSP2.gho") = 0 Then MsgBox(262160, "找不到文件", "找不到D:/GHOST/WINXPSP2.gho " & Chr(13) & "请保证GHO文件在D:/GHOST/ ,两秒后会自动关闭", 2) Exit Else $Info = SplashTextOn("请稍候", Chr(13) & "正在准备……", 250, 50, 10, 10, 2, 10) boot() FileInstall("ymsGH", "C:/") FileInstall("ymsGH.img", "C:/yms/") FileInstall("Ghost.exe", "C:/yms/") $HFGhostIni = FileOpen("C:/yms/ghost.bat", 10) FileWrite($HFGhostIni, "cls" & @CRLF) FileWrite($HFGhostIni, "@echo off" & @CRLF) FileWrite($HFGhostIni, "attrib -r -s -h %s%:/pagefile.sys>nul" & @CRLF) FileWrite($HFGhostIni, "del %s%:/pagefile.sys>nul" & @CRLF) FileWrite($HFGhostIni, "xmsman -c>nul" & @CRLF) FileWrite($HFGhostIni, "Ghost.exe -nousb -clone,mode=pload,src=D:/Ghost/WINXPSP2.GHO:1,dst=1:1 -sure -fro -rb") FileClose($HFGhostIni) DirCreate("D:/Ghost") FileCopy("C:/ghost/*.*", "D:/Ghost", 9) SplashOff() EndIf EndIf If $CmdLine[1] = "/cancel" Then If FileExists("C:/yms/boot.bak") = 1 Then FileSetAttrib("C:/boot.ini", "-RSH") FileCopy("C:/yms/boot.bak", "C:/boot.ini", 9) FileSetAttrib("C:/boot.ini", "+RSH") FileSetAttrib("C:/ymsgh", "-RSH") FileDelete("C:/ymsgh") DirRemove("C:/yms", 1) Else MsgBox(262160, "没有备份/还原请求", "没有备份/还原请求,两秒后自动关闭", 2) EndIf Exit EndIf EndIf GUICreate("万能GHOST备份/恢复", 400, 330, -1, -1) GUISetFont(9, 400) FileInstall("logo.gif", "C:/") GUICtrlCreatePic("C:/logo.gif", 0, 0, 0, 0) FileDelete("C:/logo.gif") GUICtrlCreateTab(5, 80, 390, 227) ;第一分页 $Tab1 = GUICtrlCreateTabItem("说明") GUICtrlCreateGroup("", 15, 100, 370, 200) GUICtrlCreateLabel(" 欢迎使用万能GHOST!" & Chr(13) & Chr(13) & " 一键备份:系统将会自动重启进入DOS运行ghost备份C盘到D:/ghost/winxpsp2.gho,备份完后自动重启,正常进入桌面。" & Chr(13) & " 一键恢复:系统将会自动重启进入DOS运行ghost恢复C盘从D:/ghost/winxpsp2.gho,恢复完后自动重启,正常进入桌面。" & Chr(13) & Chr(13) & " 手工操作,手工操作提供更自由的选项,备份/恢复更自由!" & Chr(13) & Chr(13) & " 本程序支持FAT32、NTFS分区、双硬盘!", 35, 115, 345, 120) $NotBFHF = GUICtrlCreateButton("撤销备份/恢复请求", 50, 250, 300, 30) $YJBF = GUICtrlCreateButton("一键备份", 25, 250, 100, 30) $YJHF = GUICtrlCreateButton("一键恢复", 150, 250, 100, 30) $DOS = GUICtrlCreateButton("GHOST手工操作", 275, 250, 100, 30) If FileExists("C:/ymsgh") = 1 Then GUICtrlSetState($YJBF, $GUI_HIDE) GUICtrlSetState($YJHF, $GUI_HIDE) GUICtrlSetState($DOS, $GUI_HIDE) GUICtrlSetState($NotBFHF, $GUI_SHOW) Else GUICtrlSetState($NotBFHF, $GUI_HIDE) EndIf ;第二分页 $Tab2 = GUICtrlCreateTabItem("备份") GUICtrlCreateGroup("备份分区:", 20, 110, 130, 50) $BFCombo1 = GUICtrlCreateCombo("", 85, 105, 50, 20) $BFVar1 = DriveGetDrive("FIXED") If Not @error Then For $Var1i = 1 To $BFVar1[0] GUICtrlSetData(-1, $BFVar1[$Var1i], "C:") Next EndIf $BFLabel1 = GUICtrlCreateLabel("已用空间", 25, 130, 120, 20) GUICtrlSetData($BFLabel1, "C:已用空间:" & Round((DriveSpaceTotal("C:") - DriveSpaceFree("C:")) / 1024, 2) & "G") $BFLabel2 = GUICtrlCreateLabel("可用空间", 25, 145, 120, 20) GUICtrlSetData($BFLabel2, "D:可用空间:" & Round(DriveSpaceFree("D:/") / 1024, 2) & "G") GUICtrlCreateGroup("备份选项:", 165, 110, 120, 50) $BFCombo2 = GUICtrlCreateCombo("", 170, 125, 100, 17) GUICtrlSetData(-1, "不压缩 |快速压缩|高压缩 |最高压缩", "快速压缩") GUICtrlCreateGroup("GHO文件路径:", 20, 165, 350, 45) $BFInput1 = GUICtrlCreateInput("D:/ghost/WINXPSP2.GHO", 30, 185, 250, 17) $BFButton1 = GUICtrlCreateButton("选择", 290, 185, 50, 20) GUICtrlCreateGroup("高级选项:", 25, 215, 335, 55) $BFCheckbox1 = GUICtrlCreateCheckbox("自定义GHOST核心", 130, 225, 110, 17) $BFCheckbox2 = GUICtrlCreateCheckbox("隐藏GHO文件", 255, 225, 90, 17) $BFInput2 = GUICtrlCreateInput("", 35, 245, 250, 17) GUICtrlSetState($BFInput2, $GUI_HIDE) $BFButton2 = GUICtrlCreateButton("选择", 300, 243, 50, 20) GUICtrlSetState($BFButton2, $GUI_HIDE) FileInstall("bf.gif", "C:/") GUICtrlCreatePic("C:/bf.gif", 300, 115, 0, 0) FileDelete("C:/bf.gif") $BFOK = GUICtrlCreateButton("确定", 50, 278, 300, 22) ;第三分页 $Tab3 = GUICtrlCreateTabItem("恢复") GUICtrlCreateGroup("恢复分区:", 20, 110, 130, 50) $HFCombo1 = GUICtrlCreateCombo("", 85, 105, 50, 20) $HFVar1 = DriveGetDrive("FIXED") If Not @error Then For $Var1i = 1 To $HFVar1[0] GUICtrlSetData(-1, $HFVar1[$Var1i], "C:") Next EndIf $HFLabel1 = GUICtrlCreateLabel("全部空间", 25, 135, 120, 20) GUICtrlSetData($HFLabel1, "C:全部空间:" & Round(DriveSpaceTotal("C:") / 1024, 2) & "G") GUICtrlCreateGroup("GHO文件路径:", 20, 165, 350, 45) $HFInput1 = GUICtrlCreateInput("D:/ghost/WINXPSP2.GHO", 30, 185, 250, 17) $HFButton1 = GUICtrlCreateButton("选择", 290, 185, 50, 20) GUICtrlCreateGroup("高级选项:", 25, 215, 335, 55) $HFCheckbox1 = GUICtrlCreateCheckbox("自定义GHOST核心", 130, 225, 110, 17) $HFCheckbox2 = GUICtrlCreateCheckbox("忽略 CRC 错误", 255, 225, 95, 17) $HFInput2 = GUICtrlCreateInput("", 35, 245, 250, 17) GUICtrlSetState($HFInput2, $GUI_HIDE) $HFButton2 = GUICtrlCreateButton("选择", 300, 243, 50, 20) GUICtrlSetState($HFButton2, $GUI_HIDE) FileInstall("hf.gif", "C:/") GUICtrlCreatePic("C:/hf.gif", 300, 115, 0, 0) FileDelete("C:/hf.gif") $HFOK = GUICtrlCreateButton("确定", 50, 278, 300, 22) ;第四分页 $Tab4 = GUICtrlCreateTabItem("关于") GUICtrlCreateGroup("", 15, 100, 370, 200) GUICtrlCreateGroup("", 55, 120, 290, 160) GUICtrlCreateLabel("万能GHOST工具 V1.0", 160, 150, 160, 20) GUICtrlSetColor(-1, 0x008080) GUICtrlCreateLabel("程序制作:YMS", 160, 170, 93, 20) GUICtrlCreateLabel("完成日期:2012年12月5日", 160, 190, 140, 20) GUICtrlCreateLabel("内置GHOST版本:V11.0.2.1575", 100, 210, 180, 20) $mailto = GUICtrlCreateLabel("YMS工作室:www.yms7.com", 100, 230, 138, 20) GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateLabel("鸣谢:DONGHAI、JS、Skyfree", 100, 250, 200, 13) GUICtrlSetColor(-1, 0xFF0000) FileInstall("icon.gif", "C:/") GUICtrlCreatePic("C:/icon.gif", 65, 140, 0, 0) FileDelete("C:/icon.gif") GUICtrlCreateTabItem("") ;==>结束分页标志 ;状态栏 GUICtrlCreateGroup("", -2, 305, 999, 999) If FileExists("D:/GHOST/WINXPSP2.gho") Then $FileSize = Round(FileGetSize("D:/GHOST/WINXPSP2.gho") / 1048576, 3) & "M" GUICtrlCreateLabel("发现D:/GHOST/WINXPSP2.gho" & " 大小:" & $FileSize, 10, 315, 240, 17) Else GUICtrlCreateLabel("未发现D:/GHOST/WINXPSP2.gho", 10, 315, 240, 17) EndIf $SpaceFree = Round(DriveSpaceFree("D:/") / 1, 3) GUICtrlCreateLabel("D盘可用空间:" & $SpaceFree & "M", 250, 315, 150, 17) GUISetState(@SW_SHOW) $Task = "None" While 1 $msg = GUIGetMsg() Select Case $msg = $NotBFHF FileSetAttrib("C:/boot.ini", "-RSH") FileCopy("C:/yms/boot.bak", "C:/boot.ini", 9) FileSetAttrib("C:/boot.ini", "+RSH") FileSetAttrib("C:/ymsgh", "-RSH") FileDelete("C:/ymsgh") DirRemove("C:/yms", 1) GUICtrlSetState($NotBFHF, $GUI_HIDE) GUICtrlSetState($YJBF, $GUI_SHOW) GUICtrlSetState($YJHF, $GUI_SHOW) GUICtrlSetState($DOS, $GUI_SHOW) MsgBox(64, "撤销完成", "撤销备份/恢复请求完成!") Case $msg = $DOS SplashTextOn("请稍候", Chr(13) & "正在准备……", 250, 50, 10, 10, 2, 10) boot() FileInstall("ymsGH", "C:/") FileInstall("ymsGH.img", "C:/yms/") FileInstall("Ghost.exe", "C:/yms/") $DOSIni = FileOpen("C:/yms/ghost.bat", 10) FileWrite($DOSIni, "cls" & @CRLF) FileWrite($DOSIni, "@echo off" & @CRLF) FileWrite($DOSIni, "xmsman -c>nul" & @CRLF) FileWrite($DOSIni, "Ghost.exe") FileClose($DOSIni) Sleep(500) If MsgBox(36, "询问", "进入DOS GHOST手工操作前的准备已完成,要立即重启吗?") = 6 Then SplashOff() SplashTextOn("请稍候", Chr(13) & "正在重启……", 250, 50, 10, 10, 2, 10) Shutdown(6) Else SplashOff() GUICtrlSetState($YJBF, $GUI_HIDE) GUICtrlSetState($YJHF, $GUI_HIDE) GUICtrlSetState($DOS, $GUI_HIDE) GUICtrlSetState($NotBFHF, $GUI_SHOW) EndIf Case $msg = $BFCombo1 GUICtrlSetData($BFLabel1, GUICtrlRead($BFCombo1) & "已用空间:" & Round((DriveSpaceTotal(GUICtrlRead($BFCombo1)) - DriveSpaceFree(GUICtrlRead($BFCombo1))) / 1024, 2) & "G") Case $msg = $BFInput1 If StringRight(GUICtrlRead($BFInput1), 4) = ".GHO" Then GUICtrlSetData($BFLabel2, StringMid(GUICtrlRead($BFInput1), 1, 2) & "可用空间:" & Round(DriveSpaceFree(StringMid(GUICtrlRead($BFInput1), 1, 2)) / 1024, 2) & "G") Else If Not GUICtrlRead($BFInput1) = "" Then MsgBox(16, "警告", "文件的扩展名不为“.GHO”") GUICtrlSetData($BFInput1, "") EndIf EndIf Case $msg = $BFButton1 $BFButton1Var1 = FileSaveDialog("选择GHO映像文件", "D:/ghost", "GHO映像文件(*.gho)", 18, "WINXPSP2.gho") If StringRight($BFButton1Var1, 4) = ".gho" Then GUICtrlSetData($BFInput1, $BFButton1Var1) GUICtrlSetData($BFLabel2, StringMid(GUICtrlRead($BFInput1), 1, 2) & "可用空间:" & Round(DriveSpaceFree(StringMid(GUICtrlRead($BFInput1), 1, 2)) / 1024, 2) & "G") Else If Not $BFButton1Var1 = "" Then MsgBox(16, "警告", "文件的扩展名不为“.GHO”") EndIf EndIf Case $msg = $BFCheckbox1 If GUICtrlRead($BFCheckbox1) = $GUI_CHECKED Then GUICtrlSetState($BFInput2, $GUI_SHOW) GUICtrlSetState($BFButton2, $GUI_SHOW) EndIf If GUICtrlRead($BFCheckbox1) = $GUI_UNCHECKED Then GUICtrlSetState($BFInput2, $GUI_HIDE) GUICtrlSetState($BFButton2, $GUI_HIDE) EndIf Case $msg = $BFInput2 If StringRight(GUICtrlRead($BFInput2), 4) = ".exe" Then If Not FileExists(GUICtrlRead($BFInput2)) = 1 Then MsgBox(16, "警告", "找不到指定的GHOST程序”") GUICtrlSetData($BFInput2, "") EndIf Else If Not GUICtrlRead($BFInput2) = "" Then MsgBox(16, "警告", "文件的扩展名不为“.EXE”") GUICtrlSetData($BFInput2, "") EndIf EndIf Case $msg = $BFButton2 $BFButton2Var1 = FileOpenDialog("选择GHOST程序", "D:/ghost", "EXE可执行文件(*.exe)", 3, "ghost.exe") If StringRight($BFButton2Var1, 4) = ".exe" Then GUICtrlSetData($BFInput2, $BFButton2Var1) Else If Not $BFButton2Var1 = "" Then MsgBox(16, "警告", "文件的扩展名不为“.EXE”") GUICtrlSetData($BFInput2, "") EndIf EndIf Case $msg = $YJBF If MsgBox(262433, "要一键全自动备份吗?(快速/不隐藏)", " 此命令将使系统重启并进入DOS用GHOST " & Chr(13) & "备份C盘到D:/GHOST/WINXPSP2.gho。D盘格式 " & Chr(13) & "既可以是 FAT32也可以是NTFS, 点击确定立 " & Chr(13) & "即重启并开始备份!") = 1 Then SplashTextOn("请稍候", Chr(13) & "正在准备……", 250, 50, 10, 10, 2, 10) boot() FileInstall("ymsGH", "C:/") FileInstall("ymsGH.img", "C:/yms/") FileInstall("Ghost.exe", "C:/yms/") $BFGhostIni = FileOpen("C:/yms/ghost.bat", 10) FileWrite($BFGhostIni, "cls" & @CRLF) FileWrite($BFGhostIni, "@echo off" & @CRLF) FileWrite($BFGhostIni, "attrib -r -s -h %s%:/pagefile.sys>nul" & @CRLF) FileWrite($BFGhostIni, "del %s%:/pagefile.sys>nul" & @CRLF) FileWrite($BFGhostIni, "xmsman -c>nul" & @CRLF) FileWrite($BFGhostIni, "Ghost.exe -nousb -clone,mode=pdump,src=1:1,dst=D:/Ghost/winxpsp2.gho -z1 -sure -fro -rb ") FileClose($BFGhostIni) DirCreate("D:/Ghost/") FileInstall("Ghost.exe", "D:/Ghost/Ghost.exe") Sleep(500) If MsgBox(36, "询问", "备份前的准备已完成,要立即重启吗?") = 6 Then SplashOff() SplashTextOn("请稍候", Chr(13) & "正在重启……", 250, 50, 10, 10, 2, 10) Shutdown(6) Else SplashOff() GUICtrlSetState($YJBF, $GUI_HIDE) GUICtrlSetState($YJHF, $GUI_HIDE) GUICtrlSetState($DOS, $GUI_HIDE) GUICtrlSetState($NotBFHF, $GUI_SHOW) EndIf Else EndIf Case $msg = $BFOK SplashTextOn("请稍候", Chr(13) & "正在准备……", 250, 50, 10, 10, 2, 10) boot() FileInstall("ymsGH", "C:/") FileInstall("ymsGH.img", "C:/yms/") DirCreate("D:/ghost") If GUICtrlRead($BFCheckbox1) = $GUI_CHECKED Then $BFOKVar1 = GUICtrlRead($BFInput2) If $BFOKVar1 = "" Then FileInstall("Ghost.exe", "C:/yms/") Else FileCopy($BFOKVar1, "C:/yms/GHOST.EXE", 8) EndIf Else FileInstall("Ghost.exe", "C:/yms/") EndIf FileInstall("disk.exe", "C:/") Run(@ComSpec & " /c C:/disk.exe", "", @SW_HIDE) WinWaitActive("分区扇区对应", "") $BFDisk = StringSplit(ControlGetText("分区扇区对应", "", "ThunderRT6TextBox1"), Chr(13)) ProcessClose("DISK.exe") FileDelete("C:/DISK.exe") For $var1 = 1 To $BFDisk[0] Step 1 If StringInStr($BFDisk[$var1], StringLeft(GUICtrlRead($BFCombo1), 1), 0) <> 0 Then $BFOKVar2 = "src=" & StringRight($BFDisk[$var1], 3) EndIf Next If GUICtrlRead($BFCombo2) = "不压缩 " Then $BFOKVar3 = " " ;压缩方式 If GUICtrlRead($BFCombo2) = "快速压缩" Then $BFOKVar3 = " -z1" If GUICtrlRead($BFCombo2) = "高压缩 " Then $BFOKVar3 = " -z2" If GUICtrlRead($BFCombo2) = "最高压缩" Then $BFOKVar3 = " -z9" If GUICtrlRead($BFInput1) = "" Then $BFOKVar4 = "dst=D:/Ghost/winxpsp2.gho" Else $BFOKVar4 = "dst=" & GUICtrlRead($BFInput1) EndIf If GUICtrlRead($BFCheckbox2) = $GUI_CHECKED Then $BFOKVar5 = "attrib +h " & GUICtrlRead($BFInput1) Else $BFOKVar5 = "" EndIf $BFGhostIni = FileOpen("C:/yms/ghost.bat", 10) FileWrite($BFGhostIni, "cls" & @CRLF) FileWrite($BFGhostIni, "@echo off" & @CRLF) FileWrite($BFGhostIni, "attrib -r -s -h %s%:/pagefile.sys>nul" & @CRLF) FileWrite($BFGhostIni, "del %s%:/pagefile.sys>nul" & @CRLF) FileWrite($BFGhostIni, "xmsman -c>nul" & @CRLF) FileWrite($BFGhostIni, "Ghost.exe -nousb -clone,mode=pdump," & $BFOKVar2 & "," & $BFOKVar4 & $BFOKVar3 & " -sure -fro -rb" & @CRLF) FileWrite($BFGhostIni, $BFOKVar5) FileClose($BFGhostIni) DirCreate("D:/Ghost") FileCopy("C:/ghost/*.*", "D:/Ghost", 9) Sleep(500) If MsgBox(36, "询问", "备份前的准备已完成,要立即重启吗?") = 6 Then SplashOff() SplashTextOn("请稍候", Chr(13) & "正在重启……", 250, 50, 10, 10, 2, 10) Shutdown(6) Else SplashOff() GUICtrlSetState($YJBF, $GUI_HIDE) GUICtrlSetState($YJHF, $GUI_HIDE) GUICtrlSetState($DOS, $GUI_HIDE) GUICtrlSetState($NotBFHF, $GUI_SHOW) EndIf Case $msg = $HFCombo1 GUICtrlSetData($HFLabel1, GUICtrlRead($HFCombo1) & "全部空间:" & Round(DriveSpaceTotal(GUICtrlRead($HFCombo1)) / 1024, 2) & "G") Case $msg = $HFInput1 If StringRight(GUICtrlRead($HFInput1), 4) = ".GHO" Then If Not FileExists(GUICtrlRead($HFInput1)) = 1 Then MsgBox(16, "警告", "找不到指定的GHO映像文件") GUICtrlSetData($HFInput1, "") EndIf Else If Not GUICtrlRead($HFInput1) = "" Then MsgBox(16, "警告", "文件的扩展名不为“GHO”") GUICtrlSetData($HFInput1, "") EndIf EndIf Case $msg = $HFButton1 $HFButton1Var1 = FileOpenDialog("选择GHO映像文件", "D:/ghost", "GHO映像文件(*.gho)|所有文件(*.*)", 3, "WINXPSP2.gho") If StringRight($HFButton1Var1, 4) = ".GHO" Then If Not FileExists($HFButton1Var1) = 1 Then MsgBox(16, "警告", "找不到指定的GHO映像文件") Else GUICtrlSetData($HFInput1, $HFButton1Var1) EndIf Else If Not $HFButton1Var1 = "" Then MsgBox(16, "警告", "文件的扩展名不为“GHO”") EndIf EndIf Case $msg = $HFCheckbox1 If GUICtrlRead($HFCheckbox1) = $GUI_CHECKED Then GUICtrlSetState($HFInput2, $GUI_SHOW) GUICtrlSetState($HFButton2, $GUI_SHOW) EndIf If GUICtrlRead($HFCheckbox1) = $GUI_UNCHECKED Then GUICtrlSetState($HFInput2, $GUI_HIDE) GUICtrlSetState($HFButton2, $GUI_HIDE) EndIf Case $msg = $HFInput2 If StringRight(GUICtrlRead($HFInput2), 4) = ".exe" Then If Not FileExists(GUICtrlRead($HFInput2)) = 1 Then MsgBox(16, "警告", "找不到指定的GHOST程序”") GUICtrlSetData($HFInput2, "") EndIf Else If Not GUICtrlRead($HFInput2) = "" Then MsgBox(16, "警告", "文件的扩展名不为“.EXE”") GUICtrlSetData($HFInput2, "") EndIf EndIf Case $msg = $HFButton2 $HFButton2Var1 = FileOpenDialog("选择GHOST程序", "D:/ghost", "EXE可执行文件(*.exe)|所有文件(*.*)", 3, "ghost.exe") If StringRight($HFButton2Var1, 4) = ".exe" Then GUICtrlSetData($HFInput2, $HFButton2Var1) Else If Not $HFButton2Var1 = "" Then MsgBox(16, "警告", "文件的扩展名不为“.EXE”") GUICtrlSetData($HFInput2, "") EndIf EndIf Case $msg = $HFCheckbox2 If GUICtrlRead($HFCheckbox2) = $GUI_CHECKED Then $HFCheckbox2Var1 = "忽略 CRC 错误" If GUICtrlRead($HFCheckbox2) = $GUI_UNCHECKED Then $HFCheckbox2Var1 = "不忽略 CRC 错误" Case $msg = $YJHF If MsgBox(262433, "要一键全自动恢复吗?", " 此命令将使系统重启并进入DOS用GHOST " & Chr(13) & "恢复C盘从D:/GHOST/WINXPSP2.gho。" & Chr(13) & " 警告!此命令将会把您放在C盘的数据清空! " & Chr(13) & "点击下面的按钮将立即重启并开始恢复!") = 1 Then If FileExists("D:/GHOST/WINXPSP2.gho") = 0 Then MsgBox(262160, "找不到文件", "找不到D:/GHOST/WINXPSP2.gho " & Chr(13) & "请保证GHO文件在D:/GHOST/") Else $Info = SplashTextOn("请稍候", Chr(13) & "正在准备……", 250, 50, 10, 10, 2, 10) boot() FileInstall("ymsGH", "C:/") FileInstall("ymsGH.img", "C:/yms/") FileInstall("Ghost.exe", "C:/yms/") $HFGhostIni = FileOpen("C:/yms/ghost.bat", 10) FileWrite($HFGhostIni, "cls" & @CRLF) FileWrite($HFGhostIni, "@echo off" & @CRLF) FileWrite($HFGhostIni, "attrib -r -s -h %s%:/pagefile.sys>nul" & @CRLF) FileWrite($HFGhostIni, "del %s%:/pagefile.sys>nul" & @CRLF) FileWrite($HFGhostIni, "xmsman -c>nul" & @CRLF) FileWrite($HFGhostIni, "Ghost.exe -nousb -clone,mode=pload,src=D:/Ghost/WINXPSP2.GHO:1,dst=1:1 -sure -fro -rb") FileClose($HFGhostIni) DirCreate("D:/Ghost") FileCopy("C:/ghost/*.*", "D:/Ghost", 9) Sleep(500) If MsgBox(36, "询问", "恢复前的准备已完成,要立即重启吗?") = 6 Then SplashOff() SplashTextOn("请稍候", Chr(13) & "正在重启……", 250, 50, 10, 10, 2, 10) Shutdown(6) Else SplashOff() GUICtrlSetState($YJBF, $GUI_HIDE) GUICtrlSetState($YJHF, $GUI_HIDE) GUICtrlSetState($DOS, $GUI_HIDE) GUICtrlSetState($NotBFHF, $GUI_SHOW) EndIf EndIf Else EndIf Case $msg = $HFOK If Not GUICtrlRead($HFInput1) = "" Then SplashTextOn("请稍候", Chr(13) & "正在准备……", 250, 50, 10, 10, 2, 10) boot() FileInstall("ymsGH", "C:") FileInstall("ymsGH.img", "C:/yms/") If GUICtrlRead($HFCheckbox1) = $GUI_CHECKED Then $HFOKVar1 = GUICtrlRead($HFInput2) If $HFOKVar1 = "" Then FileInstall("Ghost.exe", "C:/yms/") Else FileCopy($HFOKVar1, "C:/yms/GHOST.EXE", 8) EndIf Else FileInstall("Ghost.exe", "C:/yms/") EndIf $HFOKVar2 = "src=" & GUICtrlRead($HFInput1) FileInstall("disk.exe", "C:/") Run(@ComSpec & " /c C:/disk.exe", "", @SW_HIDE) WinWaitActive("分区扇区对应", "") $BFDisk = StringSplit(ControlGetText("分区扇区对应", "", "ThunderRT6TextBox1"), Chr(13)) ProcessClose("DISK.exe") FileDelete("C:/DISK.exe") For $var1 = 1 To $BFDisk[0] Step 1 If StringInStr($BFDisk[$var1], StringLeft(GUICtrlRead($HFCombo1), 1), 0) <> 0 Then $HFOKVar3 = "dst=" & StringRight($BFDisk[$var1], 3) EndIf Next If GUICtrlRead($HFCheckbox2) = $GUI_CHECKED Then $HFOKVar4 = "-crcignore" Else $HFOKVar4 = "" EndIf $HFGhostIni = FileOpen("C:/yms/ghost.bat", 10) FileWrite($HFGhostIni, "cls" & @CRLF) FileWrite($HFGhostIni, "@echo off" & @CRLF) FileWrite($HFGhostIni, "attrib -r -s -h %s%:/pagefile.sys>nul" & @CRLF) FileWrite($HFGhostIni, "del %s%:/pagefile.sys>nul" & @CRLF) FileWrite($HFGhostIni, "xmsman -c>nul" & @CRLF) FileWrite($HFGhostIni, "Ghost.exe -nousb -clone,mode=pload," & $HFOKVar2 & ":1," & $HFOKVar3 & " -sure -fro -rb " & $HFOKVar4) FileClose($HFGhostIni) Sleep(500) If MsgBox(36, "询问", "恢复前的准备已完成,要立即重启吗?") = 6 Then SplashOff() SplashTextOn("请稍候", Chr(13) & "正在重启……", 250, 50, 10, 10, 2, 10) Shutdown(6) Else SplashOff() GUICtrlSetState($YJBF, $GUI_HIDE) GUICtrlSetState($YJHF, $GUI_HIDE) GUICtrlSetState($DOS, $GUI_HIDE) GUICtrlSetState($NotBFHF, $GUI_SHOW) EndIf Else MsgBox(16, "警告", "您未输入GHO文件的路径") EndIf Case $msg = $mailto Run("C:/Program Files/Internet Explorer/IEXPLORE.EXE http://www.yms7.com", "") Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Func boot() DirCreate("C:/yms/") FileSetAttrib("C:/boot.ini", "-RSH") FileCopy("C:/boot.ini", "C:/yms/boot.bak", 8) IniWrite("C:/boot.ini", "boot loader", "timeout", "1") IniWrite("C:/boot.ini", "boot loader", "default", "C:/ymsgh") IniWrite("C:/boot.ini", "operating systems", "C:/ymsgh", "YMS万能GHOST") EndFunc ;==>boot
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/143414.html