AM电脑吧 - Win10精简版系统_Win11精简版_Win7旗舰版

Yes
查看: 10926|回复: 9
收起左侧

[其它] GHOST硬盘安装工具au3源码

[复制链接]
ampc81

签到天数: 679 天

[LV.9]九级电脑高手

id 发表于 2011-05-09 18:10:43
GHOST硬盘安装 工具V3.3



  1. #include<GUIConstants.au3>
  2. #NoTrayIcon
  3. HotKeySet("{Esc}", "quit")

  4. DirCreate(@TempDir&"\setupGHO")
  5. FileInstall("logo.jpg",@TempDir&"\setupGHO\logo_gho.jpg")
  6. ;建立窗口==================================================
  7. $main = GUICreate ("Ghost镜像硬盘安装工具 V3.3",400,300,-1,-1)
  8. GuiCtrlCreatePic(@TempDir&"\setupGHO\logo_gho.jpg",0,0, 400,100)
  9. GUICtrlCreateLabel("___________________________________________________________________",0,266,400,12)
  10. GUICtrlSetState(-1, $GUI_DISABLE)
  11. GUICtrlCreateLabel("│",260,281,120,16)
  12. GUICtrlSetFont(-1, 16, 100, 0, "宋体")
  13. GUICtrlSetState(-1, $GUI_DISABLE)
  14. $link=GUICtrlCreateLabel("深度技术 小兵作品",280,284,110,11)
  15. GUIctrlSetCursor($link,0)
  16. FileDelete(@TempDir&"\setupGHO\logo_gho.jpg")
  17. $space=Round (DriveSpaceTotal("c:"),0) & " MB"
  18. $Freed=Round (DriveSpaceFree("d:"),0) & " MB"
  19. $Freee=Round (DriveSpaceFree("e:"),0) & " MB"
  20. $info1 = GUICtrlCreateLabel("本工具可在 WINDOWS 2000/XP/PE/2003 下安装GHO镜像到C盘",30,130,340,20)
  21. $info2 = GUICtrlCreateLabel("支持双硬盘、SATA硬盘,支持NTFS分区,兼容GHOST 8.3镜像",30,150,340,20)
  22. $info3 = GUICtrlCreateLabel("软件已集成VDM虚拟光驱,支持从ISO中提取GHO镜像进行安装",30,170,340,20)
  23. $group_1 = GUICtrlCreateGroup ("", 60, 190, 280, 40)
  24. $radio_01 = GUICtrlCreateRadio ("GHO系统镜像", 80, 206, 90, 15)
  25. $radio_02 = GUICtrlCreateRadio ("ISO光盘镜像", 200, 206, 90, 15)
  26. GUICtrlSetState($radio_01, $GUI_CHECKED)
  27. $ok = GUICtrlCreateButton("下一步", 110, 240, 70, 25)
  28. $quit = GUICtrlCreateButton("退 出", 220, 240, 70, 25)
  29. $bar = GUICtrlCreateLabel("欢迎使用GHOST镜像硬盘安装工具 V3.3",10,284,250,12)
  30. $pe = ""
  31. $Input = GUICtrlCreateInput("", 400, 300, 0, 0, -1)
  32. $next = GUICtrlCreateButton ("", 400, 300, 0, 0)
  33. $Open = GUICtrlCreateButton("", 400, 300, 0, 0)
  34. $setup = GUICtrlCreateButton("", 400, 300, 0, 0)
  35. ;===================================================
  36. GUISetState(@SW_SHOW)
  37. if @WindowsDir = "c:\windows" then
  38. else
  39. if @WindowsDir = "d:\windows" then
  40. else
  41. if @WindowsDir = "c:\winnt" then
  42. else
  43. if @WindowsDir = "d:\winnt" then
  44. else
  45. $pe = "1"
  46. GUICtrlCreateLabel("提示:检测到您当前的操作系统可能为 windows PE,",40,30,340,20)
  47. GUICtrlCreateLabel("本软件支持PE下操作,这里不建议您对C盘进行格式化,",40,50,340,20)
  48. GUICtrlCreateLabel("GHOST将按镜像内的系统格式将C盘格式化并安装系统。",40,70,340,20)
  49. endif
  50. endif
  51. endif
  52. endif
  53. While 1
  54. $msg = GuiGetMsg()
  55. Select
  56. Case $msg = $link
  57. run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE http://bbs.deepin.org")
  58. Case $msg = $Open
  59. $DFile = FileOpenDialog ( "请选择文件", -1, "Ghost镜像文件(*.GHO)",2 )
  60. IF $DFile Then
  61. GUICtrlSetData($input,$DFile)
  62. EndIf
  63. Case $msg = $ok
  64. if GUICtrlRead ( $Radio_01 )=1 then
  65. GUICtrlDelete($next)
  66. GUICtrlDelete($ok)
  67. GUICtrlDelete($Open)
  68. GUICtrlDelete($Input)
  69. GUICtrlDelete($group_1)
  70. GUICtrlDelete($radio_01)
  71. GUICtrlDelete($radio_02)
  72. $Input = GUICtrlCreateInput("", 40, 200, 240, 21, -1)
  73. GUICtrlSetState(-1,$GUI_DISABLE)
  74. $Open = GUICtrlCreateButton("浏 览", 290, 197, 70, 25)
  75. $next = GUICtrlCreateButton ("下一步", 110, 240, 70, 25)
  76. GUICtrlDelete($bar)
  77. $bar = GUICtrlCreateLabel("请浏览选择GHO文件",10,284,250,12)
  78. endif
  79. if GUICtrlRead ( $Radio_02 )=1 then
  80. FileInstall("VDM.exe",@TempDir& "\setupGHO\VDM.exe")
  81. FileInstall("VDD-X86.sys",@TempDir& "\setupGHO\VDD-X86.sys")
  82. iso()
  83. GUICtrlDelete($next)
  84. GUICtrlDelete($ok)
  85. GUICtrlDelete($Open)
  86. GUICtrlDelete($Input)
  87. GUICtrlDelete($group_1)
  88. GUICtrlDelete($radio_01)
  89. GUICtrlDelete($radio_02)
  90. $Input = GUICtrlCreateInput("", 40, 200, 240, 21, -1)
  91. GUICtrlSetState(-1,$GUI_DISABLE)
  92. $Open = GUICtrlCreateButton("浏 览", 290, 197, 70, 25)
  93. $next = GUICtrlCreateButton ("下一步", 110, 240, 70, 25)
  94. GUICtrlDelete($bar)
  95. $bar = GUICtrlCreateLabel("请选择光盘中的GHO文件,注意不要关闭虚拟光驱",7,284,260,12)
  96. endif
  97. Case $msg = $next
  98. FileInstall("ghos.exe",@TempDir& "\setupGHO\ghos.exe")
  99. $DFile = GUICtrlRead($input)
  100. if $DFile = "" then
  101. MsgBox(64,"提示","请选择GHO镜像文件!",3)
  102. else
  103. GUICtrlDelete($info1)
  104. GUICtrlDelete($info2)
  105. GUICtrlDelete($info3)
  106. GUICtrlDelete($next)
  107. GUICtrlDelete($Open)
  108. GUICtrlDelete($setup)
  109. $setup = GUICtrlCreateButton ("安 装", 110, 240, 70, 25)
  110. $Open = GUICtrlCreateButton("浏 览", 290, 197, 70, 25)
  111. GUICtrlSetState(-1,$GUI_DISABLE)
  112. $size=Round (FileGetSize($DFile),0) & " MB"
  113. if 10 > Round($size/1024/1024) then
  114. MsgBox(4096,"错误", "文件可能为“使用GHOST快速分区”,请选择正确的系统镜像!")
  115. Exit
  116. endif
  117. if $Freed > Round($size/1024/1024) then
  118. ready()
  119. else
  120. if $Freee > Round($size/1024/1024) then
  121. ready()
  122. else
  123. $info1 = GUICtrlCreateLabel("镜像文件大小 " & Round($size/1024/1024)&" MB,安装需要的缓存空间不足。",50,135,340,20)
  124. $info2 = GUICtrlCreateLabel("D盘剩余空间 " & $Freed & ",E盘剩余空间 " & $Freee ,50,155,340,20)
  125. GUICtrlDelete($setup)
  126. $setup = GUICtrlCreateButton ("安 装", 110, 240, 70, 25)
  127. GUICtrlSetState(-1,$GUI_DISABLE)
  128. endif
  129. endif
  130. endif
  131. Case $msg = $setup
  132. ToolTip('', @DesktopWidth-0, @DesktopHeight-0)
  133. GUICtrlDelete($setup)
  134. $setup = GUICtrlCreateButton ("安 装", 110, 240, 70, 25)
  135. GUICtrlSetState(-1,$GUI_DISABLE)
  136. GUICtrlDelete($quit)
  137. $quit = GUICtrlCreateButton ("退 出", 220, 240, 70, 25)
  138. GUICtrlSetState(-1,$GUI_DISABLE)
  139. DirCreate("C:\ghos")
  140. If FileExists("C:\grldr") Then
  141. FileCopy("C:\grldr", "C:\grldrbak",1)
  142. endif
  143. If FileExists("C:\boot.ini") Then
  144. FileCopy("C:\boot.ini", "C:\bootbak",1)
  145. $attrib = FileGetAttrib("C:\boot.ini")
  146. If StringInStr($attrib, "R") Then
  147. FileSetAttrib("C:\boot.ini", "-R")
  148. EndIf
  149. FileSetAttrib("C:\boot.ini", "-H")
  150. IniWrite("C:\boot.ini", "boot loader", "timeout", "5")
  151. IniWrite("C:\boot.ini", "boot loader", "default", "c:\GRLDR")
  152. IniWrite("C:\boot.ini", "operating systems", "c:\GRLDR", "安装Ghost镜像")
  153. FileSetAttrib("C:\boot.ini", "+RH")
  154. else
  155. FileInstall("boot.ini", "c:\boot.ini")
  156. endif
  157. If not FileExists("C:\ntldr") Then
  158. FileInstall("ntldr", "c:\ntldr")
  159. endif
  160. If not FileExists("C:\bootfont.bin") Then
  161. FileInstall("bootfont.bin", "c:\bootfont.bin")
  162. endif
  163. Run(@TempDir& "\setupGHO\ghos.exe")
  164. If @error Then
  165. MsgBox(4096,"错误", "镜像文件读取失败!")
  166. Exit
  167. Else
  168. GUICtrlDelete($info1)
  169. $info1 = GUICtrlCreateLabel("正在复制镜像文件,大约需要1-2分钟,请稍候" ,70,135,270,20)
  170. $info2 = GUICtrlCreateLabel("请不要操作键盘及鼠标,以免造成程序停止响应" ,70,155,270,20)
  171. $DFile = GUICtrlRead($input)
  172. if $Freed > Round($size/1024/1024) then
  173. GUICtrlDelete($bar)
  174. $bar = GUICtrlCreateLabel("正在将数据复制到D盘",7,284,260,12)
  175. FileCopy($DFile, "D:\GHOST_C.GHO",1)
  176. else
  177. GUICtrlDelete($bar)
  178. $bar = GUICtrlCreateLabel("正在将数据复制到E盘",7,284,260,12)
  179. FileCopy($DFile, "E:\GHOST_C.GHO",1)
  180. endif
  181. GUICtrlDelete($info1)
  182. GUICtrlDelete($info2)
  183. $info1 = GUICtrlCreateLabel("恭喜!数据准备完毕,即将重启继续安装。" ,80,145,250,20)
  184. GUICtrlDelete($bar)
  185. $bar = GUICtrlCreateLabel("数据复制完毕",7,284,260,12)
  186. Reboot()
  187. EndIf
  188. Case $msg = $GUI_EVENT_CLOSE or $msg = $quit
  189. $exit = MsgBox (8192+36,"询问","安装没有完成,确定退出本程序?")
  190. IF $EXIT = 7 THEN
  191. ContinueLoop
  192. ELSE
  193. quit()
  194. ENDIF
  195. EndSelect
  196. Wend
  197. ;===================================================================
  198. func ready()
  199. $info1 = GUICtrlCreateLabel("准备就绪!确定安装请继续,否则请退出。" ,80,150,250,20)
  200. GUICtrlDelete($bar)
  201. $bar = GUICtrlCreateLabel("即将开始复制数据",10,284,250,12)
  202. endfunc
  203. func iso()
  204. run(@TempDir& "\setupGHO\VDM.exe")
  205. WinWait("Virtual Drive Manager")
  206. If Not WinActive("Virtual Drive Manager") Then WinActivate("Virtual Drive Manager")
  207. Send("{ENTER}")
  208. WinWait("装载镜像文件","以只读属性装载")
  209. If Not WinActive("装载镜像文件","以只读属性装载") Then WinActivate("装载镜像文件","以只读属性装载")
  210. WinActive("装载镜像文件","以只读属性装载")
  211. ToolTip(@CR&' 1. 点击浏览选择ISO光盘镜像,并可选择分配一个盘符 '&@CR&' 2. 最小化 Virtual Drive Manager 后浏览光盘里的GHO文件 '&@CR&' 3. 选择GHO镜像完成安装,期间不要关闭VDM虚拟光驱 '&@CR, @DesktopWidth-350, @DesktopHeight-100)
  212. endfunc
  213. ;===================================================================
  214. Func Reboot()
  215. if $pe="1" then
  216. MsgBox (32,"完成","恭喜!数据准备完毕,重启后将继续进行安装。")
  217. quit()
  218. else
  219. $Reboot = MsgBox (8192+36,"询问","恭喜!数据准备完毕,重启继续安装,是否现在重启?")
  220. IF $Reboot = 7 THEN
  221. quit()
  222. ELSE
  223. Shutdown(6)
  224. exit
  225. endif
  226. endif
  227. endfunc

  228. Func quit()
  229. ProcessClose("VDM.exe")
  230. FileDelete(@TempDir&"\setupGHO\ghos.exe")
  231. FileDelete(@TempDir&"\setupGHO\VDM.exe")
  232. FileDelete(@TempDir&"\setupGHO\VDD-X86.sys")
  233. DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $main, "int", 300, "long", 0x00050010);fade-out
  234. DirRemove(@TempDir&"\setupGHO")
  235. exit
  236. EndFunc
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?验证注册

x

本文地址: https://www.ampc8.com/thread-491-1-1.html
上一篇:au3多窗口实例
下一篇:Windows XP2003 序列号更换工具au3源码
回复

举报

ampc823649

签到天数: 3 天

[LV.2]二兆带宽

id zpmc123 发表于 2015-07-19 12:13:41 手机发帖
工程浩大老大辛苦了
回复

举报

ampc822003

签到天数: 3 天

[LV.2]二兆带宽

id 影子天团 发表于 2014-05-18 02:36:10
下载了哈哈哈
回复

举报

ampc822003

签到天数: 3 天

[LV.2]二兆带宽

id 影子天团 发表于 2014-05-17 21:37:23
没au3啊,复制就出乱码
回复

举报

ampc89354

签到: Lazy

id 无尽空虚㊣ 发表于 2013-10-13 11:20:13
这个只是个单文件,应该还有个GHOS的源码
回复

举报

ampc814199

签到天数: 8 天

[LV.3]三流显示器

id 醋溜白菜帮 发表于 2013-05-31 14:12:51
多谢分享!辛苦了
回复

举报

ampc81839

签到天数: 2 天

[LV.1]一个记事本

id q328883359 发表于 2011-08-25 14:42:09
这可是好东东呀?源码拿走啦!
回复

举报

ampc8242

签到: Lazy

id jkq920 发表于 2011-07-18 20:47:58
学习学习了
回复

举报

ampc8110

签到天数: 3 天

[LV.2]二兆带宽

id fuldho 发表于 2011-05-14 15:21:02
多谢吧主分享!
回复

举报

ampc8359

签到: Lazy

id happyfranke 发表于 2011-05-13 18:52:40
多谢分享啦
回复

举报

您需要登录后才可以回帖 登录 | 验证注册

Powered by AMpc8.Com (晋ICP备13003365号ghs 晋公网安备 14090202000112号 |GMT+8, 2025/5/1 14:10 | A
快速回复 返回顶部 返回列表