Исходник Change bootloader'а
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

125 lines
5.0 KiB

#include <GUIConstantsEx.au3>
#include <GuiConstants.au3>
#include <file.au3>
#NoTrayIcon
#RequireAdmin
#pragma compile(Stripper, True)
#pragma compile(ProductVersion, 3.0.0)
#pragma compile(ProductName, "Change bootLoader")
#pragma compile(FileDescription, CBL)
#pragma compile(LegalCopyright, paravis.ru@2023)
#pragma compile(CompanyName, paravis.ru@2023)
Opt("ExpandEnvStrings", 1)
$sDisk = StringLeft(@ScriptDir, 3)
$kitchen = ($sDisk & "efi\Paravis\Boot\kitchen")
$bootice = ($sDisk & "efi\Paravis\Boot\kitchen\bootice.exe")
$main = GUICreate("Change BootLoader", 390, 125, 318, 213)
GUICtrlCreateGroup("Legacy BIOS", 3, 3, 384, 61)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$xor = GUICtrlCreateButton("Install XorBoot", 8, 20, 121, 33)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$bmgr = GUICtrlCreateButton("Install Bootmgr", 134, 20, 121, 33)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$g4d = GUICtrlCreateButton("Install Grub4Dos", 261, 20, 121, 33)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("UEFI", 3, 62, 384, 61)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$bmgru = GUICtrlCreateButton("Install Bootmgr (SecureBoot ON)", 8, 80, 180, 33)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$xoru = GUICtrlCreateButton("Install Xorboot (SecureBoot OFF)", 200, 80, 180, 33)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
GUISetState(@SW_SHOW, $main)
Func _hide()
GUICtrlSetState($xor, $gui_disable)
GUICtrlSetState($bmgr, $gui_disable)
GUICtrlSetState($g4d, $gui_disable)
GUICtrlSetState($bmgru, $gui_disable)
GUICtrlSetState($xoru, $gui_disable)
EndFunc
Func _show()
GUICtrlSetState($xor, $gui_enable)
GUICtrlSetState($bmgr, $gui_enable)
GUICtrlSetState($g4d, $gui_enable)
GUICtrlSetState($bmgru, $gui_enable)
GUICtrlSetState($xoru, $gui_enable)
EndFunc
While 1
Switch GUIGetMsg()
Case $gui_event_close
ExitLoop
Case $xor
_hide()
FileDelete($sDisk & "\bootmgr")
FileDelete($sDisk & "\grldr")
FileCopy($kitchen & "\13", $sDisk & "efi\Paravis\boot\13", 1)
FileCopy($kitchen & "\1313", $sDisk & "efi\Paravis\boot\1313", 1)
FileCopy($kitchen & "\xbt.bin", $sDisk & "efi\Paravis\boot\Paravis", 1)
RunWait($bootice & " /DEVICE=" & $sDisk & " /mbr /restore /file=xbt.bin /keep_dpt /quiet")
RunWait($bootice & " /DEVICE=" & $sDisk & " /pbr /restore /file=xbt_p.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($kitchen & "\bootmgr", $sDisk & "bootmgr")
FileCopy($kitchen & "\bootmgr", $sDisk & "efi\Paravis\boot\Paravis", 1)
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($kitchen & "\grldr", $sDisk & "grldr")
FileCopy($kitchen & "\grldr", $sDisk & "efi\Paravis\boot\Paravis", 1)
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