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

Yes
查看: 16389|回复: 18
收起左侧

[启动相关软件] ghost镜像工具v2.1(源码)

[复制链接]
精华
ampc8110

签到天数: 3 天

[LV.2]二兆带宽

id fuldho 发表于 2013-06-26 15:40:07
20130626153606.jpg


#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=LOGO.ico
#PRE_Outfile=TOOLS.EXE
#PRE_Compression=4
#PRE_UseUpx=n
#PRE_Res_Comment=年老痴呆
#PRE_Res_Description=Windows 镜像工具
#PRE_Res_Fileversion=2.1.0.0
#PRE_Res_requestedExecutionLevel=None
#PRE_Res_Field=CompanyName|年老痴呆
#PRE_Res_Field=Ghost核心|11.02
#PRE_AU3Check_Stop_OnWarning=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
;#AutoIt3Wrapper_Run_Tidy=y
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <GUIListView.au3>
#include <ListViewConstants.au3>
$Form1 = GUICreate("Windows 镜像工具v2.1", 665, 360, -1, -1)
$Group = GUICtrlCreateGroup("搜索镜像名称及路径:", 435, 15, 220, 210)
$Combo = GUICtrlCreateList("", 445, 30, 200, 185, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
FileInstall("ShowDrive.Vxd", @SystemDir  & "\ShowDrive.Vxd", 1)
FileInstall("DsptW.Vxd", @SystemDir  & "\DsptW.Vxd", 1)
SplashTextOn("", "正在获取分区,请稍候...", 250, 38, -1, -1, 1, "", 10)
RUNWAIT ( @SystemDir  & "\ShowDrive.Vxd /S" , @SystemDir , @SW_HIDE )
FILEDELETE(@SystemDir  & "\ShowDrive.Vxd")
RUNWAIT ( @COMSPEC & " /C " & @SystemDir  & "\DsptW.Vxd /A /Pdr  >" & @SystemDir & "\Part.Txt" , @SystemDir , @SW_HIDE )
FILEDELETE(@SystemDir  & "\DsptW.Vxd")
$IniFile =@SystemDir  & "\Part.Txt"
$Ini=@SystemDir & "\Ghost.ini"
FILEDELETE($Ini)
FileWriteLine($Ini,"[HardDisk]")
For $i=3 To 26
        $ReadFile=FileReadLine($IniFile,$i)                       ;第三行开始读取
        If $ReadFile='' Then ExitLoop                                  ;空退出
        If StringMid($ReadFile,2,1)=":" Then                              ;$ReadFile第2字符为:
           FileWriteLine(@SystemDir & "\P.Txt",StringLeft($ReadFile,8))                   ;返回左起8个字符
        EndIf     
Next
FILEDELETE(@SystemDir & "\Part.Txt")
$Lines = _FileCountLines(@SystemDir & "\P.Txt")                                  ;获取文本行数
For $y =1 To $Lines Step 1
       $strExt = filereadline(@SystemDir & "\P.Txt",$y)
       $strExt = StringStripWS($strExt,2)   
       $StrExt=StringRegExpReplace($StrExt,'\s','=')           ;替换':        '为'='
       FileWriteLine($Ini,$StrExt)
Next
FILEDELETE(@SystemDir & "\P.Txt")
SplashOff()
FileInstall("gho.exe", @SystemDir & "\")
SplashTextOn("", "正在搜索gho文件,请稍候...", 250, 38, -1, -1, 1, "", 10)
RunWait(@SystemDir & "\gho.exe", @SystemDir & "\")
FileDelete(@SystemDir & "\gho.exe")
SplashOff()
$file = FileOpen(@SystemDir & "\gho.txt", 0)
$Files = @SystemDir & '\gho.txt'
$gho_path = FileReadLine($files, 1)
$Size = Round(FileGetSize($gho_path)/1024/1024,3)
Dim $aRecords
If _FileReadToArray($Files, $aRecords) Then
GUICtrlSetData($Combo, "")
For $x = 1 To $aRecords[0]
  GUICtrlSetData($Combo, $aRecords[$x], $x)
Next
EndIf
GUICtrlCreateGroup("磁盘分区信息", 10, 15, 420, 210)
$ListView1 = GUICtrlCreateListView("分区|序号|卷标|文件系统|剩余容量(GB)|总容量(GB)", 20, 30, 400, 185, -1, $LVS_EX_GRIDLINES)
GUICtrlSeNDMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 40)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 45)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 60)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 65)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 85)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 80)
_GUICtrlListView_JustifyColumn(GUICtrlGetHandle($ListView1), 0, 2)
_GUICtrlListView_JustifyColumn(GUICtrlGetHandle($ListView1), 1, 2)
_GUICtrlListView_JustifyColumn(GUICtrlGetHandle($ListView1), 2, 2)
_GUICtrlListView_JustifyColumn(GUICtrlGetHandle($ListView1), 3, 2)
_GUICtrlListView_JustifyColumn(GUICtrlGetHandle($ListView1), 4, 2)
_GUICtrlListView_JustifyColumn(GUICtrlGetHandle($ListView1), 5, 2)
$z = 0
_GUICtrlListView_DeleteAllItems($ListView1)
$read = IniReadSection(@SystemDir & "\Ghost.ini", "HardDisk")
If @error Then
MsgBox(64, "", "错误")
EndIf
If Not @error Then
For $i = 1 To $read[0][0]
  $fjxt = DriveGetFileSystem($read[$i][0])
  $zrl = Round(DriveSpaceTotal($read[$i][0]) / 1024, 2)
  $syrl = Round(DriveSpaceFree($read[$i][0]) / 1024, 2)
  $ses = DriveGetLabel($read[$i][0])
  GUICtrlCreateListViewItem($read[$i][0], $ListView1)
  _GUICtrlListView_AddSubItem($ListView1, $z, $read[$i][1], 1, $z + 1)
  _GUICtrlListView_AddSubItem($ListView1, $z, $fjxt, 3, $z + 1)
  _GUICtrlListView_AddSubItem($ListView1, $z, $syrl, 4, $z + 1)
  _GUICtrlListView_AddSubItem($ListView1, $z, $ses, 2, $z + 1)
  _GUICtrlListView_AddSubItem($ListView1, $z, $zrl, 5, $z + 1)
  $z += 1
Next
EndIf
_GUICtrlListView_SetItemSelected($ListView1, 0)
FileClose($file)
Dim $Dr
$Drive=DriveGetDrive("FIXED")
For $i = 1 To $Drive[0]
$Dr=StringUpper($Drive[$i])
Next
$Button1 = GUICtrlCreateButton("执行(&Y)", 360, 315, 70, 22, 0)
$Button2 = GUICtrlCreateButton("退出(&X)", 460, 315, 70, 22, 0)
$Label1 = GUICtrlCreateLabel("AM电脑吧", 560, 318, 100, 30, 0)
GUICtrlSetTip($Label1, "关于我们论坛")
GUICtrlSetCursor($Label1, 0)
$Group1 = GUICtrlCreateGroup("备份镜像路径:", 15, 245, 320, 50)
$name = $Dr & "\Ghost\" & @OSVersion & ".GHO"
$Input1 = GUICtrlCreateInput($name, 30, 265, 290, 20)
$Button3 = GUICtrlCreateButton("浏览(&F)", 360, 265, 70, 22, 0)
$Labelz = GUICtrlCreateLabel("镜像大小(MB):", 460, 268, 100, 30, 0)
$Labelzz = GUICtrlCreateLabel($Size, 560, 268, 100, 30, 0)
$Radio1 = GUICtrlCreateRadio("备份C盘系统", 30, 315, 100, 20)
$Radio2 = GUICtrlCreateRadio("还原系统到C盘", 180,315, 100, 20)
GUICtrlSetState($Radio1, $GUI_CHECKED)
GUICtrlSetState($Labelz, $GUI_DISABLE)    ;灰色
GUICtrlSetState($Labelzz, $GUI_DISABLE)   ;灰色
GUICtrlSetState($combo, $GUI_DISABLE)     ;灰色  
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Select
  Case $nMsg = $GUI_EVENT_CLOSE
   FileDelete(@SystemDir & "\gho.txt")
                        FileDelete(@SystemDir & "\Ghost.ini")
   Exit
  Case $nMsg = $Button2
   FileDelete(@SystemDir & "\gho.txt")
                        FileDelete(@SystemDir & "\Ghost.ini")
   Exit
  Case $nMsg = $Label1
   ShellExecute("https://www.ampc8.com/")
                Case $nMsg = $Combo
                               $gho_path = GUICtrlRead($Combo)
                        If  $gho_path <> ""  Then
                               $Size = Round(FileGetSize($gho_path)/1024/1024,3)
                               GUICtrlSetData($Labelzz,$Size)
                               GUICtrlSetData($Input1,  $gho_path)
                        EndIf
  Case $nMsg = $Radio2                                                      ;"还原系统到C盘"
   If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED Then
    GUICtrlSetState($Labelz,  $GUI_ENABLE)              ;JiHuo
    GUICtrlSetState($Labelzz,  $GUI_ENABLE)           ;JiHuo
                                GUICtrlSetState($combo,  $GUI_ENABLE)             ;JiHuo
    GUICtrlSetData($Group1, "还原镜像文件路径:")
    GUICtrlSetData($Input1, $gho_path)
   EndIf
  Case $nMsg = $Radio1                                                      ;     "备份C盘系统"
   If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then
    GUICtrlSetState($Labelz, $GUI_DISABLE)    ;灰色
    GUICtrlSetState($Labelzz, $GUI_DISABLE)   ;灰色
                                GUICtrlSetState($combo, $GUI_DISABLE)     ;灰色  
    GUICtrlSetData($Group1, "备份镜像文件路径:")
    GUICtrlSetData($Input1, $name)
   
   EndIf
  Case $nMsg = $Button3
                        If GUICtrlRead($Radio1)= $GUI_CHECKED Then
      $path = FileSaveDialog("", "", "Ghost 镜像(*.GHO)", "")
    If $path <> "" Then
     $Dirve2 = StringLeft($path, 1)
     If $Dirve2 = "C" Then
      MsgBox(64, "提示", "镜像文件不能保存于 C 盘,请重新选择备份路径。")
      GUICtrlSetData($Input1, "")
     Else
      If StringRight($path, 4) = ".GHO" Then
         GUICtrlSetData($Input1, $path)
      Else
                                                   GUICtrlSetData($Input1, $path &".GHO")
                                                EndIf
                                                   $path = GUICtrlRead($Input1)
                                                   If FileExists($path) Then
                                                      $ask1 = MsgBox(48 + 4, "警告", "您确定要覆盖" & $path & "吗?")
            If $ask1 = 6 Then
        GUICtrlSetData($Input1, $path)
                                                             Else
                                                                GUICtrlSetData($Input1,"")   
            EndIf
                                                   Else
                                                        GUICtrlSetData($Input1, $path)
                                                   EndIf
     EndIf
                               EndIf
                          EndIf
                        If GUICtrlRead($Radio2)= $GUI_CHECKED Then
                           $path = FileOpenDialog("查找", "", "镜像(*.gho)")
                           If $path <> "" Then
                              GUICtrlSetData($Input1,$path)
                           EndIf
                        EndIf
   Case $nMsg = $Button1
  If GUICtrlRead($Radio2) = $GUI_CHECKED Then             ;"还原系统到C盘"
                               If  Not FileExists(GUICtrlRead($Input1)) Then
                                     MsgBox(0, "错误!", "没有找到可以还原的镜像!")
                                     GUICtrlSetData($Input1,"")
          Else
                                     $D1 = StringLeft(GUICtrlRead($Input1), 2)
                If $D1 ="C:" Then
            MsgBox(0, "错误!", "你选择的镜像在“C”盘,不能恢复!")
                                              GUICtrlSetData($Input1,"")
         Else
                                        GUICtrlSetState($Button1, $GUI_DISABLE)
     $dir = @WindowsDir
     $systemroot = StringRegExpReplace($dir, "(\S:).*$", "$1")
     If StringLeft($systemroot, 2) = "X:" Then
                                         $bakdrive = IniRead(@SystemDir & "\Ghost.ini", "HardDisk", @HomeDrive, "1:1")
                                         $bakname = StringTrimLeft(GUICtrlRead($Input1), 2)
                                         $BFP = IniRead(@SystemDir & "\Ghost.InI", "HardDisk", $D1, "1:2")
                                                FileInstall("Ghost32.dll", @WindowsDir & "\GHOST32.EXE",1)
                                                FileInstall("32.bat", @WindowsDir & "\32.bat",1)
                                                $bat = FileOpen(@WindowsDir & "\32.bat", 2)
                                                FileWrite($bat,"Ghost32.exe -nousb -noide -clone,mode=pload,src=" & $BFP & "" & $bakname & ":1,dst=" & $bakdrive & " -crcignore -sure")
                                                FileClose($bat)                     
                                                RunWait(@WindowsDir & "\32.bat", @SystemDir & "\", @SW_HIDE)
                                                MsgBox(0, "安装系统", "安装系统完成!")
                                                Exit
                                             
      Else
                                               GUICtrlSetState($Button1, $GUI_DISABLE)
                                               RESTORE()
      EndIf
        EndIf
               EndIf        
  EndIf
  
  If GUICtrlRead($Radio1) = $GUI_CHECKED Then            ;     "备份C盘系统"
                        $D1 = StringLeft(GUICtrlRead($Input1), 2)
                        If $D1 ="C:" Then
         MsgBox(0, "错误!", "镜像不能保存在“C”盘!")
                              GUICtrlSetData($Input1,"")
   Else
                              $path = GUICtrlRead($Input1)
                              If StringRight($path, 4) = ".GHO" Then
             $path = $path
         Else
                                  $path =$path&".GHO"
                              EndIf
                              $bName = stringsplit($path, "\" , 1 )
                              $name = $bName[$bName[0]]
                              $name1 = StringReplace($path,"\" & $name,"")
                              If StringRight($name1, 1) <> ":" Then
                                 If  Not FileExists($name1) Then
                                     DirCreate($name1)
                                 EndIf
                              EndIf
                              GUICtrlSetState($Button1, $GUI_DISABLE)
                              $dir = @WindowsDir
         $systemroot = StringRegExpReplace($dir, "(\S:).*$", "$1")
         If StringLeft($systemroot, 2) ="X:" Then
                          $bakdrive = IniRead(@SystemDir & "\Ghost.ini", "HardDisk", @HomeDrive, "1:1")
                          $bakname = StringTrimLeft($path, 2)
                          $BFP = IniRead(@SystemDir & "\Ghost.InI", "HardDisk", $D1, "1:2")
                                        FileInstall("Ghost32.dll", @WindowsDir & "\GHOST32.EXE",1)
                                        FileInstall("32.bat", @WindowsDir & "\32.bat",1)
                                        $bat = FileOpen(@WindowsDir & "\32.bat", 2)
                                        FileWrite($bat,"Ghost32.exe  -nousb -noide -clone,mode=pdump,src=" & $bakdrive &",dst=" & $BFP & "" & $bakname & "  -sure -fro -z9")
                                        FileClose($bat)                     
                                        RunWait(@WindowsDir & "\32.bat", @SystemDir & "\", @SW_HIDE)
                                        MsgBox(0, "备份系统", "备份系统完成!")
                                     Exit
                              
                             Else
                                    backup()
       EndIf
        EndIf
                EndIf
EndSelect
WEnd
   
http://pan.baidu.com/share/link?shareid=3311698534&uk=922779640

评分

参与人数 1硬盘 +20 收起 理由
ampc81 + 20

本文地址: https://www.ampc8.com/thread-13085-1-1.html
上一篇:虚拟启动测试工具1.0
下一篇:(AM电脑吧)AMPE工具箱,不修改系统的PE
回复

举报

ampc839210

签到天数: 271 天

[LV.8]八秒开机

id trhy1234567 发表于 2016-06-22 17:12:01
感谢分享,支持。
回复

举报

ampc88849

签到天数: 3 天

[LV.2]二兆带宽

id [帐号异常] 发表于 2016-01-18 16:08:20
真心的不错,赞一个。已下载。
回复

举报

ampc825976

签到: Lazy

id bbc000067247 发表于 2015-06-10 14:09:10
ghost镜像工具v2.1(源码) 应该很牛
回复

举报

ampc827419

签到: Lazy

id xzf680 发表于 2015-03-18 17:14:02
太强了,不顶也不行哈!
回复

举报

ampc824284

签到天数: 24 天

[LV.4]四枚内存条

id a290450620 发表于 2014-10-29 21:23:48
支持啊 牛逼
回复

举报

ampc824256

签到: Lazy

id 151741850 发表于 2014-09-14 19:35:13
好的地方都有大神
回复

举报

ampc822003

签到天数: 3 天

[LV.2]二兆带宽

id 影子天团 发表于 2014-05-18 02:47:26
赞一个,哈哈
回复

举报

ampc820669

签到: Lazy

id zsdjs 发表于 2014-05-02 12:27:38
知道的出来改一改啊!!!!PE下无法使用啊!!!!!!
回复

举报

ampc820669

签到: Lazy

id zsdjs 发表于 2014-04-26 15:40:02
PE下不能使用啊!!!!!
回复

举报

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

Powered by AMpc8.Com (晋ICP备13003365号ghs 晋公网安备 14090202000112号 |GMT+8, 2024/3/29 23:42 |
快速回复 返回顶部 返回列表