#[repr(C)]
pub struct LoadedImage { /* private fields */ }
Expand description

The LoadedImage protocol. This can be opened on any image handle using the HandleProtocol boot service.

Implementations

Returns a handle to the storage device on which the image is located.

Get the load options of the image as a &CStr16.

Load options are typically used to pass command-line options as a null-terminated UCS-2 string. This format is not required though; use load_options_as_bytes to access the raw bytes.

Get the load options of the image as raw bytes.

UEFI allows arbitrary binary data in load options, but typically the data is a null-terminated UCS-2 string. Use load_options_as_cstr16 to more conveniently access the load options as a string.

Returns None if load options are not set.

Set the image data address and size.

This is useful in the following scenario:

  1. Secure boot is enabled, so images loaded with LoadImage must be signed with an appropriate key known to the firmware.
  2. The bootloader has its own key embedded, and uses that key to verify the next stage. This key is not known to the firmware, so the next stage’s image can’t be loaded with LoadImage.
  3. Since image handles are created by LoadImage, which we can’t call, we have to make use of an existing image handle – the one passed into the bootloader’s entry function. By modifying that image handle (after appropriately verifying the signature of the new data), we can repurpose the image handle for the next stage.

See shim for an example of this scenario.

Safety

This function takes data as a raw pointer because the data is not owned by LoadedImage. The caller must ensure that the memory lives long enough.

Set the load options for the image. This can be used prior to calling BootServices.start_image to control the command line passed to the image.

size is in bytes.

Safety

This function takes options as a raw pointer because the load options data is not owned by LoadedImage. The caller must ensure that the memory lives long enough.

Returns the base address and the size in bytes of the loaded image.

Trait Implementations

Unique protocol identifier.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.