{"id":19075242,"url":"https://github.com/0xvpr/vpr-deviate","last_synced_at":"2025-07-17T18:07:53.367Z","repository":{"id":230338651,"uuid":"779043895","full_name":"0xvpr/vpr-deviate","owner":"0xvpr","description":"C99/C++20 Header only library for dependency free function hooking in windows.","archived":false,"fork":false,"pushed_at":"2024-04-11T01:06:47.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T17:50:05.647Z","etag":null,"topics":["cplusplus","cpp","cpp11","cpp17","cpp20","detour-hook","function-hooking","hacking-tool","header-only","hook","library"],"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/0xvpr.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":"2024-03-28T23:24:23.000Z","updated_at":"2024-10-15T10:18:23.000Z","dependencies_parsed_at":"2024-04-10T09:37:26.549Z","dependency_job_id":"65f9d2bd-618e-4ae2-a21a-0b8432894601","html_url":"https://github.com/0xvpr/vpr-deviate","commit_stats":null,"previous_names":["0xvpr/vpr-deviate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xvpr%2Fvpr-deviate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xvpr%2Fvpr-deviate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xvpr%2Fvpr-deviate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xvpr%2Fvpr-deviate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xvpr","download_url":"https://codeload.github.com/0xvpr/vpr-deviate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240127086,"owners_count":19751938,"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":["cplusplus","cpp","cpp11","cpp17","cpp20","detour-hook","function-hooking","hacking-tool","header-only","hook","library"],"created_at":"2024-11-09T01:54:06.865Z","updated_at":"2025-07-17T18:07:53.354Z","avatar_url":"https://github.com/0xvpr.png","language":"C++","readme":"\u003ch1 align=\"center\"\u003evpr-deviate\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Windows--C--x86-supported-green\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Windows--C--x86__64-supported-green\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Windows--C++--x86-supported-green\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Windows--C++--x86__64-supported-green\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/MinGW-supported-green\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/clang-supported-green\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/MSVC-unsupported-red\"\u003e\n  \u003ca href=\"https://mit-license.org/\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/0xvpr/vpr-deviate?style=flat-square\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\nA Function hooking/detouring header-only library for Windows (MinGW)\n\n## Table of Contents\n- [Example Usage](#example-usage)\n- [Integration](#integration)\n- [Compilation](#compilation)\n\n### Example Usage\nC++\n```cpp\n#include \u003cvpr/deviate.hpp\u003e\n#include \u003cstdio.h\u003e\n\nvoid target(int x) {\n    fprintf(stdout, \"%d\\n\", x);\n}\n\nint main() {\n    unsigned char original_bytes[_rel_jmp_size_];\n\n    target(5); // 5 - original\n    vpr::deviate::detour( target,\n                          [](int x) { return x*x; },\n                          original_bytes,\n                          sizeof(original_bytes) );\n    target(5); // 25 - detoured\n```\nC\n```c\n#include \u003cvpr/deviate.h\u003e\n#include \u003cstdio.h\u003e\n\nvoid target(int x) {\n    fprintf(stdout, \"%d\\n\", x);\n}\n\nvoid func(int x) {\n    fprintf(stdout, \"%d\\n\", x*x);\n}\n\nint main() {\n    target(5); // 5 - original\n    vpr_deviate_detour((void *)target, (void *)func, nullptr, 0);\n    target(5); // 25 - detoured\n\n    return 0;\n}\n```\n\n## Integration\n### System-wide installation using CMake\n```bash                                                        \ngit clone https://github.com/0xvpr/vpr-deviate.git         \ncd vpr-deviate                                             \ncmake -DCMAKE_INSTALL_PREFIX=/your/desired/path/ -B build      \ncmake --install build                                          \n```                                                            \n                                                               \n### Local installation (fetch directly from github)            \n```cmake                                                       \n#set( CMAKE_C_STANDARD   99 ) # at least c99 if using c        \n#set( CMAKE_CXX_STANDARD 17 ) # at least c++17 if using cpp    \n                                                               \ninclude(FetchContent)                                          \nFetchContent_Declare(                                          \n  vpr-deviate                                              \n  GIT_REPOSITORY https://github.com/0xvpr/vpr-deviate.git  \n  GIT_TAG main  # Or use a specific version tag like \"v1.0.0\"  \n)                                                              \nFetchContent_MakeAvailable(vpr-deviate)                    \n\nadd_executable(app main.cpp)\ntarget_link_libraries(app PRIVATE vpr-deviate::deviate)\n```\n\n### Compilation\nUse GCC or Clang. MSVC won't accept the inline assembly for x64 (will for x86 but it's not supported by the library).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xvpr%2Fvpr-deviate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xvpr%2Fvpr-deviate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xvpr%2Fvpr-deviate/lists"}