get_text_section

Function get_text_section 

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

Extracts a text section from a UKI PE file by name and validates it as UTF-8.

This is a convenience wrapper around get_section that additionally validates the section contents as valid UTF-8 text.

§Arguments

  • image - The complete UKI image as a byte slice
  • section_name - Name of the PE section to extract (e.g., “.osrel”, “.cmdline”)

§Returns

  • Ok(&str) - If the section is found and contains valid UTF-8
  • Err(UkiError) - If the PE is invalid, section is missing or the section contains invalid UTF-8