Skip to content
Brian Gianforcaro edited this page Mar 6, 2021 · 6 revisions

Building The Samples

To build the sample applications, type nmake in the samples directory. Note that you must build the setdll and syslog samples in order to use many of the other sample programs.

Each of the sample directories has a test, which can be invoked by typing nmake test, to demonstrate the usage of the sample. With very few exceptions, all of the .exe programs also accept a /? command to display a usage message.

The trace samples log their output through the syelogd.exe daemon and hook CreateProcessW to load themselves into any child processes. For example, typing withdll -d:traceapi.dll cmd.exe will create a command shell under which all processes log their API calls through traceapi.dll.

Detours includes the following samples:

NameDescription
CommemDemonstrates how to detour a member function of a COM interface.
CpingDetours multiple functions in the DCOM/RPC stack to measure the overhead of sending DCOM messages.
DisasTests the Detours disassembler tables.
DtestDetours the Win32 Sleep function and a private function.
DumpeDumps the list of all functions exported from a binary.
DumpiDumps the list of all functions imported by a binary.
dynamic_allocDetours to a code that is crafted on a dynamically allocated region
EinstFind payloads compiled into binary files.
ExcepUses a first-chance exception filter to toggle VM permissions on a page.
FindFuncDetours a function using DetourFindFunction to find the function using debug symbols.
ImpmungeModifies all of the entries in a binary's imports table.
MemberDemonstrates how to detour a class member function.
PayloadDemonstrates various ways to use payloads to communicate information at runtime.
RegionDemonstrates how to change the region of memory off limits for trampolines.
SetdllAdds a DLL to the import table of any binary (a .DLL or .EXE for example)
SimpleModifies the Sleep API to record the number of ticks spent sleeping.
SleptMore elaborate version of the Simple sample.
SyelogSystem event logging library and service.
TraceapiWin32 API tracing sample. Detours and prints tracing statements for 1401 Win32 API functions.
TracebldTraces the file access patterns of a process and all of its children.
TracelnkTraces all calls to the Windows dynamic linking APIs.
TracememTraces all calls to the Windows HeapAlloc API.
TraceregTraces activity through the registry APIs.
TraceserTraces activity through the serial ports (com1 or com2).
TracetcpTraces activity through WinSock TCP APIs.
TrymanDemonstration of using helper processes to hook both 32-bit and 64-bit target processes.
WithdllDemonstrates how to load a detour DLL into a new process without modifying the target application.

Clone this wiki locally