CasualX / pelite

Lightweight, memory-safe, zero-allocation library for reading and navigating PE binaries.
MIT License
280 stars 42 forks source link

VersionInfo.fixed() return None while version info does exist #254

Closed wangjia184 closed 2 years ago

wangjia184 commented 2 years ago

Please check this file, it is a file complied by .NET Core targeting linux x64. It is a PE file and you can check its file version in Windows explorer. But pelite cannot retrieve its version.

CasualX commented 2 years ago

I did a little digging and found the exact location where parsing goes wrong: https://github.com/CasualX/pelite/blob/1efbb8ee9af31ff6151fb2539b1ea44d4b005cdc/src/resources/version_info.rs#L571

I vaguely remember being horrified at the spec (length can be in bytes or in words) and unsure what to do, this may take some time to figure out sorry.

Parsing goes wrong figuring out the first structure of the version info, here's the msdn docs: https://docs.microsoft.com/en-us/windows/win32/menurc/vs-versioninfo

CasualX commented 2 years ago

Well that was fast, I think I found the issue and I made a PR to fix it.

The deployment state of pelite is a mess so don't expect a new version published any time soon.

wangjia184 commented 2 years ago

@CasualX can a new version be released to crate.io?

CasualX commented 2 years ago

soon (tm)

CasualX commented 2 years ago

Update published