mirror of
https://github.com/reactos/reactos.git
synced 2024-08-10 05:08:11 +00:00
[BOOTLIB]:
- Fix BCD bugs. svn path=/trunk/; revision=69450
This commit is contained in:
parent
b099514289
commit
b25523b5e3
|
@ -505,6 +505,7 @@ BmOpenDataStore (
|
||||||
PVOID FinalBuffer;
|
PVOID FinalBuffer;
|
||||||
UNICODE_STRING BcdString;
|
UNICODE_STRING BcdString;
|
||||||
|
|
||||||
|
/* Initialize variables */
|
||||||
PathBuffer = NULL;
|
PathBuffer = NULL;
|
||||||
BcdDevice = NULL;
|
BcdDevice = NULL;
|
||||||
BcdPath = NULL;
|
BcdPath = NULL;
|
||||||
|
@ -559,6 +560,7 @@ BmOpenDataStore (
|
||||||
|
|
||||||
/* Otherwise, compute the hardcoded path of the BCD */
|
/* Otherwise, compute the hardcoded path of the BCD */
|
||||||
Status = BmpFwGetFullPath(L"\\BCD", &FullPath);
|
Status = BmpFwGetFullPath(L"\\BCD", &FullPath);
|
||||||
|
EfiPrintf(L"Status: %lx %s\r\n", Status, FullPath);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* User the raw path */
|
/* User the raw path */
|
||||||
|
|
|
@ -803,7 +803,7 @@ EfiInitpCreateApplicationEntry (
|
||||||
/* Calculate where the next option should go */
|
/* Calculate where the next option should go */
|
||||||
Option = (PVOID)((ULONG_PTR)Option + Size);
|
Option = (PVOID)((ULONG_PTR)Option + Size);
|
||||||
|
|
||||||
/* Convert the path oprtion */
|
/* Convert the path option */
|
||||||
Status = EfiInitpConvertEfiFilePath(OsDevicePath,
|
Status = EfiInitpConvertEfiFilePath(OsDevicePath,
|
||||||
BcdOSLoaderString_SystemRoot,
|
BcdOSLoaderString_SystemRoot,
|
||||||
Option,
|
Option,
|
||||||
|
|
|
@ -20,7 +20,7 @@ MiscGetBootOption (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ULONG_PTR NextOption = 0, ListOption;
|
ULONG_PTR NextOption = 0, ListOption;
|
||||||
PBL_BCD_OPTION Option;
|
PBL_BCD_OPTION Option, FoundOption;
|
||||||
|
|
||||||
/* No options, bail out */
|
/* No options, bail out */
|
||||||
if (!List)
|
if (!List)
|
||||||
|
@ -29,12 +29,14 @@ MiscGetBootOption (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop while we find an option */
|
/* Loop while we find an option */
|
||||||
while (TRUE)
|
FoundOption = NULL;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
/* Get the next option and see if it matches the type */
|
/* Get the next option and see if it matches the type */
|
||||||
Option = (PBL_BCD_OPTION)((ULONG_PTR)List + NextOption);
|
Option = (PBL_BCD_OPTION)((ULONG_PTR)List + NextOption);
|
||||||
if ((Option->Type == Type) && !(Option->Empty))
|
if ((Option->Type == Type) && !(Option->Empty))
|
||||||
{
|
{
|
||||||
|
FoundOption = Option;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,21 +51,19 @@ MiscGetBootOption (
|
||||||
Option = MiscGetBootOption((PBL_BCD_OPTION)((ULONG_PTR)Option +
|
Option = MiscGetBootOption((PBL_BCD_OPTION)((ULONG_PTR)Option +
|
||||||
ListOption),
|
ListOption),
|
||||||
Type);
|
Type);
|
||||||
|
|
||||||
/* Found one, return it */
|
|
||||||
if (Option)
|
if (Option)
|
||||||
{
|
{
|
||||||
return Option;
|
/* Return it */
|
||||||
|
FoundOption = Option;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} while (NextOption);
|
||||||
|
|
||||||
/* We found the option, return it */
|
/* Return the option that was found, if any */
|
||||||
return Option;
|
return FoundOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
* @name BlGetBootOptionListSize
|
* @name BlGetBootOptionListSize
|
||||||
*
|
*
|
||||||
|
@ -94,7 +94,7 @@ BlGetBootOptionListSize (
|
||||||
|
|
||||||
/* Update the offset */
|
/* Update the offset */
|
||||||
NextOffset = NextOption->NextEntryOffset;
|
NextOffset = NextOption->NextEntryOffset;
|
||||||
} while (NextOffset != 0);
|
} while (NextOffset);
|
||||||
|
|
||||||
/* Return final computed size */
|
/* Return final computed size */
|
||||||
return Size;
|
return Size;
|
||||||
|
@ -119,7 +119,7 @@ BlGetBootOptionSize (
|
||||||
ULONG Size, Offset;
|
ULONG Size, Offset;
|
||||||
|
|
||||||
/* Check if there's any data */
|
/* Check if there's any data */
|
||||||
if (BcdOption->DataOffset != 0)
|
if (BcdOption->DataOffset)
|
||||||
{
|
{
|
||||||
/* Add the size of the data */
|
/* Add the size of the data */
|
||||||
Size = BcdOption->DataOffset + BcdOption->DataSize;
|
Size = BcdOption->DataOffset + BcdOption->DataSize;
|
||||||
|
@ -132,7 +132,7 @@ BlGetBootOptionSize (
|
||||||
|
|
||||||
/* Any associated options? */
|
/* Any associated options? */
|
||||||
Offset = BcdOption->ListOffset;
|
Offset = BcdOption->ListOffset;
|
||||||
if (Offset != 0)
|
if (Offset)
|
||||||
{
|
{
|
||||||
/* Go get those too */
|
/* Go get those too */
|
||||||
Size += BlGetBootOptionListSize((PVOID)((ULONG_PTR)BcdOption + Offset));
|
Size += BlGetBootOptionListSize((PVOID)((ULONG_PTR)BcdOption + Offset));
|
||||||
|
@ -167,11 +167,13 @@ BlGetBootOptionString (
|
||||||
{
|
{
|
||||||
/* Extract the string */
|
/* Extract the string */
|
||||||
String = (PWCHAR)((ULONG_PTR)Option + Option->DataOffset);
|
String = (PWCHAR)((ULONG_PTR)Option + Option->DataOffset);
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No string is present */
|
/* No string is present */
|
||||||
String = NULL;
|
String = NULL;
|
||||||
|
Status = STATUS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the data size */
|
/* Compute the data size */
|
||||||
|
@ -182,9 +184,7 @@ BlGetBootOptionString (
|
||||||
AppIdentifier = BlGetApplicationIdentifier();
|
AppIdentifier = BlGetApplicationIdentifier();
|
||||||
Status = BlpBootOptionCallbackString(AppIdentifier, Type, String, StringLength, &String, &StringLength);
|
Status = BlpBootOptionCallbackString(AppIdentifier, Type, String, StringLength, &String, &StringLength);
|
||||||
#else
|
#else
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check if we have space for one more character */
|
/* Check if we have space for one more character */
|
||||||
CopyLength = StringLength + 1;
|
CopyLength = StringLength + 1;
|
||||||
if (CopyLength < StringLength)
|
if (CopyLength < StringLength)
|
||||||
|
@ -193,11 +193,6 @@ BlGetBootOptionString (
|
||||||
CopyLength = -1;
|
CopyLength = -1;
|
||||||
Status = STATUS_INTEGER_OVERFLOW;
|
Status = STATUS_INTEGER_OVERFLOW;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Go ahead */
|
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No overflow? */
|
/* No overflow? */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
@ -331,7 +326,6 @@ BlGetBootOptionDevice (
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* No secure boot, so the secure descriptors are the standard ones */
|
/* No secure boot, so the secure descriptors are the standard ones */
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
SecureDescriptor = DeviceDescriptor;
|
SecureDescriptor = DeviceDescriptor;
|
||||||
SecureListData = ListCopy;
|
SecureListData = ListCopy;
|
||||||
#endif
|
#endif
|
||||||
|
@ -765,6 +759,7 @@ BcdOpenStoreFromFile (
|
||||||
|
|
||||||
/* Assume failure */
|
/* Assume failure */
|
||||||
LocalHandle = NULL;
|
LocalHandle = NULL;
|
||||||
|
EfiPrintf(L"Opening BCD store: %wZ\n", FileName);
|
||||||
|
|
||||||
/* Allocate a path descriptor */
|
/* Allocate a path descriptor */
|
||||||
Length = FileName->Length + sizeof(*FilePath);
|
Length = FileName->Length + sizeof(*FilePath);
|
||||||
|
|
Loading…
Reference in a new issue