Overview
This page documents the core type aliases, structures, and pre-defined Manager type aliases used throughout the syscalls-cpp library.Namespace
Core Type Aliases
SyscallKey_t
- Default:
hashing::Hash_t(uint64_t) - Uses hashed syscall names - With
SYSCALLS_NO_HASH:std::string- Uses plain string names
Structure Definitions
SyscallEntry_t
m_key- Syscall identifier (hash or string depending onSYSCALLS_NO_HASH)m_uSyscallNumber- Windows syscall number for this functionm_uOffset- Offset of the generated stub in the allocated region
ModuleInfo_t
m_pModuleBase- Base address of the module in memorym_pNtHeaders- Pointer to the PE NT headersm_pExportDir- Pointer to the export directory
Policy Type Traits
IsIAllocationPolicy
static bool allocate(size_t, const std::span<const uint8_t>, void*&, HANDLE&)static void release(void*, HANDLE)
IsStubGenerationPolicy
static constexpr bool bRequiresGadgetstatic constexpr size_t getStubSize()static void generate(uint8_t*, uint32_t, void*)
IsSyscallParsingPolicy
static std::vector<SyscallEntry_t> parse(const ModuleInfo_t&)
ParserChain_t
Pre-defined Manager Types
The library provides convenient type aliases for common Manager configurations:SyscallSectionDirect
- Uses
NtCreateSection/NtMapViewOfSectionfor memory allocation - Direct syscall execution without gadgets
- Compatible with both x86 and x64
- Lower overhead than gadget-based approaches
- General purpose syscall execution
- When gadget discovery is not required
- Performance-sensitive scenarios
SyscallSectionGadget (x64 only)
- Uses
NtCreateSection/NtMapViewOfSectionfor memory allocation - Gadget-based syscall execution (finds
syscall; retin ntdll) - Randomized gadget selection for each stub
- x64 only
- Advanced evasion scenarios
- When direct syscalls might be detected
- Call stack spoofing requirements
SyscallHeapGadget (x64 only)
- Uses
RtlCreateHeap/RtlAllocateHeapfor memory allocation - Gadget-based syscall execution
- Stubs stored in private executable heap
- x64 only
- When section-based allocation is monitored
- Alternative memory allocation strategy
- Heap-based code execution scenarios
Default Parser Chain
- First tries
directoryparser (exception directory on x64, export sorting on x86) - Falls back to
signatureparser if directory parsing fails - Handles hooked functions by searching neighboring functions
Usage Examples
Using Pre-defined Types
Custom Manager Configuration
Working with SyscallEntry_t
Type Selection Guide
SyscallSectionDirect
Best for general purpose use. Direct execution with minimal overhead.
SyscallSectionGadget
Best for evasion. Indirect execution through gadgets hides call origin.
SyscallHeapGadget
Best for alternative allocation. Uses heap instead of sections.
Custom Manager
Best for specialized needs. Mix and match policies as needed.
Compile-Time Configuration
SYSCALLS_NO_HASH
When defined, changesSyscallKey_t from hash-based to string-based lookups.
Impact:
- Easier debugging (can see syscall names)
- Larger binary size (stores full strings)
- Less obfuscation (names visible in binary)
- No compile-time seed variation