Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify comments in get_memory_mapped_image #442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions pefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6268,27 +6268,25 @@ def get_memory_mapped_image(self, max_virtual_address=0x10000000, ImageBase=None
"""Returns the data corresponding to the memory layout of the PE file.

The data includes the PE header and the sections loaded at offsets
corresponding to their relative virtual addresses. (the VirtualAddress
corresponding to their relative virtual addresses (the VirtualAddress
section header member).
Any offset in this data corresponds to the absolute memory address
ImageBase+offset.
ImageBase + offset.

The optional argument 'max_virtual_address' provides with means of limiting
The optional argument 'max_virtual_address' provides a way of limiting
which sections are processed.
Any section with their VirtualAddress beyond this value will be skipped.
Normally, sections with values beyond this range are just there to confuse
tools. It's a common trick to see in packed executables.
tools. This is a common trick to see in packed executables.

If the 'ImageBase' optional argument is supplied, the file's relocations
will be applied to the image by calling the 'relocate_image()' method. Beware
that the relocation information is applied permanently.
"""

# Rebase if requested
#
if ImageBase is not None:
# Keep a copy of the image's data before modifying it by rebasing it
#
original_data = self.__data__

self.relocate_image(ImageBase)
Expand All @@ -6297,7 +6295,8 @@ def get_memory_mapped_image(self, max_virtual_address=0x10000000, ImageBase=None
mapped_data = self.header
for section in self.sections:
# Miscellaneous integrity tests.
# Some packer will set these to bogus values to make tools go nuts.
# Some packers will set these to bogus values to confuse tools.

if section.Misc_VirtualSize == 0 and section.SizeOfRawData == 0:
continue

Expand Down Expand Up @@ -6327,7 +6326,6 @@ def get_memory_mapped_image(self, max_virtual_address=0x10000000, ImageBase=None
mapped_data += section.get_data()

# If the image was rebased, restore it to its original form
#
if ImageBase is not None:
self.__data__ = original_data

Expand Down
Loading