internal CustomAttribute(PEReader buff) { parentIx = buff.GetCodedIndex(CIx.HasCustomAttr); typeIx = buff.GetCodedIndex(CIx.CustomAttributeType); valIx = buff.GetBlobIx(); sortTable = true; tabIx = MDTable.CustomAttribute; }
internal DeclSecurity(PEReader buff) { action = (SecurityAction)buff.ReadUInt16(); parentIx = buff.GetCodedIndex(CIx.HasDeclSecurity); permissionSet = buff.GetBlob(); sortTable = true; tabIx = MDTable.DeclSecurity; }
internal static void ReadMember(PEReader buff, TableRow[] members) { for (int i=0; i < members.Length; i++) { uint parenIx = buff.GetCodedIndex(CIx.MemberRefParent); string memName = buff.GetString(); uint sigIx = buff.GetBlobIx(); if (buff.FirstBlobByte(sigIx) == Field.FieldTag) // got a field members[i] = new FieldRef(parenIx,memName,sigIx); else members[i] = new MethodRef(parenIx,memName,sigIx); } }
internal static ClassRef ReadDef(PEReader buff, ReferenceScope resScope, uint index) { uint junk = buff.ReadUInt32(); string cName = buff.GetString(); string nsName = buff.GetString(); ClassRef newClass = (ClassRef)resScope.GetExistingClass(nsName,cName); if (newClass == null) { newClass = new ClassRef(resScope,nsName,cName); resScope.AddToClassList(newClass); } newClass.readAsDef = true; newClass.Row = index; junk = buff.GetCodedIndex(CIx.TypeDefOrRef); newClass.fieldIx = buff.GetIndex(MDTable.Field); newClass.methodIx = buff.GetIndex(MDTable.Method); return newClass; }
internal GenericParam(PEReader buff) : base(VAR) { index = buff.ReadUInt16(); flags = buff.ReadUInt16(); parentIx = buff.GetCodedIndex(CIx.TypeOrMethodDef); name = buff.GetString(); if (extraField) kind = buff.ReadUInt16(); sortTable = true; tabIx = MDTable.GenericParam; // resolve generic param immediately for signature resolution parent = buff.GetCodedElement(CIx.TypeOrMethodDef,parentIx); if (parent != null) { if (parent is MethodDef) { typeIndex = MVAR; ((MethodDef)parent).AddGenericParam(this); } else { ((ClassDef)parent).AddGenericParam(this); } } }
internal ImplMap(PEReader buff) { flags = buff.ReadUInt16(); memForIndex = buff.GetCodedIndex(CIx.MemberForwarded); importName = buff.GetString(); scopeIx = buff.GetIndex(MDTable.ModuleRef); sortTable = true; tabIx = MDTable.ImplMap; }
internal static void GetClassRefs(PEReader buff, TableRow[] eClasses) { for (uint i=0; i < eClasses.Length; i++) { uint junk = buff.ReadUInt32(); junk = buff.ReadUInt32(); string name = buff.GetString(); string nameSpace = buff.GetString(); uint implIx = buff.GetCodedIndex(CIx.Implementation); eClasses[i] = new ClassRef(implIx,nameSpace,name); eClasses[i].Row = i+1; } }
internal static string[] GetFeatureNames(PEReader buff, MDTable tabIx, MDTable mapTabIx, ClassDef theClass, uint classIx) { buff.SetElementPosition(mapTabIx,0); uint start = 0, end = 0, i = 0; for (; (i < buff.GetTableSize(tabIx)) && (start == 0); i++) { if (buff.GetIndex(MDTable.TypeDef) == classIx) { start = buff.GetIndex(tabIx); } } if (start == 0) return null; if (i < buff.GetTableSize(mapTabIx)) { uint junk = buff.GetIndex(MDTable.TypeDef); end = buff.GetIndex(tabIx); } else end = buff.GetTableSize(tabIx); if (tabIx == MDTable.Event) theClass.eventIx = start; else theClass.propIx = start; string[] names = new string[end-start]; buff.SetElementPosition(tabIx,start); for (i=start; i < end; i++) { uint junk = buff.ReadUInt16(); names[i] = buff.GetString(); if (tabIx == MDTable.Event) junk = buff.GetCodedIndex(CIx.TypeDefOrRef); else junk = buff.GetBlobIx(); } return names; }
internal ConstantElem(PEReader buff) { byte constType = buff.ReadByte(); byte pad = buff.ReadByte(); parentIx = buff.GetCodedIndex(CIx.HasConstant); //valIx = buff.GetBlobIx(); cValue = buff.GetBlobConst(constType); sortTable = true; tabIx = MDTable.Constant; }
public ExternClass(PEReader buff) { flags = buff.ReadUInt32(); typeDefId = buff.ReadUInt32(); name = buff.GetString(); nameSpace = buff.GetString(); implIx = buff.GetCodedIndex(CIx.Implementation); tabIx = MDTable.ExportedType; }
internal MethodSpec(PEReader buff) : base(null) { parentIx = buff.GetCodedIndex(CIx.MethodDefOrRef); instIx = buff.GetBlobIx(); tabIx = MDTable.MethodSpec; this.unresolved = true; }
internal MethodSemantics(PEReader buff) { type = (MethodType)buff.ReadUInt16(); methIx = buff.GetIndex(MDTable.Method); assocIx = buff.GetCodedIndex(CIx.HasSemantics); sortTable = true; tabIx = MDTable.MethodSemantics; }
internal MethodImpl(PEReader buff) { classIx = buff.GetIndex(MDTable.TypeDef); methBodyIx = buff.GetCodedIndex(CIx.MethodDefOrRef); methDeclIx = buff.GetCodedIndex(CIx.MethodDefOrRef); tabIx = MDTable.MethodImpl; }
internal static DeclSecurity FindSecurity(PEReader buff, MetaDataElement paren, uint codedParIx) { buff.SetElementPosition(MDTable.DeclSecurity,0); for (int i=0; i < buff.GetTableSize(MDTable.DeclSecurity); i++) { uint act = buff.ReadUInt16(); if (buff.GetCodedIndex(CIx.HasDeclSecurity) == codedParIx) return new DeclSecurity(paren,(SecurityAction)act,buff.GetBlob()); uint junk = buff.GetBlobIx(); } return null; }
internal ClassDef(PEReader buff, uint row, bool isMSCorLib) { flags = buff.ReadUInt32(); name = buff.GetString(); nameSpace = buff.GetString(); extendsIx = buff.GetCodedIndex(CIx.TypeDefOrRef); fieldIx = buff.GetIndex(MDTable.Field); methodIx = buff.GetIndex(MDTable.Method); this.Row = row; tabIx = MDTable.TypeDef; if (isMSCorLib && (name == "ValueType")) typeIndex = (byte)ElementType.ValueType; }
internal Event(PEReader buff) { flags = buff.ReadUInt16(); name = buff.GetString(); typeIx = buff.GetCodedIndex(CIx.TypeDefOrRef); tabIx = MDTable.Event; }
internal static void GetClassRefs(PEReader buff, TableRow[] typeRefs, ReferenceScope paren, uint[] parIxs) { int num = typeRefs.Length; uint[] fieldStart = new uint[num+1], methStart = new uint[num+1], extends = new uint[num+1]; for (int i=0; i < num; i++) { uint flags = buff.ReadUInt32(); string name = buff.GetString(); string nameSpace = buff.GetString(); extends[i] = buff.GetCodedIndex(CIx.TypeDefOrRef); fieldStart[i] = buff.GetIndex(MDTable.Field); methStart[i] = buff.GetIndex(MDTable.Method); //Console.WriteLine("flags = " + Hex.Int(flags)); if (i == 0) // ASSERT first entry is always <Module> typeRefs[i] = paren.GetDefaultClass(); else if (isPublic(flags)) { if (parIxs[i] != 0) { typeRefs[i] = new NestedClassRef(paren,nameSpace,name); } else { typeRefs[i] = paren.GetExistingClass(nameSpace,name); if (typeRefs[i] == null) { typeRefs[i] = new ClassRef(paren,nameSpace,name); paren.AddToClassList((ClassRef)typeRefs[i]); } } } } fieldStart[num] = buff.GetTableSize(MDTable.Field)+1; methStart[num] = buff.GetTableSize(MDTable.Method)+1; // Find Nested Classes for (int i=0; i < typeRefs.Length; i++) { if ((typeRefs[i] != null) && (typeRefs[i] is NestedClassRef)) { NestedClassRef nRef = (NestedClassRef)typeRefs[i]; ClassRef nPar = (ClassRef)typeRefs[parIxs[i]-1]; if (nPar == null) { // parent is private, so ignore typeRefs[i] = null; } else { nRef.SetParent(nPar); nPar.AddToClassList(nRef); } } if (typeRefs[i] != null) { if (buff.GetCodedElement(CIx.TypeDefOrRef,extends[i]) == MSCorLib.mscorlib.ValueType()) ((ClassRef)typeRefs[i]).MakeValueClass(); buff.SetElementPosition(MDTable.Field,fieldStart[i]); FieldDef.GetFieldRefs(buff,fieldStart[i+1]-fieldStart[i],(ClassRef)typeRefs[i]); buff.SetElementPosition(MDTable.Method,methStart[i]); MethodDef.GetMethodRefs(buff,methStart[i+1]-methStart[i],(ClassRef)typeRefs[i]); } } }
internal FieldMarshal(PEReader buff) { parentIx = buff.GetCodedIndex(CIx.HasFieldMarshal); ntIx = buff.GetBlobIx(); sortTable = true; tabIx = MDTable.FieldMarshal; }
internal static void Read(PEReader buff, TableRow[] typeRefs, bool resolve) { for (uint i=0; i < typeRefs.Length; i++) { uint resScopeIx = buff.GetCodedIndex(CIx.ResolutionScope); string name = buff.GetString(); string nameSpace = buff.GetString(); if (buff.CodedTable(CIx.ResolutionScope,resScopeIx) == MDTable.TypeRef) typeRefs[i] = new NestedClassRef(resScopeIx,nameSpace,name); else typeRefs[i] = new ClassRef(resScopeIx,nameSpace,name); typeRefs[i].Row = i+1; } if (resolve) { for (int i=0; i < typeRefs.Length; i++) { ((ClassRef)typeRefs[i]).ResolveParent(buff,false); } } }
internal GenericParamConstraint(PEReader buff) { parentIx = buff.GetIndex(MDTable.GenericParam); constraintIx = buff.GetCodedIndex(CIx.TypeDefOrRef); tabIx = MDTable.GenericParamConstraint; }
internal static ClassRef ReadClass(PEReader buff, ReferenceScope resScope) { uint resScopeIx = buff.GetCodedIndex(CIx.ResolutionScope); string name = buff.GetString(); string nameSpace = buff.GetString(); ClassRef newClass = (ClassRef)resScope.GetExistingClass(nameSpace,name); if (newClass == null) newClass = new ClassRef(resScope,nameSpace,name); return newClass; }
internal InterfaceImpl(PEReader buff) { classIx = buff.GetIndex(MDTable.TypeDef); interfacesIndex = buff.GetCodedIndex(CIx.TypeDefOrRef); tabIx = MDTable.InterfaceImpl; }
internal ManifestResource(PEReader buff) { fileOffset = buff.ReadUInt32(); flags = buff.ReadUInt32(); mrName = buff.GetString(); implIx = buff.GetCodedIndex(CIx.Implementation); tabIx = MDTable.ManifestResource; }