Exemplo n.º 1
0
 internal CLRMetaData(CLRContent clr, Location location, CLRHeader header)
 {
     CLR = clr;
     Location = location;
     Header = new CLRMetaDataHeader(this);
     StreamTable = new CLRMetaDataStreamTable(this);
     Streams = new CLRMetaDataStreams(this);
 }
Exemplo n.º 2
0
Arquivo: CLR.cs Projeto: Workshell/pe
        public static CLRContent Get(ExecutableImage image)
        {
            if (!image.NTHeaders.DataDirectories.Exists(DataDirectoryType.CLRRuntimeHeader))
                return null;

            DataDirectory directory = image.NTHeaders.DataDirectories[DataDirectoryType.CLRRuntimeHeader];

            if (DataDirectory.IsNullOrEmpty(directory))
                return null;

            LocationCalculator calc = directory.Directories.Image.GetCalculator();
            Section section = calc.RVAToSection(directory.VirtualAddress);
            ulong file_offset = calc.RVAToOffset(section, directory.VirtualAddress);
            ulong image_base = directory.Directories.Image.NTHeaders.OptionalHeader.ImageBase;
            Location location = new Location(file_offset, directory.VirtualAddress, image_base + directory.VirtualAddress, directory.Size, directory.Size, section);
            CLRContent result = new CLRContent(directory, location);

            return result;
        }