pe library

The PE image view: reads the version resource embedded in a Windows PE binary by parsing the file itself.

A separate entry point from package:flutter_bin/flutter_bin.dart on purpose. The main API asks the OS what it reports for a file — locale dependent, and it follows MUI satellite resources. This one reports what the image carries. The two agree for most binaries; where they differ, the type you hold tells you which view you are looking at.

Parsing is pure Dart, so it runs on any host (including the Linux CI job) and reads binaries the Win32 version APIs cannot — images whose RT_VERSION resource is stored under a name string rather than the numeric id 1.

Classes

BinaryFileMetadata
Represents file metadata information
PeStringTable
One StringFileInfo string table from a PE version resource.
PeVersionResource
The version resource as embedded in a PE image — the image view.

Functions

parsePeVersionResource(Uint8List bytes) PeVersionResource?
Parses an in-memory PE image. See readPeVersionResource; prefer that when the image is a file, since it reads only the parts it needs.
parsePeVersionResources(Uint8List bytes) List<PeVersionResource>
Every RT_VERSION leaf in an in-memory image. See readPeVersionResources.
readPeVersionResource(String filePath) Future<PeVersionResource?>
Reads the version resource out of a PE image, in pure Dart.
readPeVersionResources(String filePath) Future<List<PeVersionResource>>
Every RT_VERSION leaf the image carries, in resource-directory order — named entries before numeric ones, and languages in the order each entry lists them. Empty when there is nothing to read.
selectPeVersionResource(List<PeVersionResource> resources) PeVersionResource?
Picks the single resource the OS view would report: the numeric id 1 entry when the image has one, otherwise the first the directory lists.