[PR #653] [MERGED] OLD-7084: restore old upstream PR 7084 - pe_inspect: classify system DLLs on Linux through the Wine prefix, bundled names without case #693

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

📋 Pull Request Information

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

Base: main ← Head: pe-inspect-linux-classes


📝 Commits (6)

  • 0d666fc pe_inspect: classify system DLLs on Linux through the Wine prefix, bundled names without case
  • 70d615b Merge main into OLD-7084, pe_inspect Linux classes (#653)
  • 4532b5b pe_inspect: ws2_32.dll and wsock32.dll are host DLLs, as in owns_dll
  • 865e2d7 Merge commit 'refs/fix2/main' into fix2-653
  • b8c9250 pe_inspect: advapi32.dll is host-owned too, as in owns_dll on main
  • ca9e45d Merge main into pe-inspect-linux-classes

📊 Changes

5 files changed (+440 additions, -12 deletions)

View changed files

📝 README.md (+4 -0)
📝 docs/design.md (+6 -2)
📝 scripts/first_look.ps1 (+10 -0)
📝 tests/test_pe_inspect.py (+197 -0)
📝 tools/pe_inspect.py (+223 -10)

📄 Description

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

Restoration of my original pull request, old upstream PR 7084 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 (conflicts only in tests/test_pe_inspect.py, both add tests at the end; keeping both blocks resolves it)

What and why

On a host that isn't Windows, classify_dll in tools/pe_inspect.py marked the C runtime and every system DLL as shim, so the first look's to-do list was wrong there. There were three causes:

  • The bundled check was case-sensitive, so an import of MSVCP140.dll missed the package's msvcp140.dll.
  • System32 does not exist there.
  • The API-set query works only on Windows.

The change:

  • Bundled: the game folder is listed once and names are compared lower-cased, as Windows does.
  • System, off Windows: looked up without case in the Wine prefix's system32 ($WINEPREFIX, else ~/.wine). API sets are resolved through the prefix's apisetschema.dll (version-6 schema), because Wine installs no file for most of them.
  • No prefix: a DLL that is neither bundled nor owned by the runtime's shims is reported as unverified, shown as system (unverified). The shims' DLLs are the SHIM_TABLEs in runtime/shims, less the host DLLs that owns_dll leaves out. scripts/first_look.ps1 lists these DLLs after the to-do and prints a warning.
  • Report: a new system_dlls field, plus a line in the Markdown and stdout summaries, says where system DLLs were checked.
  • Docs: docs/design.md (day one, import table) and README.md (set WINEPREFIX on Linux) describe the above.
  • Windows classification is unchanged.

Tested

Linux, Python 3.14.10, CPU only, synthetic PE images and temporary folders standing in for the game folder and the Wine prefix. No game files.

  • python -I tests/test_pe_inspect.py:
    • main, before the change: 60 tests OK (1 skipped).
    • main with only this pull request's tests: 67 tests, 7 errors (pe_inspect has no IS_WINDOWS).
    • this branch: 67 tests OK (1 skipped, test_system_dll_is_classified_system, which needs Windows).
  • python -I tests/test_text_write_line_endings.py: OK.
  • python -m compileall -q tools tests, git diff --check and python -I scripts/check_no_game_data.py on the five changed files: clean.
  • scripts/first_look.ps1 was not run (no PowerShell or game executable here).

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/653 **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-linux-classes` --- ### 📝 Commits (6) - [`0d666fc`](https://github.com/ubiquitarianism/leonida/commit/0d666fcf4f3f7e3b209c6b35c55de199633c5f15) pe_inspect: classify system DLLs on Linux through the Wine prefix, bundled names without case - [`70d615b`](https://github.com/ubiquitarianism/leonida/commit/70d615b3bbdfa255118810eba1f7a9e6434d1ab7) Merge main into OLD-7084, pe_inspect Linux classes (#653) - [`4532b5b`](https://github.com/ubiquitarianism/leonida/commit/4532b5b751c5154e1c110dea31fc067387700f0e) pe_inspect: ws2_32.dll and wsock32.dll are host DLLs, as in owns_dll - [`865e2d7`](https://github.com/ubiquitarianism/leonida/commit/865e2d79124b518cb276007d1b462f8d986c9ec6) Merge commit 'refs/fix2/main' into fix2-653 - [`b8c9250`](https://github.com/ubiquitarianism/leonida/commit/b8c925002c6b4a6bfb5cfad6e7cc60ce2414586e) pe_inspect: advapi32.dll is host-owned too, as in owns_dll on main - [`ca9e45d`](https://github.com/ubiquitarianism/leonida/commit/ca9e45dbd136feae14936ffbbe300d18bcda48c7) Merge main into pe-inspect-linux-classes ### 📊 Changes **5 files changed** (+440 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+4 -0) 📝 `docs/design.md` (+6 -2) 📝 `scripts/first_look.ps1` (+10 -0) 📝 `tests/test_pe_inspect.py` (+197 -0) 📝 `tools/pe_inspect.py` (+223 -10) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7084 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7129526927 Restoration of my original pull request, old upstream PR 7084 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 (conflicts only in `tests/test_pe_inspect.py`, both add tests at the end; keeping both blocks resolves it) ### What and why On a host that isn't Windows, `classify_dll` in `tools/pe_inspect.py` marked the C runtime and every system DLL as `shim`, so the first look's to-do list was wrong there. There were three causes: - The bundled check was case-sensitive, so an import of `MSVCP140.dll` missed the package's `msvcp140.dll`. - System32 does not exist there. - The API-set query works only on Windows. The change: - **Bundled:** the game folder is listed once and names are compared lower-cased, as Windows does. - **System, off Windows:** looked up without case in the Wine prefix's `system32` (`$WINEPREFIX`, else `~/.wine`). API sets are resolved through the prefix's `apisetschema.dll` (version-6 schema), because Wine installs no file for most of them. - **No prefix:** a DLL that is neither bundled nor owned by the runtime's shims is reported as `unverified`, shown as `system (unverified)`. The shims' DLLs are the `SHIM_TABLE`s in `runtime/shims`, less the host DLLs that `owns_dll` leaves out. `scripts/first_look.ps1` lists these DLLs after the to-do and prints a warning. - **Report:** a new `system_dlls` field, plus a line in the Markdown and stdout summaries, says where system DLLs were checked. - **Docs:** `docs/design.md` (day one, import table) and `README.md` (set `WINEPREFIX` on Linux) describe the above. - Windows classification is unchanged. ### Tested Linux, Python 3.14.10, CPU only, synthetic PE images and temporary folders standing in for the game folder and the Wine prefix. No game files. - `python -I tests/test_pe_inspect.py`: - main, before the change: 60 tests OK (1 skipped). - main with only this pull request's tests: 67 tests, 7 errors (`pe_inspect` has no `IS_WINDOWS`). - this branch: 67 tests OK (1 skipped, `test_system_dll_is_classified_system`, which needs Windows). - `python -I tests/test_text_write_line_endings.py`: OK. - `python -m compileall -q tools tests`, `git diff --check` and `python -I scripts/check_no_game_data.py` on the five changed files: clean. - `scripts/first_look.ps1` was not run (no PowerShell or game executable here). 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:44 +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#693
No description provided.