SafetyHook
|
Allocates memory near target addresses. More...
#include <allocator.hpp>
Public Types | |
enum class | Error : uint8_t { BAD_VIRTUAL_ALLOC , NO_MEMORY_IN_RANGE } |
The error type returned by the allocate functions. More... |
Public Member Functions | |
Allocator (const Allocator &)=delete | |
Allocator (Allocator &&) noexcept=delete | |
Allocator & | operator= (const Allocator &)=delete |
Allocator & | operator= (Allocator &&) noexcept=delete |
std::expected< Allocation, Error > | allocate (size_t size) |
Allocates memory. | |
std::expected< Allocation, Error > | allocate_near (const std::vector< uint8_t * > &desired_addresses, size_t size, size_t max_distance=0x7FFF 'FFFF) |
Allocates memory near a target address. |
Static Public Member Functions | |
static std::shared_ptr< Allocator > | global () |
Returns the global Allocator. | |
static std::shared_ptr< Allocator > | create () |
Creates a new Allocator. |
Protected Member Functions | |
void | free (uint8_t *address, size_t size) |
Protected Attributes | |
friend | Allocation |
Allocates memory near target addresses.
|
strong |
|
nodiscard |
Allocates memory.
size | The size of the allocation. |
|
nodiscard |
Allocates memory near a target address.
desired_addresses | The target address. |
size | The size of the allocation. |
max_distance | The maximum distance from the target address. |
|
staticnodiscard |
|
staticnodiscard |