KittyMemoryEx 1.0.0
Dedicated library for runtime code patching, memory scanning, tracing, injection and some more useful memory utilities. works for both Android and Linux
Loading...
Searching...
No Matches
MemoryBackup.hpp
1#pragma once
2
3#include "KittyUtils.hpp"
4#include "KittyMemoryEx.hpp"
5#include "KittyMemOp.hpp"
6
13class MemoryBackup
14{
15 friend class MemoryBackupMgr;
16
17private:
18 IKittyMemOp *_pMem;
19
20 uintptr_t _address;
21 size_t _size;
22
23 std::vector<uint8_t> _orig_code;
24
25public:
26 MemoryBackup();
27 ~MemoryBackup();
28
29 MemoryBackup(IKittyMemOp *pMem, uintptr_t absolute_address, size_t backup_size);
30
34 bool isValid() const;
38 size_t get_BackupSize() const;
39
43 uintptr_t get_TargetAddress() const;
44
48 bool Restore();
49
53 std::string get_CurrBytes() const;
54
58 std::string get_OrigBytes() const;
59};
60
64class MemoryBackupMgr
65{
66private:
67 IKittyMemOp *_pMem;
68
69public:
70 MemoryBackupMgr() : _pMem(nullptr)
71 {
72 }
73
78 MemoryBackupMgr(IKittyMemOp *pMem) : _pMem(pMem)
79 {
80 }
81
89 MemoryBackup createBackup(uintptr_t absolute_address, size_t backup_size);
90};
Interface class for memory operations.
Definition KittyMemOp.hpp:46
MemoryBackup createBackup(uintptr_t absolute_address, size_t backup_size)
Creates a backup of the specified memory region.
MemoryBackupMgr(IKittyMemOp *pMem)
Constructor for MemoryBackuphMgr.
Definition MemoryBackup.hpp:78
A class for backing up and restoring memory data.
Definition MemoryBackup.hpp:14
std::string get_CurrBytes() const
Returns the hex string of the current target address bytes.
uintptr_t get_TargetAddress() const
Returns the address of the memory range that was backed up.
bool isValid() const
Checks if the memory backup is valid.
size_t get_BackupSize() const
Returns the size of the memory range that was backed up.
bool Restore()
Restores the backup code to the memory range.
std::string get_OrigBytes() const
Returns the hex string of the original bytes of the memory range.