|
是的,代码在下面
#NoTrayIcon
#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\万能GHOT备份&恢复.ico
#AutoIt3Wrapper_Outfile=..\..\万能GHOT备份&恢复.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=运行参数 /yjbf 静默设置备份 /yjhf 静默设置恢复 /cancel 取消已有的设置
#AutoIt3Wrapper_Res_Description=一键备份&恢复程序
#AutoIt3Wrapper_Res_Fileversion=1.2.0.0
#AutoIt3Wrapper_Res_LegalCopyright=JS
#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("JSGH", "c:\")
FileInstall("JSGH.img", "c:\JS\")
FileInstall("Ghost.exe", "c:\JS\")
$BFGhostIni = FileOpen("c:\js\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("JSGH", "c:\")
FileInstall("JSGH.img", "c:\JS\")
FileInstall("Ghost.exe", "c:\JS\")
$HFGhostIni = FileOpen("c:\js\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:\JS\boot.bak") = 1 Then
FileSetAttrib("C:\boot.ini", "-RSH")
FileCopy("c:\JS\boot.bak", "c:\boot.ini", 9)
FileSetAttrib("C:\boot.ini", "+RSH")
FileSetAttrib("C:\jsgh", "-RSH")
FileDelete("c:\jsgh")
DirRemove("c:\JS", 1)
Else
MsgBox(262160, "没有备份/还原请求", "没有备份/还原请求,两秒后自动关闭", 2)
EndIf
Exit
EndIf
EndIf
GUICreate("万能GHOT备份/恢复", 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(" 欢迎使用榔头华硕一键还原V2014!" & 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:\jsgh") = 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("榔头华硕一键还原系统V2014", 160, 150, 160, 20)
GUICtrlSetColor(-1, 0x008080)
GUICtrlCreateLabel("程序制作:吴敬李", 160, 170, 113, 20)
GUICtrlCreateLabel("完成日期:2014年1月6日", 160, 190, 140, 20)
GUICtrlCreateLabel("内置GHOST版本:V11.0.2.1575", 100, 210, 180, 20)
$mailto = GUICtrlCreateLabel("Email:115642873@qq.com", 100, 230, 138, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlCreateLabel("鸣谢:无忧、YlmF、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:\JS\boot.bak", "c:\boot.ini", 9)
FileSetAttrib("C:\boot.ini", "+RSH")
FileSetAttrib("C:\jsgh", "-RSH")
FileDelete("c:\jsgh")
DirRemove("c:\JS", 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("JSGH", "c:\")
FileInstall("JSGH.img", "c:\JS\")
FileInstall("Ghost.exe", "c:\JS\")
$DOSIni = FileOpen("c:\js\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("JSGH", "c:\")
FileInstall("JSGH.img", "c:\JS\")
FileInstall("Ghost.exe", "c:\JS\")
$BFGhostIni = FileOpen("c:\js\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("JSGH", "c:\")
FileInstall("JSGH.img", "c:\JS\")
DirCreate("d:\ghost")
If GUICtrlRead($BFCheckbox1) = $GUI_CHECKED Then
$BFOKVar1 = GUICtrlRead($BFInput2)
If $BFOKVar1 = "" Then
FileInstall("Ghost.exe", "c:\JS\")
Else
FileCopy($BFOKVar1, "c:\JS\GHOST.EXE", 8)
EndIf
Else
FileInstall("Ghost.exe", "c:\JS\")
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:\js\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("JSGH", "c:\")
FileInstall("JSGH.img", "c:\JS\")
FileInstall("Ghost.exe", "c:\JS\")
$HFGhostIni = FileOpen("c:\js\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("JSGH", "c:")
FileInstall("JSGH.img", "c:\JS\")
If GUICtrlRead($HFCheckbox1) = $GUI_CHECKED Then
$HFOKVar1 = GUICtrlRead($HFInput2)
If $HFOKVar1 = "" Then
FileInstall("Ghost.exe", "c:\JS\")
Else
FileCopy($HFOKVar1, "c:\JS\GHOST.EXE", 8)
EndIf
Else
FileInstall("Ghost.exe", "c:\JS\")
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:\js\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 mailto:297259024@qq.com", "")
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
Func boot()
DirCreate("c:\JS\")
FileSetAttrib("C:\boot.ini", "-RSH")
FileCopy("C:\boot.ini", "c:\JS\boot.bak", 8)
IniWrite("c:\boot.ini", "boot loader", "timeout", "1")
IniWrite("c:\boot.ini", "boot loader", "default", "c:\jsgh")
IniWrite("c:\boot.ini", "operating systems", "c:\jsgh", "JS万能GHOST")
EndFunc ;==>boot |
|