internal static void GetFieldRefs(PEReader buff, uint num, ClassRef parent) { for (int i=0; i < num; i++) { uint flags = buff.ReadUInt16(); string name = buff.GetString(); uint sigIx = buff.GetBlobIx(); if ((flags & (uint)FieldAttr.Public) == (uint)FieldAttr.Public) { if (parent.GetField(name) == null) { //Console.WriteLine(parent.NameString()); buff.currentClassScope = parent; FieldRef fRef = new FieldRef(parent,name,buff.GetFieldType(sigIx)); buff.currentClassScope = null; parent.AddToFieldList(fRef); } } } }
internal FieldMarshal(PEReader buff) { parentIx = buff.GetCodedIndex(CIx.HasFieldMarshal); ntIx = buff.GetBlobIx(); sortTable = true; tabIx = MDTable.FieldMarshal; }
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 FieldDef(PEReader buff) : base(null,null,null) { flags = buff.ReadUInt16(); name = buff.GetString(); sigIx = buff.GetBlobIx(); tabIx = MDTable.Field; }
internal CustomAttribute(PEReader buff) { parentIx = buff.GetCodedIndex(CIx.HasCustomAttr); typeIx = buff.GetCodedIndex(CIx.CustomAttributeType); valIx = buff.GetBlobIx(); sortTable = true; tabIx = MDTable.CustomAttribute; }
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 static void Read(PEReader buff, TableRow[] sigs) { for (int i=0; i < sigs.Length; i++) { uint sigIx = buff.GetBlobIx(); uint tag = buff.FirstBlobByte(sigIx); if (tag == LocalSig.LocalSigByte) sigs[i] = new LocalSig(sigIx); else if (tag == Field.FieldTag) sigs[i] = new Signature(sigIx); else sigs[i] = new CalliSig(sigIx); sigs[i].Row = (uint)i+1; } }
internal UnresolvedTypeSpec(PEReader buff,int i) : base(0) { blobIx = buff.GetBlobIx(); Row = (uint)i+1; this.unresolved = true; }
internal Property(PEReader buff) { flags = buff.ReadUInt16(); name = buff.GetString(); typeBlobIx = buff.GetBlobIx(); tabIx = MDTable.Property; }
internal MethodSpec(PEReader buff) : base(null) { parentIx = buff.GetCodedIndex(CIx.MethodDefOrRef); instIx = buff.GetBlobIx(); tabIx = MDTable.MethodSpec; this.unresolved = true; }
internal static void GetMethodRefs(PEReader buff, uint num, ClassRef parent) { for (int i=0; i < num; i++) { uint rva = buff.ReadUInt32(); ushort implFlags = buff.ReadUInt16(); ushort methFlags = buff.ReadUInt16(); string name = buff.GetString(); uint sigIx = buff.GetBlobIx(); uint parIx = buff.GetIndex(MDTable.Param); if (IsPublicOrProtected(methFlags)) { MethodRef mRef = new MethodRef(parIx,name,sigIx); // changed mRef.SetParent(parent); //Console.WriteLine(parent.NameString()); MethSig mSig = buff.ReadMethSig(mRef,name,sigIx); //mSig.name = name; mRef.SetSig(mSig); // changed parent.AddToMethodList(mRef); //if (parent.GetMethod(mSig) == null) { // MethodRef mRef = new MethodRef(mSig); // parent.AddToMethodList(mRef); //} } } }
internal MethodDef(PEReader buff) : base(null) { rva = buff.ReadUInt32(); implFlags = buff.ReadUInt16(); methFlags = buff.ReadUInt16(); name = buff.GetString(); sigIx = buff.GetBlobIx(); parIx = buff.GetIndex(MDTable.Param); tabIx = MDTable.Method; }
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); } }