mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-23 16:21:15 +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.
|
||||
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):
|
||||
self.logger = logger
|
||||
self._debuglog(f'Parsing headers of "{filename}"... ')
|
||||
self.filename = filename
|
||||
self.file = None
|
||||
self.imagebase = None
|
||||
self.textvirt = None
|
||||
self.textraw = None
|
||||
self.sections = []
|
||||
self.last_section = None
|
||||
|
||||
@ -108,10 +103,6 @@ def __enter__(self):
|
||||
text_section = self._get_section_by_name(".text")
|
||||
self.last_section = text_section
|
||||
|
||||
# These are used by reccmp
|
||||
self.textvirt = text_section.VirtualAddress
|
||||
self.textraw = text_section.PointerToRawData
|
||||
|
||||
self._debuglog("... Parsing finished")
|
||||
return self
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ def filter_out_ptr(ptype, op_str):
|
||||
for i, word in enumerate(words):
|
||||
try:
|
||||
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)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
Loading…
Reference in New Issue
Block a user