;U盘启动工具
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=usb.ico
#AutoIt3Wrapper_outfile=U盘启动盘制作工具.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=清风网络技术联盟U盘启动盘制作工具
#AutoIt3Wrapper_Res_Description=清风网络技术联盟U盘启动盘制作工具
#AutoIt3Wrapper_Res_Fileversion=2012.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=清风网络技术联盟友情提供
#AutoIt3Wrapper_Res_SaveSource=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#Region AutoIt3Wrapper 预编译参数(常用参数)
;#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% ;自定义资源段
;#AutoIt3Wrapper_Run_Tidy= ;脚本整理
;#AutoIt3Wrapper_Run_Obfuscator= ;代码迷惑
;#AutoIt3Wrapper_Run_AU3Check= ;语法检查
;#AutoIt3Wrapper_Run_Before= ;运行前
;#AutoIt3Wrapper_Run_After= ;运行后
#EndRegion AutoIt3Wrapper 预编译参数(常用参数)
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#include <EditConstants.au3>
Global $fba_t_xi = "选择要写入到U盘的FBA文件"
Global $hd_t_xi = "选择USB可移动磁盘"
Global $_FBA_Default = '你自己的FBA文件.fba'
DirCreate(@TempDir & "\Skin")
FileInstall(".\Skin\Skin.dll" ,@TempDir & "\Skin\Skin.dll" ,1 )
FileInstall(".\Skin\storm.she" ,@TempDir & "\Skin\storm.she",1 )
Global $iHover = -1
Global $SkinDll = DllOpen(@TempDir & "\Skin\Skin.dll")
DllCall($SkinDll, "int", "SkinH_AttachEx", "str", @TempDir & "\Skin\storm.she", "str", "mhgd")
DllCall($SkinDll, "int", "SkinH_SetAero", "int", 1)
#Region ### START Koda GUI section ### Form=
$title = "清风网络技术联盟U盘启动盘制作工具"
#Region ### START Koda GUI section ### Form=D:\我的文档\桌面\U盘启动盘制作工具GUI(代码)\4444.kxf
$Form1 = GUICreate($title, 303, 412, 280, 142)
$Group1 = GUICtrlCreateGroup("请选择USB可移动磁盘:", 8, 11, 285, 75)
;$Combo1 = GUICtrlCreateCombo("", 16, 97, 200, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST))
$Combo1 = GUICtrlCreateCombo("", 16, 33, 200, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
$Button1 = GUICtrlCreateButton("刷 新", 223, 31, 60, 27)
$lab = GUICtrlCreateLabel("程序没检测到有USB磁盘", 16, 58, 270, 25)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("请选择要制作的模式:", 8, 98, 285, 57)
$Combo2 = GUICtrlCreateCombo("", 16, 119, 200, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
GUICtrlSetData(-1, "USB-HDD模式(FAT16)|USB-HDD模式(FAT32){推荐}|USB-ZIP模式(FAT16)|USB-ZIP模式(FAT32)|USB-ZIP模式(FAT16)[复制PBP到MBR]", "USB-HDD模式(FAT32){推荐}")
$Checkbox1 = GUICtrlCreateCheckbox("CHS模式", 223, 119, 60, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group_fba = GUICtrlCreateGroup("请选择FBA文件:", 8, 163, 285, 57)
$Button_fba = GUICtrlCreateButton("浏 览", 229, 188, 60, 27)
$Input_FBA = GUICtrlCreateInput("", 24, 187, 193, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", 8, 280, 285, 60)
$Label1 = GUICtrlCreateLabel("", 15, 290, 275, 45)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("归还U盘空间", 200, 350, 83, 25)
$Button3 = GUICtrlCreateButton("一键制成USB启动盘", 16, 350, 180, 41)
$Button4 = GUICtrlCreateButton("退 出", 200, 380, 83, 25)
$Group3 = GUICtrlCreateGroup("UD区空间", 8, 224, 285, 65) ; BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
$Combo_ud_zice = GUICtrlCreateCombo("比FBA文件大50M", 24, 248, 115, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
GUICtrlSetData(-1, "比FBA文件大100M|比FBA文件大200M|比FBA文件大300M|比FBA文件大500M|自定义UD区空间")
$Input_SICE=GUICtrlCreateInput("286", 165, 248, 30, 21 , $ES_NUMBER)
GUICtrlCreateLabel("为:", 142, 250, 20, 21)
GUICtrlCreateLabel("MB", 200, 250, 153, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
if FileExists(@ScriptDir & "\dslz.fba") Then
GUICtrlSetData($Input_FBA, @ScriptDir & "\dslz.fba")
$FBA_SIZE=GUICtrlRead($Input_FBA)
$FBA_SIZE=FileGetSize($FBA_SIZE)
$FBA_SIZE=Round ($FBA_SIZE / 1024 /1024 + 50)
modif_FBA_SIZE($FBA_SIZE) ;修改UD区空间
;MsgBox(0,0, $FBA_SIZE )
EndIf
if FileExists(@ScriptDir & "\FB.fba") Then
GUICtrlSetData($Input_FBA, @ScriptDir & "\FB.fba")
$FBA_SIZE=GUICtrlRead($Input_FBA)
$FBA_SIZE=FileGetSize($FBA_SIZE)
$FBA_SIZE=Round ($FBA_SIZE / 1024 /1024 + 50)
modif_FBA_SIZE($FBA_SIZE) ;修改UD区空间
;MsgBox(0,0, $FBA_SIZE )
EndIf
USB()
_FBA()
GUISetState(@SW_SHOW)
;WinSetOnTop($title, "", 1)
#EndRegion ### END Koda GUI section ###
AdlibRegister('_HoverEffect', 500)
;AdlibUnRegister('_HoverEffect')
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Button4
Exit_()
Case $Button1
GUICtrlSetState($Button1, $GUI_DISABLE)
USB()
GUICtrlSetState($Button1, $GUI_ENABLE)
Case $Button_fba ;用任意参数调用函数
_FBA(666)
Case $Button3 ; 一键制成USB启动盘
if not FileExists( "c:\fbinst.exe") Then FileInstall("fbinst.exe", "c:\fbinst.exe" , 1)
$fba_file = GUICtrlRead($Input_FBA) ; 读取FBA文件
If $fba_file = "" Or Not FileExists($fba_file) Then
MsgBox(262144 + 64, "错误", "没选择FBA文件")
Else
If GUICtrlRead($Combo1) <> "" Then
AdlibUnRegister('_HoverEffect')
$HD = StringLeft(GUICtrlRead($Combo1), 5) ; 读取选择的USB磁盘
$MS = GUICtrlRead($Combo2) ; 读取类型
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button3, $GUI_DISABLE)
GUICtrlSetData($Label1, "正在把格式化USB磁盘并把FBA文件写入到UD区" & @CRLF & "需耗时请耐心等待..." )
$size=GUICtrlRead($Input_SICE) & "MB"; 读取UD的空间大小
;MsgBox(262144,0,$size )
Select
;Case FileGetSize(@ScriptDir & '\fbinst.exe') <> 76743
;MsgBox(262144 + 16, '错误', @ScriptDir & '\fbinst.exe' & "文件不存在或已损坏。")
;Exit_()
;Case FileGetSize(@ScriptDir & '\U-Disk-System.fba') <> 111682560
;MsgBox(262144 + 16, '错误', "U-Disk-System.fba文件不存在或已损坏。")
;Exit_()
Case $MS == 'USB-HDD模式(FAT16)'
If GUICtrlRead($Checkbox1) == $GUI_CHECKED Then
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --fat16 --primary 8m --chs --archive "' & $fba_file & '"', "c:", "", @SW_HIDE)
Else
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --fat16 --primary 8m --archive "' & $fba_file & '"', "c:", "" ,@SW_HIDE)
EndIf
Case $MS == 'USB-HDD模式(FAT32){推荐}'
If GUICtrlRead($Checkbox1) == $GUI_CHECKED Then
; MsgBox(0,"++chs",'fbinst.exe '& $HD & ' format --extended ' & $size & ' --force --align --fat32 --primary 8m --chs --archive "' & $fba_file & '"')
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --fat32 --primary 8m --chs --archive "' & $fba_file & '"', @ScriptDir, @SW_HIDE)
Else
; MsgBox(0,"--chs",'fbinst.exe '& $HD & ' format --extended ' & $size & ' --force --align --fat32 --primary 8m --archive "' & $fba_file & '"')
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --fat32 --primary 8m --archive "' & $fba_file & '"', @ScriptDir,"", @SW_HIDE)
EndIf
Case $MS == 'USB-ZIP模式(FAT16)'
If GUICtrlRead($Checkbox1) == $GUI_CHECKED Then
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --zip --fat16 --primary 8m --chs --archive "' & $fba_file & '"', "c:", "" ,@SW_HIDE)
Else
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --zip --fat16 --primary 8m --archive "' & $fba_file & '"', "c:", "" ,@SW_HIDE)
EndIf
Case $MS == 'USB-ZIP模式(FAT32)'
If GUICtrlRead($Checkbox1) == $GUI_CHECKED Then
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --zip --fat32 --primary 8m --chs --archive "' & $fba_file & '"', "c:", "" ,@SW_HIDE)
Else
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --zip --fat32 --primary 8m --archive "' & $fba_file & '"', "c:", "" ,@SW_HIDE)
EndIf
Case $MS == 'USB-ZIP模式(FAT16)[复制PBP到MBR]'
If GUICtrlRead($Checkbox1) == $GUI_CHECKED Then
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --zip --fat16 --primary 8m --chs --archive "' & $fba_file & '"', "c:", "" ,@SW_HIDE)
Else
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' format --extended ' & $size & ' --force --align --zip --fat16 --primary 8m --archive "' & $fba_file & '"', "c:", "" ,@SW_HIDE)
EndIf
ShellExecuteWait ('c:\fbinst.exe ', $HD & ' sync --copy-bpb --max-sectors 63', "c:", "" ,@SW_HIDE);复制PBP到MBR
EndSelect
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
AdlibRegister('_HoverEffect', 500)
MsgBox(262144 + 4096 + 64, '提示', 'USB启动盘制作完成。请断开USB可移动磁盘后重新插上再进行其它操作!')
Else
MsgBox(262144 + 64, '提示', '请选择USB可移动磁盘!')
EndIf
EndIf
Case $Button2 ; 归还U盘空间
if not FileExists( "c:\fbinst.exe") Then FileInstall("fbinst.exe", "c:\fbinst.exe" , 1)
If GUICtrlRead($Combo1) <> "" Then
; MsgBox(0,0,"归还U盘空间" & @CRLF & 'fbinst' & StringLeft(GUICtrlRead($Combo1), 5) & ' format --raw --force')
GUICtrlSetState($Button3, $GUI_DISABLE)
RUNWait('c:\fbinst.exe ' & StringLeft(GUICtrlRead($Combo1), 5) & ' format --raw --force', "c:" , @SW_HIDE)
GUICtrlSetState($Button3, $GUI_ENABLE)
MsgBox(262144+4096 + 64, '提示', '格式化完成,已恢复U盘全部空间。')
Else
MsgBox(262144 + 4096 + 16, '提示', '请选择USB可移动磁盘!')
EndIf
Case $Button_fba
$fba_ff = FileOpenDialog("选择要写入到U盘的FBA文件", @ScriptDir, "FBA文件(*.fba)|所有文件(*.*)")
If $fba_ff = "" Then
MsgBox(262144 + 64, "错误", "没选择FBA文件")
Else
GUICtrlSetData($Input_FBA, $fba_ff)
$fba_t_xi = "选择的FBA 文件:" & @CRLF & " " & $fba_ff
$FBA_SIZE=Round(FileGetSize(GUICtrlRead($Input_FBA)) / 1024 /1024 )
$read_ud_zic=GUICtrlRead($Combo_ud_zice)
Select
Case $read_ud_zic = "比FBA文件大50M"
$FBA_SIZE = $FBA_SIZE + 50
Case $read_ud_zic = "比FBA文件大100M"
$FBA_SIZE = $FBA_SIZE + 100
Case $read_ud_zic = "比FBA文件大200M"
$FBA_SIZE = $FBA_SIZE + 200
Case $read_ud_zic = "比FBA文件大300M"
$FBA_SIZE = $FBA_SIZE + 300
Case $read_ud_zic = "比FBA文件大500M"
$FBA_SIZE = $FBA_SIZE + 500
Case $read_ud_zic = "自定义UD区空间"
; MsgBox(0,0,"自定义UD区空间")
$FBA_SIZE = $FBA_SIZE + 8
EndSelect
modif_FBA_SIZE($FBA_SIZE) ;修改UD区空间
EndIf
Case $Combo1 ; 选择USB碰磁盘
$tt=GUICtrlRead($Combo1)
GUICtrlSetData($lab,$tt)
Case $Combo_ud_zice ; 设置UD区大小
$FBA_SIZE=Round(FileGetSize(GUICtrlRead($Input_FBA)) / 1024 /1024 )
$read_ud_zic=GUICtrlRead($Combo_ud_zice)
Select
Case $read_ud_zic = "比FBA文件大50M"
$FBA_SIZE = $FBA_SIZE + 50
Case $read_ud_zic = "比FBA文件大100M"
$FBA_SIZE = $FBA_SIZE + 100
Case $read_ud_zic = "比FBA文件大200M"
$FBA_SIZE = $FBA_SIZE + 200
Case $read_ud_zic = "比FBA文件大300M"
$FBA_SIZE = $FBA_SIZE + 300
Case $read_ud_zic = "比FBA文件大500M"
$FBA_SIZE = $FBA_SIZE + 500
EndSelect
modif_FBA_SIZE($FBA_SIZE) ;修改UD区空间
EndSwitch
WEnd
Func USB()
GUICtrlSetData($lab, "程序没检测到有USB可移动磁盘")
if not FileExists( "c:\fbinst.exe") Then FileInstall("fbinst.exe", "c:\fbinst.exe" , 1)
$file = @TempDir & '\HD.log'
; _RunDOS('c:\fbinst.exe --hdlist > ' & $file)
RunWait('cmd.exe /c c:\fbinst.exe --list > ' & $file, "c:", @SW_HIDE)
If FileExists($file) Then
$file_tmp = FileOpen($file, 0)
While 1
$line = FileReadLine($file_tmp)
If @error = -1 Then ExitLoop
If StringLeft($line, 5) <> "(hd0)" Then
If StringLeft($line, 5) = "(hd1)" OR StringRight($line, 1) ="*" Then
IF StringRight($line, 1) ="*" Then
GUICtrlSetData($Combo1, $line, $line)
GUICtrlSetData($lab, $line)
Else
GUICtrlSetData($Combo1, $line, $line)
GUICtrlSetData($lab, $line)
EndIf
Else
GUICtrlSetData($Combo1, $line)
EndIf
EndIf
WEnd
FileClose($file_tmp)
FileDelete($file)
EndIf
EndFunc ;==>USB
Func modif_FBA_SIZE($a) ; 修改UD空间
GUICtrlSetData($Input_SICE , $a)
EndFunc ; 修改UD空间
Func _HoverEffect()
$aInfo = GUIGetCursorInfo($Form1)
Switch $aInfo[4]
Case $Button_fba
GUICtrlSetData($Label1, "选择要写入到U盘的FBA文件")
Case $Input_FBA
$tt = GUICtrlRead($Input_FBA)
If Not $tt = "" Then
GUICtrlSetData($Label1, $tt)
Else
GUICtrlSetData($Label1, $fba_t_xi)
EndIf
Case $Combo1
$tt = GUICtrlRead($Combo1)
If Not $tt = "" Then
GUICtrlSetData($Label1, $tt)
Else
GUICtrlSetData($Label1, $hd_t_xi)
EndIf
Case $Checkbox1
GUICtrlSetData($Label1, "强制使用CHS模式。这可以用于某些不能自动检测模式的BIOS")
Case $Button1
GUICtrlSetData($Label1, "重新获取磁盘信息")
Case $Button3
GUICtrlSetData($Label1, "选择好USB可移动磁盘和制作模式后可以进行一键制成USB启动盘(不保证100%成功),注意:制作前请先备份U盘原有数据(数据无价,请慎用!)")
Case $Button2
GUICtrlSetData($Label1, "回收隐藏分区空间,格式化为普通的单分区模式,恢复为没有使用fbinst前的模样")
Case $Button4
GUICtrlSetData($Label1, "退出软件")
Case Else
GUICtrlSetData($Label1, "欢迎使用清风网络技术联盟U盘启动盘制作工具" & @CRLF & "使用前请先备份您U盘的重要数据")
EndSwitch
EndFunc ;==>_HoverEffect
Func _FBA($_icode = Default)
If $_icode = Default Then
$fba_ff = $_FBA_Default
Else
$fba_ff = FileOpenDialog("选择要写入到U盘的FBA文件", @ScriptDir, "FBA文件(*.fba)|所有文件(*.*)")
If $fba_ff = "" Then $fba_ff = $_FBA_Default
EndIf
GUICtrlSetData($Input_FBA, $fba_ff)
$fba_t_xi = "选择的FBA 文件:" & @CRLF & " " & $fba_ff
$FBA_SIZE = Round(FileGetSize(GUICtrlRead($Input_FBA)) / 1024 / 1024)
$read_ud_zic = GUICtrlRead($Combo_ud_zice)
Select
Case $read_ud_zic = "比FBA文件大50M"
$FBA_SIZE = $FBA_SIZE + 50
Case $read_ud_zic = "比FBA文件大100M"
$FBA_SIZE = $FBA_SIZE + 100
Case $read_ud_zic = "比FBA文件大200M"
$FBA_SIZE = $FBA_SIZE + 200
Case $read_ud_zic = "比FBA文件大300M"
$FBA_SIZE = $FBA_SIZE + 300
Case $read_ud_zic = "比FBA文件大500M"
$FBA_SIZE = $FBA_SIZE + 500
Case $read_ud_zic = "自定义UD区空间"
; MsgBox(0,0,"自定义UD区空间")
$FBA_SIZE = $FBA_SIZE + 8
EndSelect
modif_FBA_SIZE($FBA_SIZE) ;修改UD区空间
EndFunc ;==>_FBA
Func Exit_()
;Exit
AdlibUnRegister('_HoverEffect')
DllClose($SkinDll)
GUIDelete($Form1)
Exit
EndFunc ;==>Exit_