Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
		void CreateChunks() {
			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);

			CreateDebugDirectory();

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

			peHeaders.IsExeFile = Options.IsExeFile;
		}
Ejemplo n.º 3
0
 public ManagedExportsWriter(string moduleName, Machine machine, RelocDirectory relocDirectory, MetaData metaData, PEHeaders peHeaders, LogError logError)
 {
     this.moduleName          = moduleName;
     this.machine             = machine;
     this.relocDirectory      = relocDirectory;
     this.metaData            = metaData;
     this.peHeaders           = peHeaders;
     this.logError            = logError;
     vtableFixups             = new VtableFixupsChunk(this);
     stubsChunk               = new StubsChunk(this);
     sdataChunk               = new SdataChunk(this);
     exportDir                = new ExportDir(this);
     vtables                  = new List <VTableInfo>();
     allMethodInfos           = new List <MethodInfo>();
     sortedOrdinalMethodInfos = new List <MethodInfo>();
     sortedNameMethodInfos    = new List <MethodInfo>();
     // The error is reported later when we know that there's at least one exported method
     CpuArch.TryGetCpuArch(machine, out cpuArch);
 }