Memory module

namespace Memory

Memory module.

Functions

template<typename R, typename ...Args>
inline R Call(uintptr_t address, Args&&... args)
template<typename R, typename C, typename ...Args>
inline R CallMethod(uintptr_t address, C this_, Args&&... args)

Data submodule

namespace Memory

Memory module.

class Data : private vector<ubyte_t>

Public Functions

inline Data()
inline Data(initializer_list<ubyte_t> values)
inline constexpr size_t Size() const noexcept
inline constexpr void Clear() noexcept
inline const Pointer Bytes() noexcept
template<class T>
inline const T &PushObject(const T &value)
template<class T>
inline const T PopObject()
template<class T>
inline const T &ReadObject(const size_t offset)
inline const ubyte_t &operator[](const size_t index) const

Friends

inline friend void Read(const Pointer &ptr, Data &data, const size_t count, const bool vp = true)
inline friend void Write(Pointer &ptr, Data &data, const size_t count, const bool vp = true)
inline friend Data &operator+=(Data &l, const Data &r)

Patch submodule

Warning

doxygenfile: Cannot find file “memory/patch.h

PEFormat submodule

Warning

doxygenfile: Cannot find file “memory/peformat.h

Protection submodule

namespace Memory

Memory module.

class Protection
#include <protection.h>

Object used to change memory virtual protection.

Public Functions

inline Protection(const Pointer &ptr, const size_t &size, const ulong_t &mode = PAGE_EXECUTE_READWRITE)
inline ~Protection()

Protection object destructor.

inline constexpr bool IsEnabled() const noexcept

Check if protection change is enabled.

Return values

bool – Is change enabled?

inline constexpr ulong_t &GetOldMode() noexcept

Gets old mode.

Return values

ulong_t – Old mode

inline constexpr ulong_t &GetMode() noexcept

Gets current mode.

Return values

ulong_t& – Current mode

Private Members

Pointer ptr_
ulong_t mode_

Current mode.

ulong_t oldMode_

Old mode.

size_t size_

Size of memory change.

lbool_t isEnabled_

Is change enabled?

Trampoline submodule

namespace Memory

Memory module.

template<typename T, typename ...Args>
class Trampoline
#include <trampoline.h>

Object used to create a trampoline into procedure memory.

class Detour : private vector<dummy_t>
#include <trampoline.h>

Object used for storing detour pool.

Public Functions

inline Detour(initializer_list<dummy_t> values)
inline constexpr bool Empty() const noexcept
inline const Detour &operator+=(const dummy_t &f)

operator+=

Parameters

f – Function to be added to pool

Return values

Detour& – This object reference

inline const Detour &operator-=(const dummy_t &f)

operator-=

Parameters

f – Function to be removed from pool

Return values

Detour& – This object reference

inline T operator()(Args&&... arg)

Operator used to iterate through pool.

Parameters

arg – Forwarded args

Return values

T – Return value

Public Types

using dummy_t = T (*)(Args&&...)

Public Members

Detour before

Before original call.

Detour replace

Replace original call.

Detour after

After original call.

Public Functions

inline Trampoline(const Pointer &ptr, const size_t maxCalls = -1)
inline ~Trampoline()

Trampoline object destructor.

inline void Enable()

Enabled trampoline hook.

Note

Only useful if trampoline was disabled

inline void Disable()

Disable trampoline hook.

inline T Proxy(Args&&... arg)

Proxy function used to detour original function calls.

Parameters

arg – Fowarded arguments

Return values

T – Original return type

Private Members

Pointer ptr_
size_t maxCalls_

Maximum amount of calls.

size_t callCount_

Current call count.

Patch p_
bool isEnabled_

Is trampoline enabled?