示例#1
0
        public TypeInformation GetTypeByName(IntPtr base_address, string name)
        {
            Dictionary <long, SymbolLoadedModule> modules = GetLoadedModules().ToDictionary(m => m.BaseAddress.ToInt64());

            using (var sym_info = AllocateSymInfo())
            {
                if (_sym_get_type_from_name(Handle, base_address.ToInt64(), name, sym_info))
                {
                    var result = sym_info.Result;
                    SymbolLoadedModule loaded_module;
                    if (modules.ContainsKey(base_address.ToInt64()))
                    {
                        loaded_module = modules[base_address.ToInt64()];
                    }
                    else
                    {
                        loaded_module = new SymbolLoadedModule(string.Empty, new IntPtr(result.ModBase), 0, string.Empty, true, this);
                    }
                    TypeInformationCache type_cache = new TypeInformationCache();
                    var ret = CreateType(type_cache, result.Tag, result.ModBase, result.TypeIndex, result.Size, loaded_module, GetNameFromSymbolInfo(sym_info));
                    type_cache.FixupPointerTypes();
                    return(ret);
                }
                else
                {
                    throw new ArgumentException("Invalid type");
                }
            }
        }
示例#2
0
        public IEnumerable <TypeInformation> QueryTypesByName(IntPtr base_address, string mask)
        {
            Dictionary <long, SymbolLoadedModule> modules = GetLoadedModules().ToDictionary(m => m.BaseAddress.ToInt64());
            List <TypeInformation> symbols    = new List <TypeInformation>();
            TypeInformationCache   type_cache = new TypeInformationCache();

            _sym_enum_types_by_name(Handle, base_address.ToInt64(), mask, (s, z, c) => EnumTypes(type_cache, modules, symbols, s), IntPtr.Zero);
            type_cache.FixupPointerTypes();
            return(symbols);
        }
示例#3
0
        public TypeInformation GetTypeForSymbolByAddress(IntPtr address)
        {
            var symbol = GetSymbolInfoForAddress(address);

            if (symbol == null)
            {
                return(null);
            }

            TypeInformationCache type_cache = new TypeInformationCache();
            var ret = CreateType(type_cache, symbol.Tag, symbol.Module.BaseAddress.ToInt64(), symbol.TypeIndex, symbol.Size, symbol.Module, symbol.Name, symbol.Address);

            type_cache.FixupPointerTypes();
            return(ret);
        }