In my windows application, I have hooked malloc using MinHook (https://github.com/TsudaKageyu/minhook) and I'm using CaptureStackBacktrace and SymFromAddr to get symbols for memory leaks. SymFromAddr works reliably for addresses within my executable, however when reporting symbol information for addresses that have come from DLLs, the results are frequently incorrect. SymFromAddr does not report an error, it simply returns bad information. The debugger is able to get the correct information, though (I can hover over the address I pass in to SymFrommAddr and Visual Studio correctly reports the module and function name). I thought that perhaps my problem was a bad symbol search path, so I updated my call to SymInitialize to include the MS symbol server and the path to my executable but that did not solve the problem.
Does the Visual Studio debugger use the dbghelp system? Does anyone have any ideas on why the debugger and SymFromAddr do not agree?