Function getVariable [src]

To determine the minimum necessary buffer size for the variable, call getVariableSize first.

Prototype

pub fn getVariable( self: *const RuntimeServices, name: [*:0]const u16, guid: *const Guid, buffer: []u8, ) GetVariableError!?struct { []u8, VariableAttributes }

Parameters

self: *const RuntimeServicesname: [*:0]const u16guid: *const Guidbuffer: []u8

Possible Errors

BufferTooSmall
DeviceError GetVariableSizeError
Unexpected UnexpectedError
Unsupported GetVariableSizeError

Source

pub fn getVariable( self: *const RuntimeServices, name: [*:0]const u16, guid: *const Guid, buffer: []u8, ) GetVariableError!?struct { []u8, VariableAttributes } { var attrs: VariableAttributes = undefined; var len = buffer.len; switch (self._getVariable( name, guid, &attrs, &len, buffer.ptr, )) { .success => return .{ buffer[0..len], attrs }, .not_found => return null, .buffer_too_small => return error.BufferTooSmall, .device_error => return error.DeviceError, .unsupported => return error.Unsupported, else => |status| return uefi.unexpectedStatus(status), } }