{"id":15047637,"url":"https://github.com/justasmasiulis/inline_syscall","last_synced_at":"2025-04-13T02:20:59.078Z","repository":{"id":37278600,"uuid":"185871220","full_name":"JustasMasiulis/inline_syscall","owner":"JustasMasiulis","description":"Inline syscalls made easy for windows on clang","archived":false,"fork":false,"pushed_at":"2024-06-21T00:26:33.000Z","size":36,"stargazers_count":700,"open_issues_count":1,"forks_count":86,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-04T04:12:32.132Z","etag":null,"topics":["assembly","cpp17","header-only","hooks","inline","library","obfuscation","static-analysis","syscall","syscalls","windows","x64"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JustasMasiulis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-09T21:01:52.000Z","updated_at":"2025-04-01T14:42:55.000Z","dependencies_parsed_at":"2024-12-06T23:15:33.406Z","dependency_job_id":null,"html_url":"https://github.com/JustasMasiulis/inline_syscall","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":0.125,"last_synced_commit":"1fd4a2b12e6f5365a7b43efa20052b153a11dc97"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustasMasiulis%2Finline_syscall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustasMasiulis%2Finline_syscall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustasMasiulis%2Finline_syscall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustasMasiulis%2Finline_syscall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JustasMasiulis","download_url":"https://codeload.github.com/JustasMasiulis/inline_syscall/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654703,"owners_count":21140348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly","cpp17","header-only","hooks","inline","library","obfuscation","static-analysis","syscall","syscalls","windows","x64"],"created_at":"2024-09-24T21:01:58.499Z","updated_at":"2025-04-13T02:20:59.048Z","avatar_url":"https://github.com/JustasMasiulis.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inline_syscall [![](https://img.shields.io/badge/OS-windows-green.svg)]() [![](https://img.shields.io/badge/compiler-clang-green.svg)]() [![](https://img.shields.io/badge/arch-x64-green.svg)]()\nHeader only library that allows you to generate direct syscall instructions in an optimized, inlineable and easy to use manner.\n\n## How to use\nAll you have to do is copy over the header files and call the initialization function `init_syscalls_list` before using the `INLINE_SYSCALL(function_pointer)` and `INLINE_SYSCALL_T(function_type)` macros.\n\n```cpp\n// This header contains the initialization function.\n// If you already initialized, inline_syscall.hpp contains all you need.\n#include \"inline_syscall/include/in_memory_init.hpp\"\n\n// Needs to be called once at startup before INLINE_SYSCALL is used.\njm::init_syscalls_list();\n\n// Usage of the main macro INLINE_SYSCALL\nvoid* allocation = nullptr;\nSIZE_T size      = 0x1000;\nNTSTATUS status  = INLINE_SYSCALL(NtAllocateVirtualMemory)((HANDLE)-1, \u0026allocation, 0, \u0026size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);\n```\n\n## What code does it generate\nAs one of the main goals of this library is to be as optimized as possible here is the output of an optimized build.\n```asm\nmov qword ptr [rsp+30h], 0                  ; void* allocation = nullptr\nmov qword ptr [rsp+28h], 1000h              ; SIZE_T size      = 0x1000;\nmov eax, dword ptr [entry (07FF683157004h)] ; syscall id is loaded\nlea rdx, [rsp+30h]                          ; BaseAddress     = \u0026allocation\nlea r9, [rsp+28h]                           ; RegionSize      = \u0026size\nmov r10, 0FFFFFFFFFFFFFFFFh                 ; ProcessHandle   = -1\nxor r8d,r8d                                 ; ZeroBits        = 0\nsub rsp,40h                                 ; preparing stack\nmov qword ptr [type],3000h                  ; AllocationType  = MEM_RESERVE | MEM_COMMIT\nmov qword ptr [protect], 4                  ; Protect         = PAGE_READWRITE\nsyscall                                     ; syscall instruction itself\nadd rsp,40h                                 ; restoring stack\n```\n\n## FAQ\n* Q: What are the main uses of this? A: Obfuscation and hook avoidance.\n* Q: Why would I use this over some other library? A: The code this generates can be inlined and it is optimized for every single parameter count as much as possible.\n* Q: Why can't this work on MSVC? A: MSVC doesn't support GCC style inline assembly which can be properly optimized and worked on by compiler.\n* Q: Why can't this work on GCC? A: Contrary to MSVC, GCC is too good at optimizing inline assembly and as such breaks my code that tries to be somewhat generic.\n\n## Creating your own initialization function\nThis library enables you to create your own custom initialization routines that are more resilent against missing syscalls or acquire syscall ids in some other way.\n\n`JM_INLINE_SYSCALL_ENTRY_TYPE` can be defined with your own syscall entry type that needs to be constructible from a hash. By default `syscall_entry_small` is used, but `syscall_entry_full` is also shipped.\n\nIf you want to use the provided `INLINE_SYSCALL` macro you will need to use the provided `jm::hash` function.\n\nTo acquire the start of syscall entries you need to call `jm::syscall_entries()` and iterate untill you hit a zero entry.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustasmasiulis%2Finline_syscall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustasmasiulis%2Finline_syscall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustasmasiulis%2Finline_syscall/lists"}