pe: report offline package import closure #883
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/890"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Joacoorandom on 2026-11-23T16:10:44Z.
Change
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.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T16:26:59Z.
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.