Пример #1
0
        public ulong VAToOffset(SectionTableEntry section, ulong va)
        {
            ulong image_base = reader.NTHeaders.OptionalHeader.ImageBase;
            uint rva = Convert.ToUInt32(va - image_base);

            return RVAToOffset(section,rva);
        }
Пример #2
0
        public uint OffsetToRVA(SectionTableEntry section, ulong offset)
        {
            uint rva = Convert.ToUInt32((offset + section.VirtualAddress) - section.PointerToRawData);

            return rva;
        }
Пример #3
0
        public ulong RVAToOffset(SectionTableEntry section, uint rva)
        {
            ulong offset = (rva - section.VirtualAddress) + section.PointerToRawData;

            return offset;
        }
Пример #4
0
        public ulong OffsetToVA(SectionTableEntry section, ulong offset)
        {
            ulong image_base = reader.NTHeaders.OptionalHeader.ImageBase;
            uint rva = Convert.ToUInt32((offset + section.VirtualAddress) - section.PointerToRawData);

            return image_base + rva;
        }
Пример #5
0
        private string[] ShowSectionTable_Characteristics(SectionTableEntry section)
        {
            List<string> results = new List<string>();

            SectionCharacteristicsType chars = section.GetCharacteristics();
            long enum_value = Convert.ToInt64(chars);
            EnumAnnotations<SectionCharacteristicsType> enum_annotations = new EnumAnnotations<SectionCharacteristicsType>();

            foreach (EnumAnnotation<SectionCharacteristicsType> annotation in enum_annotations)
            {
                long value = Convert.ToInt64(annotation.Value);

                if (value == 0)
                    continue;

                bool selected = ((enum_value & value) == value);

                if (!selected)
                    continue;

                string line = String.Format("{0}  {1}", Utils.IntToHex(value, 8), annotation.HeaderName);

                results.Add(line);
            }

            int max_len = 0;

            foreach (var line in results)
            {
                if (line.Length > max_len)
                    max_len = line.Length;
            }

            return results.ToArray();
        }
Пример #6
0
        public ulong OffsetToVA(SectionTableEntry section, long offset)
        {
            if (_nt_headers == null)
                LoadNTHeaders();

            ulong image_base = _nt_headers.OptionalHeader.ImageBase;
            uint rva = Convert.ToUInt32((offset + section.VirtualAddress) - section.PointerToRawData);

            return image_base + rva;
        }
Пример #7
0
        public long VAToOffset(SectionTableEntry section, ulong va)
        {
            if (_nt_headers == null)
                LoadNTHeaders();

            ulong image_base = _nt_headers.OptionalHeader.ImageBase;
            uint rva = Convert.ToUInt32(va - image_base);

            return RVAToOffset(section,rva);
        }