mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2026-04-14 06:01:36 -07:00
Log BGRT contents during setup
This commit is contained in:
25
src/Efi.cs
25
src/Efi.cs
@@ -31,6 +31,9 @@ public class Efi {
|
|||||||
[DllImport("kernel32.dll", SetLastError = true)]
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
private static extern bool CloseHandle(IntPtr hObject);
|
private static extern bool CloseHandle(IntPtr hObject);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
|
private static extern UInt32 GetSystemFirmwareTable(UInt32 provider, UInt32 table, [MarshalAs(UnmanagedType.LPArray)] byte[] buffer, UInt32 len);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
private struct TokPriv1Luid {
|
private struct TokPriv1Luid {
|
||||||
public int Count;
|
public int Count;
|
||||||
@@ -441,4 +444,26 @@ public class Efi {
|
|||||||
SetVariable(bootOrder, dryRun);
|
SetVariable(bootOrder, dryRun);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log the BGRT table (for debugging).
|
||||||
|
*/
|
||||||
|
public static void LogBGRT() {
|
||||||
|
try {
|
||||||
|
const UInt32 acpiBE = 0x41435049, bgrtLE = 0x54524742;
|
||||||
|
UInt32 size = GetSystemFirmwareTable(acpiBE, bgrtLE, null, 0);
|
||||||
|
byte[] buf = new byte[size];
|
||||||
|
var ret = GetSystemFirmwareTable(acpiBE, bgrtLE, buf, size);
|
||||||
|
if (ret == size) {
|
||||||
|
var hex = BitConverter.ToString(buf).Replace("-", " ");
|
||||||
|
Setup.Log($"LogBGRT: {hex}");
|
||||||
|
} else if (ret == 0) {
|
||||||
|
Setup.Log($"LogBGRT: Win32Error {Marshal.GetLastWin32Error()}");
|
||||||
|
} else {
|
||||||
|
Setup.Log($"LogBGRT: Size problems: spec {0x38}, buf {size}, ret {ret}");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Setup.Log($"LogBGRT: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -757,6 +757,7 @@ public class Setup {
|
|||||||
|
|
||||||
InitEspPath();
|
InitEspPath();
|
||||||
InitEspInfo();
|
InitEspInfo();
|
||||||
|
Efi.LogBGRT();
|
||||||
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