Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Rikitav/Unified.Firmware/llms.txt

Use this file to discover all available pages before exploring further.

LoadOptionBase is the abstract base class in Unified.Firmware.BootService.LoadOption from which all UEFI load-option types derive. It models the four fields defined by the UEFI specification’s EFI_LOAD_OPTION structure — Attributes, Description, FilePathList (exposed here as Protocols), and OptionalData — and provides sensible defaults so that concrete subclasses only need to supply the values relevant to their use case. You will rarely instantiate a LoadOptionBase subclass yourself for everyday work; FirmwareBootOption is the concrete implementation designed for that purpose. LoadOptionBase becomes relevant when you want a strongly-typed boot-entry model with additional properties mapped from OptionalData or another source — in that case, extend LoadOptionBase, add your properties, and pass the generic type parameter to FirmwareBootService.ReadLoadOption<T>() or FirmwareBootService.EnumrateBootOptions<T>().
For the vast majority of use cases — reading, creating, updating, and deleting standard boot entries — use FirmwareBootOption directly. Only subclass LoadOptionBase when you need custom deserialization logic or a domain-specific type that carries additional properties derived from the raw boot entry data.

Namespace

namespace Unified.Firmware.BootService.LoadOption;

Properties

Attributes
LoadOptionAttributes
Gets or sets the boot-behavior flags for this load option. The default value is LoadOptionAttributes.CATEGORY_BOOT, which classifies the entry as a standard boot path processed during normal startup.Combine flag members with the bitwise OR operator:
ValueHexEffect
ACTIVE0x00000001The firmware will attempt to boot this entry automatically.
FORCE_RECONNECT0x00000002All UEFI drivers are disconnected and reconnected after all Driver#### options are processed.
HIDDEN0x00000008The entry is excluded from any boot-selection menu.
CATEGORY0x00001F00Sub-field mask describing how the boot manager groups Boot#### load options.
CATEGORY_BOOT0x00000000Normal boot entry (default).
CATEGORY_APP0x00000100Selectable application, not part of the normal boot sequence.
See LoadOptionAttributes for the full flags reference.
Description
string
Gets or sets the human-readable name for this load option, displayed in the UEFI boot selection menu. The default value is an empty string (string.Empty).
Protocols
DevicePathProtocolBase[]
Gets or sets the packed device-path protocol array. Corresponds to the FilePathList field of EFI_LOAD_OPTION. The first element identifies the device and location of the EFI image; subsequent elements are optional and OS-vendor-specific. Each element is a variable-length DevicePathProtocolBase instance. The default value is an empty array ([]).
OptionalData
byte[]
Gets or sets the binary data buffer that the firmware passes verbatim to the loaded EFI image. Corresponds to the OptionalData field of EFI_LOAD_OPTION. The firmware passes a NULL pointer to the image when this array is empty. The default value is an empty array ([]).

Subclassing

To create a custom load-option type, inherit from LoadOptionBase and add a public parameterless constructor. The deserialization infrastructure used by FirmwareBootService requires the new() constraint, so a parameterless constructor is mandatory.
using Unified.Firmware.BootService.LoadOption;

public class MyBootOption : LoadOptionBase
{
    // Additional properties populated after deserialization
    public string CustomLabel => Description.Split('|').FirstOrDefault() ?? string.Empty;
    public string BuildVersion => Description.Split('|').ElementAtOrDefault(1) ?? string.Empty;

    // Parameterless constructor is required for the new() constraint
    public MyBootOption() { }
}
Once defined, pass the type as a generic argument to the appropriate FirmwareBootService methods:
// Read a single entry as MyBootOption
MyBootOption option = FirmwareBootService.ReadLoadOption<MyBootOption>(0x0002);
Console.WriteLine("Label   : {0}", option.CustomLabel);
Console.WriteLine("Version : {0}", option.BuildVersion);

// Enumerate all boot entries as MyBootOption
// Note: EnumrateBootOptions is spelled with a typo — that is the actual method name
foreach (MyBootOption entry in FirmwareBootService.EnumrateBootOptions<MyBootOption>())
{
    Console.WriteLine("{0} — {1}", entry.CustomLabel, entry.BuildVersion);
}
LoadOptionBase itself carries no serialization logic. The marshalling layer in Unified.Firmware.BootService handles reading from and writing to NVRAM for any type that satisfies the LoadOptionBase, new() constraints. Your subclass properties that go beyond the four base fields are not automatically persisted — populate them from the base fields (e.g. by parsing Description or OptionalData) in your own code after deserialization.

Build docs developers (and LLMs) love