apotocki/detours
Microsoft Detours, the library for intercepting and instrumenting Win32 API calls.
- Library
- detours
- Newest
- 4.0.1.20260929 (r1, windows)
- Targets
- windows
- License
- MIT
- Homepage
- https://github.com/microsoft/Detours
- Documentation
- https://github.com/microsoft/Detours/wiki
- Keywords
- hooking, instrumentation, interception, windows
Use it
In otok.toml:
[deps.detours]
recipe = "apotocki/detours"
version = "~> 4.0.1.20260929"
Versions
| Version | Target | Channel | Published | Status |
|---|---|---|---|---|
| 4.0.1.20260929 (r1, windows) | windows | stable | 2026-11-13 |
4.0.1.20260929 (r1, windows)
Platforms
windows
Toolchains
cmake { default-recipe = "apotocki/cmake", version = ">= 3.20" }ninja { default-recipe = "apotocki/ninja", version = ">= 1.10" }
Recipe files
CMakeLists.txt
# The detours library of the otok recipe: the objects of Detours' src/Makefile (OBJS), static. The disassemblers of
# the other architectures (disol*.cpp) are compiled as the Makefile compiles them, for DetourCopyInstruction's offline
# use. DETOUR_DEBUG is not defined: a debug build of the Makefile traces to the standard output of the process.
cmake_minimum_required(VERSION 3.20)
project(detours VERSION 4.0.1 LANGUAGES CXX)
add_library(detours STATIC
src/detours.cpp src/modules.cpp src/disasm.cpp src/image.cpp src/creatwth.cpp
src/disolx86.cpp src/disolx64.cpp src/disolia64.cpp src/disolarm.cpp src/disolarm64.cpp)
# as the Makefile defines them
target_compile_definitions(detours PRIVATE WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x501)
install(TARGETS detours ARCHIVE DESTINATION lib)
install(FILES src/detours.h src/detver.h DESTINATION include/detours)
build.lua
-- The detours library through the recipe's CMakeLists.txt, which compiles what src/Makefile puts into detours.lib.
function build(slice, options, deps)
otok.copy(slice.recipe .. "/CMakeLists.txt", slice.source .. "/CMakeLists.txt")
otok.cmake{}
local p = slice.prefix
return { libraries = { detours = p .. "/lib/detours.lib" }, headers = p .. "/include" }
end
recipe.toml
# The otok recipe of Microsoft Detours (https://github.com/apotocki/otok): the detours library for Windows, from a commit
# of Detours' main (its last release, 4.0.1, is of 2018; the version is 4.0.1 and the date of the commit), with a
# CMakeLists.txt of the recipe in place of Detours' nmake Makefile, with MSVC or with clang-cl across from Linux; static
# only, as Detours builds it. The headers are in include/detours/, as vcpkg lays them out.
[recipe]
api = 1
library = "detours"
name = "detours"
version = "4.0.1.20260929"
revision = 1
license = "MIT"
license-files = ["LICENSE"]
homepage = "https://github.com/microsoft/Detours"
documentation = "https://github.com/microsoft/Detours/wiki"
description = "Microsoft Detours, the library for intercepting and instrumenting Win32 API calls."
keywords = ["hooking", "instrumentation", "interception", "windows"]
linkage = ["static"]
[source]
git = "https://github.com/microsoft/Detours"
commit = "1dbd4ea281d73d478aa8d09a8b83fbd265f715f7"
[platforms]
supported = ["windows"]
build-on = ["windows/msvc", "linux/clang-cl"]
[toolchains]
cmake = { version = ">= 3.20", default-recipe = "apotocki/cmake" }
ninja = { version = ">= 1.10", default-recipe = "apotocki/ninja" }
[[product]]
name = "Detours"
libraries = ["detours"]