Use this file to discover all available pages before exploring further.
Media device path protocols describe partitions and file paths on storage media. They correspond to the Media Device Path type (0x04) in the UEFI specification and are the nodes that UEFI firmware consults when locating the EFI application to load. In almost every modern boot entry you will find a HardDriveProtocol node that identifies the target GPT partition, immediately followed by a FilePathProtocol node that names the .efi binary — together they give firmware everything it needs to find and launch a bootloader.Package:Unified.Firmware.DevicePathProtocols.MediaNamespace:Unified.Firmware.BootService.Protocols
Represents a partition on a fixed disk. It stores the partition’s entry number, LBA offsets, GPT signature GUID, and the format/signature-type metadata that firmware needs to validate the target partition before handing control to the bootloader.
[DefineDevicePathProtocol(DeviceProtocolType.Media, 1)]public class HardDriveProtocol() : DevicePathProtocolBase(DeviceProtocolType.Media, 1)
// Parameterless — properties populated after construction or via DeserializeHardDriveProtocol()// Looks up partition geometry from the OS using the partition GUIDHardDriveProtocol(Guid partitionIdentificator)// Constructs from a Win32 PARTITION_INFORMATION_EX struct (GPT only)HardDriveProtocol(PARTITION_INFORMATION_EX partition)
Both convenience constructors require the partition to be GPT-formatted. Passing an MBR or RAW partition to HardDriveProtocol(PARTITION_INFORMATION_EX) throws InvalidDataException. Passing Guid.Empty to the GUID constructor throws ArgumentException.
PartitionStart and PartitionSize are stored in the binary format as logical block addresses (512-byte sectors). The library automatically multiplies by 512 on read and divides by 512 on write, so all managed property values are in bytes.
using Unified.Firmware.BootService.Protocols;// Construct from a known partition GUID — the library queries// the OS to fill in partition number, LBA offsets, and format fields.var hardDrive = new HardDriveProtocol( new Guid("a1b2c3d4-e5f6-7890-abcd-ef1234567890"));Console.WriteLine(hardDrive.PartitionFormat); // GuidPartitionTableConsole.WriteLine(hardDrive.SignatureType); // GuidSignatureConsole.WriteLine(hardDrive); // a1b2c3d4-e5f6-7890-abcd-ef1234567890
Holds a null-terminated Unicode path to an EFI application or directory. This is the node that names the bootloader binary (e.g., \EFI\ubuntu\grubx64.efi) within the partition identified by the preceding HardDriveProtocol node.
[DefineDevicePathProtocol(DeviceProtocolType.Media, 4)]public sealed class FilePathProtocol() : DevicePathProtocolBase(DeviceProtocolType.Media, 4)
GetSerializationDataLength() returns the byte length of PathName encoded as a C-style wide string (UTF-16 LE with a two-byte null terminator). The serialized size is therefore (PathName.Length + 1) * 2 bytes.
using Unified.Firmware.BootService.Protocols;var filePath = new FilePathProtocol(@"EFI\Ubuntu\grubx64.efi");Console.WriteLine(filePath);// Output: EFI\Ubuntu\grubx64.efi
UEFI path separators are backslashes (\), not forward slashes. Use verbatim string literals (@"...") or escape your backslashes to avoid confusion.
Describes a system partition that resides on an ISO-9660 CD-ROM following the El Torito boot specification. The boot entry number references the specific bootable entity in the El Torito Boot Catalog, which points to an EFI System Partition on the disc.
[DefineDevicePathProtocol(DeviceProtocolType.Media, 2)]public sealed class CdRomProtocol() : DevicePathProtocolBase(DeviceProtocolType.Media, 2)
Carries a vendor-assigned GUID and an arbitrary byte payload in a media device path node. Use this when no standard media sub-type describes the required partition or media abstraction. The library round-trips the payload verbatim during serialization.
[DefineDevicePathProtocol(DeviceProtocolType.Media, 3)]public class VendorDefinedProtocol() : DevicePathProtocolBase(DeviceProtocolType.Media, 3)
MediaDeviceProtocolType enumerates all sub-type values defined by the UEFI specification for media device path nodes (Type = 0x04):
public enum MediaDeviceProtocolType : byte{ HardDrive = 1, // GPT or MBR partition on a fixed disk CdRom = 2, // El Torito CD-ROM partition Vendor = 3, // Vendor-defined media node FilePath = 4, // Null-terminated Unicode file path Media = 5, // Media Protocol Device Path PiwgFirmwareFile = 6, // PI spec firmware file PiwgFirmwareVolume = 7, // PI spec firmware volume RelativeOffsetRange = 8, // Byte-offset range relative to device start RamDisk = 9 // Byte-offset range relative to end of device}
The four classes documented on this page correspond to sub-type values 1, 2, 3, and 4. Sub-types 5–9 are defined in the specification but do not yet have dedicated protocol classes in the library; unrecognized nodes are deserialized as RawMediaDevicePath instances.
The canonical UEFI boot entry for a GPT-partitioned disk pairs a HardDriveProtocol node (which targets the EFI System Partition) with a FilePathProtocol node (which names the EFI application). Together they form a complete media device path:
using Unified.Firmware.BootService.Protocols;// Partition GUID of the EFI System Partition on this machinevar partitionGuid = new Guid("a1b2c3d4-e5f6-7890-abcd-ef1234567890");DevicePathProtocolBase[] bootPath =[ // Node 1 — identify the target GPT partition new HardDriveProtocol(partitionGuid), // Node 2 — path to the EFI application within that partition new FilePathProtocol(@"EFI\Ubuntu\grubx64.efi"),];
A complete device path written to NVRAM also includes the hardware nodes that precede these media nodes (e.g., PciProtocol for the storage controller) and an End sentinel node after them. The media nodes shown above represent only the terminal segment of that full path.