Biblioteca apenas de cabeçalho que permite gerar instruções diretas do SySCall de maneira otimizada, inline e fácil de usar.
Tudo o que você precisa fazer é copiar sobre os arquivos do cabeçalho e chamar a função de inicialização init_syscalls_list antes de usar as macros INLINE_SYSCALL(function_pointer) e INLINE_SYSCALL_T(function_type) .
// This header contains the initialization function.
// If you already initialized, inline_syscall.hpp contains all you need.
# include " inline_syscall/include/in_memory_init.hpp "
// Needs to be called once at startup before INLINE_SYSCALL is used.
jm::init_syscalls_list ();
// Usage of the main macro INLINE_SYSCALL
void * allocation = nullptr ;
SIZE_T size = 0x1000 ;
NTSTATUS status = INLINE_SYSCALL(NtAllocateVirtualMemory)((HANDLE)- 1 , &allocation, 0 , &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);Como um dos principais objetivos desta biblioteca é ser o mais otimizado possível aqui é a saída de uma compilação otimizada.
mov qword ptr [ rsp + 30h ], 0 ; void* allocation = nullptr
mov qword ptr [ rsp + 28h ], 1000h ; SIZE_T size = 0x1000;
mov eax , dword ptr [ entry ( 07FF683157004h ) ] ; syscall id is loaded
lea rdx , [ rsp + 30h ] ; BaseAddress = &allocation
lea r9 , [ rsp + 28h ] ; RegionSize = &size
mov r10 , 0FFFFFFFFFFFFFFFFh ; ProcessHandle = -1
xor r8d , r8d ; ZeroBits = 0
sub rsp , 40h ; preparing stack
mov qword ptr [ type ], 3000h ; AllocationType = MEM_RESERVE | MEM_COMMIT
mov qword ptr [ protect ], 4 ; Protect = PAGE_READWRITE
syscall ; syscall instruction itself
add rsp , 40h ; restoring stack Esta biblioteca permite que você crie suas próprias rotinas de inicialização personalizada que são mais resilantes contra os syscalls ausentes ou adquirem IDs Syscall de alguma outra maneira.
JM_INLINE_SYSCALL_ENTRY_TYPE pode ser definido com seu próprio tipo de entrada SYSCALL que precisa ser construtível a partir de um hash. Por padrão, syscall_entry_small é usado, mas syscall_entry_full também é enviado.
Se você deseja usar a macro fornecida INLINE_SYSCALL precisará usar a função jm::hash fornecida.
Para adquirir o início das entradas do syscall, você precisa ligar para jm::syscall_entries() e iterar até que você atinja uma entrada zero.