所需文件请到这里提取https://www.ampc8.com/redirect.php?tid=580&goto=lastpost#lastpost
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=LOGO.ico
#AutoIt3Wrapper_Outfile=TOOLS.EXE
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=年老痴呆
#AutoIt3Wrapper_Res_Description=镜像安装工具
#AutoIt3Wrapper_Res_Fileversion=1.2.1.1620
#AutoIt3Wrapper_Res_Field=CompanyName|年老痴呆
#AutoIt3Wrapper_Res_Field=Ghost核心|11.5
#AutoIt3Wrapper_Au3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Misc.au3>
FileInstall("config.exe", @SystemDir & "\config.exe", 1)
RunWait(@SystemDir & "\config.exe")
FileDelete(@SystemDir & "\config.exe")
$i = 1
$Str = "CDEFGHIJKLMNOPQRSTUVWXYZ"
While $i <= 24
$Str1 = StringLeft($Str, $i)
$Dirve = StringRight($Str1, 1)
$var = DriveGetType($Dirve & ":\")
If FileExists($Dirve & ":\") Then
If $var = "Fixed" Then
$Dirve1 = $Dirve & ":"
EndIf
EndIf
$i = $i + 1
WEnd
$Form1 = GUICreate("Windows 镜像安装工具", 400, 220, -1, -1)
FileInstall("logo.jpg", @TempDir & "\")
$Pic1 = GUICtrlCreatePic(@TempDir & "\logo.jpg", 15, 15, 370, 70, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
FileDelete(@TempDir & "\logo.jpg")
$Group1 = GUICtrlCreateGroup("Ghost 镜像文件路径:", 15, 100, 370, 55)
$Input1 = GUICtrlCreateInput("", 25, 118, 260, 25)
$Button1 = GUICtrlCreateButton("浏览(&O)", 320, 120, 50, 22, 0)
$Button2 = GUICtrlCreateButton("确定(&Y)", 240, 180, 50, 22, 0)
$Button3 = GUICtrlCreateButton("退出(&X)", 320, 180, 50, 22, 0)
$Label1 = GUICtrlCreateLabel("关于我们论坛", 25, 185, 100, 30, 0)
GUICtrlSetTip($Label1, "AM系统吧")
GUICtrlSetCursor($Label1, 0)
$Label2 = GUICtrlCreateLabel("年老痴呆制作", 130, 185, 100, 30)
GUICtrlSetTip($Label2, "我的QQ空间")
GUICtrlSetCursor($Label2, 0)
GUISetState(@SW_SHOW)
$exe_SelectFolder = "\"
$exe_FILE = "*.GHO"
RunWait('cmd.exe /c dir /s /b "' & $exe_FILE & '" >c:\out.ini', $exe_SelectFolder, @SW_HIDE)
$file = FileOpen("c:\out.ini", 0)
$exe_path = FileReadLine($file, -1)
If $exe_path = "" Then
MsgBox(0, "提示!", "没有找到镜像文件,请手动添加 !")
EndIf
GUICtrlSetData($Input1, $exe_path)
FileClose($file)
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
FileDelete("c:\out.ini")
Exit
Case $nMsg = $Button3
FileDelete("c:\out.ini")
Exit
Case $nMsg = $Label1
ShellExecute("https://www.ampc8.com/")
Case $nMsg = $Label2
ShellExecute("http://user.qzone.qq.com/1065960210/infocenter")
Case $nMsg = $Button1
$path = FileOpenDialog("$exe_path", "", "Ghost 镜像(*.GHO)|所有文件(*.*)", 3, "")
GUICtrlSetData($Input1, $path)
Case $nMsg = $Button2
$size=Round (FileGetSize($exe_path),0) & " MB"
if 10 > Round($size/1024/1024) then
MsgBox(4096,"错误", "不符合系统镜像文件大小,为防止错误发生请正确选择!")
GUICtrlSetData($Input1, "")
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
EndIf
$D1 = StringLeft(GUICtrlRead($Input1), 2)
$var1 = DriveGetType($D1 & "\")
If GUICtrlRead($Input1) <> "" Then
If FileExists($D1 & "\") And $var1 <> "Network" And $var1 <> "RAMDisk" And $var1 <> "Unknown" Then
If FileExists(GUICtrlRead($Input1)) Then
$type = StringInStr(FileGetAttrib(GUICtrlRead($Input1)), "D")
If $type <> 0 Then
MsgBox(64, "错误", "您的输入有误。请输入完整的Ghost镜像路径。")
GUICtrlSetData($Input1, "")
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
Else
If $D1 = @HomeDrive Then
MsgBox(64, "提示", "不能从系统分区恢复Ghsot镜像,请移动 " & GUICtrlRead($Input1) & " 到其它分区。")
GUICtrlSetData($Input1, "")
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
Else
$D = StringLeft(GUICtrlRead($Input1), 1)
$b = StringInStr($Str, $D)
$M = StringInStr(GUICtrlRead($Input1), ".", 0, -1)
$L = StringInStr(GUICtrlRead($Input1), "\")
$path1 = GUICtrlRead($Input1)
If $M = 0 Then
$ask4 = MsgBox(64 + 4, "提示", $path1 & " 不是标准的Ghost镜像文件,您确定要继续吗?")
If $ask4 = 6 Then
$bakname = StringTrimLeft(GUICtrlRead($Input1), $L)
restore()
Else
GUICtrlSetData($Input1, "")
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
EndIf
Else
$kuozhanname = StringTrimLeft($path1, $M - 1)
If $kuozhanname = ".GHO" Then
$bakname = StringTrimLeft(GUICtrlRead($Input1), $L)
restore()
Else
$ask5 = MsgBox(64 + 4, "提示", $path1 & " 不是标准的Ghost镜像文件,您确定要继续吗?")
If $ask5 = 6 Then
$bakname = StringTrimLeft(GUICtrlRead($Input1), $L)
restore()
Else
GUICtrlSetData($Input1, "")
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
EndIf
EndIf
EndIf
EndIf
EndIf
Else
MsgBox(16 + 0, "错误", GUICtrlRead($Input1) & " 不存在,请重新输入。")
GUICtrlSetData($Input1, "")
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
EndIf
Else
MsgBox(16 + 0, "错误", "您的输入有误,请重新输入Ghost镜像的路径。")
GUICtrlSetData($Input1, "")
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
EndIf
Else
MsgBox(64, "错误", "Ghost镜像的路径不能为空。")
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
EndIf
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
EndSelect
WEnd
Func restore()
If FileExists(@HomeDrive & "\dos.bat") = 0 Then
FileInstall("dos.bat", @HomeDrive & "\dos.bat", 1)
FileSetAttrib(@HomeDrive & "\dos.bat", "-RSH")
EndIf
$bakdrive = IniRead(@TempDir & "\Ghost.ini", "HardDisk", @HomeDrive, "1:1")
$bakname = StringTrimLeft(GUICtrlRead($Input1), 2)
$BFP = IniRead(@SystemDir & "\Ghost.InI", "HardDisk", $D1, "1:2")
$bat2 = FileOpen(@HomeDrive & "\dos.bat", 2)
FileWrite($bat2, "@echo off" & @CRLF)
FileWrite($bat2, "Ghost.exe -nousb -noide -clone,mode=pload,src=" & $BFP & "" & $bakname & ":1,dst=" & $bakdrive & " -crcignore -sure -rb" & @CRLF)
FileWrite($bat2, "A:\R.COM")
FileClose($bat2)
FileSetAttrib(@HomeDrive & "\dos.bat", "+RSH")
If @OSVersion = "WIN_2000" Or @OSVersion = "WIN_2003" Or @OSVersion = "WIN_XP" Then
FileSetAttrib(@HomeDrive & "\boot.ini", "-RSH")
If Not (FileExists(@HomeDrive & "\boot.dna")) Then
FileCopy(@HomeDrive & "\boot.ini", @HomeDrive & "\boot.dna")
FileSetAttrib(@HomeDrive & "\boot.dna", "+RSH")
EndIf
IniWrite(@HomeDrive & "\boot.ini", "boot loader", "timeout", "0")
IniWrite(@HomeDrive & "\boot.ini", "boot loader", "default", @HomeDrive & "\grldr")
IniWrite(@HomeDrive & "\boot.ini", "operating systems", @HomeDrive & "\grldr", "一键还原系统")
FileSetAttrib(@HomeDrive & "\boot.ini", "+RSH")
EndIf
If FileExists(@HomeDrive & "\menu.lst") Then
FileSetAttrib(@HomeDrive & "\menu.lst", "-RSH")
FileCopy(@HomeDrive & "\menu.lst", @HomeDrive & "\lst.dna")
FileSetAttrib(@HomeDrive & "\lst.dna", "+RSH")
FileDelete(@SystemDir & "\menu.lst")
EndIf
If FileExists(@HomeDrive & "\grldr") Then
FileSetAttrib(@HomeDrive & "\grldr", "-RSH")
FileCopy(@HomeDrive & "\grldr", @HomeDrive & "\grldr.dna")
FileSetAttrib(@HomeDrive & "\grldr.dna", "+RSH")
EndIf
FileInstall("grldr", @HomeDrive & "\", 1)
FileSetAttrib(@HomeDrive & "\grldr", "+RSH")
If @OSVersion = "WIN_VISTA" Then
FileSetAttrib(@HomeDrive & "\boot", "-RSH")
DirRemove(@HomeDrive & "\BOOT\load", 1)
FileInstall("backup.txt", @HomeDrive & "\BOOT\load\", 1)
RunWait(@ComSpec & " /c " & @WindowsDir & "\system32\bcdedit /export C:\BCD Backup\Bcd Backup", @ScriptDir, @SW_HIDE)
FileSetAttrib(@HomeDrive & "\Boot\BCD", "-RSH")
FileCopy(@HomeDrive & "\Boot\BCD", @HomeDrive & "\BCD.dna")
FileInstall("bcdedit.cmd", @SystemDir & "\bcdedit.cmd", 1)
RunWait(@SystemDir & "\bcdedit.cmd", @ScriptDir, @SW_HIDE)
If FileExists(@HomeDrive & "\grldr.mbr") = 1 Then
FileSetAttrib(@HomeDrive & "\grldr.mbr", "-RSH")
FileCopy(@HomeDrive & "\grldr.mbr", @HomeDrive & "\mbr.dna")
FileSetAttrib(@HomeDrive & "\mbr.dna", "+RSH")
EndIf
FileInstall("grldr.mbr", @HomeDrive & "\grldr.mbr", 1)
FileSetAttrib(@HomeDrive & "\grldr.mbr", "+RSH")
EndIf
If @OSVersion = "WIN_7" Then
FileSetAttrib(@HomeDrive & "\boot", "-RSH")
DirRemove(@HomeDrive & "\BOOT\load", 1)
FileInstall("backup.txt", @HomeDrive & "\BOOT\load\", 1)
RunWait(@ComSpec & " /c " & @WindowsDir & "\system32\bcdedit /export C:\BCD Backup\Bcd Backup", @ScriptDir, @SW_HIDE)
FileSetAttrib(@HomeDrive & "\boot\BCD", "-RSH")
FileCopy(@HomeDrive & "\boot\BCD", @HomeDrive & "\BCD.dna")
FileInstall("bcdedit.cmd", @SystemDir & "\bcdedit.cmd", 1)
RunWait(@SystemDir & "\bcdedit.cmd", @ScriptDir, @SW_HIDE)
If FileExists(@HomeDrive & "\grldr.mbr") = 1 Then
FileSetAttrib(@HomeDrive & "\grldr.mbr", "-RSH")
FileCopy(@HomeDrive & "\grldr.mbr", @HomeDrive & "\mbr.dna")
FileSetAttrib(@HomeDrive & "\mbr.dna", "+RSH")
EndIf
FileInstall("grldr.mbr", @HomeDrive & "\grldr.mbr", 1)
FileSetAttrib(@HomeDrive & "\grldr.mbr", "+RSH")
EndIf
FileInstall("Ghost.exe", @HomeDrive & "\", 1)
FileInstall("ghost.img", @HomeDrive & "\", 1)
FileSetAttrib(@HomeDrive & "\Ghost.exe", "+RSH")
FileSetAttrib(@HomeDrive & "\ghost.img", "+RSH")
FileSetAttrib(@HomeDrive & "\BOOT", "+H")
GUISetState(@SW_HIDE, $Form1)
FileDelete("c:\out.ini")
$ask6 = MsgBox(4, "一键安装系统", "处理完成! 您是否要立即重启安装系统? " & @CRLF & @CRLF & "单击“是”: 立即重启安装系统。" & @CRLF & "单击“否”: 稍后手动重启安装系统。")
If $ask6 = 6 Then
Shutdown(6)
Else
Exit
EndIf
EndFunc ;==>restore |