Overview
Thesyscall::Manager template class is the primary interface for managing syscall stubs in the syscalls-cpp library. It coordinates syscall parsing, stub generation, and memory allocation through customizable policy-based template parameters.
Template Declaration
Template Parameters
Memory allocation policy that determines how syscall stubs are allocated. Must satisfy
IsIAllocationPolicy concept.Requirements:static bool allocate(size_t, const std::span<const uint8_t>, void*&, HANDLE&);static void release(void*, HANDLE);
syscall::policies::allocator::section- Section-based allocationsyscall::policies::allocator::heap- Heap-based allocation
Stub generation policy that determines how syscall stubs are created. Must satisfy
IsStubGenerationPolicy concept.Requirements:static constexpr bool bRequiresGadget;static constexpr size_t getStubSize();static void generate(uint8_t*, uint32_t, void*);
syscall::policies::generator::direct- Direct syscall executionsyscall::policies::generator::gadget- Gadget-based syscall executionsyscall::policies::generator::exception- Exception-based syscall execution
Parser chain or individual parser policies for extracting syscall numbers from modules. Defaults to
DefaultParserChain if not specified.Built-in parsers:syscall::policies::parser::directory- Export directory parsingsyscall::policies::parser::signature- Signature-based parsing
syscall::ParserChain_t<Parser1, Parser2, ...>- Chain multiple parsers with fallback
Type Aliases
The library provides convenient type aliases for common Manager configurations:SyscallSectionDirect
SyscallSectionGadget
SyscallHeapGadget
Member Functions
initialize()
Initialize the manager and parse syscalls from specified modules
invoke()
Invoke a syscall by name with type-safe arguments
Constructor and Destructor
Default Constructor
initialize() before invoking syscalls.
Destructor
- Removes vectored exception handler (if using exception policy)
- Releases allocated syscall memory region
- Releases associated object handles
Move Semantics
The Manager supports move construction and move assignment:Thread Safety
The Manager uses internal mutex locking to ensure thread-safe initialization. Multiple threads can safely callinitialize() concurrently, and only one initialization will occur. Once initialized, invoke() can be called from multiple threads without additional synchronization.
Example Usage
See Also
- Manager Initialization - Details on the
initialize()method - Manager Invocation - Details on the
invoke()method - Policies - Built-in allocation, stub generation, and parser policies