MCPcopy Create free account
hub / github.com/qilingframework/qiling / map_view

Method map_view

qiling/os/windows/dlls/kernel32/fileapi.py:626–650  ·  view source on GitHub ↗
(self, ql: Qiling, fbase: int, lbound: int, ubound: int)

Source from the content-addressed store, hash-verified

624 self._write_hook = None
625
626 def map_view(self, ql: Qiling, fbase: int, lbound: int, ubound: int) -> None:
627 def __read_mapview(ql: Qiling, access: int, addr: int, size: int, _) -> None:
628 """Fetch the corresponding file part into memory.
629 """
630
631 data = self.read(fbase + (addr - lbound), size)
632
633 # FIXME: that triggers the write hook, and may be problematic for read-only ranges
634 ql.mem.write(addr, data)
635
636 def __write_mapview(ql: Qiling, access: int, addr: int, size: int, value: int) -> None:
637 """Write data back to the corresponding file part.
638 """
639
640 pack = {
641 1: ql.pack8,
642 2: ql.pack16,
643 4: ql.pack32,
644 8: ql.pack64
645 }[size]
646
647 self.write(fbase + (addr - lbound), pack(value))
648
649 self._read_hook = ql.hook_mem_read(__read_mapview, begin=lbound, end=ubound)
650 self._write_hook = ql.hook_mem_write(__write_mapview, begin=lbound, end=ubound)
651
652 def unmap_view(self) -> None:
653 if self._read_hook:

Callers 1

hook_MapViewOfFileFunction · 0.80

Calls 2

hook_mem_readMethod · 0.80
hook_mem_writeMethod · 0.80

Tested by

no test coverage detected