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

Method set_bytes_at_rva

pythonmemorymodule/pefile.py:6937–6952  ·  view source on GitHub ↗

Overwrite, with the given string, the bytes at the file offset corresponding to the given RVA. Return True if successful, False otherwise. It can fail if the offset is outside the file's boundaries.

(self, rva, data)

Source from the content-addressed store, hash-verified

6935 ##
6936
6937 def set_bytes_at_rva(self, rva, data):
6938 """Overwrite, with the given string, the bytes at the file offset corresponding
6939 to the given RVA.
6940
6941 Return True if successful, False otherwise. It can fail if the
6942 offset is outside the file's boundaries.
6943 """
6944
6945 if not isinstance(data, bytes):
6946 raise TypeError("data should be of type: bytes")
6947
6948 offset = self.get_physical_by_rva(rva)
6949 if not offset:
6950 return False
6951
6952 return self.set_bytes_at_offset(offset, data)
6953
6954 def set_bytes_at_offset(self, offset, data):
6955 """Overwrite the bytes at the given file offset with the given string.

Callers 3

set_dword_at_rvaMethod · 0.95
set_word_at_rvaMethod · 0.95
set_qword_at_rvaMethod · 0.95

Calls 2

get_physical_by_rvaMethod · 0.95
set_bytes_at_offsetMethod · 0.95

Tested by

no test coverage detected