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

Method get_dword_from_data

pythonmemorymodule/pefile.py:6791–6803  ·  view source on GitHub ↗

Convert four bytes of data to a double word (little endian) 'offset' is assumed to index into a dword array. So setting it to N will return a dword out of the data starting at offset N*4. Returns None if the data can't be turned into a double word.

(self, data, offset)

Source from the content-addressed store, hash-verified

6789 return struct.pack("<L", dword & 0xFFFFFFFF)
6790
6791 def get_dword_from_data(self, data, offset):
6792 """Convert four bytes of data to a double word (little endian)
6793
6794 'offset' is assumed to index into a dword array. So setting it to
6795 N will return a dword out of the data starting at offset N*4.
6796
6797 Returns None if the data can&#x27;t be turned into a double word.
6798 """
6799
6800 if (offset + 1) * 4 > len(data):
6801 return None
6802
6803 return struct.unpack("<I", data[offset * 4 : (offset + 1) * 4])[0]
6804
6805 def get_dword_at_rva(self, rva):
6806 """Return the double word value at the given RVA.

Callers 3

get_dword_at_rvaMethod · 0.95
get_dword_from_offsetMethod · 0.95

Calls 1

unpackMethod · 0.45

Tested by

no test coverage detected