XTLDR Rewrite #7
@ -25,10 +25,12 @@ BlGetConfigValue(IN CONST PWCHAR ConfigName)
|
||||
{
|
||||
PXTBL_CONFIG_ENTRY ConfigEntry;
|
||||
PLIST_ENTRY ConfigListEntry;
|
||||
SIZE_T Length;
|
||||
SIZE_T KeyLength, ValueLength;
|
||||
EFI_STATUS Status;
|
||||
PWCHAR Value;
|
||||
|
||||
/* Get config entry name length */
|
||||
Length = RtlWideStringLength(ConfigName, 0);
|
||||
KeyLength = RtlWideStringLength(ConfigName, 0);
|
||||
|
||||
/* Iterate through config entries */
|
||||
ConfigListEntry = BlpConfig.Flink;
|
||||
@ -38,10 +40,24 @@ BlGetConfigValue(IN CONST PWCHAR ConfigName)
|
||||
ConfigEntry = CONTAIN_RECORD(ConfigListEntry, XTBL_CONFIG_ENTRY, Flink);
|
||||
|
||||
/* Check if requested configuration found */
|
||||
if(RtlCompareWideStringInsensitive(ConfigEntry->Name, ConfigName, Length) == 0)
|
||||
if(RtlCompareWideStringInsensitive(ConfigEntry->Name, ConfigName, KeyLength) == 0)
|
||||
{
|
||||
/* Return config value */
|
||||
return ConfigEntry->Value;
|
||||
/* Get value length */
|
||||
ValueLength = RtlWideStringLength(ConfigEntry->Value, 0);
|
||||
|
||||
/* Allocate memory for value */
|
||||
Status = BlMemoryAllocatePool(ValueLength * sizeof(WCHAR), (PVOID *)&Value);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure, return NULL */
|
||||
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%lx)\n", Status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Copy value and return it */
|
||||
RtlCopyMemory(Value, ConfigEntry->Value, ValueLength * sizeof(WCHAR));
|
||||
Value[ValueLength] = 0;
|
||||
return Value;
|
||||
}
|
||||
|
||||
/* Move to the next config entry */
|
||||
|
Loading…
Reference in New Issue
Block a user