public PEImageSymbol(IMAGE_SYMBOL symbol, int index)
        {
            this.index              = index;
            this.value              = symbol.Value;
            this.sectionNumber      = symbol.SectionNumber;
            this.type               = symbol.Type;
            this.storageClass       = symbol.StorageClass;
            this.numberOfAuxSymbols = symbol.NumberOfAuxSymbols;

            // TODO: NULL and UNDEFINED symbols are ignored

            // if name[0..3] are all zero, name[4..7] contain offset into symbol table
            if (symbol.ShortName[0] == 0 &&
                symbol.ShortName[1] == 0 &&
                symbol.ShortName[2] == 0 &&
                symbol.ShortName[3] == 0)
            {
                this.offset = BitConverter.ToUInt16(symbol.ShortName, 4);
                this.name   = null;
            }
            else
            {
                ASCIIEncoding encoding = new ASCIIEncoding();
                this.name = encoding.GetString(symbol.ShortName);
            }
        }
Beispiel #2
0
        public PEImageSymbol(IMAGE_SYMBOL symbol, int index)
        {
            this.index = index;
            this.value = symbol.Value;
            this.sectionNumber = symbol.SectionNumber;
            this.type = symbol.Type;
            this.storageClass = symbol.StorageClass;
            this.numberOfAuxSymbols = symbol.NumberOfAuxSymbols;

            // TODO: NULL and UNDEFINED symbols are ignored

            // if name[0..3] are all zero, name[4..7] contain offset into symbol table
            if (symbol.ShortName[0] == 0 &&
                symbol.ShortName[1] == 0 &&
                symbol.ShortName[2] == 0 &&
                symbol.ShortName[3] == 0)
            {
                this.offset = BitConverter.ToUInt16(symbol.ShortName, 4);
                this.name = null;
            }
            else
            {
                ASCIIEncoding encoding = new ASCIIEncoding();
                this.name = encoding.GetString(symbol.ShortName);
            }
        }
Beispiel #3
0
        public PEImageSymbol(IMAGE_SYMBOL symbol, int index)
        {
            this.index              = index;
            this.value              = symbol.Value;
            this.sectionNumber      = symbol.SectionNumber;
            this.type               = symbol.Type;
            this.storageClass       = symbol.StorageClass;
            this.numberOfAuxSymbols = symbol.NumberOfAuxSymbols;

            // TODO: NULL and UNDEFINED symbols are ignored

            // if name[0..3] are all zero, name[4..7] contain offset into symbol table
            if (symbol.Zeros == 0)
            {
                this.Offset = Offset;
                this.Name   = null;
            }
            else
            {
                //was using ASCII encoding
                this.Name = new string(symbol.Name);
            }
        }