private void AppendModuleImport(ImageModuleImport moduleImport)
 {
     _entryTableBuilder.Segments.Add(moduleImport);
     _lookupTablesBuilder.GetModuleLookupSegment(moduleImport);
     AddressTablesBuilder.GetModuleLookupSegment(moduleImport);
     _nameTableBuilder.GetModuleNameSegment(moduleImport);
 }
 private void AppendModuleImport(ImageModuleImport moduleImport)
 {
     _entryTableBuilder.Segments.Add(moduleImport);
     _lookupTablesBuilder.GetModuleLookupSegment(moduleImport);
     AddressTablesBuilder.GetModuleLookupSegment(moduleImport);
     _nameTableBuilder.GetModuleNameSegment(moduleImport);
 }
Esempio n. 3
0
        private static ImageModuleImport CreateMscoreeImport(bool isDll)
        {
            var module = new ImageModuleImport("mscoree.dll");

            module.SymbolImports.Add(new ImageSymbolImport(new HintName(0, isDll ? "_CorDllMain" : "_CorExeMain")));
            return(module);
        }
Esempio n. 4
0
 public void AddModuleImport(ImageModuleImport moduleImport)
 {
     _imports.Add(moduleImport);
     ModuleImportTable.AddModuleImport(moduleImport);
     LookupTables.GetModuleLookupTable(moduleImport);
     AddressTables.GetModuleLookupTable(moduleImport);
     NameTable.GetModuleNameSegment(moduleImport);
 }
Esempio n. 5
0
            public FileSegment GetModuleNameSegment(ImageModuleImport moduleImport)
            {
                FileSegment segment;

                if (!_moduleNameSegments.TryGetValue(moduleImport, out segment))
                {
                    Segments.Add(segment = DataSegment.CreateAsciiString(moduleImport.Name, true));
                    _moduleNameSegments.Add(moduleImport, segment);
                }
                return(segment);
            }
Esempio n. 6
0
        public static void ValidateModuleImport(ImageModuleImport originalModule, ImageModuleImport newModule)
        {
            Assert.Equal(originalModule.Name, newModule.Name);

            for (int i = 0; i < originalModule.SymbolImports.Count; i++)
            {
                Assert.True(i < newModule.SymbolImports.Count);

                var originalSymbol = originalModule.SymbolImports[i];
                var newSymbol      = newModule.SymbolImports[i];
                ValidateSymbolImport(originalSymbol, newSymbol);
            }
        }
Esempio n. 7
0
            public LookupTableBuffer GetModuleLookupTable(ImageModuleImport moduleImport)
            {
                LookupTableBuffer segment;

                if (!_lookupTableSegments.TryGetValue(moduleImport, out segment))
                {
                    segment = new LookupTableBuffer(_offsetConverter, _nameTableBuffer)
                    {
                        Is32Bit = Is32Bit
                    };

                    foreach (var symbolImport in moduleImport.SymbolImports)
                    {
                        segment.GetLookupSegment(symbolImport);
                    }
                    segment.GetLookupSegment(new ImageSymbolImport(0));

                    Segments.Add(segment);
                    _lookupTableSegments.Add(moduleImport, segment);
                }
                return(segment);
            }
Esempio n. 8
0
 public void AddModuleImport(ImageModuleImport import)
 {
     Segments.Insert(Segments.Count - 1, import);
 }
Esempio n. 9
0
 private static ImageModuleImport CreateMscoreeImport(bool isDll)
 {
     var module = new ImageModuleImport("mscoree.dll");
     module.SymbolImports.Add(new ImageSymbolImport(new HintName(0, isDll ? "_CorDllMain" : "_CorExeMain")));
     return module;
 }
 public FileSegment GetModuleNameSegment(ImageModuleImport moduleImport)
 {
     FileSegment segment;
     if (!_moduleNameSegments.TryGetValue(moduleImport, out segment))
     {
         Segments.Add(segment = DataSegment.CreateAsciiString(moduleImport.Name, true));
         _moduleNameSegments.Add(moduleImport, segment);
     }
     return segment;
 }
            public LookupTableBuilder GetModuleLookupSegment(ImageModuleImport moduleImport)
            {
                LookupTableBuilder segment;
                if (!_lookupTableSegments.TryGetValue(moduleImport, out segment))
                {
                    segment = new LookupTableBuilder(_offsetConverter, _nameTableBuilder)
                    {
                        Is32Bit = Is32Bit
                    };

                    foreach (var symbolImport in moduleImport.SymbolImports)
                        segment.GetLookupSegment(symbolImport);
                    segment.GetLookupSegment(new ImageSymbolImport(0));

                    Segments.Add(segment);
                    _lookupTableSegments.Add(moduleImport, segment);
                }
                return segment;
            }
Esempio n. 12
0
        public static void ValidateModuleImport(ImageModuleImport originalModule, ImageModuleImport newModule)
        {
            Assert.AreEqual(originalModule.Name, newModule.Name);

            for (int i = 0; i < originalModule.SymbolImports.Count; i++)
            {
                Assert.IsTrue(i < newModule.SymbolImports.Count);

                var originalSymbol = originalModule.SymbolImports[i];
                var newSymbol = newModule.SymbolImports[i];
                ValidateSymbolImport(originalSymbol, newSymbol);
            }
        }