MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / cache_adjust_SectionAlignment

Function cache_adjust_SectionAlignment

pythonmemorymodule/pefile.py:75–87  ·  view source on GitHub ↗
(val, section_alignment, file_alignment)

Source from the content-addressed store, hash-verified

73
74@lru_cache(maxsize=2048)
75def cache_adjust_SectionAlignment(val, section_alignment, file_alignment):
76 if section_alignment < 0x1000: # page size
77 section_alignment = file_alignment
78
79 # 0x200 is the minimum valid FileAlignment according to the documentation
80 # although ntoskrnl.exe has an alignment of 0x80 in some Windows versions
81 #
82 # elif section_alignment < 0x80:
83 # section_alignment = 0x80
84
85 if section_alignment and val % section_alignment:
86 return section_alignment * (int(val / section_alignment))
87 return val
88
89
90def count_zeroes(data):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected