[BOOT:LIB] Add boot option size helpers
This commit is contained in:
parent
fd670ace0d
commit
0743fa0106
@ -23,6 +23,16 @@ typedef struct {
|
||||
ULONG Flags;
|
||||
} BOOT_LIBRARY_PARAMETERS, *PBOOT_LIBRARY_PARAMETERS;
|
||||
|
||||
ULONG
|
||||
BlGetBootOptionSize (
|
||||
IN PBOOT_APPLICATION_ENTRY_OPTION Option
|
||||
);
|
||||
|
||||
ULONG
|
||||
BlGetBootOptionListSize (
|
||||
IN PBOOT_APPLICATION_ENTRY_OPTION Options
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlInitializeLibrary (
|
||||
IN PBOOT_INPUT_PARAMETERS InputParameters,
|
||||
|
@ -25,6 +25,84 @@ Abstract:
|
||||
sizeof(BOOT_RETURN_DATA) \
|
||||
)
|
||||
|
||||
ULONG
|
||||
BlGetBootOptionListSize (
|
||||
IN PBOOT_APPLICATION_ENTRY_OPTION Options
|
||||
);
|
||||
|
||||
ULONG
|
||||
BlGetBootOptionSize (
|
||||
IN PBOOT_APPLICATION_ENTRY_OPTION Option
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Gets the size of a boot option.
|
||||
|
||||
Arguments:
|
||||
|
||||
Option - the boot option to get the size of.
|
||||
|
||||
Return Value:
|
||||
|
||||
The size of the option.
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
ULONG TotalSize;
|
||||
|
||||
if (Option->DataOffset != 0) {
|
||||
TotalSize = Option->DataOffset + Option->DataSize;
|
||||
} else {
|
||||
TotalSize = sizeof(BOOT_APPLICATION_ENTRY_OPTION);
|
||||
}
|
||||
|
||||
if (Option->OtherOptionsOffset != 0) {
|
||||
TotalSize += BlGetBootOptionListSize((PBOOT_APPLICATION_ENTRY_OPTION)((PUCHAR)Option + Option->OtherOptionsOffset));
|
||||
}
|
||||
|
||||
return TotalSize;
|
||||
}
|
||||
|
||||
ULONG
|
||||
BlGetBootOptionListSize (
|
||||
IN PBOOT_APPLICATION_ENTRY_OPTION Options
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Gets the total size of a list boot options.
|
||||
|
||||
Arguments:
|
||||
|
||||
Options - the boot option list to get the size of.
|
||||
|
||||
Return Value:
|
||||
|
||||
The size of the options.
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
ULONG TotalSize, NextOffset;
|
||||
PBOOT_APPLICATION_ENTRY_OPTION Option;
|
||||
|
||||
TotalSize = 0;
|
||||
NextOffset = 0;
|
||||
do {
|
||||
Option = (PBOOT_APPLICATION_ENTRY_OPTION)((PUCHAR)Options + NextOffset);
|
||||
NextOffset = Option->NextOptionOffset;
|
||||
TotalSize += BlGetBootOptionSize(Option);
|
||||
} while (NextOffset != 0);
|
||||
|
||||
return TotalSize;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
InitializeLibrary (
|
||||
IN PBOOT_INPUT_PARAMETERS InputParameters,
|
||||
|
Loading…
Reference in New Issue
Block a user