Beispiel #1
0
        public Symbol(IMAGE_SYMBOL symbol, IMAGE_SYMBOL[] auxSymbols, Dictionary<long, string> stringTable)
        {
            _symbol = symbol;
            _auxSymbols = auxSymbols;

            if (symbol.UsesStringTable)
            {
                string name;
                if (stringTable.TryGetValue(symbol.StringTableOffset, out name))
                {
                    _name = name;
                }
                else
                {
                    _name = "Unavailable";
                }
            }
            else
            {
                _name = symbol.Name;
            }

            _nameDemangled = Demangler.Demangle(_name);
            string ns = Demangler.GetNamespace(_name);
            if (!string.IsNullOrEmpty(ns))
            {
                _namespace = namespaceSplit.Split(ns);
                //_namespace = ns.Split(new string[] { "::" }, StringSplitOptions.None);
                _namespace = _namespace.Take(_namespace.Length - 1).ToArray();
            }
            else
            {
                _namespace = new string[] { };
            }
        }
        private void AddSymbols()
        {
            var stringTable = ObjectFileMember.ObjectFile.StringTable;
            var symbols = ObjectFileMember.ObjectFile.Symbols;

            for (int i = 0; i < symbols.Length; ++i)
            {
                var symbol = symbols[i];
                IMAGE_SYMBOL[] auxSymbols = null;

                if (symbol.NumberOfAuxSymbols > 0)
                {
                    auxSymbols = new IMAGE_SYMBOL[symbol.NumberOfAuxSymbols];
                    for (int a = 0; a < auxSymbols.Length; ++a)
                    {
                        auxSymbols[a] = symbols[i + 1 + a];
                    }
                }

                var model = new Symbol(symbol, auxSymbols, stringTable);
                _symbols.Add(model);

                i += symbol.NumberOfAuxSymbols;
            }
        }