Beispiel #1
0
 internal DataDirectory(DataDirectoryName name, Section targetSection, uint headerOffset, Structures.IMAGE_DATA_DIRECTORY rawDataDir)
 {
     this._name = name;
     this._headerOffset = headerOffset;
     this._rawDataDir = rawDataDir;
     if (rawDataDir.RVA == 0 || targetSection == null)
     {
         _targetOffset = new Offset(0, 0, 0);
     }
     else
     {
         this._targetOffset = Offset.FromRva(rawDataDir.RVA, targetSection.ParentAssembly);
         this._targetSection = targetSection;
     }
 }
Beispiel #2
0
        internal DataDirectory(DataDirectoryName name, Section[] assemblySections, uint offset, Structures.IMAGE_DATA_DIRECTORY rawDataDir)
        {
            this._rawDataDir = rawDataDir;
            this._name = name;
            if (rawDataDir.RVA == 0)
            {
                _targetOffset = new Offset(0, 0, 0);
            }
            else
            {
                this._headerOffset = offset;

                _targetSection = Section.GetSectionByRva(assemblySections, rawDataDir.RVA);
                if (_targetSection == null)
                    this.TargetOffset = new Offset(0, rawDataDir.RVA, 0);
                else
                    this._targetOffset = Offset.FromRva(rawDataDir.RVA, assemblySections[0].ParentAssembly);
            }
        }
Beispiel #3
0
 public OffsetConverter(LWin32 assembly)
 {
     TargetSection = new Section(assembly, 0, default(Structures.IMAGE_SECTION_HEADER));
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new instance of an offset converter.
 /// </summary>
 /// <param name="targetSection"></param>
 public OffsetConverter(Section targetSection)
 {
     TargetSection = targetSection;
 }
Beispiel #5
0
        private void ReadSections()
        {
            image.Stream.Seek(optionalheaderoffset + fileHeader.SizeOfOptionalHeader, SeekOrigin.Begin);

            for (int i = 0; i < fileHeader.NumberOfSections; i++)
            {
                uint byteoffset = (uint)image.Stream.Position;
                Structures.IMAGE_SECTION_HEADER section = image.ReadStructure<Structures.IMAGE_SECTION_HEADER>();
                Section s = new Section(assembly, byteoffset, section);
                sections.Add(s);
            }
        }
Beispiel #6
0
 public static Section1 s2s(Section sc)
 {
     return new Section1(sc.RVA, sc.VirtualSize, sc.Name, sc.RawOffset, sc.RawSize);
 }