{"id":20465657,"url":"https://github.com/samueltulach/lighthook","last_synced_at":"2025-04-09T07:05:40.670Z","repository":{"id":58508309,"uuid":"531136955","full_name":"SamuelTulach/LightHook","owner":"SamuelTulach","description":"Single-header, minimalistic, cross-platform hook library written in pure C","archived":false,"fork":false,"pushed_at":"2024-09-28T13:03:37.000Z","size":721,"stargazers_count":322,"open_issues_count":2,"forks_count":48,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-02T05:01:57.926Z","etag":null,"topics":["efi","hook","hook-library","kernelmode","linux","single-header-library","usermode","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SamuelTulach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-08-31T15:07:48.000Z","updated_at":"2025-04-02T00:18:24.000Z","dependencies_parsed_at":"2024-02-06T17:29:57.449Z","dependency_job_id":"f5b454aa-e163-4866-ae8c-482592b4eaf7","html_url":"https://github.com/SamuelTulach/LightHook","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelTulach%2FLightHook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelTulach%2FLightHook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelTulach%2FLightHook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelTulach%2FLightHook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SamuelTulach","download_url":"https://codeload.github.com/SamuelTulach/LightHook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994119,"owners_count":21030050,"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":["efi","hook","hook-library","kernelmode","linux","single-header-library","usermode","windows"],"created_at":"2024-11-15T13:19:23.552Z","updated_at":"2025-04-09T07:05:40.646Z","avatar_url":"https://github.com/SamuelTulach.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](Assets/logo_small.png)\n\nSingle-header, minimalistic, cross-platform hook library written in pure C for x86-64 based systems.\n\n## But... why?\nWhile other well-written libraries that do exactly the same already exist, I wanted to have something simple that would not use an entire disassembler engine which can sometimes be painful to include in a project. \n\n**Pros of this library:**\n- Written in pure C\n- No dependencies (no full disassembler engine)\n- Single header\n- Works in both kernelmode/usermode\n- Cross-platform (Windows/Linux/EFI)\n- Easily portable (3 functions to allocate/free/protect memory that are platform specific)\n\n**Cons of this library:**\n- Breaks when a function starts with unsupported instructions (ex. AVX)\n- Breaks when a function starts with instructions accessing memory using relative addressing (call/jmp/cmp)\n\n## Showcase\n![linux](Assets/linux_usermode.png)\n![wink](Assets/windows_kernelmode.png)\n![winu](Assets/windows_usermode.png)\n![efi](Assets/efi_application.png)\n\n## Usage\nInclude the [header file](https://github.com/SamuelTulach/LightHook/blob/main/Source/LightHook.h) in your project. Initialise hook structure by calling `CreateHook`. Perform the actual hook by calling `EnableHook` and optionally revert the hook with a call to `DisableHook`.\n\n```\nHookInformation info = CreateHook((void*)\u0026FunctionToHook, (void*)\u0026FunctionToCall);\nint status = EnableHook(\u0026info);\nif (!status)\n    return;\n\n// Call the original function with info.Trampoline\nFunctionToHook(10, 20);\n\nDisableHook(\u0026info)\n```\n\n## License\nThis repository is licensed under MIT if not stated otherwise in subfolders.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamueltulach%2Flighthook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamueltulach%2Flighthook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamueltulach%2Flighthook/lists"}