Implement BlInitializeBootMenuList()
This commit is contained in:
@@ -91,6 +91,12 @@ BlGetVolumeDevicePath(IN PCHAR SystemPath,
|
||||
OUT PCHAR *ArcName,
|
||||
OUT PCHAR *Path);
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
BlInitializeBootMenuList(OUT PXTBL_BOOTMENU_ITEM MenuEntries,
|
||||
OUT PULONG EntriesCount,
|
||||
OUT PULONG DefaultId);
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlMemoryAllocatePages(IN UINT64 Pages,
|
||||
|
@@ -109,6 +109,7 @@ BlpRegisterXtLoaderProtocol()
|
||||
LdrProtocol.Memory.FreePages = BlMemoryFreePages;
|
||||
LdrProtocol.Memory.FreePool = BlMemoryFreePool;
|
||||
LdrProtocol.Protocol.OpenProtocol = BlOpenXtProtocol;
|
||||
LdrProtocol.Protocol.InitializeBootMenuList = BlInitializeBootMenuList;
|
||||
LdrProtocol.Tui.DisplayErrorDialog = BlDisplayErrorDialog;
|
||||
LdrProtocol.Tui.DisplayInfoDialog = BlDisplayInfoDialog;
|
||||
LdrProtocol.Tui.DisplayProgressDialog = BlDisplayProgressDialog;
|
||||
|
@@ -9,6 +9,93 @@
|
||||
#include <xtldr.h>
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a list of operating systems for XTLDR boot menu.
|
||||
*
|
||||
* @param MenuEntries
|
||||
* Supplies a pointer to memory area where operating systems list will be stored.
|
||||
*
|
||||
* @param EntriesCount
|
||||
* Supplies a pointer to memory area where number of menu entries will be stored.
|
||||
*
|
||||
* @param DefaultId
|
||||
* Supplies a pointer to memory area where ID of default menu entry will be stored.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
BlInitializeBootMenuList(OUT PXTBL_BOOTMENU_ITEM MenuEntries,
|
||||
OUT PULONG EntriesCount,
|
||||
OUT PULONG DefaultId)
|
||||
{
|
||||
PWCHAR DefaultMenuEntry, MenuEntryName;
|
||||
PLIST_ENTRY MenuEntrySectionList, MenuEntryList;
|
||||
PXTBL_CONFIG_SECTION MenuEntrySection;
|
||||
PXTBL_CONFIG_ENTRY MenuEntryOption;
|
||||
PXTBL_BOOTMENU_ITEM OsList;
|
||||
ULONG DefaultOS, NumberOfEntries;
|
||||
|
||||
/* Set default values */
|
||||
DefaultOS = 0;
|
||||
NumberOfEntries = 0;
|
||||
OsList = NULL;
|
||||
|
||||
/* Get default menu entry from configuration */
|
||||
DefaultMenuEntry = BlGetConfigValue(L"DEFAULT");
|
||||
|
||||
/* Iterate through all menu sections */
|
||||
MenuEntrySectionList = BlpMenuList->Flink;
|
||||
while(MenuEntrySectionList != BlpMenuList)
|
||||
{
|
||||
/* NULLify menu entry name */
|
||||
MenuEntryName = NULL;
|
||||
|
||||
/* Get menu section */
|
||||
MenuEntrySection = CONTAIN_RECORD(MenuEntrySectionList, XTBL_CONFIG_SECTION, Flink);
|
||||
|
||||
/* Check if this is the default menu entry */
|
||||
if(RtlCompareWideStringInsensitive(MenuEntrySection->SectionName, DefaultMenuEntry, 0) == 0)
|
||||
{
|
||||
/* Set default OS ID */
|
||||
DefaultOS = NumberOfEntries;
|
||||
}
|
||||
|
||||
/* Iterate through all entry parameters */
|
||||
MenuEntryList = MenuEntrySection->Options.Flink;
|
||||
while(MenuEntryList != &MenuEntrySection->Options)
|
||||
{
|
||||
/* Get menu entry parameter */
|
||||
MenuEntryOption = CONTAIN_RECORD(MenuEntryList, XTBL_CONFIG_ENTRY, Flink);
|
||||
|
||||
/* Check if this is the menu entry display name */
|
||||
if(RtlCompareWideStringInsensitive(MenuEntryOption->Name, L"SYSTEMNAME", 0) == 0)
|
||||
{
|
||||
/* Set menu entry display name */
|
||||
MenuEntryName = MenuEntryOption->Value;
|
||||
}
|
||||
|
||||
/* Get next parameter for this menu entry */
|
||||
MenuEntryList = MenuEntryList->Flink;
|
||||
}
|
||||
|
||||
/* Add OS to the boot menu list */
|
||||
OsList[NumberOfEntries].EntryName = MenuEntryName;
|
||||
OsList[NumberOfEntries].Options = &MenuEntrySection->Options;
|
||||
|
||||
/* Get next menu entry */
|
||||
MenuEntrySectionList = MenuEntrySectionList->Flink;
|
||||
NumberOfEntries++;
|
||||
}
|
||||
|
||||
/* Set return values */
|
||||
*DefaultId = DefaultOS;
|
||||
*EntriesCount = NumberOfEntries;
|
||||
MenuEntries = OsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine is the entry point of the XT EFI boot loader.
|
||||
*
|
||||
|
Reference in New Issue
Block a user