title: An impasse with hooking calls to HeapAlloc for a memory tracking application
body: <p>I am writing a memory tracking application that hooks all the calls to HeapAlloc using IAT patching mechanism. The idea is to capture all the calls to HeapAlloc and get a callstack. </p>
  
  <p>However I am currently facing a problem with getting the callstack using DBGHELP Apis. I found that the dbghelp dll itself is linking to MSVCRT dll and this dependancy results in a recursive call. When I try to get a callstack for any of the calls from the target application, dbghelp internally calls some method from MSVCRT that again calls HeapAlloc. And since I have already patched MSVCRT it results in an infinite loop. </p>
  
  <p>Has anyone faced this problem and solved it ? Is there any way out of this impasse?</p>