Exemple #1
0
 /// <summary>
 /// Create a new PE File with the name "fileName".  If "fileName" ends in ".dll" then
 /// the file is a dll, otherwise it is an exe file.  This file has an Assembly called
 /// "assemblyName".
 /// </summary>
 /// <param name="fileName">Name for the output file</param>
 /// <param name="assemblyName">Name of the assembly</param>
 public PEFile(string fileName, string assemblyName)
     : base(fileName)
 {
     Contract.Requires(fileName != null);
     Contract.Requires(assemblyName != null);
     //PrimitiveType.ClearAddedFlags();   // KJG 18-April-2005 - Now done in MetaDataOut
     this.fileName = fileName;
     thisAssembly = new Assembly(assemblyName, this);
     metaData = new MetaDataOut();
     versionInfo = new PEFileVersionInfo();
     versionInfo.SetDefaults(fileName);
 }
Exemple #2
0
 internal static void Read(PEReader buff, TableRow[] table, PEFile pefile)
 {
     for (int i = 0; i < table.Length; i++)
     {
         HashAlgorithmType hAlg = (HashAlgorithmType)buff.ReadUInt32();
         ushort majVer = buff.ReadUInt16();
         ushort minVer = buff.ReadUInt16();
         ushort bldNo = buff.ReadUInt16();
         ushort revNo = buff.ReadUInt16();
         uint flags = buff.ReadUInt32();
         byte[] pKey = buff.GetBlob();
         string name = buff.GetString();
         string cult = buff.GetString();
         table[i] = new Assembly(name, hAlg, majVer, minVer, bldNo, revNo, flags, pKey, cult, pefile);
     }
 }
Exemple #3
0
 internal void SetThisAssembly(Assembly assem)
 {
     Contract.Requires(assem != null);
     if (Diag.DiagOn) Console.WriteLine("Setting fileScope to assembly " + assem.Name());
     thisAssembly = assem;
 }