Function handleProtocol [src]
Returns a pointer to the Protocol interface if it's supported by the
handle.
Note that UEFI implementations are no longer required to implement this
function, so it's implemented using openProtocol instead.
Prototype
pub fn handleProtocol( self: *BootServices, Protocol: type, handle: Handle, ) HandleProtocolError!?*Protocol Parameters
self: *BootServicesProtocol: typehandle: Handle Possible Errors
Source
pub fn handleProtocol(
self: *BootServices,
Protocol: type,
handle: Handle,
) HandleProtocolError!?*Protocol {
// per https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.html#efi-boot-services-handleprotocol
// handleProtocol is basically `openProtocol` where:
// 1. agent_handle is `uefi.handle` (aka handle passed to `EfiMain`)
// 2. controller_handle is `null`
// 3. attributes is `EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL`
return self.openProtocol(
Protocol,
handle,
.{ .by_handle_protocol = .{ .agent = uefi.handle } },
) catch |err| switch (err) {
error.AlreadyStarted => return uefi.unexpectedStatus(.already_started),
error.AccessDenied => return uefi.unexpectedStatus(.access_denied),
error.InvalidParameter => return uefi.unexpectedStatus(.invalid_parameter),
else => return @errorCast(err),
};
}