| ... | ... | @@ -154,6 +154,27 @@ pub const BootServices = extern struct { |
| 154 | 154 | /// Creates an event in a group. |
| 155 | 155 | createEventEx: fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(.C) Status, |
| 156 | 156 | |
| 157 | /// Opens a protocol with a structure as the loaded image for a UEFI application |
| 158 | pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol { |
| 159 | if (!@hasDecl(protocol, "guid")) |
| 160 | @compileError("Protocol is missing guid!"); |
| 161 | |
| 162 | var ptr: ?*protocol = undefined; |
| 163 | |
| 164 | try self.openProtocol( |
| 165 | handle, |
| 166 | &protocol.guid, |
| 167 | @ptrCast(*?*anyopaque, &ptr), |
| 168 | // Invoking handle (loaded image) |
| 169 | uefi.handle, |
| 170 | // Control handle (null as not a driver) |
| 171 | null, |
| 172 | uefi.tables.OpenProtocolAttributes{ .by_handle_protocol = true }, |
| 173 | ).err(); |
| 174 | |
| 175 | return ptr.?; |
| 176 | } |
| 177 | |
| 157 | 178 | pub const signature: u64 = 0x56524553544f4f42; |
| 158 | 179 | |
| 159 | 180 | pub const event_timer: u32 = 0x80000000; |