ReadAsciiString() public method

public ReadAsciiString ( ulong fileOffset ) : string
fileOffset ulong
return string
Example #1
0
        public override void Render(ImageMapSegment segment, Program program, Formatter formatter)
        {
            // Get the entry that has the segment# for the string table.
            var dynStrtab = loader.GetDynEntries(shdr.sh_offset).Where(d => d.d_tag == DT_STRTAB).FirstOrDefault();

            if (dynStrtab == null)
            {
                return;
            }
            var strtabSection = loader.GetSectionInfoByAddr(dynStrtab.d_ptr);

            foreach (var entry in loader.GetDynEntries(shdr.sh_offset))
            {
                switch (entry.d_tag)
                {
                default:
                    formatter.Write("{0,-12} {1:X8}", entry.d_tag, entry.d_val);
                    break;

                case DT_DEBUG:
                    formatter.Write("{0,-12} {1:X8}", "DT_DEBUG", entry.d_val);
                    break;

                case DT_FINI:
                    formatter.Write("{0,-12} ", "DT_FINI");
                    formatter.WriteHyperlink(string.Format("{0:X8}", entry.d_ptr), Address.Ptr32(entry.d_ptr));
                    break;

                case DT_HASH:
                    formatter.Write("{0,-12} ", "DT_HASH");
                    formatter.WriteHyperlink(string.Format("{0:X8}", entry.d_ptr), Address.Ptr32(entry.d_ptr));
                    break;

                case DT_INIT:
                    formatter.Write("{0,-12} ", "DT_INIT");
                    formatter.WriteHyperlink(string.Format("{0:X8}", entry.d_ptr), Address.Ptr32(entry.d_ptr));
                    break;

                case DT_JMPREL:
                    formatter.Write("{0,-12} ", "DT_JMPREL");
                    formatter.WriteHyperlink(string.Format("{0:X8}", entry.d_ptr), Address.Ptr32(entry.d_ptr));
                    break;

                case DT_NEEDED:
                    formatter.Write("{0,-12} {1}", "DT_NEEDED", loader.ReadAsciiString(loader.RawImage, strtabSection.sh_offset + entry.d_ptr));
                    break;

                case DT_STRSZ:
                    formatter.Write("{0,-12} {1:X}", "DT_STRSZ", entry.d_val);
                    break;

                case DT_STRTAB:
                    formatter.Write("{0,-12} ", "DT_STRTAB");
                    formatter.WriteHyperlink(string.Format("{0:X8}", entry.d_ptr), Address.Ptr32(entry.d_ptr));
                    break;

                case DT_SYMENT:
                    formatter.Write("{0,-12} {1}", "DT_SYMENTTRTAB", entry.d_val);
                    break;

                case DT_SYMTAB:
                    formatter.Write("{0,-12} ", "DT_SYMTAB");
                    formatter.WriteHyperlink(string.Format("{0:X8}", entry.d_ptr), Address.Ptr32(entry.d_ptr));
                    break;
                }
                formatter.WriteLine();
            }
        }