public static extern bool SymGetScope(IntPtr hProcess, ulong BaseOfDll, uint Index, ref SYMBOL_INFO Symbol);
public static extern bool SymGetTypeFromName(IntPtr hProcess, ulong BaseOfDll, string Name, ref SYMBOL_INFO Symbol);
public static extern bool SymFromName(IntPtr hProcess, string Name, ref SYMBOL_INFO Symbol);
public static extern bool SymFromAddr(IntPtr hProcess, ulong Address, IntPtr DisplacementUnused, ref SYMBOL_INFO Symbol);
Variable MakeVarFromSym(SYMBOL_INFO symInfo) { Variable v = new Variable(); v.Local = (symInfo.Flags & SymInfoFlags.SYMFLAG_LOCAL) != SymInfoFlags.SYMFLAG_NONE; v.Parameter = (symInfo.Flags & SymInfoFlags.SYMFLAG_PARAMETER) != SymInfoFlags.SYMFLAG_NONE; v.Regval = (symInfo.Flags & SymInfoFlags.SYMFLAG_REGISTER) != SymInfoFlags.SYMFLAG_NONE; v.Regrel = (symInfo.Flags & SymInfoFlags.SYMFLAG_REGREL) != SymInfoFlags.SYMFLAG_NONE; v.Reg = (Variable.Register)symInfo.Register; v.Offset = (int)symInfo.Address; v.Size = (int)symInfo.Size; v.Name = symInfo.Name; return v; }
bool EnumLocals(ref SYMBOL_INFO symInfo, uint symSize, IntPtr contextZero) { Variable var = MakeVarFromSym(symInfo); if (var != null) mVariables.Add(var); return true; }
public Variable GetNamedVar(string name, ulong addr) { SYMBOL_INFO symInfo = new SYMBOL_INFO(); symInfo.Initialize(); if (DbgHelp.SymFromName(hProcess, name, ref symInfo)) return MakeVarFromSym(symInfo); else return null; }