mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1345] [MERGED] pe_inspect: resolve legacy VA delay-import thunks and skip ImageBase DLL name (PE-INSPECT-DELAY-VA-THUNKS) #1375
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1375
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1345
Author: @IlyassRS3
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @QemmHD
Base:
main← Head:fix/pe-inspect-delay-va-thunks📝 Commits (1)
3a7b8b2pe_inspect: resolve legacy VA delay-import thunks and skip ImageBase DLL name📊 Changes
2 files changed (+25 additions, -4 deletions)
View changed files
📝
tests/test_pe_inspect.py(+21 -1)📝
tools/pe_inspect.py(+4 -3)📄 Description
Item ID:
PE-INSPECT-DELAY-VA-THUNKSAI-assisted: yes
Summary
Fixes two bugs in
tools/pe_inspect.py:_importsfor legacy VA-based delay-import descriptors (dlattrRva == 0):_va_entriesbroke named function resolution indlattrRva == 0delay-import tables:PeImage.import_descriptorscomputesva_entries = Truewhenattributes & 1 == 0(dlattrRvaclear, per the PE/COFF v1ImgDelayDescrformat whereszName,pIAT,pINT, and the named lookup entries inpINTall store virtual addresses), andPeImage.thunk_names(lookup_rva, *, va_entries=False)already supports converting those VAs viavalue -= self.image_base(used bytools/import_call_sites.py:68).tools/pe_inspect.py:_importsunpacked_va_entriesand dropped it, callingimg.thunk_names(lookup)withva_entries=False, so every named delay-import entry in adlattrRva == 0image (includingtests/test_import_call_sites.py's ownbuild_delay_image(attributes=0)fixture) resolved as"?".va_entries=va_entriestoimg.thunk_names(lookup, va_entries=va_entries).szName == ImageBase(dll_rva == 0) read"MZ"from the DOS header:dll = img.string_at(dll_rva) if dll_rva > 0 else Noneso a descriptor pointing atImageBaseis skipped (matchingtools/import_call_sites.py).dlattrRva == 0delay-import lookup slot intests/test_pe_inspect.py:build_image(is64=False)to store a spec-compliant virtual address (base + 0x1440, matching lines 119–120 andtools/pe_inspect.py:149), and addedtest_delay_import_va_descriptor_skips_image_base_dll_and_handles_ordinals.Merge compatibility
#693's_exportsedit) and keeps test additions at lines 124 and 232 (away from#384,#649,#653,#693,#698).Verification
Tested on Apple M5 arm64 (macOS 27.2.1, Python 3.14; CPU-only, no game files):
python3 -I tests/test_pe_inspect.py -v— 61 tests (60 ok, 1 Windows-only skipped)python3 -I tests/test_import_call_sites.py -v— 21/21 OKtools/pe_inspect.pytoupstream/mainfails both VA delay-import tests intests/test_pe_inspect.py(['?'] != ['D3D12SerializeVersionedRootSignature']).python3 -m compileall -q tools/pe_inspect.py tests/test_pe_inspect.py— OKpython3 -I scripts/check_no_game_data.py tools/pe_inspect.py tests/test_pe_inspect.py— OKpython3 -I tests/test_text_write_line_endings.py— 3/3 OK🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.