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.

The EFI System Partition (ESP) is a dedicated FAT32 partition present on every UEFI-booted drive. It stores bootloaders, firmware update capsules, and configuration files for all installed operating systems. Because the ESP is not automatically assigned a drive letter on Windows and may be mounted at an arbitrary path on Linux, finding it from application code requires firmware-level partition enumeration. The EfiPartition static class and FirmwareInterface.SystemPartition property do that work for you.

FirmwareInterface.SystemPartition

FirmwareInterface.SystemPartition returns a DirectoryInfo pointing at the root of the ESP. It throws PlatformNotSupportedException if the system is not running in UEFI mode or if UEFI is unavailable.
using System.IO;
using Unified.Firmware;
using Unified.Firmware.SystemPartition;

// Verify UEFI is available before accessing the ESP
if (!FirmwareInterface.Available)
{
    Console.Error.WriteLine("UEFI is not available on this system.");
    return;
}

DirectoryInfo esp = FirmwareInterface.SystemPartition;
Console.WriteLine("ESP root: {0}", esp.FullName);

// Read a bootloader configuration file from the ESP
string configPath = Path.Combine(esp.FullName, "EFI", "Ubuntu", "grub.cfg");
string configText = File.ReadAllText(configPath);
Console.WriteLine(configText);
Internally SystemPartition delegates to EfiPartition.VolumePath, which queries the OS for the partition whose type GUID matches the ESP type.

EfiPartition static class

EfiPartition provides three static members that describe the ESP without going through FirmwareInterface.

EfiPartition.TypeID

The ESP type GUID as defined by the UEFI specification. This value is constant across all machines and partitioning tools:
using Unified.Firmware.SystemPartition;

Console.WriteLine(EfiPartition.TypeID);
// c12a7328-f81f-11d2-ba4b-00a0c93ec93b

EfiPartition.VolumePath

A VolumePath struct that wraps both the unique partition identifier and the platform-specific full path string:
using Unified.Firmware.SystemPartition;

VolumePath esp = EfiPartition.VolumePath;

Console.WriteLine("Partition GUID : {0}", esp.Identificator);
Console.WriteLine("Full path      : {0}", esp.FullPath);

EfiPartition.Identificator

A shortcut to EfiPartition.VolumePath.Identificator — the unique GUID of this specific partition (not to be confused with the fixed type GUID):
Guid partitionId = EfiPartition.Identificator;
Console.WriteLine("ESP partition ID: {0}", partitionId);

VolumePath struct

VolumePath is an immutable record struct. Its FullPath format varies by platform:
PlatformExample
Windows\\?\Volume{3f7c96fe-1234-5678-abcd-0a1b2c3d4e5f}\
Linux/boot/efi or the actual mount point of the ESP
Three implicit conversions make it interoperable with standard .NET APIs:
using System.IO;
using Unified.Firmware;
using Unified.Firmware.SystemPartition;

VolumePath vp = EfiPartition.VolumePath;

// Implicit conversion to string (uses FullPath)
string pathStr = vp;
Console.WriteLine(pathStr);

// Implicit conversion to Guid (uses Identificator)
Guid id = vp;
Console.WriteLine(id);

// Implicit conversion to DirectoryInfo
DirectoryInfo dir = vp;
foreach (DirectoryInfo sub in dir.EnumerateDirectories("EFI"))
    Console.WriteLine(sub.FullName);
On Windows, VolumePath.FullPath uses the \\?\Volume{GUID}\ format, which requires Windows 8 or later and the calling process to have sufficient privileges to open a handle to the volume. The path is not a drive letter and cannot be passed to older APIs that only accept C:\-style paths — use DirectoryInfo or File methods instead.
On Linux the library locates the ESP by scanning partition tables. The path returned in VolumePath.FullPath is the directory where the ESP is currently mounted. If the ESP has not been mounted before calling EfiPartition.VolumePath, the operation will fail. Ensure the ESP is mounted (typically at /boot/efi) before invoking any EfiPartition member.

EfiExecutableInfo

EfiExecutableInfo describes a single .efi binary on the ESP and exposes its architecture by reading the PE header — no external tools required.

Properties

PropertyTypeDescription
FullNamestringAbsolute path to the .efi file
ApplicationstringName of the provider folder (e.g. ubuntu, Microsoft, Boot)
ArchitectureFirmwareApplicationArchitectureArchitecture parsed from the PE COFF header
FileInfoFileInfoLazily created FileInfo for the same path

Constructors

From a FileInfo — use when you already have a reference to the file:
using Unified.Firmware.SystemPartition;

var info = new EfiExecutableInfo(new FileInfo(@"C:\EFI\ubuntu\grubx64.efi"));
Console.WriteLine(info.Architecture); // x64
From a full path string — the constructor appends .efi if the extension is missing:
var info = new EfiExecutableInfo(@"\\?\Volume{...}\EFI\ubuntu\grubx64.efi");
From FirmwareApplicationArchitecture — looks up the default fallback bootloader (\EFI\Boot\boot{arch}.efi) on the ESP:
using Unified.Firmware.SystemPartition;

// Locates \EFI\Boot\bootx64.efi on the ESP
var info = new EfiExecutableInfo(FirmwareApplicationArchitecture.x64);

Console.WriteLine("Default x64 loader : {0}", info.FullName);
Console.WriteLine("Architecture       : {0}", info.Architecture);
Console.WriteLine("Provider folder    : {0}", info.Application);
From application name and file name — combines the ESP root, EFI\{ApplicationName}\{ApplicationFile}:
var info = new EfiExecutableInfo("ubuntu", "grubx64.efi");
Console.WriteLine(info.FullName); // ...\EFI\ubuntu\grubx64.efi
From a DriveInfo and architecture — for an EFI executable on a removable drive rather than the system ESP:
var usb = new DriveInfo("D");
var info = new EfiExecutableInfo(usb, FirmwareApplicationArchitecture.x64);
Console.WriteLine(info.FullName); // D:\EFI\Boot\bootx64.efi
From a DriveInfo, application name, and file name:
var usb = new DriveInfo("D");
var info = new EfiExecutableInfo(usb, "myapp", "loader.efi");

FirmwareApplicationArchitecture enum

MemberPE valueDescription
Ia320x014C32-bit x86
x640x8664AMD64 / Intel 64
Ia640x0200Intel Itanium 64
Arm0x01C2AArch32
AArch640xAA64AArch64
RISC_V320x5032RISC-V 32-bit
RISC_V640x5064RISC-V 64-bit
RISC_V1280x5128RISC-V 128-bit
Unknown0Unrecognized PE machine type
The Architecture property of EfiExecutableInfo reads two bytes at the PE header machine field offset and maps the value to this enum, returning Unknown for any unrecognized value.

Build docs developers (and LLMs) love