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.
FirmwareBootService is the primary entry point in the Unified.Firmware.BootService package for interacting with your system’s UEFI NVRAM. It exposes static properties that mirror the BootCurrent, BootNext, and BootOrder global EFI variables, and static methods for every operation you need: listing all boot entries, reading a single entry by index, creating a new entry, updating or editing one in-place, and deleting one along with its BootOrder reference.
Namespace
Static Properties
Gets the index of the
Boot#### variable this machine was booted from, read from the BootCurrent EFI global variable. Use the returned value as an argument to any method that accepts a BootOptionIndex.Access: get-onlySets the
BootNext EFI global variable, which causes the firmware to load the specified boot entry exactly once on the next reboot, after which the normal BootOrder is restored.Access: set-onlyGets or sets the full
BootOrder EFI global variable as an array of BootOptionIndex values. The firmware processes entries in array order during startup. Assigning a new array replaces BootOrder in NVRAM.Access: get / setStatic Methods
EnumerateBootOptions
Boot#### entries in the current boot order, reading each one from NVRAM and deserializing it as a FirmwareBootOption.
Parameters: none
Returns: IEnumerable<FirmwareBootOption> — a lazy sequence of boot options in boot-order sequence.
Exceptions: none specific to this method; underlying firmware access may raise platform I/O exceptions.
EnumrateBootOptions<T>
EnumerateBootOptions. Each Boot#### entry is deserialized into an instance of T rather than FirmwareBootOption. Use this when you have a custom LoadOptionBase subclass that adds domain-specific properties.
The method name
EnumrateBootOptions contains a typo (missing the second e in Enumerate). This is the actual name in the API — use it exactly as written.The concrete load-option type to deserialize each boot entry as. Must inherit
LoadOptionBase and have a public parameterless constructor.IEnumerable<T> — a lazy sequence of T instances in boot-order sequence.
EnumrateRawBootOptions
Boot#### entry in boot order as an EFI_LOAD_OPTION native structure without any managed-type conversion. Useful for low-level inspection or when you need to access fields not surfaced by LoadOptionBase.
The method name
EnumrateRawBootOptions contains a typo (missing the second e in Enumerate). This is the actual name in the API — use it exactly as written.IEnumerable<EFI_LOAD_OPTION> — a lazy sequence of raw native structures in boot-order sequence.
ReadLoadOption(BootOptionIndex)
Boot#### NVRAM variable and deserializes it as a FirmwareBootOption.
Parameters
The index of the
Boot#### variable to read. A ushort literal is implicitly converted — e.g. 0x0003 targets Boot0003.FirmwareBootOption — the deserialized boot entry.
ReadLoadOption<T>(BootOptionIndex)
Boot#### NVRAM variable and deserializes it as an instance of T.
Type Parameters
The concrete type to deserialize into. Must inherit
LoadOptionBase and have a public parameterless constructor.The index of the
Boot#### variable to read.T — the deserialized boot entry.
ReadRawLoadOption(BootOptionIndex)
Boot#### NVRAM variable and returns its native EFI_LOAD_OPTION structure without managed-type conversion.
Parameters
The index of the
Boot#### variable to read.EFI_LOAD_OPTION — the raw native load option structure.
CreateLoadOption
Boot#### index, writes the serialized loadOption into it, and updates BootOrder in NVRAM. Pass AddFirst: true to prepend the new entry to the boot order (making it the highest-priority option), or false to append it at the end.
Parameters
The load option to serialize and store. Accepts any
LoadOptionBase subclass, including FirmwareBootOption.When
true, the new entry is inserted at position 0 of BootOrder. When false, it is appended.BootOptionIndex — the index assigned to the newly created Boot#### variable.
Exceptions
| Exception | Condition |
|---|---|
FreeLoadOptionIndexNotFound | All 65 535 Boot#### slots are occupied and no free index can be found. |
UpdateLoadOption
loadOption and writes it over the existing Boot#### variable at bootOptionIndex. The BootOrder array is not modified.
Parameters
The updated load option to serialize and write.
The index of the existing
Boot#### variable to overwrite.void
EditLoadOption
Boot#### entry at bootOptionIndex, passes the deserialized FirmwareBootOption to UpdateOptionAction for in-place mutation, then writes the modified object back to NVRAM. This avoids having to perform a separate read and update.
Parameters
The index of the
Boot#### variable to edit.A callback that receives the deserialized boot option. Mutate its properties inside the callback — changes are written back automatically when the delegate returns.
void
DeleteLoadOption
Boot#### NVRAM variable at loadOptionIndex to null (writing IntPtr.Zero) and removes that index from BootOrder.
Parameters
The index of the
Boot#### variable to delete.void
DeleteLoadOption removes the index from BootOrder automatically. You do not need to read and reassign LoadOrder yourself.Exceptions Reference
| Exception | Namespace | Description |
|---|---|---|
FreeLoadOptionIndexNotFound | Unified.Firmware.BootService | Thrown by CreateLoadOption when every possible Boot#### slot (0x0000–0xFFFE) is already present in BootOrder. |
InvalidHandleValueException | Unified.Firmware.BootService | Thrown when the firmware backend returns an invalid handle value during a variable read or write operation. Extends Win32Exception. |
InvalidLoadOptionStrcutreException | Unified.Firmware.BootService | Thrown when a Boot#### variable contains a malformed EFI_LOAD_OPTION structure that cannot be deserialized. |
DeviceProtocolCastingException | Unified.Firmware.BootService | Thrown when a device path protocol entry cannot be cast to the expected managed wrapper type. |
InvalidInheritedClassException | Unified.Firmware.BootService | Thrown when a type registered as a device path protocol wrapper does not inherit the required base class. |
MissingDevicePathProtocolWrapperAttributeException | Unified.Firmware.BootService | Thrown when a device path protocol wrapper class is missing the required defining attribute. |
InvalidDevicePathProtocolStructureException | Unified.Firmware.BootService | Thrown when a device path protocol wrapper class has an incorrect structure. |