GHOST硬盘安装 工具V3.3
- #include<GUIConstants.au3>
- #NoTrayIcon
- HotKeySet("{Esc}", "quit")
- DirCreate(@TempDir&"\setupGHO")
- FileInstall("logo.jpg",@TempDir&"\setupGHO\logo_gho.jpg")
- ;建立窗口==================================================
- $main = GUICreate ("Ghost镜像硬盘安装工具 V3.3",400,300,-1,-1)
- GuiCtrlCreatePic(@TempDir&"\setupGHO\logo_gho.jpg",0,0, 400,100)
- GUICtrlCreateLabel("___________________________________________________________________",0,266,400,12)
- GUICtrlSetState(-1, $GUI_DISABLE)
- GUICtrlCreateLabel("│",260,281,120,16)
- GUICtrlSetFont(-1, 16, 100, 0, "宋体")
- GUICtrlSetState(-1, $GUI_DISABLE)
- $link=GUICtrlCreateLabel("深度技术 小兵作品",280,284,110,11)
- GUIctrlSetCursor($link,0)
- FileDelete(@TempDir&"\setupGHO\logo_gho.jpg")
- $space=Round (DriveSpaceTotal("c:"),0) & " MB"
- $Freed=Round (DriveSpaceFree("d:"),0) & " MB"
- $Freee=Round (DriveSpaceFree("e:"),0) & " MB"
- $info1 = GUICtrlCreateLabel("本工具可在 WINDOWS 2000/XP/PE/2003 下安装GHO镜像到C盘",30,130,340,20)
- $info2 = GUICtrlCreateLabel("支持双硬盘、SATA硬盘,支持NTFS分区,兼容GHOST 8.3镜像",30,150,340,20)
- $info3 = GUICtrlCreateLabel("软件已集成VDM虚拟光驱,支持从ISO中提取GHO镜像进行安装",30,170,340,20)
- $group_1 = GUICtrlCreateGroup ("", 60, 190, 280, 40)
- $radio_01 = GUICtrlCreateRadio ("GHO系统镜像", 80, 206, 90, 15)
- $radio_02 = GUICtrlCreateRadio ("ISO光盘镜像", 200, 206, 90, 15)
- GUICtrlSetState($radio_01, $GUI_CHECKED)
- $ok = GUICtrlCreateButton("下一步", 110, 240, 70, 25)
- $quit = GUICtrlCreateButton("退 出", 220, 240, 70, 25)
- $bar = GUICtrlCreateLabel("欢迎使用GHOST镜像硬盘安装工具 V3.3",10,284,250,12)
- $pe = ""
- $Input = GUICtrlCreateInput("", 400, 300, 0, 0, -1)
- $next = GUICtrlCreateButton ("", 400, 300, 0, 0)
- $Open = GUICtrlCreateButton("", 400, 300, 0, 0)
- $setup = GUICtrlCreateButton("", 400, 300, 0, 0)
- ;===================================================
- GUISetState(@SW_SHOW)
- if @WindowsDir = "c:\windows" then
- else
- if @WindowsDir = "d:\windows" then
- else
- if @WindowsDir = "c:\winnt" then
- else
- if @WindowsDir = "d:\winnt" then
- else
- $pe = "1"
- GUICtrlCreateLabel("提示:检测到您当前的操作系统可能为 windows PE,",40,30,340,20)
- GUICtrlCreateLabel("本软件支持PE下操作,这里不建议您对C盘进行格式化,",40,50,340,20)
- GUICtrlCreateLabel("GHOST将按镜像内的系统格式将C盘格式化并安装系统。",40,70,340,20)
- endif
- endif
- endif
- endif
- While 1
- $msg = GuiGetMsg()
- Select
- Case $msg = $link
- run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE http://bbs.deepin.org")
- Case $msg = $Open
- $DFile = FileOpenDialog ( "请选择文件", -1, "Ghost镜像文件(*.GHO)",2 )
- IF $DFile Then
- GUICtrlSetData($input,$DFile)
- EndIf
- Case $msg = $ok
- if GUICtrlRead ( $Radio_01 )=1 then
- GUICtrlDelete($next)
- GUICtrlDelete($ok)
- GUICtrlDelete($Open)
- GUICtrlDelete($Input)
- GUICtrlDelete($group_1)
- GUICtrlDelete($radio_01)
- GUICtrlDelete($radio_02)
- $Input = GUICtrlCreateInput("", 40, 200, 240, 21, -1)
- GUICtrlSetState(-1,$GUI_DISABLE)
- $Open = GUICtrlCreateButton("浏 览", 290, 197, 70, 25)
- $next = GUICtrlCreateButton ("下一步", 110, 240, 70, 25)
- GUICtrlDelete($bar)
- $bar = GUICtrlCreateLabel("请浏览选择GHO文件",10,284,250,12)
- endif
- if GUICtrlRead ( $Radio_02 )=1 then
- FileInstall("VDM.exe",@TempDir& "\setupGHO\VDM.exe")
- FileInstall("VDD-X86.sys",@TempDir& "\setupGHO\VDD-X86.sys")
- iso()
- GUICtrlDelete($next)
- GUICtrlDelete($ok)
- GUICtrlDelete($Open)
- GUICtrlDelete($Input)
- GUICtrlDelete($group_1)
- GUICtrlDelete($radio_01)
- GUICtrlDelete($radio_02)
- $Input = GUICtrlCreateInput("", 40, 200, 240, 21, -1)
- GUICtrlSetState(-1,$GUI_DISABLE)
- $Open = GUICtrlCreateButton("浏 览", 290, 197, 70, 25)
- $next = GUICtrlCreateButton ("下一步", 110, 240, 70, 25)
- GUICtrlDelete($bar)
- $bar = GUICtrlCreateLabel("请选择光盘中的GHO文件,注意不要关闭虚拟光驱",7,284,260,12)
- endif
- Case $msg = $next
- FileInstall("ghos.exe",@TempDir& "\setupGHO\ghos.exe")
- $DFile = GUICtrlRead($input)
- if $DFile = "" then
- MsgBox(64,"提示","请选择GHO镜像文件!",3)
- else
- GUICtrlDelete($info1)
- GUICtrlDelete($info2)
- GUICtrlDelete($info3)
- GUICtrlDelete($next)
- GUICtrlDelete($Open)
- GUICtrlDelete($setup)
- $setup = GUICtrlCreateButton ("安 装", 110, 240, 70, 25)
- $Open = GUICtrlCreateButton("浏 览", 290, 197, 70, 25)
- GUICtrlSetState(-1,$GUI_DISABLE)
- $size=Round (FileGetSize($DFile),0) & " MB"
- if 10 > Round($size/1024/1024) then
- MsgBox(4096,"错误", "文件可能为“使用GHOST快速分区”,请选择正确的系统镜像!")
- Exit
- endif
- if $Freed > Round($size/1024/1024) then
- ready()
- else
- if $Freee > Round($size/1024/1024) then
- ready()
- else
- $info1 = GUICtrlCreateLabel("镜像文件大小 " & Round($size/1024/1024)&" MB,安装需要的缓存空间不足。",50,135,340,20)
- $info2 = GUICtrlCreateLabel("D盘剩余空间 " & $Freed & ",E盘剩余空间 " & $Freee ,50,155,340,20)
- GUICtrlDelete($setup)
- $setup = GUICtrlCreateButton ("安 装", 110, 240, 70, 25)
- GUICtrlSetState(-1,$GUI_DISABLE)
- endif
- endif
- endif
- Case $msg = $setup
- ToolTip('', @DesktopWidth-0, @DesktopHeight-0)
- GUICtrlDelete($setup)
- $setup = GUICtrlCreateButton ("安 装", 110, 240, 70, 25)
- GUICtrlSetState(-1,$GUI_DISABLE)
- GUICtrlDelete($quit)
- $quit = GUICtrlCreateButton ("退 出", 220, 240, 70, 25)
- GUICtrlSetState(-1,$GUI_DISABLE)
- DirCreate("C:\ghos")
- If FileExists("C:\grldr") Then
- FileCopy("C:\grldr", "C:\grldrbak",1)
- endif
- If FileExists("C:\boot.ini") Then
- FileCopy("C:\boot.ini", "C:\bootbak",1)
- $attrib = FileGetAttrib("C:\boot.ini")
- If StringInStr($attrib, "R") Then
- FileSetAttrib("C:\boot.ini", "-R")
- EndIf
- FileSetAttrib("C:\boot.ini", "-H")
- IniWrite("C:\boot.ini", "boot loader", "timeout", "5")
- IniWrite("C:\boot.ini", "boot loader", "default", "c:\GRLDR")
- IniWrite("C:\boot.ini", "operating systems", "c:\GRLDR", "安装Ghost镜像")
- FileSetAttrib("C:\boot.ini", "+RH")
- else
- FileInstall("boot.ini", "c:\boot.ini")
- endif
- If not FileExists("C:\ntldr") Then
- FileInstall("ntldr", "c:\ntldr")
- endif
- If not FileExists("C:\bootfont.bin") Then
- FileInstall("bootfont.bin", "c:\bootfont.bin")
- endif
- Run(@TempDir& "\setupGHO\ghos.exe")
- If @error Then
- MsgBox(4096,"错误", "镜像文件读取失败!")
- Exit
- Else
- GUICtrlDelete($info1)
- $info1 = GUICtrlCreateLabel("正在复制镜像文件,大约需要1-2分钟,请稍候" ,70,135,270,20)
- $info2 = GUICtrlCreateLabel("请不要操作键盘及鼠标,以免造成程序停止响应" ,70,155,270,20)
- $DFile = GUICtrlRead($input)
- if $Freed > Round($size/1024/1024) then
- GUICtrlDelete($bar)
- $bar = GUICtrlCreateLabel("正在将数据复制到D盘",7,284,260,12)
- FileCopy($DFile, "D:\GHOST_C.GHO",1)
- else
- GUICtrlDelete($bar)
- $bar = GUICtrlCreateLabel("正在将数据复制到E盘",7,284,260,12)
- FileCopy($DFile, "E:\GHOST_C.GHO",1)
- endif
- GUICtrlDelete($info1)
- GUICtrlDelete($info2)
- $info1 = GUICtrlCreateLabel("恭喜!数据准备完毕,即将重启继续安装。" ,80,145,250,20)
- GUICtrlDelete($bar)
- $bar = GUICtrlCreateLabel("数据复制完毕",7,284,260,12)
- Reboot()
- EndIf
- Case $msg = $GUI_EVENT_CLOSE or $msg = $quit
- $exit = MsgBox (8192+36,"询问","安装没有完成,确定退出本程序?")
- IF $EXIT = 7 THEN
- ContinueLoop
- ELSE
- quit()
- ENDIF
- EndSelect
- Wend
- ;===================================================================
- func ready()
- $info1 = GUICtrlCreateLabel("准备就绪!确定安装请继续,否则请退出。" ,80,150,250,20)
- GUICtrlDelete($bar)
- $bar = GUICtrlCreateLabel("即将开始复制数据",10,284,250,12)
- endfunc
- func iso()
- run(@TempDir& "\setupGHO\VDM.exe")
- WinWait("Virtual Drive Manager")
- If Not WinActive("Virtual Drive Manager") Then WinActivate("Virtual Drive Manager")
- Send("{ENTER}")
- WinWait("装载镜像文件","以只读属性装载")
- If Not WinActive("装载镜像文件","以只读属性装载") Then WinActivate("装载镜像文件","以只读属性装载")
- WinActive("装载镜像文件","以只读属性装载")
- ToolTip(@CR&' 1. 点击浏览选择ISO光盘镜像,并可选择分配一个盘符 '&@CR&' 2. 最小化 Virtual Drive Manager 后浏览光盘里的GHO文件 '&@CR&' 3. 选择GHO镜像完成安装,期间不要关闭VDM虚拟光驱 '&@CR, @DesktopWidth-350, @DesktopHeight-100)
- endfunc
- ;===================================================================
- Func Reboot()
- if $pe="1" then
- MsgBox (32,"完成","恭喜!数据准备完毕,重启后将继续进行安装。")
- quit()
- else
- $Reboot = MsgBox (8192+36,"询问","恭喜!数据准备完毕,重启继续安装,是否现在重启?")
- IF $Reboot = 7 THEN
- quit()
- ELSE
- Shutdown(6)
- exit
- endif
- endif
- endfunc
- Func quit()
- ProcessClose("VDM.exe")
- FileDelete(@TempDir&"\setupGHO\ghos.exe")
- FileDelete(@TempDir&"\setupGHO\VDM.exe")
- FileDelete(@TempDir&"\setupGHO\VDD-X86.sys")
- DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $main, "int", 300, "long", 0x00050010);fade-out
- DirRemove(@TempDir&"\setupGHO")
- exit
- EndFunc
复制代码 |