paravis
2 years ago
1 changed files with 225 additions and 114 deletions
@ -1,121 +1,232 @@ |
|||||||
|
#include <Array.au3> |
||||||
|
#include <File.au3> |
||||||
#include <GUIConstantsEx.au3> |
#include <GUIConstantsEx.au3> |
||||||
#include <GuiConstants.au3> |
#include <WindowsConstants.au3> |
||||||
#include <file.au3> |
#include <WinAPI.au3> |
||||||
#NoTrayIcon |
#NoTrayIcon |
||||||
#RequireAdmin |
|
||||||
|
Global $aArray = DriveGetDrive($DT_ALL), $sDisk, $iBtn11, $iBtn10, $iBtn7, $PathEr, $sDisk, $sDiskS, $UN11, $UN10x64, $UN10x86, $UN7x64, $UN7x86 |
||||||
#pragma compile(Stripper, True) |
|
||||||
#pragma compile(ProductVersion, 3.0.0) |
For $i = 1 To $aArray[0] |
||||||
#pragma compile(ProductName, "Change bootLoader") |
$aFileList = _FileListToArrayRec($aArray[$i] & "\WindowsESD", "NOT.DEL", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) |
||||||
#pragma compile(FileDescription, CBL) |
If Not @error Then |
||||||
#pragma compile(LegalCopyright, paravis.ru@2023) |
$sDisk = $aArray[$i] & "\WindowsESD\" |
||||||
#pragma compile(CompanyName, paravis.ru@2023) |
$PathEr = 1 |
||||||
|
ExitLoop |
||||||
Opt("ExpandEnvStrings", 1) |
EndIf |
||||||
|
Next |
||||||
$sDisk = StringLeft(@ScriptDir, 2) |
|
||||||
$boot = ($sDisk & "efi\Paravis\Boot") |
For $i = 1 To $aArray[0] |
||||||
$kitchen = ($sDisk & "efi\Paravis\Boot\kitchen") |
$aFileList = _FileListToArrayRec($aArray[$i] & "\efi\Paravis\Windows", "NOT.DEL", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) |
||||||
$bootice = ($sDisk & "efi\Paravis\Boot\kitchen\bootice.exe") |
If Not @error Then |
||||||
$main = GUICreate("Change BootLoader", 390, 125, 318, 213) |
$sDisk = $aArray[$i] & "\efi\Paravis\Windows\" |
||||||
GUICtrlCreateGroup("Legacy BIOS", 3, 3, 384, 61) |
$PathEr += 1 |
||||||
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma") |
ExitLoop |
||||||
$xor = GUICtrlCreateButton("Install XorBoot", 8, 20, 121, 33) |
EndIf |
||||||
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma") |
Next |
||||||
$bmgr = GUICtrlCreateButton("Install Bootmgr", 134, 20, 121, 33) |
|
||||||
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma") |
If $PathEr > 1 Then |
||||||
$g4d = GUICtrlCreateButton("Install Grub4Dos", 261, 20, 121, 33) |
MsgBox(48, 'Предупреждение!', 'В системе больше одной папки с образами. Проверьте и удалите лишние (читаем ReadMe.txt). Система будет перезагружена.') |
||||||
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma") |
Exit |
||||||
GUICtrlCreateGroup("", -99, -99, 1, 1) |
EndIf |
||||||
GUICtrlCreateGroup("UEFI", 3, 62, 384, 61) |
|
||||||
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma") |
For $i = 1 To $aArray[0] |
||||||
$bmgru = GUICtrlCreateButton("Install Bootmgr (SecureBoot ON)", 8, 80, 180, 33) |
$aFileList = _FileListToArrayRec($aArray[$i] & "\efi\Paravis\Boot\kitchen", "NOT.DEL", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) |
||||||
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma") |
If Not @error Then |
||||||
$xoru = GUICtrlCreateButton("Install Xorboot (SecureBoot OFF)", 200, 80, 180, 33) |
$sDiskS = $aArray[$i] & "\efi\Paravis\Boot\" |
||||||
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma") |
ExitLoop |
||||||
GUISetState(@SW_SHOW, $main) |
EndIf |
||||||
|
Next |
||||||
Func _hide() |
|
||||||
GUICtrlSetState($xor, $gui_disable) |
$ESD11 = $sDisk & "install_11.esd" |
||||||
GUICtrlSetState($bmgr, $gui_disable) |
$ESD10x64 = $sDisk & "install_10_x64.esd" |
||||||
GUICtrlSetState($g4d, $gui_disable) |
$ESD10x86 = $sDisk & "install_10_x86.esd" |
||||||
GUICtrlSetState($bmgru, $gui_disable) |
$ESD7x64 = $sDisk & "install_7_x64.esd" |
||||||
GUICtrlSetState($xoru, $gui_disable) |
$ESD7x86 = $sDisk & "install_7_x86.esd" |
||||||
|
If FileExists ($sDisk & "autounattend\unattend11.xml") Then |
||||||
|
$UN11 = " /unattend:" & $sDisk & "autounattend\unattend11.xml" |
||||||
|
Else |
||||||
|
$UN11 = '' |
||||||
|
EndIf |
||||||
|
If FileExists ($sDisk & "autounattend\unattend10x64.xml") Then |
||||||
|
$UN10x64 = " /unattend:" & $sDisk & "autounattend\unattend10x64.xml" |
||||||
|
Else |
||||||
|
$UN10x64 = '' |
||||||
|
EndIf |
||||||
|
If FileExists ($sDisk & "autounattend\unattend10x86.xml") Then |
||||||
|
$UN10x86 = " /unattend:" & $sDisk & "autounattend\unattend10x86.xml" |
||||||
|
Else |
||||||
|
$UN10x86 = '' |
||||||
|
EndIf |
||||||
|
If FileExists ($sDisk & "autounattend\unattend7x64.xml") Then |
||||||
|
$UN7x64 = " /unattend:" & $sDisk & "autounattend\unattend7x64.xml" |
||||||
|
Else |
||||||
|
$UN7x64 = '' |
||||||
|
EndIf |
||||||
|
If FileExists ($sDisk & "autounattend\unattend7x86.xml") Then |
||||||
|
$UN7x86 = " /unattend:" & $sDisk & "autounattend\unattend7x86.xml" |
||||||
|
Else |
||||||
|
$UN7x86 = '' |
||||||
|
EndIf |
||||||
|
$OEM11 = " /m:" & $sDisk & "$OEM11$" |
||||||
|
$OEM10x64 = " /m:" & $sDisk & "$OEM10x64$" |
||||||
|
$OEM10x86 = " /m:" & $sDisk & "$OEM10x86$" |
||||||
|
$OEM7x64 = " /m:" & $sDisk & "$OEM7x64$" |
||||||
|
$OEM7x86 = " /m:" & $sDisk & "$OEM7x86$" |
||||||
|
$setup = "X:\sources\setup.exe /installfrom:" |
||||||
|
|
||||||
|
|
||||||
|
If FileExists(@WindowsDir & "\SYSWOW64") Then |
||||||
|
RunWait($sDiskS & "src_x64.exe auto2") |
||||||
|
_x64() |
||||||
|
Else |
||||||
|
RunWait($sDiskS & "src_x86.exe auto2") |
||||||
|
_x86() |
||||||
|
EndIf |
||||||
|
|
||||||
|
Func _x86() |
||||||
|
$detect_efi = EnvGet("firmware_type") |
||||||
|
If $detect_efi = "Legacy" Then |
||||||
|
$hGUI = GUICreate("Windows Setup by Paravis", 410, 250, -1, -1, $WS_POPUP, $WS_EX_LAYERED) |
||||||
|
GUISetBkColor(0xABCDEF) |
||||||
|
GUICtrlSetState(-1, $GUI_DISABLE) |
||||||
|
GUISetState() |
||||||
|
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255) |
||||||
|
$font = "Segoe UI" |
||||||
|
$iBtn10 = GUICtrlCreateButton("Установить Windows 10", 5, 5, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtn7 = GUICtrlCreateButton("Установить Windows 7", 5, 45, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtnTC = GUICtrlCreateButton("Запустить Total Commander", 5, 105, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtnR = GUICtrlCreateButton("Перезагрузка", 5, 145, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
GUISetState() |
||||||
|
|
||||||
|
_checkesd86() |
||||||
|
|
||||||
|
While 1 |
||||||
|
Switch GUIGetMsg() |
||||||
|
Case $GUI_EVENT_CLOSE |
||||||
|
;~ exit |
||||||
|
Case $iBtn10 |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($setup & $ESD10x86 & $OEM10x86 & $UN10x86) |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtn7 |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($setup & $ESD7x86 & $OEM7x86 & $UN7x86) |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtnTC |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($sDiskS & 'kitchen\TotalCommander\TOTALCMD.EXE /I="%%COMMANDER_PATH%%\tcmdmain.ini"') |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtnR |
||||||
|
Exit |
||||||
|
EndSwitch |
||||||
|
WEnd |
||||||
|
Else |
||||||
|
If Not FileExists($sDisk & "install_10_x86.esd") Then |
||||||
|
MsgBox(48, 'Предупреждение!', 'Не найден образ Windows 10 x86. Система будет перезагружена.') |
||||||
|
Exit |
||||||
|
EndIf |
||||||
|
$hGUI = GUICreate("Windows Setup by Paravis", 360, 190, -1, -1, $WS_POPUP, $WS_EX_LAYERED) |
||||||
|
GUISetBkColor(0xABCDEF) |
||||||
|
GUICtrlSetState(-1, $GUI_DISABLE) |
||||||
|
GUISetState() |
||||||
|
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255) |
||||||
|
$font = "Segoe UI" |
||||||
|
$iBtn10 = GUICtrlCreateButton("Установить Windows 10", 5, 5, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtnTC = GUICtrlCreateButton("Запустить Total Commander", 5, 65, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtnR = GUICtrlCreateButton("Перезагрузка", 5, 105, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
GUISetState() |
||||||
|
|
||||||
|
While 1 |
||||||
|
Switch GUIGetMsg() |
||||||
|
Case $GUI_EVENT_CLOSE |
||||||
|
;~ exit |
||||||
|
Case $iBtn10 |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($setup & $ESD10x86 & $OEM10x86 & $UN10x86) |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtnTC |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($sDiskS & 'kitchen\TotalCommander\TOTALCMD.EXE /I="%%COMMANDER_PATH%%\tcmdmain.ini"') |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtnR |
||||||
|
Exit |
||||||
|
EndSwitch |
||||||
|
WEnd |
||||||
|
EndIf |
||||||
EndFunc |
EndFunc |
||||||
|
|
||||||
Func _show() |
Func _x64() |
||||||
GUICtrlSetState($xor, $gui_enable) |
$hGUI = GUICreate("Windows Setup by Paravis", 410, 250, -1, -1, $WS_POPUP, $WS_EX_LAYERED) |
||||||
GUICtrlSetState($bmgr, $gui_enable) |
GUISetBkColor(0xABCDEF) |
||||||
GUICtrlSetState($g4d, $gui_enable) |
GUICtrlSetState(-1, $GUI_DISABLE) |
||||||
GUICtrlSetState($bmgru, $gui_enable) |
GUISetState() |
||||||
GUICtrlSetState($xoru, $gui_enable) |
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255) |
||||||
|
$font = "Segoe UI" |
||||||
|
$iBtn11 = GUICtrlCreateButton("Установить Windows 11", 5, 5, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtn10 = GUICtrlCreateButton("Установить Windows 10", 5, 45, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtn7 = GUICtrlCreateButton("Установить Windows 7", 5, 85, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtnTC = GUICtrlCreateButton("Запустить Total Commander", 5, 145, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
$iBtnR = GUICtrlCreateButton("Перезагрузка", 5, 185, 350, 40) |
||||||
|
GUICtrlSetFont(-1, 16, 500, 0, $font) |
||||||
|
GUISetState() |
||||||
|
|
||||||
|
_checkesd64() |
||||||
|
|
||||||
|
While 1 |
||||||
|
Switch GUIGetMsg() |
||||||
|
Case $GUI_EVENT_CLOSE |
||||||
|
;~ exit |
||||||
|
Case $iBtn11 |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($setup & $ESD11 & $OEM11 & $UN11) |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtn10 |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($setup & $ESD10x64 & $OEM10x64 & $UN10x64) |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtn7 |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($setup & $ESD7x64 & $OEM7x64 & $UN7x64) |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtnTC |
||||||
|
GUISetState(@SW_HIDE) |
||||||
|
RunWait($sDiskS & 'kitchen\TotalCommander\TOTALCMD64.EXE /I="%%COMMANDER_PATH%%\tcmdmain.ini"') |
||||||
|
GUISetState(@SW_SHOW) |
||||||
|
Case $iBtnR |
||||||
|
Exit |
||||||
|
EndSwitch |
||||||
|
WEnd |
||||||
EndFunc |
EndFunc |
||||||
|
|
||||||
|
Func _checkesd64() |
||||||
|
If Not FileExists($sDisk & "install_11.esd") Then |
||||||
|
GUICtrlSetState($iBtn11, $GUI_DISABLE) |
||||||
|
EndIf |
||||||
|
If Not FileExists($sDisk & "install_10_x64.esd") Then |
||||||
|
GUICtrlSetState($iBtn10, $GUI_DISABLE) |
||||||
|
EndIf |
||||||
|
If Not FileExists($sDisk & "install_7_x64.esd") Then |
||||||
|
GUICtrlSetState($iBtn7, $GUI_DISABLE) |
||||||
|
EndIf |
||||||
|
EndFunc |
||||||
|
|
||||||
While 1 |
Func _checkesd86() |
||||||
Switch GUIGetMsg() |
If Not FileExists($sDisk & "install_10_x86.esd") Then |
||||||
Case $gui_event_close |
GUICtrlSetState($iBtn10, $GUI_DISABLE) |
||||||
ExitLoop |
EndIf |
||||||
Case $xor |
If Not FileExists($sDisk & "install_7_x86.esd") Then |
||||||
_hide() |
GUICtrlSetState($iBtn7, $GUI_DISABLE) |
||||||
FileDelete($sDisk & "\bootmgr") |
EndIf |
||||||
FileDelete($sDisk & "\grldr") |
EndFunc |
||||||
RunWait($bootice & " /DEVICE=" & $sDisk & " /mbr /restore /file=" & $boot & "\xor\xmbr.bin /keep_dpt /quiet") |
|
||||||
RunWait($bootice & " /DEVICE=" & $sDisk & " /pbr /restore /file=" & $boot & "\xor\xpbr.bin /keep_bpb /quiet") |
|
||||||
MsgBox(0 + 64 + 262144, "Xorboot", "bootloader successfully changed!") |
|
||||||
_show() |
|
||||||
Case $bmgr |
|
||||||
_hide() |
|
||||||
FileDelete(@ScriptDir & "Paravis") |
|
||||||
FileDelete($sDisk & "\bootmgr") |
|
||||||
FileDelete($sDisk & "\grldr") |
|
||||||
FileCopy($boot & "\mgr\bootmgr", $sDisk & "bootmgr") |
|
||||||
RunWait($bootice & " /DEVICE=" & $sDisk & " /mbr /install /type=nt60 /quiet") |
|
||||||
RunWait($bootice & " /DEVICE=" & $sDisk & " /pbr /install /type=bootmgr /quiet") |
|
||||||
MsgBox(0 + 64 + 262144, "Bootmgr", "bootloader successfully changed!") |
|
||||||
_show() |
|
||||||
Case $g4d |
|
||||||
_hide() |
|
||||||
FileDelete($sDisk & "\bootmgr") |
|
||||||
FileDelete($sDisk & "\grldr") |
|
||||||
FileCopy($boot & "\g4d\grldr", $sDisk & "grldr") |
|
||||||
RunWait($bootice & " /DEVICE=" & $sDisk & " /mbr /install /type=GRUB4DOS /quiet") |
|
||||||
RunWait($bootice & " /DEVICE=" & $sDisk & " /pbr /install /type=GRUB4DOS /quiet") |
|
||||||
MsgBox(0 + 64 + 262144, "Grub4Dos", "Bootloader successfully changed!") |
|
||||||
_show() |
|
||||||
Case $bmgru |
|
||||||
_hide() |
|
||||||
FileDelete($sDisk & "\efi\boot\bootx64.efi") |
|
||||||
FileDelete($sDisk & "\efi\boot\bootia32.efi") |
|
||||||
FileDelete($sDisk & "\efi\boot\bx86.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\hx86.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\x86.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\bx64.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\hx64.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\x64.pf") |
|
||||||
FileCopy($kitchen & "\UEFIx64\mgrx64.efi", $sDisk & "\efi\boot\bootx64.efi") |
|
||||||
FileCopy($kitchen & "\UEFIx86\mgrx86.efi", $sDisk & "\efi\boot\bootia32.efi") |
|
||||||
MsgBox(0 + 64 + 262144, "UEFI Bootmgr", "Bootloader successfully changed!") |
|
||||||
_show() |
|
||||||
Case $xoru |
|
||||||
_hide() |
|
||||||
FileDelete($sDisk & "\efi\boot\bootx64.efi") |
|
||||||
FileDelete($sDisk & "\efi\boot\bootia32.efi") |
|
||||||
FileDelete($sDisk & "\efi\boot\bx86.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\hx86.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\x86.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\bx64.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\hx64.pf") |
|
||||||
FileDelete($sDisk & "\efi\boot\x64.pf") |
|
||||||
FileCopy($kitchen & "\UEFIx64\bootx64.efi", $sDisk & "\efi\boot\bootx64.efi") |
|
||||||
FileCopy($kitchen & "\UEFIx86\bootia32.efi", $sDisk & "\efi\boot\bootia32.efi") |
|
||||||
FileCopy($kitchen & "\UEFIx86\bx86.pf", $sDisk & "\efi\boot\bx86.pf") |
|
||||||
FileCopy($kitchen & "\UEFIx86\hx86.pf", $sDisk & "\efi\boot\hx86.pf") |
|
||||||
FileCopy($kitchen & "\UEFIx86\x86.pf", $sDisk & "\efi\boot\x86.pf") |
|
||||||
FileCopy($kitchen & "\UEFIx64\bx64.pf", $sDisk & "\efi\boot\bx64.pf") |
|
||||||
FileCopy($kitchen & "\UEFIx64\hx64.pf", $sDisk & "\efi\boot\hx64.pf") |
|
||||||
FileCopy($kitchen & "\UEFIx64\x64.pf", $sDisk & "\efi\boot\x64.pf") |
|
||||||
MsgBox(0 + 64 + 262144, "UEFI Xorboot", "Bootloader successfully changed!") |
|
||||||
_show() |
|
||||||
EndSwitch |
|
||||||
WEnd |
|
Loading…
Reference in new issue