mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-03-14 08:49:48 -04:00
Ordinal imports (#534)
This commit is contained in:
parent
03423b2ffa
commit
00e32673d1
1 changed files with 10 additions and 4 deletions
|
@ -308,9 +308,15 @@ class Bin:
|
|||
if lookup_addr == 0 or import_addr == 0:
|
||||
break
|
||||
|
||||
# Skip the "Hint" field, 2 bytes
|
||||
name_ofs = lookup_addr + self.imagebase + 2
|
||||
symbol_name = self.read_string(name_ofs).decode("ascii")
|
||||
# MSB set if this is an ordinal import
|
||||
if lookup_addr & 0x80000000 != 0:
|
||||
ordinal_num = lookup_addr & 0x7FFF
|
||||
symbol_name = f"Ordinal_{ordinal_num}"
|
||||
else:
|
||||
# Skip the "Hint" field, 2 bytes
|
||||
name_ofs = lookup_addr + self.imagebase + 2
|
||||
symbol_name = self.read_string(name_ofs).decode("ascii")
|
||||
|
||||
yield (dll_name, symbol_name, ofs_iat)
|
||||
ofs_ilt += 4
|
||||
ofs_iat += 4
|
||||
|
@ -384,7 +390,7 @@ class Bin:
|
|||
if section.contains_vaddr(addr):
|
||||
return (i + 1, addr - section.virtual_address)
|
||||
|
||||
raise InvalidVirtualAddressError(hex(addr))
|
||||
raise InvalidVirtualAddressError(f"{self.filename} : {hex(addr)}")
|
||||
|
||||
def is_valid_section(self, section_id: int) -> bool:
|
||||
"""The PDB will refer to sections that are not listed in the headers
|
||||
|
|
Loading…
Reference in a new issue