SafetyHook
Loading...
Searching...
No Matches
InlineHook::Error Struct Reference

Error type for InlineHook. More...

#include <inline_hook.hpp>

Public Types

enum  : uint8_t {
  BAD_ALLOCATION , FAILED_TO_DECODE_INSTRUCTION , SHORT_JUMP_IN_TRAMPOLINE , IP_RELATIVE_INSTRUCTION_OUT_OF_RANGE ,
  UNSUPPORTED_INSTRUCTION_IN_TRAMPOLINE , FAILED_TO_UNPROTECT , NOT_ENOUGH_SPACE
}
 The type of error. More...
 

Static Public Member Functions

static Error bad_allocation (Allocator::Error err)
 Create a BAD_ALLOCATION error.
 
static Error failed_to_decode_instruction (uint8_t *ip)
 Create a FAILED_TO_DECODE_INSTRUCTION error.
 
static Error short_jump_in_trampoline (uint8_t *ip)
 Create a SHORT_JUMP_IN_TRAMPOLINE error.
 
static Error ip_relative_instruction_out_of_range (uint8_t *ip)
 Create a IP_RELATIVE_INSTRUCTION_OUT_OF_RANGE error.
 
static Error unsupported_instruction_in_trampoline (uint8_t *ip)
 Create a UNSUPPORTED_INSTRUCTION_IN_TRAMPOLINE error.
 
static Error failed_to_unprotect (uint8_t *ip)
 Create a FAILED_TO_UNPROTECT error.
 
static Error not_enough_space (uint8_t *ip)
 Create a NOT_ENOUGH_SPACE error.
 

Public Attributes

enum safetyhook::InlineHook::Error:: { ... }  type
 The type of error.
 
union { 
 
   Allocator::Error   allocator_error 
 Allocator error information.
 
   uint8_t *   ip 
 IP of the problematic instruction.
 
};  
 Extra information about the error.
 

Detailed Description

Error type for InlineHook.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : uint8_t

The type of error.

Enumerator
BAD_ALLOCATION 

An error occurred when allocating memory.

FAILED_TO_DECODE_INSTRUCTION 

Failed to decode an instruction.

SHORT_JUMP_IN_TRAMPOLINE 

The trampoline contains a short jump.

IP_RELATIVE_INSTRUCTION_OUT_OF_RANGE 

An IP-relative instruction is out of range.

UNSUPPORTED_INSTRUCTION_IN_TRAMPOLINE 

An unsupported instruction was found in the trampoline.

FAILED_TO_UNPROTECT 

Failed to unprotect memory.

NOT_ENOUGH_SPACE 

Not enough space to create the hook.

Member Function Documentation

◆ bad_allocation()

static Error safetyhook::InlineHook::Error::bad_allocation ( Allocator::Error err)
inlinestaticnodiscard

Create a BAD_ALLOCATION error.

Parameters
errThe Allocator::Error that failed.
Returns
The new BAD_ALLOCATION error.

◆ failed_to_decode_instruction()

static Error safetyhook::InlineHook::Error::failed_to_decode_instruction ( uint8_t * ip)
inlinestaticnodiscard

Create a FAILED_TO_DECODE_INSTRUCTION error.

Parameters
ipThe IP of the problematic instruction.
Returns
The new FAILED_TO_DECODE_INSTRUCTION error.

◆ failed_to_unprotect()

static Error safetyhook::InlineHook::Error::failed_to_unprotect ( uint8_t * ip)
inlinestaticnodiscard

Create a FAILED_TO_UNPROTECT error.

Parameters
ipThe IP of the problematic instruction.
Returns
The new FAILED_TO_UNPROTECT error.

◆ ip_relative_instruction_out_of_range()

static Error safetyhook::InlineHook::Error::ip_relative_instruction_out_of_range ( uint8_t * ip)
inlinestaticnodiscard

Create a IP_RELATIVE_INSTRUCTION_OUT_OF_RANGE error.

Parameters
ipThe IP of the problematic instruction.
Returns
The new IP_RELATIVE_INSTRUCTION_OUT_OF_RANGE error.

◆ not_enough_space()

static Error safetyhook::InlineHook::Error::not_enough_space ( uint8_t * ip)
inlinestaticnodiscard

Create a NOT_ENOUGH_SPACE error.

Parameters
ipThe IP of the problematic instruction.
Returns
The new NOT_ENOUGH_SPACE error.

◆ short_jump_in_trampoline()

static Error safetyhook::InlineHook::Error::short_jump_in_trampoline ( uint8_t * ip)
inlinestaticnodiscard

Create a SHORT_JUMP_IN_TRAMPOLINE error.

Parameters
ipThe IP of the problematic instruction.
Returns
The new SHORT_JUMP_IN_TRAMPOLINE error.

◆ unsupported_instruction_in_trampoline()

static Error safetyhook::InlineHook::Error::unsupported_instruction_in_trampoline ( uint8_t * ip)
inlinestaticnodiscard

Create a UNSUPPORTED_INSTRUCTION_IN_TRAMPOLINE error.

Parameters
ipThe IP of the problematic instruction.
Returns
The new UNSUPPORTED_INSTRUCTION_IN_TRAMPOLINE error.

The documentation for this struct was generated from the following file: