Пример #1
0
        public void InitMemorySectionList(ProcessInfo pi)
        {
            mapped_section_list.Clear();
            TotalMemorySize = 0;

            for (Int32 i = 0; i < pi.entries.Length; i++)
            {
                MemoryEntry entry = pi.entries[i];
                if ((entry.prot & 0x1) == 0x1)
                {
                    UInt64 length        = entry.end - entry.start;
                    UInt64 start         = entry.start;
                    String name          = entry.name;
                    Int32  idx           = 0;
                    UInt64 buffer_length = 1024 * 1024 * 128;

                    //Executable section
                    if ((entry.prot & 0x5) == 0x5)
                    {
                        buffer_length = length;
                    }

                    while (length != 0)
                    {
                        UInt64 cur_length = buffer_length;

                        if (cur_length > length)
                        {
                            cur_length = length;
                            length     = 0;
                        }
                        else
                        {
                            length -= cur_length;
                        }

                        MappedSection mappedSection = new MappedSection();
                        mappedSection.Start  = start;
                        mappedSection.Length = (Int32)cur_length;
                        mappedSection.Name   = entry.name + "[" + idx + "]";
                        mappedSection.Check  = false;
                        mappedSection.Prot   = entry.prot;

                        mapped_section_list.Add(mappedSection);

                        start += cur_length;
                        ++idx;
                    }
                }
            }
        }
Пример #2
0
        public String GetSectionName(Int32 section_idx)
        {
            if (section_idx < 0)
            {
                return("sectioni wrong!");
            }
            MappedSection sectionInfo = mapped_section_list[section_idx];

            StringBuilder section_name = new StringBuilder();

            section_name.Append(sectionInfo.Name + "-");
            section_name.Append(String.Format("{0:X}", sectionInfo.Prot) + "-");
            section_name.Append(String.Format("{0:X}", sectionInfo.Start) + "-");
            section_name.Append((sectionInfo.Length / 1024).ToString() + "KB");

            return(section_name.ToString());
        }