Resolve KnownDLL names from System32 before package images #177
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/178"
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 Vonsek on 2026-11-21T18:01:40Z.
Change
The Windows loader maps a module named in the
\KnownDllsobject directory from System32 before it searches the application directory.docs/experiments.mdlisted this as not modeled.pe_inventory.pylet any uniquely named package image decide the import, so a package file calledkernel32.dll(or any other known DLL name) replaced the System32 export table inpackage_resolution, at the first hop and at forwarder hops.dependency_paths.pythen added that file to the reachable graph and could reportbundled_export_missingfor imports that the loader satisfies from System32.pe_inventory.known_dlls()enumerates the host's\KnownDllsdirectory withNtOpenDirectoryObject/NtQueryDirectoryObjectand keeps theSectionentries. It addsntdll.dll, which is mapped into every process before imports are resolved. The directory can list more modules than theKnownDLLsregistry value, so the scanner reads the directory itself.resolve_desktop()takes an optionalknown_dllsset. A known name skips the package lookup and selects the System32 image. API-set contracts keep their own route. With package resolution enabled, the hop getsknown_dll: true.scan()passes the set to package resolution and records it underknown_dllsin the report.desktop_resolutiondoes not change.dependency_paths.trace()does not treat a package image as loaded when the first package hop is a known DLL. It reports the edge with its System32 status anddesktop_chain.Verification
python -B tests/intake/paths_check.pypasses. Before the change it fails:resolve_desktop()does not accept the known-DLL set. With onlydependency_paths.pyreverted, it fails the new path-graph assertions. The new cases cover a known name with and without the set, a known name whose package copy exports an extra symbol, a packaged forwarder whose next hop is a known DLL (in a different case), an API-set contract, and the path report for both a missing and a present System32 export.bundled_export_forwarders: fixtures built withclang --target=x86_64-pc-windows-msvcandlld-link /nodefaultlib, with a source-builtkernel32.dllin a temporarySystem32andknown_dllsreplaced by a test double. It passes with the change; without it the package copy decides KERNEL32 imports and givesexport_not_found.ctest --preset dev --no-tests=error -R 'static_exe_intake|conditional_import_paths|bundled_export_forwarders' -Vat ee2f38e (rebased on main; the earlier run at b4e01fe gave the same result) on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.12: 3/3 passed (conditional_import_paths,static_exe_intake,bundled_export_forwarders). The fullctest --preset dev --no-tests=errorpassed 107/107, withbvh_wave64_hardware,bvh_wave64_warpandwave_shuffle_warpskipped.known_dlls()returned 42 names on Windows 11 build 26200.9974 (x64): theSectionentries of\KnownDllstogether withntdll.dll, includingkernel32.dll,kernelbase.dll,ucrtbase.dll,ws2_32.dlland thewow64*.dllmodules. This is the first run of theNtQueryDirectoryObjectenumeration on Windows.Evidence and follow-up
docs/experiments.mdis unchanged. Its 16 package DLLs were not checked against the host's known-DLL names in this change.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T18:32:42Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
ee2f38eb8cℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:40:28Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:16:19Z.
GitHub reports a conflict on
b4e01feb. Please reconcile the KnownDLL resolution and its fixtures with the current dependency inventory before marking ready, and run the direct and forwarded resolution cases together.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T18:27:23Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
ee2f38eℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T19:15:02Z.
The conflict on the current head
ee2f38ebis confined totests/intake/forwarders_check.py. Please preserve the descriptor-name lookup cases from #230 and the KnownDLL forwarder cases when reconciling that file.Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:40:29Z.
Rebased on main
7233cec(d5a1d6f, plus487cedafor the review finding). The only conflict wastests/intake/forwarders_check.py: the descriptor-name lookup cases from #230 (check_descriptor_names) and the KnownDLL forwarder cases now both run, in that order.On Windows 11 26200.9974 (MSVC 14.44.35207, SDK 10.0.26100):
ctest --preset dev --no-tests=error -R 'static_exe_intake|conditional_import_paths|bundled_export_forwarders|dependency_paths_controls' -Vpassed 4/4, so the direct and forwarded resolution cases run together, and the full suite passed 121/121.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T20:00:55Z.
I verified the updated forwarder test and resolved the earlier thread. There is a related uncovered path in
scan():package_resolutionis still populated onlyif bundled[dll]. If a KnownDLL is present only in System32 and forwards to a non-known packaged DLL, that condition skips the package-aware walk entirely. Please exercise this case without a shadow copy of the KnownDLL (starting fromscanor its row-building logic), and keep the forwarded package reachable. The existing fixture setspackage_resolutiondirectly, which bypasses this condition.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T18:32:42Z.
Code review location:
tools/dependency_paths.py; line 43When a bundled KnownDLL name resolves from System32 and its export forwards to a non-known packaged DLL,
resolve_desktop()records that later packaged hop inpackage_resolution. Clearingprovidershere bypasses package-chain processing and makestrace()use onlydesktop_resolution, so the forwarded target is marked unlinked and its import gaps disappear. This reproduces with syntheticknown.Value -> target.Valueexport tables. If the System32 target exportsValuebut the packaged target does not, the graph also hides theexport_not_foundalready recorded inpackage_resolution. Exclude the known-named copy without discarding later packaged hops or the package chain's terminal status.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:40:28Z.
Code review location:
tools/dependency_paths.py; line 43Fixed in
487ceda. With a KnownDLL first hop,trace()no longer drops the package chain: packaged modules named later in the chain are queued from the importing image with reasonforwarder, and a non-present terminal status is reported as a finding withpackage_chain.tests/intake/paths_check.pyaddsknown.Fwd -> target.Fwdandknown.Gap -> target.Gapwith a packagedtarget.dllthat exports onlyFwd: the first reachesbin/target.dllwith no finding, the second reportsexport_not_foundwith the package chain even though the System32target.dllexportsGap. Without the fix the test fails withKeyError: 'bin/target.dll'.