Example #1
0
 internal FieldMarshal(PEReader buff)
 {
     Contract.Requires(buff != null);
     parentIx = buff.GetCodedIndex(CIx.HasFieldMarshal);
     ntIx = buff.GetBlobIx();
     tabIx = MDTable.FieldMarshal;
 }
Example #2
0
 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;
 }
Example #3
0
 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);
         }
     }
 }
Example #4
0
 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;
 }
Example #5
0
 internal MethodSpec(PEReader buff)
     : base(null)
 {
     parentIx = buff.GetCodedIndex(CIx.MethodDefOrRef);
     instIx = buff.GetBlobIx();
     tabIx = MDTable.MethodSpec;
     this.unresolved = true;
 }
Example #6
0
 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);
             }
         }
     }
 }
Example #7
0
 internal FieldDef(PEReader buff)
     : base(null, null, null)
 {
     flags = buff.ReadUInt16();
     name = buff.GetString();
     sigIx = buff.GetBlobIx();
     tabIx = MDTable.Field;
 }
Example #8
0
 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;
     }
 }
Example #9
0
 internal UnresolvedTypeSpec(PEReader buff, int i)
     : base(0)
 {
     Contract.Requires(buff != null);
     blobIx = buff.GetBlobIx();
     Row = (uint)i + 1;
     this.unresolved = true;
 }
Example #10
0
 internal Property(PEReader buff)
 {
     flags = buff.ReadUInt16();
     name = buff.GetString();
     typeBlobIx = buff.GetBlobIx();
     tabIx = MDTable.Property;
 }
Example #11
0
 internal static string[] GetFeatureNames(PEReader buff, MDTable tabIx, MDTable mapTabIx,
     ClassDef theClass, uint classIx)
 {
     buff.SetElementPosition(mapTabIx, 0);
     uint start = 0;
     uint 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;
     uint end;
     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;
 }