Пример #1
0
        private void ReadNarrow(EndianAwareBinaryReader reader, ICliMetadataRoot metadataRoot, Action <byte[]> bodyBuilder)
        {
            var firstByte = reader.ReadByte();

            this.codeSize = (byte)((firstByte & 0xFC) >> 2);
            bodyBuilder(reader.ReadBytes((int)this.CodeSize));
        }
Пример #2
0
 internal CliMetadataModuleReferenceLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, uint nameIndex)
 {
     this.index        = index;
     this.metadataRoot = metadataRoot;
     this.state        = state;
     this.nameIndex    = nameIndex;
 }
Пример #3
0
 internal CliMetadataStandAloneSigLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, uint signatureIndex)
 {
     this.index          = index;
     this.metadataRoot   = metadataRoot;
     this.state          = state;
     this.signatureIndex = signatureIndex;
 }
Пример #4
0
 internal CliMetadataNestedClassLockedTableRow(byte state, ICliMetadataRoot metadataRoot, uint nestedClassIndex, uint enclosingClassIndex)
 {
     this.metadataRoot        = metadataRoot;
     this.state               = state;
     this.nestedClassIndex    = nestedClassIndex;
     this.enclosingClassIndex = enclosingClassIndex;
 }
Пример #5
0
        public CliParameterMemberDictionary(_ICliManager manager, uint methodIndex, ICliMetadataRoot metadataRoot, TParent parent, int dropoff = 0)
        {
            this.manager = manager;
            this.parent  = parent;
            var method = metadataRoot.TableStream.MethodDefinitionTable[(int)methodIndex];

            this.signature = method.Signature;
            bool skipFirst = false;

            if (method.Parameters.Count > 0 &&
                method.Parameters[0].Sequence == 0)
            {
                skipFirst = true;
            }
            if (dropoff != 0)
            {
                if (skipFirst)
                {
                    this.Initialize(method.Parameters.Skip(1).Drop(dropoff).ToArray());
                }
                else
                {
                    this.Initialize(method.Parameters.Drop(dropoff).ToArray());
                }
            }
            else if (skipFirst)
            {
                this.Initialize(method.Parameters.Skip(1).ToArray());
            }
            else
            {
                this.Initialize(method.Parameters);
            }
        }
Пример #6
0
 internal CliMetadataTypeSpecificationLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, uint signatureIndex)
 {
     this.index          = index;
     this.metadataRoot   = metadataRoot;
     this.state          = state;
     this.signatureIndex = signatureIndex;
 }
Пример #7
0
        private static void ValidateModuleTable(IAssembly hostAssembly, ICliMetadataRoot metadataRoot, CompilerErrorCollection resultErrorCollection)
        {
            var moduleTable = metadataRoot.TableStream.ModuleTable;

            if (moduleTable == null || moduleTable.Count > 1)
            {
                if (moduleTable.Count > 1)
                {
                    // The module table shall contain one and only one row.  More than one was found.
                    resultErrorCollection.ModelError(CliWarningsAndErrors.CliMetadata0001, hostAssembly, moduleTable);
                }
                else
                {
                    // The module table shall contain one and only one row.  None were found.
                    resultErrorCollection.ModelError(CliWarningsAndErrors.CliMetadata0001, hostAssembly);
                }
            }
            if (moduleTable != null && moduleTable.Count > 0)
            {
                var firstModule = moduleTable[1];
                if (firstModule.NameIndex == 0)
                {
                    /* *
                     * Name shall index a non-empty string. This string should match exactly
                     * any corresponding ModuleRef.Name string that resolves to this module.
                     * */
                    resultErrorCollection.ModelError(CliWarningsAndErrors.CliMetadata0002, hostAssembly, firstModule);
                }
                if (firstModule.ModuleVersionIndex == 0)
                {
                    // Mvid shall index a non-null Guid in the Guid heap.
                    resultErrorCollection.ModelError(CliWarningsAndErrors.CliMetadata0003, hostAssembly, firstModule);
                }
            }
        }
Пример #8
0
 internal CliMetadataAssemblyRefProcessorLockedTableRow(byte state, ICliMetadataRoot metadataRoot, uint processor, uint assemblyRefIndex)
 {
     this.metadataRoot     = metadataRoot;
     this.state            = state;
     this.processor        = processor;
     this.assemblyRefIndex = assemblyRefIndex;
 }
Пример #9
0
 internal CliMetadataFieldRVALockedTableRow(byte state, ICliMetadataRoot metadataRoot, uint rva, uint fieldIndex)
 {
     this.metadataRoot = metadataRoot;
     this.state        = state;
     this.rva          = rva;
     this.fieldIndex   = fieldIndex;
 }
Пример #10
0
        internal CliMetadataMethodHeader(ICliMetadataRoot metadataRoot, uint relativeVirtualAddress, Action <byte[]> bodyBuilder)
        {
            var image           = metadataRoot.SourceImage;
            var rvaLocationScan = image.ResolveRelativeVirtualAddress(relativeVirtualAddress);

            if (rvaLocationScan.Resolved)
            {
                var section       = rvaLocationScan.Section;
                var bodySubstream = new Substream(section.SectionData, rvaLocationScan.Offset, 65536, false);
                var bodyReader    = new EndianAwareBinaryReader(bodySubstream, Endianness.LittleEndian, false);
                var peekedChar    = bodyReader.PeekByte();
                if (peekedChar != -1)
                {
                    MethodHeaderFlags headerType = ((MethodHeaderFlags)peekedChar) & MethodHeaderFlags.WideFormat;
                    if (headerType == MethodHeaderFlags.NarrowFormat)
                    {
                        this.ReadNarrow(bodyReader, metadataRoot, bodyBuilder);
                    }
                    else
                    {
                        this.ReadWide(bodyReader, metadataRoot, bodyBuilder);
                    }
                }
            }
        }
Пример #11
0
 internal CliMetadataFieldLayoutLockedTableRow(byte state, ICliMetadataRoot metadataRoot, uint offset, uint fieldIndex)
 {
     this.metadataRoot = metadataRoot;
     this.state        = state;
     this.offset       = offset;
     this.fieldIndex   = fieldIndex;
 }
Пример #12
0
 internal CliMetadataFieldMarshalLockedTableRow(byte state, ICliMetadataRoot metadataRoot, CliMetadataHasFieldMarshalTag parentSource, uint parentIndex, uint nativeTypeIndex)
 {
     this.metadataRoot    = metadataRoot;
     this.state           = state;
     this.parentSource    = parentSource;
     this.parentIndex     = parentIndex;
     this.nativeTypeIndex = nativeTypeIndex;
 }
Пример #13
0
 internal CliMetadataEventMapLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, uint parentIndex, uint eventListIndex)
 {
     this.index          = index;
     this.metadataRoot   = metadataRoot;
     this.state          = state;
     this.parentIndex    = parentIndex;
     this.eventListIndex = eventListIndex;
 }
Пример #14
0
 public CliAssembly(CliManager identityManager, ICliMetadataAssemblyTableRow metadata, IAssemblyUniqueIdentifier uniqueIdentifier, IStrongNamePublicKeyInfo strongNameInfo)
 {
     this.metadataRoot     = metadata.MetadataRoot;
     this.MetadataEntry    = metadata;
     this.strongNameInfo   = strongNameInfo;
     this.identityManager  = identityManager;
     this.UniqueIdentifier = new CliAssemblyUniqueIdentifier(uniqueIdentifier, this.FrameworkVersion);
 }
Пример #15
0
 internal CliMetadataClassLayoutLockedTableRow(byte state, ICliMetadataRoot metadataRoot, ushort packingSize, uint classSize, uint parentIndex)
 {
     this.metadataRoot = metadataRoot;
     this.state        = state;
     this.packingSize  = packingSize;
     this.classSize    = classSize;
     this.parentIndex  = parentIndex;
 }
Пример #16
0
 internal CliMetadataPropertyMapLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, uint parentIndex, uint propertyListIndex)
 {
     this.index             = index;
     this.metadataRoot      = metadataRoot;
     this.state             = state;
     this.parentIndex       = parentIndex;
     this.propertyListIndex = propertyListIndex;
 }
Пример #17
0
 internal CliMetadataMethodSpecificationLockedTableRow(byte state, ICliMetadataRoot metadataRoot, CliMetadataMethodDefOrRefTag methodBodySource, uint methodIndex, uint instantiationIndex)
 {
     this.metadataRoot       = metadataRoot;
     this.state              = state;
     this.methodBodySource   = methodBodySource;
     this.methodIndex        = methodIndex;
     this.instantiationIndex = instantiationIndex;
 }
Пример #18
0
 internal CliMetadataInterfaceImplLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, uint classIndex, CliMetadataTypeDefOrRefTag interfaceSource, uint interfaceIndex)
 {
     this.index           = index;
     this.metadataRoot    = metadataRoot;
     this.state           = state;
     this.classIndex      = classIndex;
     this.interfaceSource = interfaceSource;
     this.interfaceIndex  = interfaceIndex;
 }
Пример #19
0
 internal CliMetadataConstantLockedTableRow(byte state, ICliMetadataRoot metadataRoot, CliMetadataNativeTypes @type, CliMetadataHasConstantTag parentSource, uint parentIndex, uint valueIndex)
 {
     this.metadataRoot = metadataRoot;
     this.state        = state;
     this.@type        = @type;
     this.parentSource = parentSource;
     this.parentIndex  = parentIndex;
     this.valueIndex   = valueIndex;
 }
Пример #20
0
 public CliMetadataAssemblyProcessorTableReader(ICliMetadataRoot metadataRoot, Tuple <object, FileStream, EndianAwareBinaryReader> readerInfo, uint rowCount)
     : base(metadataRoot, rowCount)
 {
     this.metadataRoot = metadataRoot;
     this.syncObject   = readerInfo.Item1;
     this.fStream      = readerInfo.Item2;
     this.reader       = readerInfo.Item3;
     this.rowCount     = rowCount;
 }
Пример #21
0
 internal CliMetadataParameterLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, ParameterAttributes flags, ushort sequence, uint nameIndex)
 {
     this.index        = index;
     this.metadataRoot = metadataRoot;
     this.state        = state;
     this.flags        = flags;
     this.sequence     = sequence;
     this.nameIndex    = nameIndex;
 }
Пример #22
0
 internal CliMetadataFieldLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, FieldAttributes fieldAttributes, uint nameIndex, uint fieldTypeIndex)
 {
     this.index           = index;
     this.metadataRoot    = metadataRoot;
     this.state           = state;
     this.fieldAttributes = fieldAttributes;
     this.nameIndex       = nameIndex;
     this.fieldTypeIndex  = fieldTypeIndex;
 }
Пример #23
0
 internal CliMetadataGenericParamConstraintLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, uint ownerIndex, CliMetadataTypeDefOrRefTag constraintSource, uint constraintIndex)
 {
     this.index            = index;
     this.metadataRoot     = metadataRoot;
     this.state            = state;
     this.ownerIndex       = ownerIndex;
     this.constraintSource = constraintSource;
     this.constraintIndex  = constraintIndex;
 }
 internal CliMetadataAssemblyRefOSLockedTableRow(byte state, ICliMetadataRoot metadataRoot, uint platformId, uint majorVersion, uint minorVersion, uint assemblyRefIndex)
 {
     this.metadataRoot     = metadataRoot;
     this.state            = state;
     this.platformId       = platformId;
     this.majorVersion     = majorVersion;
     this.minorVersion     = minorVersion;
     this.assemblyRefIndex = assemblyRefIndex;
 }
Пример #25
0
 public CliMetadataGenericParamConstraintTableReader(ICliMetadataRoot metadataRoot, Tuple <object, FileStream, EndianAwareBinaryReader> readerInfo, uint rowCount)
     : base(metadataRoot, rowCount)
 {
     this.metadataRoot = metadataRoot;
     this.syncObject   = readerInfo.Item1;
     this.fStream      = readerInfo.Item2;
     this.reader       = readerInfo.Item3;
     this.rowCount     = rowCount;
 }
Пример #26
0
 internal CliMetadataPropertyLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, PropertyAttributes flags, uint nameIndex, uint propertyTypeIndex)
 {
     this.index             = index;
     this.metadataRoot      = metadataRoot;
     this.state             = state;
     this.flags             = flags;
     this.nameIndex         = nameIndex;
     this.propertyTypeIndex = propertyTypeIndex;
 }
Пример #27
0
 internal CliMetadataFileLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, CliMetadataFileAttributes flags, uint nameIndex, uint hashValueIndex)
 {
     this.index          = index;
     this.metadataRoot   = metadataRoot;
     this.state          = state;
     this.flags          = flags;
     this.nameIndex      = nameIndex;
     this.hashValueIndex = hashValueIndex;
 }
Пример #28
0
 internal CliMetadataMethodSemanticsLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, MethodSemanticsAttributes semantics, uint methodIndex, CliMetadataHasSemanticsTag associationSource, uint associationIndex)
 {
     this.index             = index;
     this.metadataRoot      = metadataRoot;
     this.state             = state;
     this.semantics         = semantics;
     this.methodIndex       = methodIndex;
     this.associationSource = associationSource;
     this.associationIndex  = associationIndex;
 }
Пример #29
0
 internal CliMetadataTypeRefLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, CliMetadataResolutionScopeTag resolutionScope, uint sourceIndex, uint nameIndex, uint namespaceIndex)
 {
     this.index           = index;
     this.metadataRoot    = metadataRoot;
     this.state           = state;
     this.resolutionScope = resolutionScope;
     this.sourceIndex     = sourceIndex;
     this.nameIndex       = nameIndex;
     this.namespaceIndex  = namespaceIndex;
 }
Пример #30
0
 internal CliMetadataDeclSecurityLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, SecurityAction action, CliMetadataHasDeclSecurityTag parentSource, uint parentIndex, uint permissionSetIndex)
 {
     this.index              = index;
     this.metadataRoot       = metadataRoot;
     this.state              = state;
     this.action             = action;
     this.parentSource       = parentSource;
     this.parentIndex        = parentIndex;
     this.permissionSetIndex = permissionSetIndex;
 }