Add a way to define custom boot menu handler
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 27s
Builds / ExectOS (i686) (push) Successful in 25s

This commit is contained in:
2023-12-23 10:43:00 +01:00
parent 57b6037dd6
commit ea5365dcfd
4 changed files with 42 additions and 7 deletions

View File

@@ -126,6 +126,11 @@ BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
OUT PEFI_HANDLE DiskHandle,
OUT PEFI_FILE_HANDLE *FsHandle);
XTCDECL
EFI_STATUS
BlOpenXtProtocol(OUT PVOID *ProtocolHandler,
IN PEFI_GUID ProtocolGuid);
XTCDECL
VOID
BlQueryConsoleMode(OUT PUINT_PTR ResX,
@@ -144,12 +149,11 @@ BlReadKeyStroke(OUT PEFI_INPUT_KEY Key);
XTCDECL
VOID
BlResetConsoleInputBuffer();
BlRegisterBootMenu(PVOID BootMenuRoutine);
XTCDECL
EFI_STATUS
BlOpenXtProtocol(OUT PVOID *ProtocolHandler,
IN PEFI_GUID ProtocolGuid);
VOID
BlResetConsoleInputBuffer();
XTCDECL
EFI_STATUS

View File

@@ -74,6 +74,24 @@ BlOpenXtProtocol(OUT PVOID *ProtocolHandler,
return STATUS_EFI_SUCCESS;
}
/**
* Registers a boot menu callback routine, that will be used to display alternative boot menu.
*
* @param BootMenuRoutine
* Supplies a pointer to the boot menu callback routine.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
BlRegisterBootMenu(PVOID BootMenuRoutine)
{
/* Set boot menu routine */
BlpStatus.BootMenu = BootMenuRoutine;
}
/**
* This routine registers XTLDR protocol for further usage by modules.
*
@@ -109,8 +127,9 @@ BlpRegisterXtLoaderProtocol()
LdrProtocol.Memory.AllocatePool = BlMemoryAllocatePool;
LdrProtocol.Memory.FreePages = BlMemoryFreePages;
LdrProtocol.Memory.FreePool = BlMemoryFreePool;
LdrProtocol.Protocol.OpenProtocol = BlOpenXtProtocol;
LdrProtocol.Protocol.InitializeBootMenuList = BlInitializeBootMenuList;
LdrProtocol.Protocol.OpenProtocol = BlOpenXtProtocol;
LdrProtocol.Protocol.RegisterBootMenu = BlRegisterBootMenu;
LdrProtocol.Tui.DisplayErrorDialog = BlDisplayErrorDialog;
LdrProtocol.Tui.DisplayInfoDialog = BlDisplayInfoDialog;
LdrProtocol.Tui.DisplayProgressDialog = BlDisplayProgressDialog;

View File

@@ -191,8 +191,16 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle,
for(;;)
{
/* Display boot menu */
BlDisplayBootMenu();
if(BlpStatus.BootMenu != NULL)
{
/* Display alternative boot menu */
BlpStatus.BootMenu();
}
else
{
/* Display default boot menu */
BlDisplayBootMenu();
}
}
/* This point should be never reached, if this happen return error code */