* @brief The MemoryPatch class represents a memory patch for applying modifications to a memory address. * * @details The MemoryPatch class allows for the creation and management of memory patches, including: * - Applying patches with byte data * - Applying patches with hexadecimal strings * - Applying patches with assembly code * - Checking the validity of a MemoryPatch object * - Restorin
| 28 | * - Retrieving the hex strings of current, original, and patch bytes |
| 29 | */ |
| 30 | class MemoryPatch |
| 31 | { |
| 32 | friend class MemoryPatchMgr; |
| 33 | |
| 34 | private: |
| 35 | IKittyMemOp *_pMem; |
| 36 | |
| 37 | uintptr_t _address; |
| 38 | size_t _size; |
| 39 | |
| 40 | std::vector<uint8_t> _orig_code; |
| 41 | std::vector<uint8_t> _patch_code; |
| 42 | |
| 43 | public: |
| 44 | MemoryPatch(); |
| 45 | ~MemoryPatch(); |
| 46 | |
| 47 | MemoryPatch(IKittyMemOp *pMem, uintptr_t absolute_address, const void *patch_code, size_t patch_size); |
| 48 | |
| 49 | /** |
| 50 | * @brief Checks if the MemoryPatch object is valid. |
| 51 | */ |
| 52 | bool isValid() const; |
| 53 | |
| 54 | /** |
| 55 | * @brief Returns the size of the memory patch. |
| 56 | */ |
| 57 | size_t get_PatchSize() const; |
| 58 | |
| 59 | /** |
| 60 | * @brief Returns the target address of the memory patch. |
| 61 | */ |
| 62 | uintptr_t get_TargetAddress() const; |
| 63 | |
| 64 | /** |
| 65 | * @brief Restores the patch to its original value |
| 66 | */ |
| 67 | bool Restore(); |
| 68 | |
| 69 | /** |
| 70 | * @brief Applies patch modifications to the target address |
| 71 | */ |
| 72 | bool Modify(); |
| 73 | |
| 74 | /** |
| 75 | * @brief Returns hex string of the current target address bytes |
| 76 | */ |
| 77 | std::string get_CurrBytes() const; |
| 78 | |
| 79 | /** |
| 80 | * @brief Returns hex string of the original bytes |
| 81 | */ |
| 82 | std::string get_OrigBytes() const; |
| 83 | |
| 84 | /** |
| 85 | * @brief Returns hex string of the patch bytes |
| 86 | */ |
| 87 | std::string get_PatchBytes() const; |
no outgoing calls
no test coverage detected