{"id":18006908,"url":"https://github.com/wbenny/detoursnt","last_synced_at":"2025-04-05T01:03:39.740Z","repository":{"id":38375546,"uuid":"145229221","full_name":"wbenny/DetoursNT","owner":"wbenny","description":"Detours with just single dependency - NTDLL","archived":false,"fork":false,"pushed_at":"2022-08-24T14:00:27.000Z","size":229,"stargazers_count":620,"open_issues_count":1,"forks_count":122,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-03-29T00:04:31.443Z","etag":null,"topics":["detours","hooking","ntdll","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/wbenny.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}},"created_at":"2018-08-18T15:01:57.000Z","updated_at":"2025-03-25T09:28:48.000Z","dependencies_parsed_at":"2022-08-09T07:35:18.113Z","dependency_job_id":null,"html_url":"https://github.com/wbenny/DetoursNT","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wbenny%2FDetoursNT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wbenny%2FDetoursNT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wbenny%2FDetoursNT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wbenny%2FDetoursNT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wbenny","download_url":"https://codeload.github.com/wbenny/DetoursNT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247271515,"owners_count":20911587,"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":["detours","hooking","ntdll","windows"],"created_at":"2024-10-30T01:11:05.135Z","updated_at":"2025-04-05T01:03:39.724Z","avatar_url":"https://github.com/wbenny.png","language":"C++","readme":"# DetoursNT\n\nDetoursNT is a simple project with one goal - make Detours dependent only on `NTDLL.DLL` without any modifications of\nthe original code.\n\n### Why?\n\n- Because this way you can hook native processes.\n- Because this way you can load your hooking library **right after** load of `NTDLL.DLL`\n  - This can be achieved in many ways - for example using Windows Driver via so-called APC injection.\n    You can look at my project [injdrv][injdrv] to get an idea about how is this done.\n\n### How?\n\nThis repository has attached original git repository of Detours from Microsoft as a submodule.\nTherefore, the original code hasn't been touched in any way.\n\nNTDLL-only dependency been achieved by creating a C header file [DetoursNT.h](DetoursNT/DetoursNT.h) which has\nbeen force-included (`/FI` switch of MSVC) into every compilation unit of Detours. This header\nmocks functions of `KERNEL32.DLL` to custom implementation defined in [DetoursNT.cpp](DetoursNT/DetoursNT.cpp).\n\nI'd like to thank authors of following projects:\n- [ReactOS][reactos] - used for implementation of `KERNEL32.DLL` functions\n- [ProcessHacker][processhacker] - used for prototypes of `NTDLL.DLL` functions\n\n### Compilation\n\nBecause original Detours source code is attached as a git submodule, you must not forget to fetch it:\n\n`git clone --recurse-submodules https://github.com/wbenny/DetoursNT`\n\nAfter that, compile **DetoursNT** using Visual Studio 2017. Solution file is included. No other dependencies are required.\n\n### Usage\n\nAfter you hit `F7` in Visual Studio and have everything compiled, you can check that `SampleHookDLL.dll`\nindeed depends only on `NTDLL.DLL`:\n\n![Dependency Walker](Images/depends.png)\n\nThis hooking DLL only hooks `NtTestAlert` function for demonstrative purposes. In this repository there is also\n`Sample` project. It's only purpose is to call `LoadLibrary(TEXT(\"SampleHookDLL.dll\"))`, `NtTestAlert()` and\n`FreeLibrary()` to show you that the hook is working.\n\n![Sample](Images/sample.png)\n\n### Remarks\n\n- This implementation intentionally crashes on SEH exceptions which occur inside of Detours. This is because SEH\n  handlers are usually located in CRT (which is ommited here).\n- Supported architectures are: x86, x64, ARM (32-bit) and ARM64.\n\n\n### License\n\nThis software is open-source under the MIT license. See the LICENSE.txt file in this repository.\n\n[Detours][detours] is licensed under MIT license (a copy of the license is included in separate git submodule)\n\nIf you find this project interesting, you can buy me a coffee\n\n```\n  BTC 3GwZMNGvLCZMi7mjL8K6iyj6qGbhkVMNMF\n  LTC MQn5YC7bZd4KSsaj8snSg4TetmdKDkeCYk\n```\n\n  [detours]: \u003chttps://github.com/Microsoft/Detours\u003e\n  [injdrv]: \u003chttps://github.com/wbenny/injdrv\u003e\n  [reactos]: \u003chttps://www.reactos.org/\u003e\n  [processhacker]: \u003chttps://github.com/processhacker/processhacker/tree/master/phnt/include\u003e\n","funding_links":[],"categories":["\u003ca id=\"89f963773ee87e2af6f9170ee60a7fb2\"\u003e\u003c/a\u003eDLL"],"sub_categories":["\u003ca id=\"4dcfd9135aa5321b7fa65a88155256f9\"\u003e\u003c/a\u003e新添加"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwbenny%2Fdetoursnt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwbenny%2Fdetoursnt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwbenny%2Fdetoursnt/lists"}