Skip to content

Version Information

Karsten Hahn edited this page Feb 11, 2023 · 3 revisions

A map of the StringFileInfo strings can be retrieved as follows:

List<VersionInfo> info = VersionInfo.parseFromResources(file);
for(VersionInfo i : info) {
    Map<String, String> strings = i.getVersionStrings();
    for (Map.Entry<String,String> entry : strings.entrySet()) {
        System.out.print(entry.getKey() + ": ");
        System.out.println(entry.getValue());
    }
}

Alternative way via the PEData object. This assumes there is only one version info resource (if not it uses the first one it finds) and is potentially more convenient to use for some cases.

PEData data = PELoader.loadPE(file);
Optional<VersionInfo> versionInfoOpt = data.loadVersionInfo();
if(versionInfoOpt.isPresent()) {
    Map<String, String> strings = versionInfoOpt.get().getVersionStrings();
}

Clone this wiki locally