1

Is there any way for SymInitialize and SymFromAddr methods to automatically load symbols from a custom symbol store. I'm trying to resolve an address to a readable function name using SymFromAddr(). It seems to work fine if I have symbols for the given module stored locally, however I'd like it to automatically download them from the path given to SymInitialize, just like WinDbg does it. I call SymInitialize like that:

SymInitialize(procHandle, "SRV*c:\\symbols*http://msdl.microsoft.com/download/symbols;http://mycustomstore.com/symbols", TRUE);

SymFromAddr returns error 487 "Attempt to access invalid address." as it can't find the symbol since it has never even attempted to download it.

Is there any way to force download them?

pullo_van
  • 649
  • 6
  • 19
  • 1
    try removing the semicolon and replace it with an asterisk or provide null and set _NT_SYMBOL_PATH with an asterisked string set _NT_SYMBOL_PATH=srv*\\localserver\myshare\mycache*http://www.company.com/manysymbols refer advanced symsrv use in windbg help file – blabb Mar 22 '16 at 18:33

2 Answers2

5

As it turned out dbghelp.dll needs symsrv.dll in order to load symbols. It was struggling to find it, so needed a bit of help. I've used dbghelp logging to help track down the issue https://msdn.microsoft.com/en-us/library/ms680687.aspx

pullo_van
  • 649
  • 6
  • 19
-1

If you want to use a HTTP symbol store, you define it with

.sympath SRV*c:\mysymbols*http://example.com/symbols

To add the Microsoft symbol path, use

.symfix+ c:\microsoftsymbols

Looking at the WinDbg symbol path now gives you:

0:000> .sympath
srv*c:\mysymbols*http://example.com/symbols;SRV*c:\microsoftsymbols*http://msdl.microsoft.com/download/symbols

which tells us that your symbol path was not correct, since it didn't have the second SRV*...* part but just http://.... If you copy/paste the symbol path from your code to WinDbg, it probably wouldn't work as well.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222