⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winsetupfromusb_0-1-1.au3

📁 U盘装纯净版系统
💻 AU3
📖 第 1 页 / 共 5 页
字号:
	DisableMenus(1)
	$sync = 0
	$SourceList[0][0] = 0
	$NrCpdFiles = 0
	GUICtrlSetData($Go, "STOP")
	If GUICtrlRead($FixedRadio) = $GUI_CHECKED And StringInStr($vers, "64") > 0 Then
		MsgBox(16, "Not supported", "Installing x64 versions from USB disks seen as fixed is not supported!" & @CRLF & @CRLF _
		& "If you can rewrite and compile rdummy.sys for 64-bit versions, please contact us at mfsn.org." & @CRLF _
		& "Aborting in 10 seconds...")
		Logging("Fixed disk and x64 found, aborting...")
		Quit()
	EndIf
	If GUICtrlRead($RemovableRadio) = $GUI_CHECKED And $USBdrives[$USBdrives[0][1]][6] = "Fixed" And StringInStr($vers, "64") > 0 Then 
		MsgBox(16, "Hmm...", "Installing x64 versions from USB disks seen as fixed is not supported!" & @CRLF _
		& "Seems you have forced Fixed/Removable selection to be able to continue." & @CRLF _
		& "You really need to know what you are doing..." & @CRLF _
		& "Will continue, but you are on your own.")
		Logging("Fixed disk, forced Removable selection and x64 found, continuing...")
	EndIf
	Logging("Removing TEMP folder")
	_GUICtrlStatusBar_SetText($hStatus,"Removing TEMP folder", 2)
	DirRemove(@ScriptDir & "\TEMP", 1)
	$NrCpdFiles = 0
	If FileExists($TargetActive & "\grldr") + FileExists($TargetActive & "\menu.lst") < 2 And ($TotalSourceSize > 0 or GUICtrlRead($AddSysLinuxCheck) = $GUI_CHECKED) Then 
		_GUICtrlStatusBar_SetText($hStatus,"Installing grub4dos bootsector", 2)
		InstallGrub()
	EndIf
While 1
	If GUICtrlRead($BootOnlyCheck) = $GUI_CHECKED And $WinSource <> "" Then
		If FileExists($TargetDrive & "$WIN_NT$.~BT") Then
			$msg = MsgBox(48 + 3, "Folder $WIN_NT$.~BT exists", "YES to rename it to .BKP" & @CRLF & "NO to delete it" & @CRLF & "CANCEL to return to the main menu")
			If $msg = 6 Then DirMove($TargetDrive & "$WIN_NT$.~BT", $TargetDrive & "$WIN_NT$.~BT.BKP")
			If $msg = 7 Then DirRemove ($TargetDrive & "$WIN_NT$.~BT", 1)
			If $msg = 2 Then ExitLoop
		EndIf
		MakeBT()
		$FileList = _FileSearch(@ScriptDir & "\TEMP")
		_Quick_Sort($FileList, 1, $FileList[0])
		$SourceList[0][0] += 1
		ReDim $SourceList[$SourceList[0][0] + 1][3]
		$SourceList[0][1] = $FileList[0]
		$SourceList[1][0] = $FileList
		$sl = StringLen(@ScriptDir & "\TEMP")
		$SourceList[1][1] = $sl
		_CopyDirWithProgress($FileList, $TargetDrive, $sl, $FileList[0], 1) 
		Logging("Preparing boot files only completed")
	Else
		If $WinSource <> "" And GUICtrlRead($BootOnlyCheck) = $GUI_UNCHECKED Then
			If FileExists($TargetDrive & "\$WIN_NT$.~BT") + FileExists($TargetDrive & "\$WIN_NT$.~LS") = 2 Then
				$msg = MsgBox(48 + 3, "Folders $WIN_NT$.~BT and $WIN_NT$.~LS were found", "Folders $WIN_NT$.~BT and $WIN_NT$.~LS were found" _
				& @CRLF & @CRLF & "YES to syncronise source with $WIN_NT$.~LS" _
				& @CRLF & "NO to rename them and patch setup and startup files" & @CRLF & "CANCEL to delete them")
				If $msg = 7 Then
					Logging("Renaming ~BT and ~LS folders and patching setup and startup files")
					_GUICtrlStatusBar_SetText($hStatus,"Renaming ~BT and ~LS folders and patching setup and startup files", 2)
					PatchSrc()
				EndIF
				If $msg = 6 Then
					Logging("Syncronising with source")
					_GUICtrlStatusBar_SetText($hStatus,"Syncronising with source", 2) 
					$sync = 1
				EndIf
				If $msg = 2 Then 
					DirRemove($TargetDrive & "$WIN_NT$.~BT", 1)
					DirRemove($TargetDrive & "$WIN_NT$.~LS", 1)
				EndIf
			EndIf
			If FileExists($TargetDrive & "\$WIN_NT$.~BT") + FileExists($TargetDrive & "\$WIN_NT$.~LS") = 1 Then
				MsgBox(48 + 3, "Orphan folder $WIN_NT$.~BT or $WIN_NT$.~LS was found", "Orphan folder $WIN_NT$.~BT or $WIN_NT$.~LS was found" _
				& @CRLF & "Renaming it to .BAK", 5)
				Logging("Orphan folder $WIN_NT$.~BT or $WIN_NT$.~LS was found, renaming to .BAK")
				If FileExists($TargetDrive & "\$WIN_NT$.~BT") Then DirMove($TargetDrive & "\$WIN_NT$.~BT", $TargetDrive & "\$WIN_NT$.~BT.BAK", 1)
				If FileExists($TargetDrive & "\$WIN_NT$.~LS") Then DirMove($TargetDrive & "\$WIN_NT$.~BT", $TargetDrive & "\$WIN_NT$.~LS.BAK", 1)
			EndIf
			If $sync <> 1 Then
				If Not FileExists(@ScriptDir & "\TEMP\$win_nt$.~bt") Then MakeBT()
				If StringInStr($sp, "SP2") + StringInStr($sp, "SP3") + StringInStr($sp, "XP") = 0 Then 
					MsgBox(64, "Your source doesn't appear to be XP SP2 or 3", "Your source doesn't appear to be XP SP2 or 3." & @CRLF _
					& "During Text part of setup some compressed files may be deleted." _
					& @CRLF & "After setup you can run the program again to copy just the missing files.")
				EndIf
				$txtsetupsif = @ScriptDir & "\TEMP\txtsetup.sif"
				If GUICtrlRead($FixedRadio) = $GUI_CHECKED And StringInStr($vers, "64") = 0 Then
					Logging("Adding lines for rdummy.sys")
					_GUICtrlStatusBar_SetText($hStatus,"Adding lines for rdummy.sys", 2)
					FileCopy(@ScriptDir & "\files\winsetup\rdummy.sy_", @ScriptDir & "\TEMP\$win_nt$.~ls\i386", 1)
					FileCopy(@ScriptDir & "\files\winsetup\rdummy.sy_", @ScriptDir & "\TEMP\$win_nt$.~bt", 1)
					If Not IniWrite($txtsetupsif, "SourceDisksFiles", "rdummy.sys", "1,,,,,,4_,4,1,,,1,4") Then 
						MsgBox(16, "Fatal error", "Couldn't write to " & $txtsetupsif & " , will have to abort :(")
						Logging ("Couldn't write to " & $txtsetupsif & " aborting...")
						Quit()
					EndIf			
					IniWrite($txtsetupsif, "BusExtenders.Load", "rdummy", "rdummy.sys")
					IniWrite($txtsetupsif, "BusExtenders", "RDUMMY", '"USB hard disk as removable",files.RDUMMY,RDUMMY')
					IniWriteLine($txtsetupsif, "files.RDUMMY", "rdummy.sys,4")
					IniWriteLine(@ScriptDir & "\TEMP\$win_nt$.~bt\winnt.sif", "GuiRunOnce", '"sc delete rdummy"')
				EndIf
				Logging("Adding lines for undoren.cmd and binifix4.cmd")
				_GUICtrlStatusBar_SetText($hStatus,"Adding lines for ren_fold.cmd and binifix4.cmd", 2)
				IniWrite($txtsetupsif, "SourceDisksFiles", "undoren.cmd", "1,,,,,,,2,0,0") 
				IniWrite($txtsetupsif, "SourceDisksFiles", "binifix4.cmd", "1,,,,,,,2,0,0")
				IniWriteLine(@ScriptDir & "\TEMP\$win_nt$.~bt\winnt.sif", "GuiRunOnce", '"undoren.cmd"' & @CRLF) 
				IniWrite(@ScriptDir & "\TEMP\$win_nt$.~bt\winnt.sif", "SetupParams", "UserExecute", '"binifix4.cmd C:"')
				If $AMD64 = 0 Then
					FileCopy(@ScriptDir & "\files\winsetup\binifix4.cmd", @ScriptDir & "\TEMP\$win_nt$.~ls\i386", 1)
					FileCopy(@ScriptDir & "\files\winsetup\undoren.cmd", @ScriptDir & "\TEMP\$win_nt$.~ls\i386", 1) 
				Else
					FileCopy(@ScriptDir & "\files\winsetup\binifix4.cmd", @ScriptDir & "\TEMP\$win_nt$.~ls\amd64", 1)
					FileCopy(@ScriptDir & "\files\winsetup\undoren.cmd", @ScriptDir & "\TEMP\$win_nt$.~ls\amd64", 1) 
				EndIf
				Logging("Preparing ~BT folder and boot files")
				_GUICtrlStatusBar_SetText($hStatus,"Preparing ~BT folder and boot files", 2)
				$SourceList[0][0] += 1
				$FileList = _FileSearch(@ScriptDir & "\TEMP")
				_Quick_Sort($FileList, 1, $FileList[0])
				$SourceList[0][1] += $FileList[0]
				ReDim $SourceList[$SourceList[0][0] + 1][3]
				$SourceList[$SourceList[0][0]][0] = $FileList
				$sl = StringLen(@ScriptDir & "\TEMP")
				$SourceList[$SourceList[0][0]][1] = $sl
				$SourceList[$SourceList[0][0]][2] = $TargetDrive
				;boot files and root done
			EndIf
			Logging("Preparing ~LS folder")
			_GUICtrlStatusBar_SetText($hStatus,"Preparing ~LS folder", 2)
			$SourceList[0][0] += 1
			ReDim $SourceList[$SourceList[0][0] + 1][3]
			$FileList = _FileSearch($WinSource & "\I386")
			_Quick_Sort($FileList, 1, $FileList[0])
			$sl = StringLen($WinSource & "\I386")
			$SourceList[0][1] += $FileList[0]
			$SourceList[$SourceList[0][0]][0] = $FileList
			$SourceList[$SourceList[0][0]][1] = $sl
			$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\$WIN_NT$.~LS\I386"
			;check for x64 and add AMD64 folder
			If $AMD64 = 1 Then
				$SourceList[0][0] += 1
				ReDim $SourceList[$SourceList[0][0] + 1][3]
				$FileList = _FileSearch($WinSource & "\AMD64")
				_Quick_Sort($FileList, 1, $FileList[0])
				$sl = StringLen($WinSource & "\AMD64")
				$SourceList[0][1] += $FileList[0]
				$SourceList[$SourceList[0][0]][0] = $FileList
				$SourceList[$SourceList[0][0]][1] = $sl
				$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\$WIN_NT$.~LS\AMD64"
			EndIf
			;BTS OEM folder
			If FileExists($WinSource & "\OEM\") Then
				$SourceList[0][0] += 1
				ReDim $SourceList[$SourceList[0][0] + 1][3]
				$FileList = _FileSearch($WinSource & "\OEM")
				_Quick_Sort($FileList, 1, $FileList[0])
				$sl = StringLen($WinSource & "\OEM")
				$SourceList[0][1] += $FileList[0]
				$SourceList[$SourceList[0][0]][0] = $FileList
				$SourceList[$SourceList[0][0]][1] = $sl
				$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\OEM"
			EndIf
			;$OEM$ folder
			If FileExists($WinSource & "\$OEM$\") Then 
				$SourceList[0][0] += 1
				ReDim $SourceList[$SourceList[0][0] + 1][3]
				$FileList = _FileSearch($WinSource & "\$OEM$")
				_Quick_Sort($FileList, 1, $FileList[0])
				$sl = StringLen($WinSource & "\$OEM$")
				$SourceList[0][1] += $FileList[0]
				$SourceList[$SourceList[0][0]][0] = $FileList
				$SourceList[$SourceList[0][0]][1] = $sl
				$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\$WIN_NT$.~LS\$OEM$"
			EndIf
			;cmpnents
			If FileExists($WinSource & "\cmpnents\") Then 
				$SourceList[0][0] += 1
				ReDim $SourceList[$SourceList[0][0] + 1][3]
				$FileList = _FileSearch($WinSource & "\cmpnents")
				_Quick_Sort($FileList, 1, $FileList[0])
				$sl = StringLen($WinSource & "\cmpnents")
				$SourceList[0][1] += $FileList[0]
				$SourceList[$SourceList[0][0]][0] = $FileList
				$SourceList[$SourceList[0][0]][1] = $sl
				$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\$WIN_NT$.~LS\cmpnents"
			EndIf
			;printers 2003
			If FileExists($WinSource & "\printers\") Then 
				$SourceList[0][0] += 1
				ReDim $SourceList[$SourceList[0][0] + 1][3]
				$FileList = _FileSearch($WinSource & "\printers")
				_Quick_Sort($FileList, 1, $FileList[0])
				$sl = StringLen($WinSource & "\printers")
				$SourceList[0][1] += $FileList[0]
				$SourceList[$SourceList[0][0]][0] = $FileList
				$SourceList[$SourceList[0][0]][1] = $sl
				$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\$WIN_NT$.~LS\printers"
			EndIf
			;boot.ini
			If Not FileExists($TargetDrive & "\BOOT.INI") Then
				Logging("Preparing BOOT.INI")
				_GUICtrlStatusBar_SetText($hStatus,"Preparing BOOT.INI", 2)
				IniWriteSection($TargetDrive & "\BOOT.INI", "Boot Loader", "Timeout=5" & @LF & "Default=multi(0)disk(0)rdisk(" & GUICtrlRead($WinTargetdisk) + 1 _
				& ")partition(" & GUICtrlRead($WinTargetPartition) & ")" & GUICtrlRead($WinTarget))
				IniWriteSection($TargetDrive & "\BOOT.INI", "Operating Systems", "multi(0)disk(0)rdisk(" & GUICtrlRead($WinTargetDisk) + 1 _
				& ")partition(" & GUICtrlRead($WinTargetPartition) & ")" & GUICtrlRead($WinTarget) & "=" & '"Second part of' & StringReplace($vers, "windows", "") _
				& " setup from hd " & GUICtrlRead($WinTargetdisk) & " part " & GUICtrlRead($WinTargetPartition) & '" /FASTDETECT')
				If GUICtrlRead($BootINIAddCheck) = $GUI_CHECKED Then
					Logging("Additional line to boot.ini")
					IniWrite($TargetDrive & "\BOOT.INI", "Operating Systems", "multi(0)disk(0)rdisk(" & GUICtrlRead($TargetDiskAdd) + 1 _
					& ")partition(" & GUICtrlRead($TargetPartitionAdd) & ")" & GUICtrlRead($WinTargetAdd), '"Second part of' & StringReplace($vers, "windows", "") _
					& " setup from hd " & GUICtrlRead($TargetDiskAdd) & " part " & GUICtrlRead($TargetPartitionAdd) & '" /FASTDETECT')
				EndIf
			Else
				Logging("Addiing lines to existing boot.ini")
				IniWriteLine($TargetDrive & "\BOOT.INI", "Operating Systems", "multi(0)disk(0)rdisk(" & GUICtrlRead($WinTargetDisk) + 1 _
					& ")partition(" & GUICtrlRead($WinTargetPartition) & ")" & GUICtrlRead($WinTarget) & '="Second part of' & StringReplace($vers, "windows", "") _
					& " setup from hd " & GUICtrlRead($WinTargetDisk) & " part " & GUICtrlRead($WinTargetPartition) & '+Start first time" /FASTDETECT')
				If GUICtrlRead($BootINIAddCheck) = $GUI_CHECKED Then
					Logging("Additional line to boot.ini")
					IniWriteLine($TargetDrive & "\BOOT.INI", "Operating Systems", "multi(0)disk(0)rdisk(" & GUICtrlRead($TargetDiskAdd) + 1 _
					& ")partition(" & GUICtrlRead($TargetPartitionAdd) & ")" & GUICtrlRead($WinTargetAdd) & '="Second part of' & StringReplace($vers, "windows", "") _
					& " setup from hd " & GUICtrlRead($TargetDiskAdd) & " part " & GUICtrlRead($TargetPartitionAdd) & '+Start first time" /FASTDETECT')
				EndIf
			EndIf
			;add ntldr to winsetup.lst
			Logging("Preparing winsetup.lst")
			$menulst = FileOpen($TargetActive & "\winsetup.lst", 1)
			FileWriteLine($menulst, @CRLF & "title Second part of" & StringReplace($vers, "windows", "") & " setup+Start Windows for first time")
			FileWriteLine($menulst, "root (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")")
			FileWriteLine($menulst, "chainloader (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")/ntldr")
			FileWriteLine($menulst, "savedefault")
			FileClose($menulst)
		EndIf ;making Win source
			
		;pesource
		If $PESource <> "" And GUICtrlRead($AddPECheck) = $GUI_CHECKED Then
			If FileExists($TargetDrive & "\minint\") Then
				$msg = MsgBox(48 + 3, "Folder MININT exists", "YES to rename it to .BKP" & @CRLF & "NO to delete it" & @CRLF & "CANCEL to return to the main menu")
				If $msg = 6 Then DirMove($TargetDrive & "\minint", $TargetDrive & "\minint.bkp")
				If $msg = 7 Then DirRemove ($TargetDrive & "\minint", 1)
				If $msg = 2 Then ExitLoop
			EndIf
			;minint
			Logging("Preparing PE source")
			_GUICtrlStatusBar_SetText($hStatus,"Preparing PE source", 2)
			$SourceList[0][0] += 1
			$FileList = _FileSearch($PESource & "\I386")

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -