private Section CreateSection(string name, uint size, Section previous)
{
uint virtualAddress;
Section section = new Section()
{
Name = name
};
if (previous != null)
{
virtualAddress = previous.VirtualAddress + ImageWriter.Align(previous.VirtualSize, 8192);
}
else
{
virtualAddress = 8192;
}
section.VirtualAddress = virtualAddress;
section.VirtualSize = size;
section.PointerToRawData = (previous != null ? previous.PointerToRawData + previous.SizeOfRawData : ImageWriter.Align(this.GetHeaderSize(), 512));
section.SizeOfRawData = ImageWriter.Align(size, 512);
return(section);
}