I am new to Microsoft Detours. I have installed it to trace the system calls a process makes. I run the following commands which I got from the web
syelogd.e
Instead of detours (which is free for 32-bit only) or easyhook (which is, khm, a little bit messy code) you may want to check out mhook 2.4 which is very neat code and BSD-licensed. Works on x86 and x64, handles IP-relative code, etc.
There's also a thorough description on how it works at the site.
As for the stack backtrace, you can use CaptureStackBackTrace() from kernel32
, or if you want to get fancy, use StackWalk64() from dbghelp
.