Exemplo n.º 1
0
        public void writeSectionData(BinaryOut outfile)
        {
            uint pos = outfile.getPos();

            outfile.putRange(data.ToArray());

            //these get written directly after the section data
            CoffRelocation.write(outfile, relocTblPos);
            uint padding = fileSize - (outfile.getPos() - pos);

            outfile.putZeros(padding);
        }
Exemplo n.º 2
0
        //- writing out -------------------------------------------------------

        public override void writeOut(BinaryOut outfile)
        {
            base.writeOut(outfile);

            //initize block header
            uint hdrpos = outfile.getPos();

            outfile.skip(24);

            //write block data
            uint blockaddr = outfile.getPos();
            uint blocksize = (uint)blockdata.Count;

            outfile.putRange(blockdata.ToArray());

            //write import list
            uint importaddr  = outfile.getPos();
            uint importcount = (uint)imports.Count;

            foreach (ImportEntry imp in imports)
            {
                imp.writeToFile(outfile);
            }

            //write export list
            uint exportaddr  = outfile.getPos();
            uint exportcount = (uint)exports.Count;

            foreach (ExportEntry exp in exports)
            {
                exp.writeToFile(outfile);
            }
            uint endpos = outfile.getPos();

            //go back and adjust block header
            outfile.seek(hdrpos);
            outfile.putFour(blockaddr);
            outfile.putFour(blocksize);
            outfile.putFour(importaddr);
            outfile.putFour(importcount);
            outfile.putFour(exportaddr);
            outfile.putFour(exportcount);
            outfile.seek(endpos);
        }
Exemplo n.º 3
0
        public void writeOut(BinaryOut outfile)
        {
            outfile.putTwo(signature);

            outfile.putTwo(lastsize);
            outfile.putTwo(nblocks);
            outfile.putTwo(nreloc);
            outfile.putTwo(hdrsize);
            outfile.putTwo(minalloc);
            outfile.putTwo(maxalloc);
            outfile.putTwo(ss);
            outfile.putTwo(sp);
            outfile.putTwo(checksum);
            outfile.putTwo(ip);
            outfile.putTwo(cs);
            outfile.putTwo(relocpos);
            outfile.putTwo(noverlay);
            outfile.putZeros(8);
            outfile.putTwo(oem_id);
            outfile.putTwo(oem_info);
            outfile.putZeros(20);
            outfile.putFour(e_lfanew);
            outfile.putRange(stub);
        }