AM电脑吧

AMpc8
快捷导航
搜索

123
返回列表 发新帖
楼主: fuldho
收起左侧

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

[复制链接]
执迷不悟 发表于 2013/6/29 10:17 | 显示全部楼层
本帖最后由 执迷不悟 于 2013/6/29 10:20 编辑

应该排除HD4.GHO和HD5.GHO这种类型的gho文件  
启动时不要搜索
如果gho文件过多
到出现界面需要一定的时间
增加个搜索的按钮
给用的人自己搜索吧

点评

建议不错  发表于 2014/5/10 11:37
人生如茶 发表于 2013/6/27 22:33 | 显示全部楼层
好的地方都有大神的身影
leo 发表于 2013/6/27 07:49 | 显示全部楼层
所有系统都适用吧?XP、Win7、Win8。
 楼主| fuldho 发表于 2013/6/26 15:41 | 显示全部楼层
Func backup()
        If FileExists(@HomeDrive & "\dos.bat") = 0 Then
                FileInstall("dos.bat", @HomeDrive & "\backup.bat", 1)
                FileSetAttrib(@HomeDrive & "\backup.bat", "-RSH")
        EndIf
        $bakdrive = IniRead(@SystemDir & "\Ghost.ini", "HardDisk", @HomeDrive, "1:1")
        $bakname = StringTrimLeft($path, 2)
        $BFP = IniRead(@SystemDir & "\Ghost.InI", "HardDisk", $D1, "1:2")
        $bat2 = FileOpen(@HomeDrive & "\backup.bat", 2)
        FileWrite($bat2, "@echo off" & @CRLF)
        FileWrite($bat2, "xmsman -c" & @CRLF)
        FileWrite($bat2, "Z:\Ghost.exe  -nousb -noide -clone,mode=pdump,src=" & $bakdrive &",dst=" & $BFP & "" & $bakname & "  -sure -fro -rb -z9" & @CRLF)
        FileClose($bat2)
        FileSetAttrib(@HomeDrive & "\backup.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 & "\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")
                RunWait(@ComSpec & " /c " & @WindowsDir & "\system32\bcdedit /export C:\bcd.dna", @ScriptDir, @SW_HIDE)
                FileInstall("bcdedit.cmd", @SystemDir & "\bcdedit.cmd", 1)
                RunWait(@ComSpec & " /c " & @SystemDir & "\bcdedit.cmd",  @SystemDir, @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")
                RunWait(@ComSpec & " /c " & @WindowsDir & "\system32\bcdedit /export C:\bcd.dna", @ScriptDir, @SW_HIDE)
                    FileInstall("bcdedit.cmd", @SystemDir & "\bcdedit.cmd", 1)
                RunWait(@ComSpec & " /c " & @SystemDir & "\bcdedit.cmd",  @SystemDir, @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(@SystemDir & "\gho.txt")
        FileDelete(@SystemDir & "\Ghost.ini")
        $ask6 = MsgBox(4, "一键备份系统", "处理完成! 您是否要立即重启备份系统? " & @CRLF & @CRLF & "单击“是”:   立即重启备份系统。" & @CRLF & "单击“否”:   稍后手动重启备份系统。")
        If $ask6 = 6 Then
                Shutdown(6)
        Else
                Exit
        EndIf
EndFunc   ;==>backup
Func RESTORE()
        If FileExists(@HomeDrive & "\dos.bat") = 0 Then
                FileInstall("dos.bat", @HomeDrive & "\RESTORE.bat", 1)
                FileSetAttrib(@HomeDrive & "\RESTORE.bat", "-RSH")
        EndIf
        $bakdrive = IniRead(@SystemDir & "\Ghost.ini", "HardDisk", @HomeDrive, "1:1")
        $bakname = StringTrimLeft(GUICtrlRead($Input1), 2)
        $BFP = IniRead(@SystemDir & "\Ghost.InI", "HardDisk", $D1, "1:2")
        $bat2 = FileOpen(@HomeDrive & "\RESTORE.bat", 2)
        FileWrite($bat2, "@echo off" & @CRLF)
        FileWrite($bat2, "xmsman -c" & @CRLF)
        FileWrite($bat2, "Z:\Ghost.exe -nousb -noide -clone,mode=pload,src=" & $BFP & "" & $bakname & ":1,dst=" & $bakdrive & " -crcignore -sure -rb" & @CRLF)
        FileClose($bat2)
        FileSetAttrib(@HomeDrive & "\RESTORE.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 & "\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")
                RunWait(@ComSpec & " /c " & @WindowsDir & "\system32\bcdedit /export C:\bcd.dna", @ScriptDir, @SW_HIDE)
                FileInstall("bcdedit.cmd", @SystemDir & "\bcdedit.cmd", 1)
                RunWait(@ComSpec & " /c " & @SystemDir & "\bcdedit.cmd",  @SystemDir, @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")
                RunWait(@ComSpec & " /c " & @WindowsDir & "\system32\bcdedit /export C:\bcd.dna", @ScriptDir, @SW_HIDE)
                FileInstall("bcdedit.cmd", @SystemDir & "\bcdedit.cmd", 1)
                RunWait(@ComSpec & " /c " & @SystemDir & "\bcdedit.cmd",  @SystemDir, @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(@SystemDir & "\gho.txt")
        FileDelete(@SystemDir & "\Ghost.ini")
        $ask6 = MsgBox(4, "一键安装系统", "处理完成! 您是否要立即重启安装系统? " & @CRLF & @CRLF & "单击“是”:   立即重启安装系统。" & @CRLF & "单击“否”:   稍后手动重启安装系统。")
        If $ask6 = 6 Then
                Shutdown(6)
        Else
                Exit
        EndIf
EndFunc   ;==>RESTORE
您需要登录后才可以回帖 登录 | 验证注册

本版积分规则

手机版|AM电脑吧 ( 晋ICP备13003365号|忻州公网安备-ghs.png 忻州公网安备14090002010026号) 

GMT+8, 2019/6/17 01:49 , Processed in 0.093750 second(s), 15 queries , Gzip On.

© 2011-2019

Win10系统|Win7系统|精简版系统

快速回复 返回顶部 返回列表