LSPlant LSPosed Developers
Loading...
Searching...
No Matches
lsplant::v2::InitInfo Struct Reference

Information and configuration that are needed to call Init() More...

#include <lsplant.hpp>

Public Types

using InlineHookFunType = std::function< void *(void *target, void *hooker)>
 Type of inline hook function. In std::function form so that user can use lambda expression with capture list.
target is the target function to be hooked.
hooker is the hooker function to replace the target function.
return is the backup function that points to the previous target function. it should return null if hook fails and nonnull if successes.
 
using InlineUnhookFunType = std::function< bool(void *func)>
 Type of inline unhook function. In std::function form so that user can use lambda expression with capture list.
func is the target function that is previously hooked.
return should indicate the status of unhooking.

 
using ArtSymbolResolver = std::function< void *(std::string_view symbol_name)>
 Type of symbol resolver to libart.so. In std::function form so that user can use lambda expression with capture list.
symbol_name is the symbol name that needs to retrieve.
return is the absolute address in the memory that points to the target symbol. It should be null if the symbol cannot be found.

 
using ArtSymbolPrefixResolver = std::function< void *(std::string_view symbol_prefix)>
 Type of prefix symbol resolver to libart.so. In std::function form so that user can use lambda expression with capture list.
symbol_prefix is the symbol prefix that needs to retrieve.
return is the first absolute address in the memory that points to the target symbol. It should be null if the symbol cannot be found.

 
using MemoryAllocator = std::function< void *(std::span< const uint8_t > data)>
 Type of memory allocator for executable code. In std::function form, but it MUST NOT have a capture list.
data is the executable code data to be allocated and copied.
return is the absolute address in the memory that points to the executable code. It should be null if the allocation fails.
 
using MemoryRecycler = std::function< void(void *memory)>
 Type of memory recycler for executable code. In std::function form, but it MUST NOT have a capture list.
memory is the start address of the memory previously allocated by MemoryAllocator.
 

Data Fields

InlineHookFunType inline_hooker
 The inline hooker function. Must not be null.
 
InlineUnhookFunType inline_unhooker
 The inline unhooker function. Must not be null.
 
ArtSymbolResolver art_symbol_resolver
 The symbol resolver to libart.so. Must not be null.
 
ArtSymbolPrefixResolver art_symbol_prefix_resolver
 The symbol prefix resolver to libart.so. May be null.
 
std::string_view generated_class_name = "LSPHooker_"
 The generated class name. Must not be empty. It contains a field and a method and they could be set by generated_field_name and generated_method_name respectively.
 
std::string_view generated_source_name = "LSP"
 The generated source name. Could be empty.
 
std::string_view generated_field_name = "hooker"
 The generated field name. Must not be empty.
 
std::string_view generated_method_name = "{target}"
 The generated class name. Must not be empty. If {target} is set, it will follows the name of the target.
 
MemoryAllocator executable_memory_allocator
 The memory allocator for executable code. May be null. If provided, it will be used to allocate memory for trampolines.
 
MemoryRecycler executable_memory_recycler
 The memory recycler for executable code. May be null. It must be non-null if executable_memory_allocator is provided.
 

Detailed Description

Information and configuration that are needed to call Init()

Definition at line 16 of file lsplant.hpp.

Member Typedef Documentation

◆ ArtSymbolPrefixResolver

Type of prefix symbol resolver to libart.so. In std::function form so that user can use lambda expression with capture list.
symbol_prefix is the symbol prefix that needs to retrieve.
return is the first absolute address in the memory that points to the target symbol. It should be null if the symbol cannot be found.

Note
It should be able to resolve symbols from both .dynsym and .symtab.

Definition at line 43 of file lsplant.hpp.

◆ ArtSymbolResolver

Type of symbol resolver to libart.so. In std::function form so that user can use lambda expression with capture list.
symbol_name is the symbol name that needs to retrieve.
return is the absolute address in the memory that points to the target symbol. It should be null if the symbol cannot be found.

Note
It should be able to resolve symbols from both .dynsym and .symtab.

Definition at line 35 of file lsplant.hpp.

◆ InlineHookFunType

using lsplant::v2::InitInfo::InlineHookFunType = std::function<void *(void *target, void *hooker)>

Type of inline hook function. In std::function form so that user can use lambda expression with capture list.
target is the target function to be hooked.
hooker is the hooker function to replace the target function.
return is the backup function that points to the previous target function. it should return null if hook fails and nonnull if successes.

Definition at line 23 of file lsplant.hpp.

◆ InlineUnhookFunType

Type of inline unhook function. In std::function form so that user can use lambda expression with capture list.
func is the target function that is previously hooked.
return should indicate the status of unhooking.

Definition at line 28 of file lsplant.hpp.

◆ MemoryAllocator

using lsplant::v2::InitInfo::MemoryAllocator = std::function<void *(std::span<const uint8_t> data)>

Type of memory allocator for executable code. In std::function form, but it MUST NOT have a capture list.
data is the executable code data to be allocated and copied.
return is the absolute address in the memory that points to the executable code. It should be null if the allocation fails.

Definition at line 50 of file lsplant.hpp.

◆ MemoryRecycler

Type of memory recycler for executable code. In std::function form, but it MUST NOT have a capture list.
memory is the start address of the memory previously allocated by MemoryAllocator.

Definition at line 54 of file lsplant.hpp.

Field Documentation

◆ art_symbol_prefix_resolver

ArtSymbolPrefixResolver lsplant::v2::InitInfo::art_symbol_prefix_resolver

The symbol prefix resolver to libart.so. May be null.

Definition at line 64 of file lsplant.hpp.

◆ art_symbol_resolver

ArtSymbolResolver lsplant::v2::InitInfo::art_symbol_resolver

The symbol resolver to libart.so. Must not be null.

Definition at line 61 of file lsplant.hpp.

◆ executable_memory_allocator

MemoryAllocator lsplant::v2::InitInfo::executable_memory_allocator

The memory allocator for executable code. May be null. If provided, it will be used to allocate memory for trampolines.

Definition at line 79 of file lsplant.hpp.

◆ executable_memory_recycler

MemoryRecycler lsplant::v2::InitInfo::executable_memory_recycler

The memory recycler for executable code. May be null. It must be non-null if executable_memory_allocator is provided.

Definition at line 82 of file lsplant.hpp.

◆ generated_class_name

std::string_view lsplant::v2::InitInfo::generated_class_name = "LSPHooker_"

The generated class name. Must not be empty. It contains a field and a method and they could be set by generated_field_name and generated_method_name respectively.

Definition at line 68 of file lsplant.hpp.

◆ generated_field_name

std::string_view lsplant::v2::InitInfo::generated_field_name = "hooker"

The generated field name. Must not be empty.

Definition at line 72 of file lsplant.hpp.

◆ generated_method_name

std::string_view lsplant::v2::InitInfo::generated_method_name = "{target}"

The generated class name. Must not be empty. If {target} is set, it will follows the name of the target.

Definition at line 75 of file lsplant.hpp.

◆ generated_source_name

std::string_view lsplant::v2::InitInfo::generated_source_name = "LSP"

The generated source name. Could be empty.

Definition at line 70 of file lsplant.hpp.

◆ inline_hooker

InlineHookFunType lsplant::v2::InitInfo::inline_hooker

The inline hooker function. Must not be null.

Definition at line 57 of file lsplant.hpp.

◆ inline_unhooker

InlineUnhookFunType lsplant::v2::InitInfo::inline_unhooker

The inline unhooker function. Must not be null.

Definition at line 59 of file lsplant.hpp.


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