From efbd06100e65cb154bd3986271c7e9a8bc911dc1 Mon Sep 17 00:00:00 2001 From: insolor Date: Fri, 3 Jun 2022 19:44:10 +0300 Subject: [PATCH] Some renaming --- peclasses/pe_classes.py | 4 ++-- peclasses/portable_executable.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/peclasses/pe_classes.py b/peclasses/pe_classes.py index 98ed997..5ec0a4e 100644 --- a/peclasses/pe_classes.py +++ b/peclasses/pe_classes.py @@ -97,7 +97,7 @@ class ImageOptionalHeader(AnnotatedStructure): size_of_heap_commit: c_uint loader_flags: c_uint number_of_rva_and_sizes: c_uint - image_data_directory: ImageDataDirectoryArray + data_directory: ImageDataDirectoryArray class ImageNTHeaders(AnnotatedStructure): @@ -136,7 +136,7 @@ class ImageOptionalHeader64(AnnotatedStructure): size_of_heap_commit: c_ulonglong loader_flags: c_uint number_of_rva_and_sizes: c_uint - image_data_directory: ImageDataDirectoryArray + data_directory: ImageDataDirectoryArray class ImageNTHeaders64(AnnotatedStructure): diff --git a/peclasses/portable_executable.py b/peclasses/portable_executable.py index abc4648..bbef217 100644 --- a/peclasses/portable_executable.py +++ b/peclasses/portable_executable.py @@ -47,7 +47,7 @@ def _read_file(self, file): self.file_header = self.nt_headers.file_header self.optional_header = self.nt_headers.optional_header - self.data_directory = self.optional_header.image_data_directory + self.data_directory = self.optional_header.data_directory self._section_table = None self._relocation_table = None @@ -58,7 +58,7 @@ def reread(self): def optional_header_offset(self) -> Offset: return self.dos_header.e_lfanew + 4 + sizeof(ImageFileHeader) - def rewrite_image_nt_headers(self): + def rewrite_nt_headers(self): offset = self.dos_header.e_lfanew nt_headers_data = bytes(self.nt_headers)[:self.nt_headers_size] self.file.seek(offset) @@ -132,7 +132,7 @@ def add_new_section(self, new_section: Section, data_size: int): new_section.virtual_address + new_section.virtual_size, section_alignment ) - self.rewrite_image_nt_headers() + self.rewrite_nt_headers() def info(self): entry_point = (self.optional_header.address_of_entry_point