Beispiel #1
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);
     }
 }
Beispiel #2
0
 internal void AddUnmanagedResourceDirectory(PEResourceDirectory directory)
 {
     Contract.Requires(directory != null);
     if (rsrc == null)
     rsrc = new Section(FileImage.rsrcName, 0x40000040);
       rsrc.IncTide(directory.Size());
       unmanagedResourceRoot = directory;
 }
Beispiel #3
0
        /*----------------------------- Writing -----------------------------------------*/
        private void InitPEWriter(PEFileVersionInfo verInfo, MetaDataOut md, bool writePDB, string fileName)
        {
            Contract.Requires(verInfo != null);
            Contract.Requires(md != null);
            Contract.Requires(fileName != null);
            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
            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;

            }
        }
Beispiel #4
0
 internal void AddInitData(DataConstant cVal)
 {
     if (sdata == null)
     {
         sdata = new Section(FileImage.sdataName, 0xC0000040);   // IMAGE_SCN_CNT  INITIALIZED_DATA, READ, WRITE
         data = new List<DataConstant>();
     }
     data.Add(cVal);
 }