pe: bind bundled ordinal-only imports during EXE startup #954
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/961"
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-23T18:49:11Z.
Change
Extend
pe_mapandpe_run_package.pyto bind bundled DLL imports by ordinal, includingNONAMEexports, during a source-built EXE startup. The offline preflight already classifies ordinal imports such asdll!#77correctly, but the package runner previously refused them before mapping. This closes that specific import-binding gap without changing the runtime ABI or claiming title execution.pe_map_export_ordinal(mapped, ordinal)and use the mapped image's export address table (not its name/ordinal-name tables). Validate the public ordinal range 1..65535, export bounds, live readable pages and nonempty final address; refuse forwarded/empty entries and invalid pointers.#ordinalsymbols inpe_run_package.pyafter its existing static package-forwarder resolution. A chain that ends at an ordinal is served from its actual terminal mapped DLL. An unresolved mapped export fails before starting the EXE.#77from a source-built DLL exportingmix_args @77 NONAME, plus altered/mismatched-export providers. The Windows test compares ordinary process startup withpe_run_package, validates the PE import/export tables, calls the mapped ordinal export directly, and checks that missing/wrong providers are refused before the guest entry.Refs #870, #165. Independent of the TLS slot-0, DirectStorage and runtime provider slices currently in progress.
Tests
On Linux/Python 3.14, based on
0f0c3eb:Observed: 3/3 new planning tests passed, 8/8 preflight tests passed; existing dependency/import path controls passed; 13 Markdown files / 192 links passed; 791 tracked files passed the bidi scan. No compiler or Windows runner was available on the local Linux host, so the new native-vs-mapped EXE test has not yet been executed locally.
Windows CI is expected to compile and exercise this specific test:
Expected: native and mapped startup return 13 for the normal ordinal-only provider and 14 for the altered implementation; wrong
#78and missing-DLL controls fail before mapped entry; direct mapped#77returns the correct output while six invalid ordinals fail. These Windows expectations are not represented as observed results until CI completes.Scope
Only static package-internal ordinal binding; the mapper cannot resolve a forwarder on its own, so it refuses forwarded entries. The package planner must resolve the terminal module beforehand. This does not implement console APIs, main-image TLS slot 0, dynamic imports, or a retail executable run. No game files, executable binaries, dumps, archives, secrets or private traces are committed.
AI-assisted implementation and tests. Commit
cbe4fcb.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:11:37Z.
I independently ran the source-built ordinal fixture. The normal and altered providers returned 13 and 14 in Windows and pe_map, and the wrong ordinal and missing DLL were refused. With your Debug compile fix included, the ordinal startup and planning tests passed in Debug. The compatibility update also passed the four targeted Release CTests with #950 integrated, and I verified that a pre-change mapper still runs a name-only package and gives a clear diagnostic for an ordinal package. The C export documents the live-mapping precondition and returns null for a null mapping.