예제 #1
0
        private 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;
        }
예제 #2
0
        void CreateChunks()
        {
            peHeaders = new PEHeaders(Options.PEHeadersOptions);

            var  machine = Options.PEHeadersOptions.Machine ?? Machine.I386;
            bool is64bit = machine == Machine.AMD64 || machine == Machine.IA64 || machine == Machine.ARM64;

            relocDirectory = new RelocDirectory(machine);
            if (machine == Machine.I386)
            {
                needStartupStub = true;
            }

            importAddressTable = new ImportAddressTable(is64bit);
            importDirectory    = new ImportDirectory(is64bit);
            startupStub        = new StartupStub(relocDirectory, machine, (format, args) => Error(format, args));

            CreateStrongNameSignature();

            imageCor20Header = new ImageCor20Header(Options.Cor20HeaderOptions);
            CreateMetaDataChunks(module);
            managedExportsWriter = new ManagedExportsWriter(UTF8String.ToSystemStringOrEmpty(module.Name), machine, relocDirectory, metaData, peHeaders, (format, args) => Error(format, args));

            CreateDebugDirectory();

            importDirectory.IsExeFile = Options.IsExeFile;
            peHeaders.IsExeFile       = Options.IsExeFile;
        }
예제 #3
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();
            }

            CreateStrongNameSignature();

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

            if (hasDebugDirectory)
            {
                debugDirectory = new DebugDirectory();
            }

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

            peHeaders.IsExeFile = Options.IsExeFile;
        }
예제 #4
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;
        }
예제 #5
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;
		}
예제 #6
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;
        }