mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
Add temp reference for entrypoints
This commit is contained in:
parent
56971a3f5e
commit
ea1224db08
@ -30,6 +30,17 @@
|
|||||||
// LIBRARY: LEGO1 0x1008b640
|
// LIBRARY: LEGO1 0x1008b640
|
||||||
// _rand
|
// _rand
|
||||||
|
|
||||||
|
// entry
|
||||||
|
// LIBRARY: ISLE 0x4082e0
|
||||||
|
// _WinMainCRTStartup
|
||||||
|
|
||||||
|
// entry
|
||||||
|
// LIBRARY: LEGO1 0x1008c860
|
||||||
|
// __DllMainCRTStartup@12
|
||||||
|
|
||||||
|
// LIBRARY: ISLE 0x409110
|
||||||
|
// __mtinit
|
||||||
|
|
||||||
// LIBRARY: ISLE 0x409190
|
// LIBRARY: ISLE 0x409190
|
||||||
// __getptd
|
// __getptd
|
||||||
|
|
||||||
|
|||||||
@ -81,6 +81,7 @@ def __init__(self, filename: str, logger=None) -> None:
|
|||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.file = None
|
self.file = None
|
||||||
self.imagebase = None
|
self.imagebase = None
|
||||||
|
self.entry = None
|
||||||
self.sections: List[ImageSectionHeader] = []
|
self.sections: List[ImageSectionHeader] = []
|
||||||
self.last_section = None
|
self.last_section = None
|
||||||
self._relocated_addrs = set()
|
self._relocated_addrs = set()
|
||||||
@ -106,6 +107,8 @@ def __enter__(self):
|
|||||||
|
|
||||||
optional_hdr = self.file.read(pe_hdr.SizeOfOptionalHeader)
|
optional_hdr = self.file.read(pe_hdr.SizeOfOptionalHeader)
|
||||||
(self.imagebase,) = struct.unpack("<i", optional_hdr[0x1C:0x20])
|
(self.imagebase,) = struct.unpack("<i", optional_hdr[0x1C:0x20])
|
||||||
|
(entry,) = struct.unpack("<i", optional_hdr[0x10:0x14])
|
||||||
|
self.entry = entry + self.imagebase
|
||||||
|
|
||||||
self.sections = [
|
self.sections = [
|
||||||
ImageSectionHeader(*struct.unpack("<8s6I2HI", self.file.read(0x28)))
|
ImageSectionHeader(*struct.unpack("<8s6I2HI", self.file.read(0x28)))
|
||||||
@ -223,6 +226,11 @@ def get_section_offset_by_name(self, name: str) -> int:
|
|||||||
section = self._get_section_by_name(name)
|
section = self._get_section_by_name(name)
|
||||||
return section.virtual_address
|
return section.virtual_address
|
||||||
|
|
||||||
|
def get_abs_addr(self, section: int, offset: int) -> int:
|
||||||
|
"""Convenience function for converting section:offset pairs from cvdump
|
||||||
|
into an absolute vaddr."""
|
||||||
|
return self.get_section_offset_by_index(section) + offset
|
||||||
|
|
||||||
def get_raw_addr(self, vaddr: int) -> int:
|
def get_raw_addr(self, vaddr: int) -> int:
|
||||||
"""Returns the raw offset in the PE binary for the given virtual address."""
|
"""Returns the raw offset in the PE binary for the given virtual address."""
|
||||||
self._set_section_for_vaddr(vaddr)
|
self._set_section_for_vaddr(vaddr)
|
||||||
|
|||||||
@ -37,9 +37,7 @@ def __init__(self, pdb, sym_recompfile, sym_logger, base_dir):
|
|||||||
size = contrib_dict[(pub.section, pub.offset)]
|
size = contrib_dict[(pub.section, pub.offset)]
|
||||||
|
|
||||||
info = RecompiledInfo()
|
info = RecompiledInfo()
|
||||||
info.addr = pub.offset + sym_recompfile.get_section_offset_by_index(
|
info.addr = sym_recompfile.get_abs_addr(pub.section, pub.offset)
|
||||||
pub.section
|
|
||||||
)
|
|
||||||
|
|
||||||
info.start = 0
|
info.start = 0
|
||||||
info.size = size
|
info.size = size
|
||||||
@ -52,9 +50,7 @@ def __init__(self, pdb, sym_recompfile, sym_logger, base_dir):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
info = RecompiledInfo()
|
info = RecompiledInfo()
|
||||||
info.addr = proc.offset + sym_recompfile.get_section_offset_by_index(
|
info.addr = sym_recompfile.get_abs_addr(proc.section, proc.offset)
|
||||||
proc.section
|
|
||||||
)
|
|
||||||
|
|
||||||
info.start = 0
|
info.start = 0
|
||||||
info.size = proc.size
|
info.size = proc.size
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user