Descriptor for a Section in a PEFile eg .text, .sdata
Example #1
0
 internal void AddInitData(DataConstant cVal)
 {
     if (sdata == null) {
         sdata = new Section(FileImage.sdataName,0xC0000040);   // IMAGE_SCN_CNT  INITIALIZED_DATA, READ, WRITE
         data = new ArrayList();
     }
     data.Add(cVal);
     //cVal.DataOffset = sdata.Tide();
     //sdata.IncTide(cVal.GetSize());
 }
Example #2
0
        /*----------------------------- Writing -----------------------------------------*/
        private void InitPEWriter(PEFileVersionInfo verInfo, MetaDataOut md, bool writePDB, string fileName)
        {
            this.verInfo = verInfo;
            if (!verInfo.fromExisting)
                verInfo.lMajor = MetaData.LMajors[(int)verInfo.netVersion];
            if (verInfo.isDLL) {
                hintNameTable = FileImage.dllHintNameTable.ToCharArray();
                if (!verInfo.fromExisting) verInfo.characteristics = FileImage.dllCharacteristics;
            } else {
                hintNameTable = FileImage.exeHintNameTable.ToCharArray();
                if (!verInfo.fromExisting) verInfo.characteristics = FileImage.exeCharacteristics;
            }
            text = new Section(FileImage.textName,0x60000020);     // IMAGE_SCN_CNT  CODE, EXECUTE, READ
            //      rsrc = new Section(rsrcName,0x40000040);     // IMAGE_SCN_CNT  INITIALIZED_DATA, READ
            metaData = md;
            metaData.InitMetaDataOut(this);

            // Check if we should include a PDB file
            if (writePDB) {

                // Work out the PDB filename from the PE files filename
                if ((fileName == null) || (fileName == "")) fileName = "default";

                // Setup the PDB Writer object
                pdbWriter = new PDBWriter(fileName);

                // Set the amount of space required for the debug information
                debugBytesSize += pdbWriter.PDBFilename.Length;

            }
        }
Example #3
0
 private void ReadSectionHeaders()
 {
     if (Diag.DiagOn) Console.WriteLine("Sections");
     inputSections = new Section[numSections];
     for (int i=0; i < numSections; i++) {
         inputSections[i] = new Section(this);
     }
 }