Skip to main content

extract_pe_version

Function extract_pe_version 

Source
pub fn extract_pe_version(bytes: &[u8]) -> Option<String>
Expand description

Read the ProductVersion (falling back to FileVersion) from the VS_VERSIONINFO resource of a Windows PE. Returns None when:

  • the bytes aren’t a valid PE32 / PE32+,
  • there’s no .rsrc section,
  • there’s no VS_VERSIONINFO resource, or
  • neither version string is set.

Tries PE32+ (64-bit) first, then PE32 (32-bit). Pelite’s pe module re-export only resolves under cfg(target_pointer_width = "64") style gates that fail on the release pipeline’s non-Windows runners, so we go through the explicit pe64::PeFile / pe32::PeFile paths instead.