get_section

Function get_section 

Source
pub fn get_section<'a>(
    image: &'a [u8],
    section_name: &'static str,
) -> Option<Result<&'a [u8], UkiError>>
Expand description

Extracts a raw section from a UKI PE file by name.

Parses the PE file format to locate and extract the raw bytes of a named section (e.g., “.osrel”, “.cmdline”). This function returns the section contents as raw bytes without any UTF-8 validation.

§Arguments

  • image - The complete UKI image as a byte slice
  • section_name - Name of the PE section to extract (must be ≤ 8 characters)

§Returns

  • None - If the PE format is invalid or cannot be parsed
  • Some(Ok(&[u8])) - If the section is found, containing the raw section data
  • Some(Err(UkiError::MissingSection)) - If the section is not found in the PE file

§Implementation Notes