Detours is a software package for re-routing Win32 APIs underneath applications. For almost twenty years, has been licensed by hundreds of ISVs and used by nearly every product team at Microsoft.
Detours 4.0.1 is now open source under the MIT license. Detours is on GitHub at https://github.com/Microsoft/Detours (opens in new tab). The source code is identical to Build 343 of Detours 3.0. Detours Build 338 and later fix a security vulnerability that has been identified in releases of Detours before 3.0 Build 334.
Detours 4.0.1 supports x86, x64 and other Windows-compatible processors (IA64 and ARM). It includes support for either 32-bit or 64-bit processes.
Detours 4.0 simplifies the licensing of Detours. Detours 3.0 was available in two versions. Detours Professional allowed commercial use. Detours Express allowed research, non-commercial, and non-production use. The two versions were identical except for their licenses.
Detours 3.0 included the following new features over Detours 2.x:
- Support for 64-bit code on x64 and IA64 processors (Professional Edition only).
- Support for all Windows processors (Professional Edition only).
- Removed requirement for including detoured.dll in processes.
- Compatibility improvements for detouring APIs used by managed-code (MSIL) programs, especially on x64 processors.
- Addition of APIs to enumerate PE binary Imports and to determine the module referenced by a function pointer.
Innovative systems research hinges on the ability to easily instrument and extend existing operating system and application functionality. With access to appropriate source code, it is often trivial to insert new instrumentation or extensions by rebuilding the OS or application. However, in today’s world systems researchers seldom have access to all relevant source code.
Detours is a library for instrumenting arbitrary Win32 functions Windows-compatible processors. Detours intercepts Win32 functions by re-writing the in-memory code for target functions. The Detours package also contains utilities to attach arbitrary DLLs and data segments (called payloads) to any Win32 binary.
Detours preserves the un-instrumented target function (callable through a trampoline) as a subroutine for use by the instrumentation. Our trampoline design enables a large class of innovative extensions to existing binary software.
We have used Detours to create an automatic distributed partitioning system, to instrument and analyze the DCOM protocol stack, and to create a thunking layer for a COM-based OS API. Detours is used widely within Microsoft and within the industry.