2 * COPYRIGHT: See COPYING.ARM in the top level directory
3 * PROJECT: ReactOS UEFI Boot Library
4 * FILE: boot/environ/lib/misc/bcd.c
5 * PURPOSE: Boot Library BCD Routines
6 * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
9 /* INCLUDES ******************************************************************/
13 /* FUNCTIONS *****************************************************************/
16 * @name BlGetBootOptionListSize
18 * The BlGetBootOptionListSize routine
21 * UEFI Image Handle for the current loaded application.
23 * @return Size of the BCD option
27 BlGetBootOptionListSize (
28 _In_ PBL_BCD_OPTION BcdOption
31 ULONG Size
= 0, NextOffset
= 0;
32 PBL_BCD_OPTION NextOption
;
34 /* Loop all the options*/
37 /* Move to the next one */
38 NextOption
= (PBL_BCD_OPTION
)((ULONG_PTR
)BcdOption
+ NextOffset
);
40 /* Compute the size of the next one */
41 Size
+= BlGetBootOptionSize(NextOption
);
43 /* Update the offset */
44 NextOffset
= NextOption
->NextEntryOffset
;
45 } while (NextOffset
!= 0);
47 /* Return final computed size */
52 * @name BlGetBootOptionSize
54 * The BlGetBootOptionSize routine
57 * UEFI Image Handle for the current loaded application.
59 * @return Size of the BCD option
64 _In_ PBL_BCD_OPTION BcdOption
69 /* Check if there's any data */
70 if (BcdOption
->DataOffset
!= 0)
72 /* Add the size of the data */
73 Size
= BcdOption
->DataOffset
+ BcdOption
->DataSize
;
77 /* No data, just the structure itself */
78 Size
= sizeof(*BcdOption
);
81 /* Any associated options? */
82 Offset
= BcdOption
->ListOffset
;
85 /* Go get those too */
86 Size
+= BlGetBootOptionListSize((PVOID
)((ULONG_PTR
)BcdOption
+ Offset
));
89 /* Return the final size */