XTLDR Rewrite #7

Merged
belliash merged 184 commits from xtldr_rewrite into master 2024-01-09 18:51:04 +01:00
Showing only changes of commit a65c22c9c9 - Show all commits

View File

@ -113,10 +113,10 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
PWCHAR ModulesList, ProtocolName; PWCHAR ModulesList, ProtocolName;
PLIST_ENTRY OptionsListEntry; PLIST_ENTRY OptionsListEntry;
PXTBL_CONFIG_ENTRY Option; PXTBL_CONFIG_ENTRY Option;
SIZE_T ModuleListLength;
EFI_STATUS Status; EFI_STATUS Status;
/* Set default values */ /* Set default values */
ModulesList = NULL;
ProtocolName = NULL; ProtocolName = NULL;
/* Iterate through all options provided by boot menu entry */ /* Iterate through all options provided by boot menu entry */
@ -134,8 +134,19 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
} }
else if(RtlCompareWideStringInsensitive(Option->Name, L"BOOTMODULES", 0) == 0) else if(RtlCompareWideStringInsensitive(Option->Name, L"BOOTMODULES", 0) == 0)
{ {
/* Set protocol name */ /* Check a length of modules list */
ModulesList = Option->Value; ModuleListLength = RtlWideStringLength(Option->Value, 0);
Status = BlMemoryAllocatePool(sizeof(PWCHAR) * ModuleListLength, (PVOID *)&ModulesList);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to allocate memory, print error message and return status code */
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%lx)\n");
return STATUS_EFI_OUT_OF_RESOURCES;
}
/* Make a copy of modules list */
RtlCopyMemory(ModulesList, Option->Value, sizeof(PWCHAR) * ModuleListLength);
} }
/* Move to the next option entry */ /* Move to the next option entry */