You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tools/pe_inspect.py: Share the bounded descriptor parser (import_descriptors) with tools/import_call_sites.py, adding optional va_entries support in thunk_names() for legacy VA delay-import lookup entries while keeping pe_inspect's own output unchanged.
tools/import_call_sites.py: Enumerate PE32+ delay-loaded import IAT slots (named and ordinal, RVA and legacy VA descriptors) alongside ordinary imports so calls and tail jumps targeting delay-import thunks are counted. Requires positive, mapped szName, pIAT, and pINT RVAs (rejecting missing/underflowed pINT rather than falling back to resolver addresses, and rejecting a legacy DLL-name VA normalizing to RVA 0). Ordinary imports take precedence on slot collision, and distinct slots with the same DLL!NAME merge into one entry.
tests/test_import_call_sites.py: Synthetic PE32+ tests covering RVA and legacy VA descriptors (including VA-encoded named lookup entries), named and ordinal delay imports, coexistence and slot collisions with ordinary imports, missing/underflowed pINT, RVA-0 DLL-name rejection, and malformed/truncated tables. Assertions check owned fields (thunks, call, jmp) so they stay compatible with import_call_sites: detect direct IAT call [rip+disp32] (FF 15) sites #7116.
Testing & Disclosure
AI-assisted: Implemented with Codex (gpt-6.2-sol) and reviewed with Codex (gpt-6.2-astra).
Environment: macOS 27.3, Apple M1 Max (CPU-only, synthetic fixtures, zero game data).
One minor review note: pe_inspect._imports() unpacks _va_entries from img.import_descriptors(index, delay=delay) and leaves it unused (img.thunk_names(lookup)), whereas import_call_sites passes va_entries=va_entries for legacy VA delay descriptors. Keeping _imports() unchanged is fine if intentional, or passing va_entries=_va_entries would let pe_inspect decode legacy VA delay-import names the same way.
Tested 34016784c merged with maindde82f27e (clean merge) on Windows 11 (10.0.26300), Python 3.13.15 (venv with the pinned tests/requirements.txt), with llvm-mc 21.1.8 (AMDGPU) and SPIRV-Tools v2026.4 on PATH: pass.
tests/test_import_call_sites.py with this PR: passes (Ran 18 tests in 0.011s, OK). On main: passes (Ran 8 tests in 0.007s, OK).
Negative control: this PR's test with main's version of tools/import_call_sites.py, tools/pe_inspect.py fails (Ran 18 tests in 0.012s, FAILED (failures=5, errors=4)), so the new test does catch the problem.
Code not reviewed beyond running it. No GPU or game files.
Tested 3401678 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass.
Ran the test files this PR adds or changes, from a clean checkout of the PR head: test_import_call_sites.py - all exit 0.
AI-assisted (Claude Code).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claim: #7804 (comment)
What changed
tools/pe_inspect.py: Share the bounded descriptor parser (import_descriptors) withtools/import_call_sites.py, adding optionalva_entriessupport inthunk_names()for legacy VA delay-import lookup entries while keepingpe_inspect's own output unchanged.tools/import_call_sites.py: Enumerate PE32+ delay-loaded import IAT slots (named and ordinal, RVA and legacy VA descriptors) alongside ordinary imports so calls and tail jumps targeting delay-import thunks are counted. Requires positive, mappedszName,pIAT, andpINTRVAs (rejecting missing/underflowedpINTrather than falling back to resolver addresses, and rejecting a legacy DLL-name VA normalizing to RVA 0). Ordinary imports take precedence on slot collision, and distinct slots with the sameDLL!NAMEmerge into one entry.tests/test_import_call_sites.py: Synthetic PE32+ tests covering RVA and legacy VA descriptors (including VA-encoded named lookup entries), named and ordinal delay imports, coexistence and slot collisions with ordinary imports, missing/underflowedpINT, RVA-0 DLL-name rejection, and malformed/truncated tables. Assertions check owned fields (thunks,call,jmp) so they stay compatible with import_call_sites: detect direct IAT call [rip+disp32] (FF 15) sites #7116.Testing & Disclosure
gpt-6.2-sol) and reviewed with Codex (gpt-6.2-astra).python3 -I tests/test_import_call_sites.py < /dev/null— 18/18 passedpython3 -I tests/test_pe_inspect.py < /dev/null— 59 passed, 1 Windows-only skippython3 -m compileall -q make_game.py tools tests < /dev/null— passedpython3 -I scripts/check_no_game_data.py tools/import_call_sites.py tools/pe_inspect.py tests/test_import_call_sites.py < /dev/null— passed