pe: report offline package import closure #890
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!890
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/890/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Joacoorandom on GitHub · 2026-11-23 16:10 UTC · original
Joacoorandom:pe/offline-package-import-closure→main· +387 −0 · 7 files · 2 commits · merged 2026-11-23 16:40 UTCChange
Add
tools/pe_package_preflight.py, a read-only, cross-platform import-closure report for a directory of source-built PE images. Unlike the fullpe_inventory.scan()desktop inventory, this diagnostic does not require an x64 Windows host, inspect System32, or load any EXE/DLL.It reuses the existing strict PE
parse_image()reader, export table handling and forwarded-export resolver to report:The CLI refuses PE symlinks, entries outside the root, images over 512 MiB, and packages exceeding 1,024 PE images / 2 GiB of PE data. The JSON report contains no executable code and can be saved under
out/.Reproduction
On Linux with the existing
requirements-dev.txtinstalled:Observed locally on Python 3.14: all 6 new tests passed. Existing dependency-path and intake-path checks passed. Documentation: 13 Markdown files and 179 links passed; bidirectional-control scan: 718 tracked source/config files, no controls. A source-built x64 diagnostic executable (no bundled DLLs) produced a JSON report with 46 normal imports all classified
external_unverified, zero local failures. This is an offline parsing smoke test, not an execution/compatibility result.The new tests use only synthetic in-memory import/export metadata and temporary fake files. They check forwarded/ordinal resolution, malformed/cyclic forwarders, missing symbols, duplicate basenames, delay-import reachability, deterministic output, path escape/symlink rejection and clean CLI failure for a non-PE. The standalone tool and tests are registered in CMake/CTest and the existing Python Linux CI job.
Limits
Host DLL exports, Windows KnownDLLs, API-set remapping, runtime ABI compatibility, dynamic loads, TLS execution and full-program startup are not verified. The repository's Windows-only inventory remains the authoritative tool for desktop provider comparisons. No private binaries, archives, assets or distribution links are part of this change.
Checklist
AI-assisted implementation and tests. Commit:
ddac8a7.@R0Y00 on GitHub · 2026-11-23 16:26 UTC · original
Review update at
320474d. A report path outside the package could still overwrite an inspected PE if both paths were hard links to the same file. The report now replaces the output path, and the regression compares the input bytes after writing. Reachability paths also keep intermediate forwarded providers, with a check that a longer ordinary forwarder path beats a direct delay path. All 8 preflight checks passed on Windows and Linux. CI is rerunning.