I'm trying to use dbghelp in order to find the address of a class method. For example, a DirectX method (DXGI): dxgi!CDXGIFactory::CreateSwapChainImpl
I've the correct symbols and _NT_SYMBOLS_PATH is defined. Using WinDBG, the following 'x' command is working fine:
0:000> x dxgi!CDXGIFactory::CreateSwapChain
6acb78ce dxgi!CDXGIFactory::CreateSwapChain (<no parameter info>)
6acdaf69 dxgi!CDXGIFactory::CreateSwapChain (<no parameter info>)
However, trying to use this string with SymFromName, I'm getting an error 1168 (Element not found):
result = SymFromName( hprocess, L"dxgi!CDXGIFactory::CreateSwapChain", &symbol )
// result is false, GetLastError is 1168
Does it fail because of the '::', or because there are two addresses for the same symbol (how do I work around?).
It is definitely the SYMOPT_EXACT_SYMBOL setting which is causing the 1168 error to be thrown. Otherwise having multiple symbols or '::' is fine, and the API can return a valid address.
One work-around would be to use mangled names:
And for future reference, WinDbg uses the IDebugSymbols::StartSymbolMatch API to lookup multiple symbols.