- Fix BCD bugs.
svn path=/trunk/; revision=69450
PVOID FinalBuffer;
UNICODE_STRING BcdString;
PVOID FinalBuffer;
UNICODE_STRING BcdString;
+ /* Initialize variables */
PathBuffer = NULL;
BcdDevice = NULL;
BcdPath = NULL;
PathBuffer = NULL;
BcdDevice = NULL;
BcdPath = NULL;
/* Otherwise, compute the hardcoded path of the BCD */
Status = BmpFwGetFullPath(L"\\BCD", &FullPath);
/* Otherwise, compute the hardcoded path of the BCD */
Status = BmpFwGetFullPath(L"\\BCD", &FullPath);
+ EfiPrintf(L"Status: %lx %s\r\n", Status, FullPath);
if (!NT_SUCCESS(Status))
{
/* User the raw path */
if (!NT_SUCCESS(Status))
{
/* User the raw path */
/* Calculate where the next option should go */
Option = (PVOID)((ULONG_PTR)Option + Size);
/* Calculate where the next option should go */
Option = (PVOID)((ULONG_PTR)Option + Size);
- /* Convert the path oprtion */
+ /* Convert the path option */
Status = EfiInitpConvertEfiFilePath(OsDevicePath,
BcdOSLoaderString_SystemRoot,
Option,
Status = EfiInitpConvertEfiFilePath(OsDevicePath,
BcdOSLoaderString_SystemRoot,
Option,
)
{
ULONG_PTR NextOption = 0, ListOption;
)
{
ULONG_PTR NextOption = 0, ListOption;
+ PBL_BCD_OPTION Option, FoundOption;
/* No options, bail out */
if (!List)
/* No options, bail out */
if (!List)
}
/* Loop while we find an option */
}
/* Loop while we find an option */
+ FoundOption = NULL;
+ do
{
/* Get the next option and see if it matches the type */
Option = (PBL_BCD_OPTION)((ULONG_PTR)List + NextOption);
if ((Option->Type == Type) && !(Option->Empty))
{
{
/* Get the next option and see if it matches the type */
Option = (PBL_BCD_OPTION)((ULONG_PTR)List + NextOption);
if ((Option->Type == Type) && !(Option->Empty))
{
Option = MiscGetBootOption((PBL_BCD_OPTION)((ULONG_PTR)Option +
ListOption),
Type);
Option = MiscGetBootOption((PBL_BCD_OPTION)((ULONG_PTR)Option +
ListOption),
Type);
-
- /* Found one, return it */
+ /* Return it */
+ FoundOption = Option;
+ break;
- /* We found the option, return it */
- return Option;
+ /* Return the option that was found, if any */
+ return FoundOption;
/*++
* @name BlGetBootOptionListSize
*
/*++
* @name BlGetBootOptionListSize
*
/* Update the offset */
NextOffset = NextOption->NextEntryOffset;
/* Update the offset */
NextOffset = NextOption->NextEntryOffset;
- } while (NextOffset != 0);
/* Return final computed size */
return Size;
/* Return final computed size */
return Size;
ULONG Size, Offset;
/* Check if there's any data */
ULONG Size, Offset;
/* Check if there's any data */
- if (BcdOption->DataOffset != 0)
+ if (BcdOption->DataOffset)
{
/* Add the size of the data */
Size = BcdOption->DataOffset + BcdOption->DataSize;
{
/* Add the size of the data */
Size = BcdOption->DataOffset + BcdOption->DataSize;
/* Any associated options? */
Offset = BcdOption->ListOffset;
/* Any associated options? */
Offset = BcdOption->ListOffset;
{
/* Go get those too */
Size += BlGetBootOptionListSize((PVOID)((ULONG_PTR)BcdOption + Offset));
{
/* Go get those too */
Size += BlGetBootOptionListSize((PVOID)((ULONG_PTR)BcdOption + Offset));
{
/* Extract the string */
String = (PWCHAR)((ULONG_PTR)Option + Option->DataOffset);
{
/* Extract the string */
String = (PWCHAR)((ULONG_PTR)Option + Option->DataOffset);
+ Status = STATUS_SUCCESS;
}
else
{
/* No string is present */
String = NULL;
}
else
{
/* No string is present */
String = NULL;
+ Status = STATUS_NOT_FOUND;
}
/* Compute the data size */
}
/* Compute the data size */
AppIdentifier = BlGetApplicationIdentifier();
Status = BlpBootOptionCallbackString(AppIdentifier, Type, String, StringLength, &String, &StringLength);
#else
AppIdentifier = BlGetApplicationIdentifier();
Status = BlpBootOptionCallbackString(AppIdentifier, Type, String, StringLength, &String, &StringLength);
#else
- Status = STATUS_SUCCESS;
/* Check if we have space for one more character */
CopyLength = StringLength + 1;
if (CopyLength < StringLength)
/* Check if we have space for one more character */
CopyLength = StringLength + 1;
if (CopyLength < StringLength)
CopyLength = -1;
Status = STATUS_INTEGER_OVERFLOW;
}
CopyLength = -1;
Status = STATUS_INTEGER_OVERFLOW;
}
- else
- {
- /* Go ahead */
- Status = STATUS_SUCCESS;
- }
/* No overflow? */
if (NT_SUCCESS(Status))
/* No overflow? */
if (NT_SUCCESS(Status))
}
#else
/* No secure boot, so the secure descriptors are the standard ones */
}
#else
/* No secure boot, so the secure descriptors are the standard ones */
- Status = STATUS_SUCCESS;
SecureDescriptor = DeviceDescriptor;
SecureListData = ListCopy;
#endif
SecureDescriptor = DeviceDescriptor;
SecureListData = ListCopy;
#endif
/* Assume failure */
LocalHandle = NULL;
/* Assume failure */
LocalHandle = NULL;
+ EfiPrintf(L"Opening BCD store: %wZ\n", FileName);
/* Allocate a path descriptor */
Length = FileName->Length + sizeof(*FilePath);
/* Allocate a path descriptor */
Length = FileName->Length + sizeof(*FilePath);