|
#NoTrayIcon
#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=biosclub.ico
#AutoIt3Wrapper_outfile=zeroonekey.exe
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <process.au3>
#include <Constants.au3>
#include <file.au3>
#include <array.au3>
#include <GUIStatusBar.au3>
#include <GuiTab.au3>
Dim $Dll
;判断程序是否重复运行
$g_szVersion = "ZeroTOOLSv1.0"
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)
;建立工具箱目录
$finddir=FileFindFirstFile (StringLeft(@WindowsDir,2)&"\Zero")
if $finddir=-1 then
DirCreate (StringLeft(@WindowsDir,2)&"\Zero")
EndIf
FileInstall("biosclub.ico",@SystemDir&"\",1)
FileInstall("biosclub.ico",@WindowsDir&"\",1)
FileInstall("Stylish.skf",@SystemDir&"\",1)
;FileInstall("XP-style.skf",@SystemDir&"\",1)
;FileInstall("logo.jpg",@SystemDir&"\",1)
FileInstall("SkinCrafterDll.dll",@SystemDir&"\",1)
#Region ### START Koda GUI section ### Form=D:\au3脚本\收藏夹程序\Form1.kxf
;获取硬盘分区参数开始
;***********************************************************************
; 函数说明
;$partfile 生成的分区信息文件
;$hdinfo 硬盘分区盘符信息
;$hdinfolast 硬盘最后一个分区盘符信息
;$partno 硬盘分区编号信息
;$partnolast 硬盘最后一个分区编号信息
;$CountLines 分区信息文件行数
;$str 分区信息文件读取变量
;$strlast 分区信息文件最后一组数据读取变量
;**************************************************************************
;查看并生
Dim $partfile,$hdinfo,$hdinfolast,$str,$partno,$CountLines,$strlast,$partnolast,$p
FileInstall("dsptw.exe",StringLeft(@WindowsDir,2)&"\Zero\dsptw.exe",1)
_rundos( StringLeft(@WindowsDir,2)&"\Zero\dsptw.exe /A /PDR > " & @SystemDir & "\diskinfo.dll")
Global $partfile=FileOpen(@SystemDir & "\diskinfo.dll",0)
If $partfile=-1 Then MsgBox(16,"错误","硬盘可能可能有错误,请先检查!")
FileDelete(StringLeft(@WindowsDir,2)&"\Zero\dsptw.exe")
Global $CountLines = _FileCountLines(@SystemDir & "\diskinfo.dll") ;获取的行数比实际有数据的行数多1
For $p = 3 To $CountLines
Global $str=FileReadLine($partfile,$p) ;读取文件数据区
Global $strlast=FileReadLine($partfile,$CountLines-1) ;读取文件最后一行
Global $hdinfo=StringMid($str,1,2) ;得到分区盘符
Global $hdinfofist=StringMid(FileReadLine($partfile,3),1,2) ;得到第一个分区盘符
Global $hdinfolast=StringMid($strlast,1,2) ;得到最后一行的盘符
Global $partno=String(StringMid($str,4,3)) ;得到分区编号
Global $partnofist=String(StringMid(FileReadLine($partfile,3),4,3));得到第一个分区的编号
Global $partnolast=String(StringMid($strlast,4,3)) ;得到最后一个分区的编号
Global $bfpart=$hdinfolast
;MsgBox(4096,"Drive " &$hdinfo, $partno)
Next
;获取硬盘分区参数结束
$var = DriveGetDrive("FIXED")
If Not @error Then
; $i = $var[0]
For $p = 1 To $var[0]
;$varhd = GUICtrlSetData($AcceptList1, StringUpper($var[$p]))
$lasthd = StringUpper($var[0])
$lastdrv = StringUpper($var[$lasthd])
Next
EndIf
$windir=StringLeft(@WindowsDir,2)
$windirs=(Round(DriveSpaceTotal($windir)) - Round(DriveSpaceFree($windir))) & "M"
$windirp=DriveGetFileSystem($windir)
$winsys=@OSVersion
$getlist=StringLeft(@WindowsDir,1)
Select
Case $winsys="WIN_2003"
$winos="Windows 2003"
Case $winsys="WIN_XP"
$winos="Windows XP"
case $winsys="WIN_2000"
$winos="Windows 2000"
case $winsys="WIN_NT4"
$winos="Windows NT4"
EndSelect
#Region ### START Koda GUI section ### Form=D:\au3脚本\onekey v1.0\Form1.kxf
$about = GUICreate(" ZeroOneKey GHOST11 V1.0", 324, 184, -1, -1)
GUISetIcon(@SystemDir &"\biosclub.ico")
_SkinGUI(@SystemDir &"\SkinCrafterDll.dll", @SystemDir &"\Stylish.skf", $about)
$aboutGroup1 = GUICtrlCreateGroup("版本信息:", 8, 2, 307, 78)
$aboutLabel1 = GUICtrlCreateLabel("程序中文名:零点一键备份还原 V1.0版", 16, 18, 250, 17, $WS_GROUP)
$aboutLabel2 = GUICtrlCreateLabel("程序英文名:ZeroOneKey V1.0", 16, 38, 250, 17, $WS_GROUP)
$aboutLabel3 = GUICtrlCreateLabel("程序内核名:GHOST 11.0.1.1533", 16, 58, 250, 17, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$aboutGroup2 = GUICtrlCreateGroup("请选择:", 8, 80, 307, 70)
$aboutLabel4 = GUICtrlCreateLabel("硬盘第一分区为:"&$hdinfofist, 16, 95, 200, 17, $WS_GROUP)
$aboutLabel5 = GUICtrlCreateLabel("系统所在分区为:"&$windir, 160, 95, 140, 17, $WS_GROUP)
$bakup = GUICtrlCreateButton("备份(&B)", 55, 115, 75, 25)
$restore = GUICtrlCreateButton("还原(&R)", 140, 115, 75, 25)
$btcancel = GUICtrlCreateButton("取消(&C)", 225, 115, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$aboutLabel7 = GUICtrlCreateLabel("程序:http://www.biosclub.com QQ:78357343", 16, 160, 270, 17, $WS_GROUP)
;GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $bakup
GUIDelete($about)
bakup()
case $restore
GUIDelete($about)
restore()
case $btcancel
Exit
EndSwitch
WEnd
func bakup()
#Region ### START Koda GUI section ### Form=D:\au3脚本\onekey v1.0\Form1.kxf
$Form1 = GUICreate("ZeroOneKey GHOST11 V1.0", 355, 190, -1, -1,BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))
GUISetIcon(@SystemDir &"\biosclub.ico")
_SkinGUI(@SystemDir &"\SkinCrafterDll.dll", @SystemDir &"\Stylish.skf", $Form1)
$Group1 = GUICtrlCreateGroup("系统信息:", 8, 0, 340, 57)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("操作系统:"&$winos&" "&@OSServicePack, 16, 16, 300, 17)
$Label2 = GUICtrlCreateLabel("系统分区:"& $windir, 16, 32, 120, 17)
$Label3 = GUICtrlCreateLabel("分区格式:"& $windirp, 120, 32, 120, 17)
$Label4 = GUICtrlCreateLabel("空间占用:"&$windirs, 224, 32, 120, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("功能选择:", 8, 56, 340, 97)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("将分区:", 17, 76, 52, 17)
$fromdisk = GUICtrlCreateCombo($hdinfofist&" "&$partnofist, 96, 72, 58, 30,$CBS_DROPDOWNLIST)
$Label6 = GUICtrlCreateLabel("备份到:", 170, 76, 52, 17)
$todisk = GUICtrlCreateCombo($hdinfolast&" "&$partnolast, 250, 72, 58, 30,$CBS_DROPDOWNLIST)
$Label7 = GUICtrlCreateLabel($hdinfofist&"盘已用空间:"&(Round(DriveSpaceTotal($windir)) - Round(DriveSpaceFree($windir))) & "M", 17, 100, 150, 17,$WS_DISABLED)
$Label8 = GUICtrlCreateLabel($hdinfolast&"盘可用空间:"& Round(DriveSpaceFree($hdinfolast)) & "M", 170, 100, 150, 17,$WS_DISABLED)
$Label9 = GUICtrlCreateLabel("备份文件名:", 16, 124, 76, 17)
$ghostname = GUICtrlCreateInput($bfpart&"\GHOST\"&StringLeft($windir,1)&"_"&$winsys, 96, 120, 121, 21,$ES_READONLY)
GUICtrlSetTip(-1, $bfpart&"\GHOST\"&StringLeft($windir,1)&"_"&$winsys&".GHO")
$Label10 = GUICtrlCreateLabel(".GHO", 224, 124, 31, 17)
$ghorar = GUICtrlCreateCombo("", 256, 120, 73, 25,$CBS_DROPDOWNLIST)
GUICtrlSetFont($GhoRAR, 9, 400, 0, "宋体")
GUICtrlSetData($GhoRAR, "不压缩|快速压缩|高压缩|最高压缩","快速压缩")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$btok = GUICtrlCreateButton("确定(&O)", 160, 160, 75, 25, 0)
$cancel = GUICtrlCreateButton("关闭(&C)", 256, 160, 75, 25, 0)
$Label11 = GUICtrlCreateLabel("程序: QQ:78357343", 8, 168, 130, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
For $p = 3 To $CountLines
Global $str=FileReadLine($partfile,$p) ;读取文件数据区
Global $strlast=FileReadLine($partfile,$CountLines-1) ;读取文件最后一行
Global $hdinfo=StringMid($str,1,2) ;得到分区盘符
Global $hdinfofist=StringMid(FileReadLine($partfile,3),1,2) ;得到第一个分区盘符
Global $hdinfolast=StringMid($strlast,1,2) ;得到最后一行的盘符
Global $partno=String(StringMid($str,4,3)) ;得到分区编号
Global $partnofist=String(StringMid(FileReadLine($partfile,3),4,3));得到第一个分区的编号
Global $partnolast=String(StringMid($strlast,4,3)) ;得到最后一个分区的编号
$varhdform = GUICtrlSetData($fromdisk, StringUpper($hdinfo&" "&$partno)) ;生成下拉例表数据
$varhdto = GUICtrlSetData($todisk, StringUpper($hdinfo&" "&$partno)) ;生成下拉例表数据
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $fromdisk
$getfrom=GUICtrlRead($fromdisk)
$fromleft=StringLeft($getfrom,2)
$getto=GUICtrlRead($todisk)
$toleft=StringLeft($getto,2)
if $fromleft=$toleft Then
MsgBox(64,"警告!","备份分区与镜像存放分区不能是同一分区!!",5)
GUICtrlSetData($fromdisk,$hdinfofist&" "&$partnofist,$hdinfofist&" "&$partnofist)
Else
if $fromleft = $windir then
GUICtrlSetData ($ghostname,$toleft&"\GHOST\"&StringLeft($fromleft,1)&"_"&$winsys)
GUICtrlSetTip($ghostname, $toleft&"\GHOST\"&StringLeft($fromleft,1)&"_"&$winsys&".GHO")
Else
GUICtrlSetData ($ghostname,$toleft&"\GHOST\"&StringLeft($fromleft,1)&"_DATA")
GUICtrlSetTip($ghostname, $toleft&"\GHOST\"&StringLeft($fromleft,1)&"_DATA.GHO")
EndIf
GUICtrlSetData($Label7, $fromleft & "盘已用空间:" & (Round(DriveSpaceTotal($fromleft)) - Round(DriveSpaceFree($fromleft))) & "M")
EndIf
case $todisk
$getto=GUICtrlRead($todisk)
$toleft=StringLeft($getto,2)
$getfrom=GUICtrlRead($fromdisk)
$fromleft=StringLeft($getfrom,2)
if $fromleft=$toleft Then
MsgBox(64,"警告!","备份分区与镜像存放分区不能是同一分区!!",5)
GUICtrlSetData($todisk,$hdinfolast&" "&$partnolast,$hdinfolast&" "&$partnolast)
Else
if $fromleft = $windir then
GUICtrlSetData ($ghostname,$toleft&"\GHOST\"&StringLeft($fromleft,1)&"_"&$winsys)
GUICtrlSetTip($ghostname, $toleft&"\GHOST\"&StringLeft($fromleft,1)&"_"&$winsys&".GHO")
Else
GUICtrlSetData ($ghostname,$toleft&"\GHOST\"&StringLeft($fromleft,1)&"_DATA")
GUICtrlSetTip($ghostname, $toleft&"\GHOST\"&StringLeft($fromleft,1)&"_DATA.GHO")
EndIf
GUICtrlSetData($Label8, $toleft & "盘已用空间:" & (Round(DriveSpaceTotal($toleft)) - Round(DriveSpaceFree($toleft))) & "M")
EndIf
$getfrom=GUICtrlRead($fromdisk)
$ghostsys=$getfrom
CASE $btok
$getGhoRAR=GUICtrlRead($GhoRAR)
Select
Case $getGhoRAR="不压缩"
$grar=""
Case $getGhoRAR="快速压缩"
$grar="-z1"
case $getGhoRAR="高压缩"
$grar="-z3"
case $getGhoRAR="最高压缩"
$grar="-z9"
EndSelect
$getbakname1=GUICtrlRead($ghostname)
$getfrom=GUICtrlRead($fromdisk)
$srcform=StringRight($getfrom,3)
$getto=GUICtrlRead($todisk)
$dstto=StringRight($getto,3)
$dsttopart=StringLeft($getto,2)
$sumname=StringLen($getbakname1)
$getbakname=StringRight($getbakname1,$sumname-2)
$finddir=FileFindFirstFile ($dsttopart&"\GHOST")
if $finddir=-1 then
DirCreate ($dsttopart&"\GHOST")
EndIf
;此处要更新代码
$ghostbat="ghost.exe -clone,mode=pdump,src="& $srcform &",dst="& $dstto & $getbakname & ".zer -sure -nousb -fro -rb " &$grar
;$ghostrebat="ghost -clone,mode=pload,src=1:"& $dstto & $getbakname&":1,dst=1:"& $srcform &" -sure -no1394 -nousb -rb"
if FileExists(@HomeDrive &"\Zero\ghost.bat") Then FileDelete(@HomeDrive &"\Zero\ghost.bat")
if FileExists(@SystemDir & "\diskinfo.dll") Then FileDelete(@SystemDir & "\diskinfo.dll")
if not FileExists(@HomeDrive &"\Zero\ghost.bat") Then FileInstall("ghost.bat",@HomeDrive &"\Zero\ghost.bat",1)
;$file = FileOpen(@HomeDrive &"\Zero\ghost.bat", 2)
;If $file = -1 Then
;MsgBox(0, "错误", "无法打开目标文件。")
;Exit
;EndIf
;FileWrite($file,"cls"& @CRLF)
;FileWrite($file,"@echo off"& @CRLF)
;FileWrite($file,"attrib -r -s -h %s%:\pagefile.sys>nul"& @CRLF)
;FileWrite($file,"del %s%:\pagefile.sys>nul"& @CRLF)
;FileWrite($file,"xmsman -c>nul"& @CRLF)
;FileWrite($file,$ghostbat& @CRLF)
;FileWrite($file,"restart")
;FileClose($file)
if not FileExists(@HomeDrive &"\Zero\ghost.bat") Then FileWrite(@HomeDrive &"\Zero\ghost.bat",$ghostbat)
;if not FileExists(@HomeDrive &"\Zero\Zero.gz") Then FileWrite(@HomeDrive &"\Zero\Zero.gz",$ghostrebat)
if FileExists(@HomeDrive &"\grldr") then FileCopy(@HomeDrive &"\grldr",@HomeDrive &"\Zero\grldr.bak")
if not FileExists(@HomeDrive &"\grldr") Then FileInstall("grldr",@HomeDrive &"\grldr",1)
if not FileExists(@HomeDrive &"\Zero\Zero.img") Then FileInstall("Zero.img",@HomeDrive &"\Zero\Zero.img",1);一键备份还原工具
if not FileExists(@HomeDrive &"\Zero\menu.lst") Then FileInstall("menu.lst",@HomeDrive &"\Zero\menu.lst",1);一键备份还原菜单
if not FileExists(@HomeDrive &"\Zero\ghost.exe") Then FileInstall("ghost.exe",@HomeDrive &"\Zero\ghost.exe",1);一键备份还原
if not FileExists(@HomeDrive &"\Zero\ghost.bat") Then FileInstall("ghost.bat",@HomeDrive &"\Zero\ghost.bat",1);一键备份还原
FileSetAttrib("c:\boot.ini", "-SHR")
FileCopy("c:\boot.ini", "c:\Zero\boot.bak")
IniWrite("c:\boot.ini", "boot loader", "timeout", 1)
IniWrite("c:\boot.ini", "boot loader", "default", "C:\grldr")
IniWrite("c:\boot.ini", "operating systems", "C:\grldr", "ZeroOneKey Ghost 11")
$msg = MsgBox(8192 + 0 + 64 + 4, "是否重启", "要重启计算机立即进行一键恢复吗?")
If $msg = 6 Then
if FileExists(@SystemDir & "\diskinfo.dll") Then FileDelete(@SystemDir & "\diskinfo.dll")
if FileExists(@SystemDir & "\SkinCrafterDll.dll") Then FileDelete(@SystemDir & "\SkinCrafterDll.dll")
if FileExists(@SystemDir & "\logo.jpg") Then FileDelete(@SystemDir & "\logo.jpg")
if FileExists(@SystemDir & "\biosclub.ico") Then FileDelete(@SystemDir & "\biosclub.ico")
Shutdown(2)
Else
if FileExists(@SystemDir & "\diskinfo.dll") Then FileDelete(@SystemDir & "\diskinfo.dll")
if FileExists(@SystemDir & "\SkinCrafterDll.dll") Then FileDelete(@SystemDir & "\SkinCrafterDll.dll")
if FileExists(@SystemDir & "\logo.jpg") Then FileDelete(@SystemDir & "\logo.jpg")
if FileExists(@SystemDir & "\biosclub.ico") Then FileDelete(@SystemDir & "\biosclub.ico")
FileCopy("c:\Zero\boot.bak","c:\boot.ini",1)
FileSetAttrib("c:\boot.ini","+RSH")
DirRemove("c:\Zero",1)
FileDelete("c:\grldr")
if FileExists(@HomeDrive &"\Zero\grldr.bak") then filecopy(@HomeDrive &"\Zero\grldr.bak",@HomeDrive&"\grldr")
Exit
EndIf
case $cancel
Exit
EndSwitch
WEnd
EndFunc
Func restore()
EndFunc
Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
$Dll = DllOpen($SkincrafterDll)
DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr",0, "wstr", "", "wstr", "", "wstr", "", "wstr", "")
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
DllCall($Dll, "int:cdecl", "ApplySkin")
EndFunc ;==_SkinGUI
Func Quit()
GUISetState(@SW_HIDE)
DllCall($dll, "int", "DeInitDecoration")
DllCall($dll, "int", "RemoveSkin")
DllClose($dll)
Exit
EndFunc
以上代码在运行AU3的时候是没有问题 转换EXE以后 就会提示如下错误
Line -1:
Error:变量没有在开始声明
谢谢啦 |
|