MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / write

Method write

python/binaryview.py:4501–4525  ·  view source on GitHub ↗

``write`` writes the bytes in ``data`` to the virtual address ``addr``. :param int addr: virtual address to write to. :param bytes data: data to be written at addr. :param bool except_on_relocation: (default True) raise exception when write overlaps a relocation :return: number of bytes

(self, addr: int, data: bytes, except_on_relocation: bool = True)

Source from the content-addressed store, hash-verified

4499 return uuid.UUID(bytes=data)
4500
4501 def write(self, addr: int, data: bytes, except_on_relocation: bool = True) -> int:
4502 """
4503 ``write`` writes the bytes in ``data`` to the virtual address ``addr``.
4504
4505 :param int addr: virtual address to write to.
4506 :param bytes data: data to be written at addr.
4507 :param bool except_on_relocation: (default True) raise exception when write overlaps a relocation
4508 :return: number of bytes written to virtual address ``addr``
4509 :rtype: int
4510 :Example:
4511
4512 >>> bv.read(0,4)
4513 b'BBBB'
4514 >>> bv.write(0, b"AAAA")
4515 4
4516 >>> bv.read(0,4)
4517 b'AAAA'
4518 """
4519 if not (isinstance(data, bytes) or isinstance(data, bytearray) or isinstance(data, str)):
4520 raise TypeError("Must be bytes, bytearray, or str")
4521 buf = databuffer.DataBuffer(data)
4522 if except_on_relocation and self.range_contains_relocation(addr, len(data)):
4523 raise RelocationWriteException("Attempting to write to a location which has a relocation")
4524
4525 return core.BNWriteViewBuffer(self.handle, addr, buf.handle)
4526
4527 def insert(self, addr: int, data: bytes) -> int:
4528 """

Callers 9

__setitem__Method · 0.95
valueMethod · 0.45
mainFunction · 0.45
write_breakpointFunction · 0.45
save_svgFunction · 0.45
__init__Method · 0.45
write_dwarfFunction · 0.45
fromMethod · 0.45
fromMethod · 0.45

Calls 3

DataBufferMethod · 0.80

Tested by

no test coverage detected