mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2026-09-12 07:06:06 -07:00
Add logging to verify entry creation
This commit is contained in:
+6
-1
@@ -472,7 +472,12 @@ public class Efi {
|
|||||||
var bootOrderInts = new List<UInt16>(BytesToUInt16s(bootOrder.Data));
|
var bootOrderInts = new List<UInt16>(BytesToUInt16s(bootOrder.Data));
|
||||||
// Windows can't enumerate EFI variables, and trying them all is too slow.
|
// Windows can't enumerate EFI variables, and trying them all is too slow.
|
||||||
// BootOrder + BootCurrent + the first 0xff entries should be enough.
|
// BootOrder + BootCurrent + the first 0xff entries should be enough.
|
||||||
foreach (var num in BytesToUInt16s(bootCurrent.Data).Concat(bootOrderInts).Concat(Enumerable.Range(0, 0xff).Select(i => (UInt16) i))) {
|
var seen = new HashSet<UInt16>();
|
||||||
|
foreach (var num in bootOrderInts.Concat(BytesToUInt16s(bootCurrent.Data)).Concat(Enumerable.Range(0, 0xff).Select(i => (UInt16) i))) {
|
||||||
|
if (seen.Contains(num)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
seen.Add(num);
|
||||||
var entry = GetVariable(String.Format("Boot{0:X04}", num));
|
var entry = GetVariable(String.Format("Boot{0:X04}", num));
|
||||||
if (entry.Data != null) {
|
if (entry.Data != null) {
|
||||||
Setup.Log($"LogBootOrder: {entry}");
|
Setup.Log($"LogBootOrder: {entry}");
|
||||||
|
|||||||
@@ -400,6 +400,9 @@ public class Setup {
|
|||||||
}
|
}
|
||||||
var fwbootmgr = "{fwbootmgr}";
|
var fwbootmgr = "{fwbootmgr}";
|
||||||
Execute("bcdedit", $"/set {fwbootmgr} displayorder {guid} /addfirst", true);
|
Execute("bcdedit", $"/set {fwbootmgr} displayorder {guid} /addfirst", true);
|
||||||
|
// Verify that the entry was created.
|
||||||
|
Execute("bcdedit", "/enum firmware", true);
|
||||||
|
Execute("bcdedit", $"/enum {guid}", true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log($"EnableBCDEdit failed: {e.ToString()}");
|
Log($"EnableBCDEdit failed: {e.ToString()}");
|
||||||
throw new SetupException("Failed to enable HackBGRT with BCDEdit!");
|
throw new SetupException("Failed to enable HackBGRT with BCDEdit!");
|
||||||
@@ -441,6 +444,8 @@ public class Setup {
|
|||||||
protected void EnableEntry() {
|
protected void EnableEntry() {
|
||||||
Efi.MakeAndEnableBootEntry("HackBGRT", "\\EFI\\HackBGRT\\loader.efi", DryRun);
|
Efi.MakeAndEnableBootEntry("HackBGRT", "\\EFI\\HackBGRT\\loader.efi", DryRun);
|
||||||
WriteLine("Enabled NVRAM entry for HackBGRT.");
|
WriteLine("Enabled NVRAM entry for HackBGRT.");
|
||||||
|
// Verify that the entry was created.
|
||||||
|
Efi.LogBootEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user