|
SafetyHook
|
An inline hook. More...
#include <inline_hook.hpp>
Classes | |
| struct | Error |
| Error type for InlineHook. More... | |
Public Types | |
| enum | Flags : int { Default = 0 , StartDisabled = 1 << 0 } |
| Flags for InlineHook. More... | |
Public Member Functions | |
| InlineHook (const InlineHook &)=delete | |
| InlineHook (InlineHook &&other) noexcept | |
| InlineHook & | operator= (const InlineHook &)=delete |
| InlineHook & | operator= (InlineHook &&other) noexcept |
| void | reset () |
| Reset the hook. | |
| uint8_t * | target () const |
| Get a pointer to the target. | |
| uintptr_t | target_address () const |
| Get the target address. | |
| uint8_t * | destination () const |
| Get a pointer ot the destination. | |
| uintptr_t | destination_address () const |
| Get the destination address. | |
| const Allocation & | trampoline () const |
| Get the trampoline Allocation. | |
| operator bool () const | |
| Tests if the hook is valid. | |
| template<typename T> | |
| T | original () const |
| Returns the address of the trampoline to call the original function. | |
| const auto & | original_bytes () const |
| Returns a vector containing the original bytes of the target function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | call (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | ccall (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | thiscall (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | stdcall (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | fastcall (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | unsafe_call (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | unsafe_ccall (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | unsafe_thiscall (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | unsafe_stdcall (Args... args) |
| Calls the original function. | |
| template<typename RetT = void, typename... Args> | |
| RetT | unsafe_fastcall (Args... args) |
| Calls the original function. | |
| std::expected< void, Error > | enable () |
| Enable the hook. | |
| std::expected< void, Error > | disable () |
| Disable the hook. | |
| bool | enabled () const |
| Check if the hook is enabled. | |
Static Public Member Functions | |
| static std::expected< InlineHook, Error > | create (void *target, void *destination, Flags flags=Default) |
| Create an inline hook. | |
| template<typename T, typename U> | |
| static std::expected< InlineHook, Error > | create (T target, U destination, Flags flags=Default) |
| Create an inline hook. | |
| static std::expected< InlineHook, Error > | create (const std::shared_ptr< Allocator > &allocator, void *target, void *destination, Flags flags=Default) |
| Create an inline hook with a given Allocator. | |
| template<typename T, typename U> | |
| static std::expected< InlineHook, Error > | create (const std::shared_ptr< Allocator > &allocator, T target, U destination, Flags flags=Default) |
| Create an inline hook with a given Allocator. | |
Friends | |
| class | MidHook |
An inline hook.
| enum safetyhook::InlineHook::Flags : int |
Flags for InlineHook.
| Enumerator | |
|---|---|
| Default | Default flags. |
| StartDisabled | Start the hook disabled. |
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inlinestaticnodiscard |
Create an inline hook with a given Allocator.
| allocator | The allocator to use. |
| target | The address of the function to hook. |
| destination | The destination address. |
| flags | The flags to use. |
|
staticnodiscard |
Create an inline hook with a given Allocator.
| allocator | The allocator to use. |
| target | The address of the function to hook. |
| destination | The destination address. |
| flags | The flags to use. |
|
inlinestaticnodiscard |
Create an inline hook.
| target | The address of the function to hook. |
| destination | The destination address. |
| flags | The flags to use. |
|
staticnodiscard |
Create an inline hook.
| target | The address of the function to hook. |
| destination | The destination address. |
| flags | The flags to use. |
|
inlinenodiscard |
Get a pointer ot the destination.
|
inlinenodiscard |
Get the destination address.
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inlineexplicit |
Tests if the hook is valid.
|
inlinenodiscard |
Returns the address of the trampoline to call the original function.
| T | The type of the function pointer. |
|
inlinenodiscard |
Returns a vector containing the original bytes of the target function.
| void safetyhook::InlineHook::reset | ( | ) |
Reset the hook.
This will restore the original function and remove the hook.
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inlinenodiscard |
Get a pointer to the target.
|
inlinenodiscard |
Get the target address.
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inlinenodiscard |
Get the trampoline Allocation.
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |
|
inline |
Calls the original function.
| RetT | The return type of the function. |
| ...Args | The argument types of the function. |
| ...args | The arguments to pass to the function. |