Esempio n. 1
0
        public static BaseRelocationTable Load(PEImage image)
        {
            if (image == null)
            {
                return(null);
            }

            var dd = image.Directories[DataDirectories.BaseRelocationTable];

            if (dd.IsNull)
            {
                return(null);
            }

            var table = new BaseRelocationTable();

            using (var accessor = image.OpenImageToSectionData(dd.RVA))
            {
                long endOffset = accessor.Position + dd.Size;

                while (accessor.Position < endOffset)
                {
                    var block = BaseRelocationBlock.Load(accessor);
                    block._parent = table;
                    table._list.Add(block);

                    // Each block must start on a 32-bit boundary.
                    accessor.Align(4);
                }
            }

            return(table);
        }
Esempio n. 2
0
        public BaseRelocationTable Clone()
        {
            var copy = new BaseRelocationTable();

            CopyTo(copy);

            return(copy);
        }
Esempio n. 3
0
 protected void CopyTo(BaseRelocationTable copy)
 {
     foreach (var childNode in _list)
     {
         var copyChildNode = childNode.Clone();
         copy._list.Add(copyChildNode);
         copyChildNode._parent = this;
     }
 }