internal static BaseRelocationBlock Load(IBinaryAccessor accessor) { var block = new BaseRelocationBlock(); block.PageRVA = accessor.ReadUInt32(); // The total number of bytes in the base relocation block, including the Page RVA and Block Size fields and // the Type/Offset fields that follow. int blockSize = accessor.ReadInt32(); int count = (blockSize - 8) / 2; for (int i = 0; i < count; i++) { ushort value = accessor.ReadUInt16(); if (value == 0) // if necessary, insert 2 bytes of 0 to pad to a multiple of 4 bytes in length. { continue; } var type = (BaseRelocationType)(value >> 12); uint offset = (uint)(value & 0x0fff); var entry = new BaseRelocationEntry(type, offset); entry._parent = block; block._list.Add(entry); } return(block); }
public BaseRelocationBlock Clone() { BaseRelocationBlock copy = new BaseRelocationBlock(); CopyTo(copy); return(copy); }
protected void CopyTo(BaseRelocationBlock copy) { copy._pageRVA = _pageRVA; foreach (var childNode in _list) { var copyChildNode = childNode.Clone(); copy._list.Add(copyChildNode); copyChildNode._parent = this; } }