|
UD&FBA安装工具GUI版开源大礼免费分享,感谢原创无私奉献[类似一键工作室]
界面如图:
以下是源代码,不会用高亮显示,请版主帮我改下高亮显示,谢谢!
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=C:\Users\Administrator\Desktop\20080717215414607.ico
#AutoIt3Wrapper_OutFile=New_USB_System 2011_V4.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUPX=n
#AutoIt3Wrapper_Res_Comment=Power By Repaik.com
#AutoIt3Wrapper_Res_Description=New USB System 2011 V4
#AutoIt3Wrapper_Res_FileVersion=2.9.426.2011
[email=#AutoIt3Wrapper_Res_LegalCopyright=@copyright]#AutoIt3Wrapper_Res_LegalCopyright=@copyright[/email] 2010
#AutoIt3Wrapper_Res_Field=CompanyName|Power By Repaik.com
#AutoIt3Wrapper_Res_Field=程序设计|Roustar31
#AutoIt3Wrapper_Res_Field=首发论坛|http://www.repaik.com
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <ListViewConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <ProgressConstants.au3>
#include <GuiImageList.au3>
#include <Process.au3>
Opt("TrayIconHide", 1)
Dim $Dll
Global $DwptW = @SystemDir & '\DsptW.eXe'
Global $ShowDrive = @SystemDir & '\ShowDrive.eXe'
Global $Part = @SystemDir & '\Part.Txt'
Global $GhostIni = @SystemDir & '\Ghost.InI'
If FileExists($GhostIni) Then FileDelete($GhostIni)
FileInstall('ShowDrive.Vxd', $ShowDrive, 1)
RunWait($ShowDrive & ' /S', '', @SW_HIDE)
FileDelete($ShowDrive)
FileInstall('DsptW.Vxd', $DwptW, 1)
If FileExists($Part) Then FileDelete($Part)
RunWait(@ComSpec & ' /C ' & $DwptW & ' 0 /L >' & $Part, '', @SW_HIDE)
$SerailNumber = StringMid(FileReadLine($Part, 3), 59)
FileDelete($Part)
For $i = 1 To 26
RunWait(@ComSpec & ' /C ' & $DwptW & ' ' & $i & ' /Find:All /GhostStyle >>' & $Part, '', @SW_HIDE)
If StringInStr(FileRead($Part), 'Error') Then ExitLoop
Next
FileDelete($DwptW)
Dim $v
_FileReadToArray($Part, $v)
FileWrite($GhostIni, '[HardDisk]' & @CRLF)
For $i = 1 To $v[0]
$ReadLine = FileReadLine($Part, $i)
If StringInStr($ReadLine, 'Error') Then ExitLoop
If Not StringInStr($ReadLine, 'No.') And StringInStr($ReadLine, ':') Then
$GhostStr = StringMid($ReadLine, 6, 2) & '=' & StringMid($ReadLine, 1, 3)
If StringMid($GhostStr, 1, 1) = 1 And StringMid($ReadLine, 6, 2) = ' ' Then
FileWriteLine($GhostIni, StringReplace($GhostStr & 'C:', ' ', ''))
Else
FileWriteLine($GhostIni, $GhostStr)
EndIf
ExitLoop
EndIf
Next
For $i = 1 To $v[0]
$ReadLine = FileReadLine($Part, $i)
If StringInStr($ReadLine, 'Error') Then ExitLoop
If Not StringInStr($ReadLine, 'No.') And StringInStr($ReadLine, ':') Then
$GhostStr = StringMid($ReadLine, 6, 2) & '=' & StringMid($ReadLine, 1, 3)
If StringMid($ReadLine, 6, 2) <> '' And Not StringInStr($GhostStr, '1:1') Then FileWriteLine($GhostIni, $GhostStr)
EndIf
Next
FileDelete($Part)
_FileReadToArray($GhostIni, $v)
For $i = 2 To $v[0]
$ReadLine = StringLeft(FileReadLine($GhostIni, $i), 3)
If StringLeft($ReadLine, 1) = 1 Then
ExitLoop
EndIf
Next
$Var = IniReadSection($GhostIni, 'HardDisk')
If @error Then
MsgBox(262144, '', '出错了啦! 当前目录找不到 Ghost.InI 文件.')
Else
For $i = 1 To $Var[0][0]
$GetLastP = StringMid($Var[$i][0], 1, 1)
If StringInStr($GetLastP, 'H') Then $GetLastP = StringMid($Var[$i + 1][0], 1, 1)
If $GetLastP <> 1 Then
ExitLoop
EndIf
Next
EndIf
$i = 1
$Str = "CDEFGHIJKLMNOPQRSTUVWXYZ"
While $i <= 24
$Str1 = StringLeft($Str, $i)
$Dirve = StringRight($Str1, 1)
$Var = DriveGetType($Dirve & ":\")
If FileExists($Dirve & ":\") Then
If $Var = "REMOVABLE" Then
$Dirve1 = $Dirve & ":"
EndIf
If $Var <> "REMOVABLE" Then
$Dirve1 = ""
EndIf
EndIf
$i = $i + 1
WEnd
ini()
$usbhdd = IniRead($GhostIni, "USB", "name", "请插入U盘")
If $Dirve1 <> "" Then
$usbhdd1 = $Dirve1 & "名称:" & $usbhdd
EndIf
If $Dirve1 = "" Then
$usbhdd1 = "请插入U盘再运行本程序!"
MsgBox(64, "", "你没有插入U盘请插入U盘再运行本程序!" & @CRLF & "请先插入要制作的U盘,再运行本程序!")
Exit
EndIf
FileInstall("SkinCrafterDll.dll", @TempDir & "\SkinCrafterDll.dll", 1)
FileInstall("vista.skf", @TempDir & "\vista.skf", 1)
$Form1 = GUICreate("New USB System 2011 V4 Power By Repaik.com 2011.4.26", 601, 465, -1, -1)
_SkinGUI(@TempDir & "\SkinCrafterDll.dll", @TempDir & "\vista.skf", $Form1)
FileInstall("usb-PE.jpg", @TempDir & "\usb-PE.jpg", 1)
$Pic1 = GUICtrlCreatePic(@TempDir & "\usb-PE.jpg", 0, 0, 600, 120)
$Label1 = GUICtrlCreateLabel("选择制作的U盘", 24, 144, 90, 20)
$Combo1 = GUICtrlCreateCombo($usbhdd1, 125, 142, 240, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Labelzip = GUICtrlCreateLabel("选择U盘启动格式", 370, 144, 100, 20)
$Combo2 = GUICtrlCreateCombo("", 480, 142, 100, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($Combo2, "USB-HDD|USB-ZIP", "USB-HDD")
$ListView1 = GUICtrlCreateListView("分区|序号|文件系统|已用容量(GB)|剩余容量(GB)|总容量(GB)", 24, 180, 556, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 60)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 100)
_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($GhostIni, "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)
$usrl = Round($zrl - $syrl, 2)
GUICtrlCreateListViewItem($read[$i][0], $ListView1)
_GUICtrlListView_AddSubItem($ListView1, $z, $read[$i][1], 1, $z + 1)
_GUICtrlListView_AddSubItem($ListView1, $z, $fjxt, 2, $z + 1)
_GUICtrlListView_AddSubItem($ListView1, $z, $syrl, 4, $z + 1)
_GUICtrlListView_AddSubItem($ListView1, $z, $zrl, 5, $z + 1)
_GUICtrlListView_AddSubItem($ListView1, $z, $usrl, 3, $z + 1)
$z += 1
Next
EndIf
_GUICtrlListView_SetItemSelected($ListView1, $read[0][0] - 1)
GUICtrlCreateGroup("注意事项", 24, 290, 560, 70)
GUICtrlCreateLabel("本程序制作成的U盘启动盘具有三防特性:防毒﹑防删﹑防格。制作成功的启动区为彻底隐藏的UD分区", 32, 310, 540, 17)
GUICtrlCreateLabel("本程序制作时需要改写U盘的启动代码,若遇到安全软件阻止请选择不拦截,否则可能不能制作成功", 34, 332, 540, 17)
$Button1 = GUICtrlCreateButton("访问导航(&B)", 30, 420, 100, 35)
$Button2 = GUICtrlCreateButton("访问论坛(&G)", 140, 420, 100, 35)
$Button3 = GUICtrlCreateButton("开始制作(&S)", 250, 420, 100, 35)
$Button5 = GUICtrlCreateButton("还原U盘(&U)", 360, 420, 100, 35)
$ZT = GUICtrlCreateLabel("当前状态:等待用户确认设置开始制作...", 130, 395, 380, 20)
$pro = GUICtrlCreateProgress(24, 370, 560, 18, $PBS_SMOOTH)
If $Dirve1 = "" Then
GUICtrlSetState($Button3, $GUI_DISABLE)
EndIf
$Button4 = GUICtrlCreateButton("退出", 470, 420, 100, 35)
GUISetState(@SW_SHOW)
Func quit()
GUISetState(@SW_HIDE)
DllCall($Dll, "int:cdecl", "DeInitDecoration")
DllCall($Dll, "int:cdecl", "RemoveSkin")
DllClose($Dll)
FileDelete(@TempDir & "\SkinCrafterDll.dll")
FileDelete(@TempDir & "\vista.skf")
FileDelete($GhostIni)
FileDelete($DwptW)
FileDelete($ShowDrive)
FileDelete(@WindowsDir & "\fbinst.exe")
FileDelete(@WindowsDir & "\abc.fba")
FileDelete(@TempDir & "\usb-PE.jpg")
Exit
EndFunc ;==>quit
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
ShellExecute("http://www.1616.net/?un7099")
Case $Button2
ShellExecute("http://www.repaik.com")
Case $Button4
quit()
Case $GUI_EVENT_CLOSE
quit()
Case $Button3
GUICtrlSetState($Button3, $GUI_DISABLE)
GUICtrlSetState($Button4, $GUI_DISABLE)
GUICtrlSetState($Button5, $GUI_DISABLE)
$ZIP = GUICtrlRead($Combo2)
If $ZIP = "USB-HDD" Then
$usb1 = ""
$usbg = " --fat32"
EndIf
If $ZIP = "USB-ZIP" Then
$usb1 = " --ZIP"
$usbg = " --fat16"
EndIf
$ZZUSB = GUICtrlRead($Combo1)
$ZZUSBHDD = StringLeft($ZZUSB, 2)
$HDFB = IniRead($GhostIni, "HardDisk", $ZZUSBHDD, "2:1")
$HDFB2 = StringLeft($HDFB, 1)
$HDFB1 = $HDFB2 - 1
GUICtrlSetData($pro, 10)
$ask = MsgBox(64 + 4, "提示", "你选择了将" & $ZZUSB & "制作成可启动U盘" & @CRLF & "要确定开始制作,请点击“是”,否则点击“否”")
If $ask = 6 Then
$ask2 = MsgBox(64 + 4 + 16, "警告", "你选择了将" & $ZZUSB & "制作成可启动U盘" & @CRLF & "一旦开始制作,U盘将被格式化,确认制作请点击“是”,否则点击“否”")
If $ask2 = 6 Then
GUICtrlSetData($ZT, "当前状态:正在准备程序必须数据中,请稍候...")
FileInstall("fbinst.exe", @WindowsDir & "\fbinst.exe", 1)
;RunWait(@ComSpec & " /c " & @WindowsDir&"\fbinst (hd"&$HDFB1&")"&"format --raw", @ScriptDir, @SW_HIDE)
RunWait(@WindowsDir & "\fbinst (hd" & $HDFB1 & ")" & " format --raw --force", @WindowsDir, @SW_HIDE)
GUICtrlSetData($pro, 20)
;RunWait(@ComSpec & " /c " & @WindowsDir&"\fbinst (hd"&$HDFB1&")"&"format --extended 125m --force --fat32 --align --primary 8m",@ScriptDir, @SW_HIDE)
RunWait(@WindowsDir & "\fbinst (hd" & $HDFB1 & ")" & " format --extended 100m --force" & $usb1 & $usbg & " --align --primary 8m", @WindowsDir, @SW_HIDE)
GUICtrlSetData($ZT, "当前状态:正在将引导程序写入U盘中,请稍候...")
GUICtrlSetData($pro, 40)
Sleep(1000)
GUICtrlSetData($ZT, "当前状态:正在准备U盘PE数据和必备文件中,请稍候...")
FileInstall("abc.fba", @WindowsDir & "\abc.fba", 1)
GUICtrlSetData($pro, 60)
GUICtrlSetData($ZT, "当前状态:正在将PE维护系统数据写入U盘中,请稍候...")
;RunWait(@ComSpec & " /c " & @WindowsDir&"\fbinst (hd"&$HDFB1&")"&"load "[email=&@WindowsDir&]&@WindowsDir&"\abc.fba",@ScriptDir[/email], @SW_HIDE)
RunWait(@WindowsDir & "\fbinst (hd" & $HDFB1 & ")" & " load " & @WindowsDir & "\abc.fba", @WindowsDir, @SW_HIDE)
GUICtrlSetData($pro, 90)
FileDelete(@WindowsDir & "\fbinst.exe")
FileDelete(@WindowsDir & "\abc.fba")
Sleep(1000)
GUICtrlSetData($pro, 100)
GUICtrlSetData($ZT, "当前状态:所有任务全部完成!")
MsgBox(64, "恭喜", "超级三防U盘启动盘制作成功" & @CRLF & "请安全移除U盘并重新接上,不要现在就去打开U盘可见区")
quit()
EndIf
If $ask2 = 7 Then
GUICtrlSetState($Button3, $GUI_ENABLE)
GUICtrlSetState($Button4, $GUI_ENABLE)
GUICtrlSetState($Button5, $GUI_ENABLE)
GUICtrlSetData($pro, 0)
EndIf
EndIf
If $ask = 7 Then
GUICtrlSetState($Button3, $GUI_ENABLE)
GUICtrlSetState($Button4, $GUI_ENABLE)
GUICtrlSetState($Button5, $GUI_ENABLE)
GUICtrlSetData($pro, 0)
EndIf
Case $Button5
$ZZUSB = GUICtrlRead($Combo1)
$ZZUSBHDD = StringLeft($ZZUSB, 2)
$HDFB = IniRead($GhostIni, "HardDisk", $ZZUSBHDD, "2:1")
$HDFB2 = StringLeft($HDFB, 1)
$HDFB1 = $HDFB2 - 1
GUICtrlSetState($Button3, $GUI_DISABLE)
GUICtrlSetState($Button4, $GUI_DISABLE)
GUICtrlSetState($Button5, $GUI_DISABLE)
$ask1 = MsgBox(64 + 4 + 16, "提示", "你选择的了将" & $ZZUSB & "U盘重置到默认状态," & @CRLF & "要确定重置U盘,请点击“是”,否则点击“否”" & @CRLF & "请事先备份U盘可见区内的数据,还原后将格式可见区")
If $ask1 = 6 Then
GUICtrlSetData($ZT, "当前状态:正在重置U盘中,请稍候...")
FileInstall("fbinst.exe", @WindowsDir & "\fbinst.exe", 1)
RunWait(@WindowsDir & "\fbinst (hd" & $HDFB1 & ")" & " format --raw --force", @WindowsDir, @SW_HIDE)
GUICtrlSetData($pro, 100)
Sleep(1000)
MsgBox(64, "提示", "你已经成功的将U盘重置为未制作前的状态!" & @CRLF & "请安全移除U盘并重新接上,不要现在就去打开U盘可见区")
GUICtrlSetData($ZT, "当前状态:等待用户确认设置开始制作...")
GUICtrlSetData($pro, 0)
GUICtrlSetState($Button3, $GUI_ENABLE)
GUICtrlSetState($Button4, $GUI_ENABLE)
GUICtrlSetState($Button5, $GUI_ENABLE)
EndIf
If $ask1 = 7 Then
GUICtrlSetState($Button3, $GUI_ENABLE)
GUICtrlSetState($Button4, $GUI_ENABLE)
GUICtrlSetState($Button5, $GUI_ENABLE)
GUICtrlSetData($pro, 0)
EndIf
EndSwitch
WEnd
Func ini()
$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_diskdrive")
For $objItem In $colItems
IniWrite($GhostIni, $objItem.interfacetype, "Name", $objItem.caption)
$num = StringSplit($objItem.PNPDeviceID, "\")
$ii = UBound($num)
$ii = $ii - 1
$number = String($num[$ii])
IniWrite($GhostIni, $objItem.interfacetype, "ID", $number)
Next
EndFunc ;==>ini
Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
$Dll = DllOpen($SkincrafterDll)
DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
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
源代码出处: http://www.repaik.com/?u=1533
[ 本帖最后由 2011cf 于 2011-5-14 12:03 编辑 ] |
|