{"id":25950178,"url":"https://github.com/jakobzs/minhook","last_synced_at":"2025-04-09T14:06:28.434Z","repository":{"id":152523781,"uuid":"624064568","full_name":"Jakobzs/minhook","owner":"Jakobzs","description":"A Rust wrapper for the MinHook library","archived":false,"fork":false,"pushed_at":"2025-03-02T18:00:41.000Z","size":33,"stargazers_count":32,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T12:58:27.918Z","etag":null,"topics":["detour","hook","hooking","minhook","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/Jakobzs.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":"2023-04-05T17:08:10.000Z","updated_at":"2025-04-02T06:14:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"f962ea77-6502-4900-95b0-3826611370dc","html_url":"https://github.com/Jakobzs/minhook","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jakobzs%2Fminhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jakobzs%2Fminhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jakobzs%2Fminhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jakobzs%2Fminhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jakobzs","download_url":"https://codeload.github.com/Jakobzs/minhook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054227,"owners_count":21039952,"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":["detour","hook","hooking","minhook","rust"],"created_at":"2025-03-04T12:53:07.495Z","updated_at":"2025-04-09T14:06:28.391Z","avatar_url":"https://github.com/Jakobzs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# minhook\n\n[![Rust](https://github.com/Jakobzs/minhook/actions/workflows/rust.yml/badge.svg)](https://github.com/Jakobzs/minhook/actions/workflows/rust.yml)\n[![Crates.io](https://img.shields.io/crates/v/minhook)](https://crates.io/crates/minhook)\n[![rustdoc](https://img.shields.io/badge/docs-rustdoc-brightgreen)](https://jakobzs.github.io/minhook/minhook)\n\nA Rust wrapper for the [MinHook](https://github.com/TsudaKageyu/minhook) library.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nminhook = \"0.7.1\"\n```\n\n## Example\n\nThis example shows how to create a hook for a function, and also call the original function.\n\n```rust\nuse minhook::{MinHook, MH_STATUS};\n\nfn main() -\u003e Result\u003c(), MH_STATUS\u003e {\n    // Create a hook for the return_0 function, detouring it to return_1\n    let return_0_address = unsafe { MinHook::create_hook(return_0 as _, return_1 as _)? };\n\n    // Enable the hook\n    unsafe { MinHook::enable_all_hooks()? };\n\n    // Call the detoured return_0 function, it should return 1\n    assert_eq!(return_0(), 1);\n\n    // Transmute the original return_0 function address to a function pointer\n    let return_0_original = unsafe { std::mem::transmute::\u003c_, fn() -\u003e i32\u003e(return_0_address) };\n\n    // Call the original return_0 function\n    assert_eq!(return_0_original(), 0);\n\n    Ok(())\n}\n\nfn return_0() -\u003e i32 {\n    0\n}\n\nfn return_1() -\u003e i32 {\n    1\n}\n```\n\n## License\n\nThis project is licensed under the MIT license ([LICENSE](LICENSE) or http://opensource.org/licenses/MIT).\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakobzs%2Fminhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakobzs%2Fminhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakobzs%2Fminhook/lists"}