public void writeToFile(BinaryOut outfile) { outfile.putString(name); outfile.putFour((uint)addr); //int b = (typ == IMPORTTYPE.DIR32) ? 0 : 1; outfile.putOne((uint)typ); }
//standard sections public void buildExportSection() { uint ordinalBase = 1; BinaryOut expData = new BinaryOut(); expData.putFour(0); expData.putFour((uint)getTimestamp()); expData.putTwo(1); expData.putTwo(0); expData.putFour(0); //filename addr expData.putFour(ordinalBase); expData.putFour((uint)exportList.Count); expData.putFour((uint)exportList.Count); expData.putFour(0x28 + mempos); uint expnametbl = 0x28 + 4 * (uint)exportList.Count; expData.putFour(expnametbl + mempos); uint ordtbl = expnametbl + 4 * (uint)exportList.Count; expData.putFour(ordtbl + mempos); //export addr tbl foreach (CoffExportEntry exp in exportList) { expData.putFour(exp.addr); } //export name tbl expData.skip(4 * (uint)exportList.Count); //ordinal number tbl foreach (CoffExportEntry exp in exportList) { expData.putTwo(exp.ord - ordinalBase); } uint faddr = expData.getPos() + mempos; expData.putString(filename); List <uint> nameaddrs = new List <uint>(); foreach (CoffExportEntry exp in exportList) { nameaddrs.Add(expData.getPos() + mempos); expData.putString(exp.name); } expData.seek(0xc); expData.putFour(faddr); expData.seek(expnametbl); foreach (uint nameaddr in nameaddrs) { expData.putFour(nameaddr); } exportSec = new CoffSection(".edata"); exportSec.data = new List <byte>(expData.getData()); uint datasize = (uint)exportSec.data.Count; exportSec.filePos = filepos; exportSec.fileSize = (datasize + (fileAlignment - 1)) & ~(fileAlignment - 1); filepos += exportSec.fileSize; exportSec.memPos = mempos; exportSec.memSize = datasize; mempos += (datasize + (memAlignment - 1)) & ~(memAlignment - 1); exportSec.settings.canRead = true; exportSec.settings.hasInitData = true; uint msize = (exportSec.memSize + fileAlignment - 1) & ~(fileAlignment - 1); sizeOfInitializedData += msize; sections.Add(exportSec); dExportTable.rva = exportSec.memPos; dExportTable.size = exportSec.memSize; }
public void writeToFile(BinaryOut modfile) { modfile.putString(name); modfile.putFour((uint)addr); }
public virtual void writeOut(BinaryOut outfile) { outfile.putString(name); }