Verified Commit 04ea6911 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Function for setting BootOrder

parent 930e358b
......@@ -3,6 +3,7 @@ use uefi::guid::GLOBAL_VARIABLE_GUID;
use uefi::status::{Error, Result};
use crate::ffi::wstr;
use crate::slice;
use crate::system_table;
fn get(name: &str, data: &mut [u8]) -> Result<usize> {
......@@ -64,6 +65,15 @@ pub fn get_boot_order() -> Result<Vec<u16>> {
Ok(order)
}
pub fn set_boot_order(order: &[u16]) -> Result<usize> {
set("BootOrder", unsafe {
slice::from_raw_parts(
order.as_ptr() as *const u8,
order.len() * 2
)
})
}
pub fn get_boot_item(num: u16) -> Result<Vec<u8>> {
let mut data = [0; 4096];
let count = get(&format!("Boot{:>04X}", num), &mut data)?;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment