2

I need to find the correct .dll/.exe from where the function enumerated. For this I am using get_libraryName which to me should return file Name(.dll/.exe) in which the function was originally defined.

But It returns every time NULL(BadPtr=0x00000).. Is there any way out to retrieve the exact file Name from where the function was being defined and used ?

Regards Hassan

4

1 回答 1

2
IDiaSession mSession;
DiaSourceClass mSourceClass;
IDiaSymbol mGlobalScope;
string pdbFileName = @"c:\test.pdb";

mSourceClass = new DiaSourceClass();
mSourceClass.loadDataFromPdb(pdbFileName);
mSourceClass.openSession(out mSession);
mSession.loadAddress = loadAddress; 
mGlobalScope = mSession.globalScope;

IDiaEnumSymbols methodSymbols;
mGlobalScope.findChildren(SymTagEnum.SymTagFunction, null, 0, out methodSymbols);
foreach (IDiaSymbol methodSymbol in methodSymbols)
{
     string projectName = functionSymbol.lexicalParent.name;
}

希望这可以帮助 !

于 2011-01-13T11:15:07.767 回答