Example #1
0
        private RelocSection GetRelocSection()
        {
            RelocationBuffer buffer = new RelocationBuffer(_text);

            return(new RelocSection()
            {
                Buffer = buffer,
                Header = GetRelocHeader(buffer)
            });
        }
Example #2
0
        private SectionHeader GetRelocHeader(RelocationBuffer buffer)
        {
            uint rva = GetNextVirtualAddress(_rsrc);

            return(new SectionHeader()
            {
                Name = ".reloc",
                VirtualSize = (uint)buffer.Length,
                VirtualAddress = rva,
                SizeOfRawData = BitArithmetic.Align((uint)buffer.Length, FILE_ALIGMENT),
                PointerToRawData = _rsrc.Header.PointerToRawData + _rsrc.Header.SizeOfRawData,
                Characteristics = SectionCharacteristic.MEM_READ
                                  | SectionCharacteristic.CNT_INITIALIZED_DATA
                                  | SectionCharacteristic.MEM_DISCARDABLE
            });
        }