tooling: add deterministic PE compatibility report #1029

Merged
lambirou merged 2 commits from upstream-pr/1036 into main 2026-11-23 23:07:08 +00:00
lambirou commented 2026-11-23 22:20:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-23T22:20:22Z.


Change

Add tools/compat_report.py, an offline AMD64 PE import-routing report with deterministic JSON
and Markdown, plus a synthetic PE test registered in the Linux Python job.

The labels are candidate module routes derived from the import module name: hle,
windows, stub or unsupported. Every row records route_kind: candidate,
resolution: not_checked and provider: null; a name or ordinal absent from an export table
still receives its module route and is not claimed to resolve. Stub rows expose stub: true,
provider: null, and the summary reports stub_providers: 0.

The report also records TLS, SEH and load-config directory presence. The 12-byte exception entry
count is limited to AMD64; ARM64 and x86 images are rejected with exit 2 and their machine name.
The image is never loaded or executed.

Verification

  • out\pe-env\Scripts\python.exe -B tests\compat_report_check.py
    • Observed: compat report synthetic checks passed, exit 0.
  • Positive fixture: 7 imports (5 normal, 2 delay). Routes hle=3, windows=2,
    stub=2, unsupported=0; by_ordinal=3; stub rows 2, stub providers 0.
  • Candidate controls: xmem.dll!#65535 still maps to hle with resolution: not_checked;
    a fabricated api-ms-win-fixture-l1-1-0.dll!FabricatedApi maps to windows from the
    prefix with resolution: not_checked.
  • Machine controls: ARM64 (0xAA64) and x86 (0x14C) images exit 2 with the machine name and write
    no report.
  • Negative control: unsupported: negative.exe -> mystery.dll!MissingExport, exit 1, with both
    outputs written for inspection.
  • Read errors: missing input and invalid PE return 2 without a traceback or a report.
  • out\pe-env\Scripts\python.exe -B tests\docs_links_check.py: Self-test passed.,
    Checked 13 Markdown files and 223 links., exit 0.
  • git diff --check origin/main...HEAD: clean.
  • Tests not run: CMake, CTest, native Windows tests and GPU tests. This is a Python-only change.

Evidence and follow-up

  • Branch tools/compat-report, head a982c11, based on 61e5a09. Two commits:
    68ec1db adds the report and synthetic fixture; a982c11 addresses the review by naming
    candidate routes, flagging the absent stub provider, limiting the SEH count to AMD64 and
    registering the check.
  • The policy is data, not inference: HLE entries come from src/xmem_shim.cpp and
    src/d3d12_xs_shim.cpp; stub entries are public GDK module names without a shim in this tree;
    Windows entries are explicit system DLLs plus the documented API-set prefixes.
  • Provenance: Reference ivall/xcl@38b05b7b6954cfa5bd21cec72f68823603ca2227, public
    README/issues, observed 2026-11-23 for the reporting categories. Public specification used:
    Microsoft PE/COFF and GDK module documentation. Independent implementation:
    tools/compat_report.py, tests/compat_report_check.py.
  • Tests: synthetic PE with named, ordinal and delay imports; API-set prefix control; stub
    provider control; ARM64 and x86 rejection; unknown-DLL negative control.
  • Follow-up: split the route table into the XCL-02 import-routing module; add TLS callback counts
    and load-config flags; reject an output path that equals the input or the other output.
  • The diff is larger than the 400-line guide because the test builds the PE32+ image and its
    import, TLS, exception and load-config directories from bytes. It remains one behavior.
  • No game files, dumps, shader bytes, title paths or secrets are included.

Checklist

  • One reviewable behavior: deterministic offline import-routing candidates.
  • Positive test, candidate controls and negative control.
  • README and the Linux Python job updated.
  • No game files, dumps, logs or secrets.
  • Provenance recorded.
  • AI-assisted (Codex).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6570010896 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1036). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-23T22:20:22Z. --- ## Change Add `tools/compat_report.py`, an offline AMD64 PE import-routing report with deterministic JSON and Markdown, plus a synthetic PE test registered in the Linux Python job. The labels are **candidate module routes** derived from the import module name: `hle`, `windows`, `stub` or `unsupported`. Every row records `route_kind: candidate`, `resolution: not_checked` and `provider: null`; a name or ordinal absent from an export table still receives its module route and is not claimed to resolve. Stub rows expose `stub: true`, `provider: null`, and the summary reports `stub_providers: 0`. The report also records TLS, SEH and load-config directory presence. The 12-byte exception entry count is limited to AMD64; ARM64 and x86 images are rejected with exit 2 and their machine name. The image is never loaded or executed. ## Verification - `out\pe-env\Scripts\python.exe -B tests\compat_report_check.py` - Observed: `compat report synthetic checks passed`, exit 0. - Positive fixture: 7 imports (5 normal, 2 delay). Routes `hle=3`, `windows=2`, `stub=2`, `unsupported=0`; `by_ordinal=3`; stub rows 2, stub providers 0. - Candidate controls: `xmem.dll!#65535` still maps to `hle` with `resolution: not_checked`; a fabricated `api-ms-win-fixture-l1-1-0.dll!FabricatedApi` maps to `windows` from the prefix with `resolution: not_checked`. - Machine controls: ARM64 (0xAA64) and x86 (0x14C) images exit 2 with the machine name and write no report. - Negative control: `unsupported: negative.exe -> mystery.dll!MissingExport`, exit 1, with both outputs written for inspection. - Read errors: missing input and invalid PE return 2 without a traceback or a report. - `out\pe-env\Scripts\python.exe -B tests\docs_links_check.py`: `Self-test passed.`, `Checked 13 Markdown files and 223 links.`, exit 0. - `git diff --check origin/main...HEAD`: clean. - Tests not run: CMake, CTest, native Windows tests and GPU tests. This is a Python-only change. ## Evidence and follow-up - Branch `tools/compat-report`, head `a982c11`, based on `61e5a09`. Two commits: `68ec1db` adds the report and synthetic fixture; `a982c11` addresses the review by naming candidate routes, flagging the absent stub provider, limiting the SEH count to AMD64 and registering the check. - The policy is data, not inference: HLE entries come from `src/xmem_shim.cpp` and `src/d3d12_xs_shim.cpp`; stub entries are public GDK module names without a shim in this tree; Windows entries are explicit system DLLs plus the documented API-set prefixes. - Provenance: Reference `ivall/xcl@38b05b7b6954cfa5bd21cec72f68823603ca2227`, public README/issues, observed 2026-11-23 for the reporting categories. Public specification used: Microsoft PE/COFF and GDK module documentation. Independent implementation: `tools/compat_report.py`, `tests/compat_report_check.py`. - Tests: synthetic PE with named, ordinal and delay imports; API-set prefix control; stub provider control; ARM64 and x86 rejection; unknown-DLL negative control. - Follow-up: split the route table into the XCL-02 import-routing module; add TLS callback counts and load-config flags; reject an output path that equals the input or the other output. - The diff is larger than the 400-line guide because the test builds the PE32+ image and its import, TLS, exception and load-config directories from bytes. It remains one behavior. - No game files, dumps, shader bytes, title paths or secrets are included. ## Checklist - [x] One reviewable behavior: deterministic offline import-routing candidates. - [x] Positive test, candidate controls and negative control. - [x] README and the Linux Python job updated. - [x] No game files, dumps, logs or secrets. - [x] Provenance recorded. - [x] AI-assisted (Codex).
upstream-sync closed this pull request 2026-11-24 06:45:57 +00:00
R0Y00 commented 2026-11-24 06:49:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:35:33Z.


Please make the policy labels describe candidate module routes. For example, a name or ordinal absent from the checked-in xmem export table still receives hle, and a fabricated api-ms-win-… name receives windows from its prefix. Neither classification establishes that the import resolves. The stub rows currently have no provider; flag that explicitly in the JSON and summary. Also scope the 12-byte exception-directory count to AMD64: ARM64 and x86 images must be rejected or reported without that count. Add these synthetic controls and register the offline check in the existing Linux Python job.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115945174 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1036#issuecomment-7115945174). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T22:35:33Z. --- Please make the policy labels describe candidate module routes. For example, a name or ordinal absent from the checked-in xmem export table still receives `hle`, and a fabricated `api-ms-win-…` name receives `windows` from its prefix. Neither classification establishes that the import resolves. The `stub` rows currently have no provider; flag that explicitly in the JSON and summary. Also scope the 12-byte exception-directory count to AMD64: ARM64 and x86 images must be rejected or reported without that count. Add these synthetic controls and register the offline check in the existing Linux Python job.
lambirou commented 2026-11-24 06:49:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-23T22:52:33Z.


Addressed in a982c11. Route labels are now explicit candidates: every row carries route_kind=candidate, resolution=not_checked and provider=null. An absent xmem ordinal (#65535) and a fabricated api-ms-win name still receive their module route without claiming resolution. Stub rows report stub=true and the summary reports stub_providers=0. ARM64 and x86 images are rejected with exit 2 and their machine name before the 12-byte SEH count, with synthetic controls. The check is registered in the Linux Python job and the AGENTS list. compat_report_check passes; docs_links_check passes with 13 files and 223 links.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7116285254 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1036#issuecomment-7116285254). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-23T22:52:33Z. --- Addressed in a982c11. Route labels are now explicit candidates: every row carries route_kind=candidate, resolution=not_checked and provider=null. An absent xmem ordinal (#65535) and a fabricated api-ms-win name still receive their module route without claiming resolution. Stub rows report stub=true and the summary reports stub_providers=0. ARM64 and x86 images are rejected with exit 2 and their machine name before the 12-byte SEH count, with synthetic controls. The check is registered in the Linux Python job and the AGENTS list. compat_report_check passes; docs_links_check passes with 13 files and 223 links.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
R0Y00/Xbox2Windows!1029
No description provided.