def test_access_process_vm_big(self): task = find_task(self.prog, os.getpid()) with self._pages() as (map, address, _): self.assertEqual(access_process_vm(task, address, len(map)), map[:]) self.assertEqual( access_process_vm(task, address + 1, len(map) - 1), map[1:] ) self.assertEqual( access_process_vm(task, address + 1, len(map) - 2), map[1:-1] )
def test_access_process_vm(self): task = find_task(self.prog, os.getpid()) data = b"hello, world" buf = ctypes.create_string_buffer(data) address = ctypes.addressof(buf) self.assertEqual(access_process_vm(task, address, len(data)), data) self.assertEqual(access_remote_vm(task.mm, address, len(data)), data) self.assertRaises(FaultError, access_process_vm, task, 0, 8)