Ark Server API 3.54
Serverside plugin support for Ark Survival Evolved.
Loading...
Searching...
No Matches
API::Hooks Class Reference

#include <Hooks.h>

Inheritance diagram for API::Hooks:
ArkApi::IHooks

Classes

struct  Hook
 

Public Member Functions

 Hooks ()
 
 Hooks (const Hooks &)=delete
 
 Hooks (Hooks &&)=delete
 
Hooksoperator= (const Hooks &)=delete
 
Hooksoperator= (Hooks &&)=delete
 
 ~Hooks () override=default
 
bool SetHookInternal (const std::string &func_name, LPVOID detour, LPVOID *original) override
 
bool DisableHook (const std::string &func_name, LPVOID detour) override
 Removes a hook from a function.
 
- Public Member Functions inherited from ArkApi::IHooks
virtual ~IHooks ()=default
 
template<typename T >
bool SetHook (const std::string &func_name, LPVOID detour, T **original)
 Hooks a function. Hooks are called in the reverse order.
 
virtual bool DisableHook (const std::string &func_name, LPVOID detour)=0
 Removes a hook from a function.
 

Private Attributes

std::unordered_map< std::string, std::vector< std::shared_ptr< Hook > > > all_hooks_
 

Detailed Description

Definition at line 10 of file Hooks.h.

Constructor & Destructor Documentation

◆ Hooks() [1/3]

API::Hooks::Hooks ( )

Definition at line 13 of file Hooks.cpp.

◆ Hooks() [2/3]

API::Hooks::Hooks ( const Hooks )
delete

◆ Hooks() [3/3]

API::Hooks::Hooks ( Hooks &&  )
delete

◆ ~Hooks()

API::Hooks::~Hooks ( )
overridedefault

Member Function Documentation

◆ DisableHook()

bool API::Hooks::DisableHook ( const std::string &  func_name,
LPVOID  detour 
)
overridevirtual

Removes a hook from a function.

Parameters
func_nameFunction full name
detourA pointer to the detour function
Returns
true if success, false otherwise

Implements ArkApi::IHooks.

Definition at line 66 of file Hooks.cpp.

References all_hooks_, API::Offsets::Get(), API::Offsets::GetAddress(), Log::GetLog(), and SetHookInternal().

◆ operator=() [1/2]

Hooks & API::Hooks::operator= ( const Hooks )
delete

◆ operator=() [2/2]

Hooks & API::Hooks::operator= ( Hooks &&  )
delete

◆ SetHookInternal()

bool API::Hooks::SetHookInternal ( const std::string &  func_name,
LPVOID  detour,
LPVOID *  original 
)
overridevirtual

Implements ArkApi::IHooks.

Definition at line 18 of file Hooks.cpp.

References all_hooks_, API::Offsets::Get(), API::Offsets::GetAddress(), and Log::GetLog().

Referenced by DisableHook().

Member Data Documentation

◆ all_hooks_

std::unordered_map<std::string, std::vector<std::shared_ptr<Hook> > > API::Hooks::all_hooks_
private

Definition at line 41 of file Hooks.h.

Referenced by DisableHook(), and SetHookInternal().


The documentation for this class was generated from the following files: