Function get_file_version

Source
pub fn get_file_version(filename: &HSTRING) -> Result<Version, FileVersionError>
Expand description

Retrieves the file version of the specified executable or DLL.

§Errors

  • The lang-codepage part is assumed to be an US English exe, so if it is not an US English exe, the acquisition will fail.
  • It also fails if the version is not mixed in the exe.

§Example

use commonlibsse_ng::rel::version::{get_file_version, Version};
use windows::core::h; // Windows UTF-16 string conversion macro

let target = h!(r"D:\STEAM\steamapps\common\Skyrim Special Edition\SkyrimSE.exe");
let result = get_file_version(target);
assert_eq!(result, Ok(Version::new(1, 6, 1170, 0)));