コード例 #1
0
        void CreateChunks()
        {
            bool hasDebugDirectory = false;

            peHeaders = new PEHeaders(Options.PEHeadersOptions);

            if (!Options.Is64Bit) {
                importAddressTable = new ImportAddressTable();
                importDirectory = new ImportDirectory();
                startupStub = new StartupStub();
                relocDirectory = new RelocDirectory();
            }

            if (Options.StrongNameKey != null)
                strongNameSignature = new StrongNameSignature(Options.StrongNameKey.SignatureSize);
            else if (module.Assembly != null && !PublicKeyBase.IsNullOrEmpty2(module.Assembly.PublicKey)) {
                int len = module.Assembly.PublicKey.Data.Length - 0x20;
                strongNameSignature = new StrongNameSignature(len > 0 ? len : 0x80);
            }
            else if (((Options.Cor20HeaderOptions.Flags ?? module.Cor20HeaderFlags) & ComImageFlags.StrongNameSigned) != 0)
                strongNameSignature = new StrongNameSignature(0x80);

            imageCor20Header = new ImageCor20Header(Options.Cor20HeaderOptions);
            CreateMetaDataChunks(module);

            if (hasDebugDirectory)
                debugDirectory = new DebugDirectory();

            if (importDirectory != null)
                importDirectory.IsExeFile = Options.IsExeFile;

            peHeaders.IsExeFile = Options.IsExeFile;
        }
コード例 #2
0
ファイル: ModuleWriterBase.cs プロジェクト: EmilZhou/dnlib
		/// <summary>
		/// Creates the debug directory if a PDB file should be written
		/// </summary>
		protected void CreateDebugDirectory() {
			if (CanWritePdb())
				debugDirectory = new DebugDirectory();
		}
コード例 #3
0
ファイル: ModuleWriter.cs プロジェクト: visi/dnlib
        void CreateChunks()
        {
            bool hasDebugDirectory = false;

            peHeaders = new PEHeaders(Options.PEHeadersOptions);

            if (!Options.Is64Bit) {
                importAddressTable = new ImportAddressTable();
                importDirectory = new ImportDirectory();
                startupStub = new StartupStub();
                relocDirectory = new RelocDirectory();
            }

            CreateStrongNameSignature();

            imageCor20Header = new ImageCor20Header(Options.Cor20HeaderOptions);
            CreateMetaDataChunks(module);

            if (hasDebugDirectory)
                debugDirectory = new DebugDirectory();

            if (importDirectory != null)
                importDirectory.IsExeFile = Options.IsExeFile;

            peHeaders.IsExeFile = Options.IsExeFile;
        }