hle(host_posix): FindResourceW, SizeofResource, LockResource and version.dll's three calls are unimplemented #629

Closed
opened 2026-11-28 16:03:21 +00:00 by github-bot · 3 comments
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 16:00 UTC · original

Summary

The resource calls were half there: FindResourceExW and LoadResource walked the mapped image's tree, but FindResourceW, SizeofResource and LockResource were unimplemented, and so was all of version.dll — GetFileVersionInfoSizeW, GetFileVersionInfoW, VerQueryValueW. A title reading its own version info (a build check, a crash log, an "about" string) got nothing, and one loading its own art got no size to allocate.

What the change does

  • SizeofResource: the data entry's size, which is at offset 4 of the entry FindResourceExW hands out.
  • LockResource: the bytes, which are already in the mapped image; LoadResource hands out the same address, so the two agree.
  • FindResourceW: the same walk as FindResourceExW with any language, which is how a title asks for its own version resource.
  • GetFileVersionInfoSizeW / GetFileVersionInfoW: RT_VERSION/1 out of the image the path names, and its bytes copied into the title's block. version.dll's calls address a file, so they answer for an image this host has mapped (by file name) and refuse a path it has not mapped — the tree is read from the mapped image, not off disk.
  • VerQueryValueW: parses the VS_VERSIONINFO block — \ (the fixed file info), \VarFileInfo\Translation, and \StringFileInfo\<table>\<key> — with wValueLength read as characters for a string and bytes for a binary value, as Windows reports them.
  • version.dll is now served by the same table as kernel32.dll, since those three names live there.

Tests

Two new ones in system.rs: a version resource built block by block (the way a linker writes it) is queried for its fixed file info, its FileVersion string and its translation, and a missing key, table or path is not found; and the calls that cannot be answered (a null resource, an unmapped path) fail with their reasons. The builder caught a real mistake in my own test — VS_FIXEDFILEINFO is thirteen words, not twelve, and one word short put every child block four bytes off.

Why it matters

A title can read its own build number, and the version resource is parsed once, from the image the host already has mapped, with no PE re-reading.

**@⁠AnastasisKon** on GitHub · 2026-11-28 16:00 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/625) ## Summary The resource calls were half there: `FindResourceExW` and `LoadResource` walked the mapped image's tree, but `FindResourceW`, `SizeofResource` and `LockResource` were unimplemented, and so was all of `version.dll` — `GetFileVersionInfoSizeW`, `GetFileVersionInfoW`, `VerQueryValueW`. A title reading its own version info (a build check, a crash log, an "about" string) got nothing, and one loading its own art got no size to allocate. ## What the change does - `SizeofResource`: the data entry's size, which is at offset 4 of the entry `FindResourceExW` hands out. - `LockResource`: the bytes, which are already in the mapped image; `LoadResource` hands out the same address, so the two agree. - `FindResourceW`: the same walk as `FindResourceExW` with any language, which is how a title asks for its own version resource. - `GetFileVersionInfoSizeW` / `GetFileVersionInfoW`: `RT_VERSION`/1 out of the image the path names, and its bytes copied into the title's block. `version.dll`'s calls address a *file*, so they answer for an image this host has mapped (by file name) and refuse a path it has not mapped — the tree is read from the mapped image, not off disk. - `VerQueryValueW`: parses the `VS_VERSIONINFO` block — `\` (the fixed file info), `\VarFileInfo\Translation`, and `\StringFileInfo\<table>\<key>` — with `wValueLength` read as characters for a string and bytes for a binary value, as Windows reports them. - `version.dll` is now served by the same table as `kernel32.dll`, since those three names live there. ## Tests Two new ones in `system.rs`: a version resource built block by block (the way a linker writes it) is queried for its fixed file info, its `FileVersion` string and its translation, and a missing key, table or path is not found; and the calls that cannot be answered (a null resource, an unmapped path) fail with their reasons. The builder caught a real mistake in my own test — `VS_FIXEDFILEINFO` is thirteen words, not twelve, and one word short put every child block four bytes off. ## Why it matters A title can read its own build number, and the version resource is parsed once, from the image the host already has mapped, with no PE re-reading.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 16:03:21 +00:00
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 16:00 UTC · original

/claim

**@⁠AnastasisKon** on GitHub · 2026-11-28 16:00 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/625#issuecomment-7241908605) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-28 16:01 UTC · original

Claimed by @⁠AnastasisKon. Open a draft pull request with Refs #625 in its description within 24 hours, or the claim expires.

**@⁠github-actions[bot]** on GitHub · 2026-11-28 16:01 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/625#issuecomment-7241910719) Claimed by @⁠AnastasisKon. Open a draft pull request with `Refs #625` in its description within 24 hours, or the claim expires.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 16:31 UTC · original

Merged with the PR that serves these calls; closing.

**@⁠AnastasisKon** on GitHub · 2026-11-28 16:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/625#issuecomment-7242314155) Merged with the PR that serves these calls; closing.
This discussion has been locked. Commenting is limited to contributors.
No description provided.