[PR #649] [MERGED] OLD-7282: restore old upstream PR 7282 - pe_inspect: read the resource directory and the RT_VERSION block without its strings #689

Closed
opened 2026-11-26 20:18:43 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/649
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: pe-inspect-rt-version


📝 Commits (1)

  • b895135 pe_inspect: read the resource directory and the RT_VERSION block without its strings

📊 Changes

3 files changed (+498 additions, -0 deletions)

View changed files

📝 docs/design.md (+11 -0)
📝 tests/test_pe_inspect.py (+194 -0)
📝 tools/pe_inspect.py (+293 -0)

📄 Description

Claimed in the coordination issue as: OLD-7282 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7129422079

Restoration of my original pull request, old upstream PR 7282 in ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 21625bca8c; no changes beyond the rebase.

Depends on: #45 (draft; not a dependency, but both change tools/pe_inspect.py and conflict there)

What and why

  • tools/pe_inspect.py never read data directory 2, so the report said nothing about the version block, the one part of a PE that names its build.
  • Resources: the types present, with entry and byte counts. Named types are counted, not named.
  • Version: the fixed file info's numbers (file and product version, flags with their names, OS, type, subtype, date), the translations, and for each string table each standard key with its value's length and SHA-256.
  • No values: string values are free UTF-16 text that can name the title, so no value is written. Two builds compare by hash. A key outside the standard names is listed by its hash.
  • Problems: a resource tree or version block that is cut short, loops, points outside the file or has a bad signature is listed in problems (offsets and counts only). The rest of the report is still written.
  • Output: the Markdown report gets a "Resources" section, and stdout gets one line per image that has a version block.
  • docs/design.md describes the new resources field next to the PE report steps.

Tested

Linux, Python 3.14.10, CPU only, synthetic inputs (the tests build the resource tree and the version block by hand; no game files).

  • python -I tests/test_pe_inspect.py:
    • main at the base: 60 tests, OK (1 skipped).
    • main with only this PR's test changes: all 9 new test methods fail.
    • this branch: 69 tests, OK (1 skipped).
  • The tests check that the made-up values reach no output. They also cover a missing directory, a file cut at every length inside the block, malformed blocks and a loop in the tree.
  • python -I tests/test_docs_design_rows.py and python -I tests/test_design_contract_rows.py: OK.
  • python -m compileall -q tools tests, git diff --check and python -I scripts/check_no_game_data.py on the three changed files: clean.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

AI-assisted (Claude Code, Claude Opus 5.5).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/649 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `pe-inspect-rt-version` --- ### 📝 Commits (1) - [`b895135`](https://github.com/ubiquitarianism/leonida/commit/b8951357f12bf7bdc80e46b8f31d42fb1bdc3c9c) pe_inspect: read the resource directory and the RT_VERSION block without its strings ### 📊 Changes **3 files changed** (+498 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+11 -0) 📝 `tests/test_pe_inspect.py` (+194 -0) 📝 `tools/pe_inspect.py` (+293 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7282 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7129422079 Restoration of my original pull request, old upstream PR 7282 in `ItsNotRexed/Leonida`, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 21625bca8c675c62f9dbffc318ce6a59d57faf31; no changes beyond the rebase. Depends on: #45 (draft; not a dependency, but both change `tools/pe_inspect.py` and conflict there) ### What and why - `tools/pe_inspect.py` never read data directory 2, so the report said nothing about the version block, the one part of a PE that names its build. - **Resources:** the types present, with entry and byte counts. Named types are counted, not named. - **Version:** the fixed file info's numbers (file and product version, flags with their names, OS, type, subtype, date), the translations, and for each string table each standard key with its value's length and SHA-256. - **No values:** string values are free UTF-16 text that can name the title, so no value is written. Two builds compare by hash. A key outside the standard names is listed by its hash. - **Problems:** a resource tree or version block that is cut short, loops, points outside the file or has a bad signature is listed in `problems` (offsets and counts only). The rest of the report is still written. - **Output:** the Markdown report gets a "Resources" section, and stdout gets one line per image that has a version block. - `docs/design.md` describes the new `resources` field next to the PE report steps. ### Tested Linux, Python 3.14.10, CPU only, synthetic inputs (the tests build the resource tree and the version block by hand; no game files). - `python -I tests/test_pe_inspect.py`: - main at the base: 60 tests, OK (1 skipped). - main with only this PR's test changes: all 9 new test methods fail. - this branch: 69 tests, OK (1 skipped). - The tests check that the made-up values reach no output. They also cover a missing directory, a file cut at every length inside the block, malformed blocks and a loop in the tree. - `python -I tests/test_docs_design_rows.py` and `python -I tests/test_design_contract_rows.py`: OK. - `python -m compileall -q tools tests`, `git diff --check` and `python -I scripts/check_no_game_data.py` on the three changed files: clean. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) AI-assisted (Claude Code, Claude Opus 5.5). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:43 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#689
No description provided.