mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 00:31:16 +00:00
Remove the need for textraw and textvirt members
This commit is contained in:
parent
98cff9fcde
commit
1c1e9f8e3e
@ -64,17 +64,12 @@ class Bin:
|
|||||||
"""Parses a PE format EXE and allows reading data from a virtual address.
|
"""Parses a PE format EXE and allows reading data from a virtual address.
|
||||||
Reference: ohttps://learn.microsoft.com/en-us/windows/win32/debug/pe-format"""
|
Reference: ohttps://learn.microsoft.com/en-us/windows/win32/debug/pe-format"""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
# Could remove textvirt and textraw in an upcoming refactor
|
|
||||||
|
|
||||||
def __init__(self, filename, logger=None):
|
def __init__(self, filename, logger=None):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self._debuglog(f'Parsing headers of "{filename}"... ')
|
self._debuglog(f'Parsing headers of "{filename}"... ')
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.file = None
|
self.file = None
|
||||||
self.imagebase = None
|
self.imagebase = None
|
||||||
self.textvirt = None
|
|
||||||
self.textraw = None
|
|
||||||
self.sections = []
|
self.sections = []
|
||||||
self.last_section = None
|
self.last_section = None
|
||||||
|
|
||||||
@ -108,10 +103,6 @@ def __enter__(self):
|
|||||||
text_section = self._get_section_by_name(".text")
|
text_section = self._get_section_by_name(".text")
|
||||||
self.last_section = text_section
|
self.last_section = text_section
|
||||||
|
|
||||||
# These are used by reccmp
|
|
||||||
self.textvirt = text_section.VirtualAddress
|
|
||||||
self.textraw = text_section.PointerToRawData
|
|
||||||
|
|
||||||
self._debuglog("... Parsing finished")
|
self._debuglog("... Parsing finished")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ def filter_out_ptr(ptype, op_str):
|
|||||||
for i, word in enumerate(words):
|
for i, word in enumerate(words):
|
||||||
try:
|
try:
|
||||||
inttest = int(word, 16)
|
inttest = int(word, 16)
|
||||||
if inttest >= file.imagebase + file.textvirt:
|
if inttest >= file.get_section_offset_by_index(1):
|
||||||
words[i] = placeholder_generator.get(inttest)
|
words[i] = placeholder_generator.get(inttest)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user