mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2025-12-07 09:36:10 -08:00
Log boot entries during setup
This commit is contained in:
26
src/Efi.cs
26
src/Efi.cs
@@ -55,6 +55,9 @@ public class Efi {
|
|||||||
* @return String representation of this object.
|
* @return String representation of this object.
|
||||||
*/
|
*/
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
|
if (Data == null) {
|
||||||
|
return $"{Name} Guid={Guid} Attributes={Attributes} Data=null";
|
||||||
|
}
|
||||||
var hex = BitConverter.ToString(Data).Replace("-", " ");
|
var hex = BitConverter.ToString(Data).Replace("-", " ");
|
||||||
var text = new string(Data.Select(c => 0x20 <= c && c <= 0x7f ? (char) c : ' ').ToArray());
|
var text = new string(Data.Select(c => 0x20 <= c && c <= 0x7f ? (char) c : ' ').ToArray());
|
||||||
return $"{Name} Guid={Guid} Attributes={Attributes} Text='{text}' Bytes='{hex}'";
|
return $"{Name} Guid={Guid} Attributes={Attributes} Text='{text}' Bytes='{hex}'";
|
||||||
@@ -445,6 +448,29 @@ public class Efi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log the boot entries.
|
||||||
|
*/
|
||||||
|
public static void LogBootEntries() {
|
||||||
|
try {
|
||||||
|
var bootOrder = GetVariable("BootOrder");
|
||||||
|
var bootCurrent = GetVariable("BootCurrent");
|
||||||
|
Setup.Log($"LogBootOrder: {bootOrder}");
|
||||||
|
Setup.Log($"LogBootOrder: {bootCurrent}");
|
||||||
|
var bootOrderInts = new List<UInt16>(BytesToUInt16s(bootOrder.Data));
|
||||||
|
// Windows can't enumerate EFI variables, and trying them all is too slow.
|
||||||
|
// 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 entry = GetVariable(String.Format("Boot{0:X04}", num));
|
||||||
|
if (entry.Data != null) {
|
||||||
|
Setup.Log($"LogBootOrder: {entry}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Setup.Log($"LogBootOrder failed: {e.ToString()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log the BGRT table (for debugging).
|
* Log the BGRT table (for debugging).
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -758,6 +758,7 @@ public class Setup {
|
|||||||
InitEspPath();
|
InitEspPath();
|
||||||
InitEspInfo();
|
InitEspInfo();
|
||||||
Efi.LogBGRT();
|
Efi.LogBGRT();
|
||||||
|
Efi.LogBootEntries();
|
||||||
bool allowSecureBoot = false;
|
bool allowSecureBoot = false;
|
||||||
bool allowBitLocker = false;
|
bool allowBitLocker = false;
|
||||||
bool allowBadLoader = false;
|
bool allowBadLoader = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user