Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols 1.0.1

dotnet add package Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols --version 1.0.1                
NuGet\Install-Package Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols --version 1.0.1                
#r "nuget: Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols as a Cake Addin
#addin nuget:?package=Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols&version=1.0.1

// Install Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols as a Cake Tool
#tool nuget:?package=Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols&version=1.0.1                

ExtensibleFirmware

Markdown

Description

ExtensibleFirmware is a .NET class library for working with UEFI firmware. It provides tools for editing the boot process, allowing developers to modify and configure boot parameters for enhanced flexibility.

Features

  • Getting EFI system partition
  • Editing and creating boot entries.
  • Editing global variables for firmware.

Installation

# Install via NuGet
Install-Package ExtensibleFirmware

Usage Examples

Example 1: Getting ESP

using Rikitav.IO.ExtensibleFirmware.SystemPartition;
using System.IO;

namespace Examples
{
    class Program
    {
        public static void Main()
        {
            // Getting 'EFI system partition' volume path
            string EspVolumePath = EfiPartition.GetFullPath();

            // Example reading config file from ESP using volume path, instead of using MountVol
            string configText = File.ReadAllText(Path.Combine(EspVolumePath, "EFI", "Ubuntu", "grub.cfg"));
        }
    }
}

Example 2: Reading boot option

using Rikitav.IO.ExtensibleFirmware.BootService;
using Rikitav.IO.ExtensibleFirmware.BootService.DevicePathProtocols;
using Rikitav.IO.ExtensibleFirmware.BootService.LoadOption;
using System;

namespace Examples
{
    class Program
    {
        public static void Main()
        {
            // Reading boot option
            FirmwareBootOption bootOption = FirmwareBootService.ReadLoadOption(0x0003); // <-- Set here your variable index
            
            // Enumerating all protocols
            foreach (DevicePathProtocolBase protocol in bootOption.OptionProtocols)
                Console.WriteLine(protocol.ToString()); // Getting string representation of protocol
        }
    }
}

Example 3: Creating boot option

using Rikitav.IO.ExtensibleFirmware.BootService;
using Rikitav.IO.ExtensibleFirmware.BootService.DevicePathProtocols;
using Rikitav.IO.ExtensibleFirmware.BootService.LoadOption;
using Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols;
using System;

namespace Examples
{
    class Program
    {
        public static void Main()
        {
            // Setting device path protocols
            // This protocols instructions boot service how to load your option
            DevicePathProtocolBase[] protocols = new DevicePathProtocolBase[]
            {
                new HardDriveMediaDevicePath(new Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")), // The partition on which the bootloader is located
                new FilePathMediaDevicePath("EFI\\MyApplication\\bootx64.efi"), // Path to the EFI application to be loaded
                new DevicePathProtocolEnd() // Indicates the end of the boot option. if this is omitted, the option will not be considered valid
            };

            // Creating simple load option
            FirmwareBootOption bootOption = new FirmwareBootOption(LoadOptionAttributes.ACTIVE, "MyLoader", Array.Empty<byte>(), protocols);

            // Creating new load option
            ushort newLoadOptionIndex = FirmwareBootService.CreateLoadOption(bootOption, true);

            // Logging new boot option index
            Console.WriteLine("Boot option sucessfully created, new option index : {0}", newLoadOptionIndex);
        }
    }
}

Requirements

Most functionality will work on every Windows system that supports uefi, except EfiExecutableInfo and VolumenName pathes, the will only work on Windows 8 or above

Resources

If you want to learn more about UEFI and how this library works, read the documentation at the following links :

License

This project is licensed under the GNU GPL License. See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 91 9/12/2024
1.0.0 98 9/12/2024