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