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 IntConst(PEReader buff, int numBytes) { switch (numBytes) { case (1) : val = buff.ReadSByte(); type = ElementType.I8; break; case (2) : val = buff.ReadInt16(); type = ElementType.I2; break; case (4) : val = buff.ReadInt32(); type = ElementType.I4; break; case (8) : val = buff.ReadInt64(); type = ElementType.I8; break; default: val = 0; break; } size = (uint)numBytes; // * 4; }
internal static void Read(PEReader buff, TableRow[] impls) { for (int i=0; i < impls.Length; i++) impls[i] = new InterfaceImpl(buff); }
internal static void Read(PEReader buff, TableRow[] gpars) { for (int i=0; i < gpars.Length; i++) gpars[i] = new GenericParamConstraint(buff); }
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 AssemblyRef ReadAssemblyRef(PEReader buff) { buff.SetElementPosition(MDTable.Assembly,1); HashAlgorithmType hAlg = (HashAlgorithmType)buff.ReadUInt32(); ushort majVer = buff.ReadUInt16(); ushort minVer = buff.ReadUInt16(); ushort bldNo = buff.ReadUInt16(); ushort revNo = buff.ReadUInt16(); uint flags = buff.ReadUInt32(); byte[] pKey = buff.GetBlob(); string name = buff.GetString(); string cult = buff.GetString(); AssemblyRef assemRef = null; if (name.ToLower() == "mscorlib") { assemRef = MSCorLib.mscorlib; assemRef.AddVersionInfo(majVer,minVer,bldNo,revNo); if (pKey.Length > 8) assemRef.AddKey(pKey); else assemRef.AddKeyToken(pKey); assemRef.AddCulture(cult); assemRef.SetFlags(flags); } else { assemRef = new AssemblyRef(name,majVer,minVer,bldNo,revNo,flags,pKey,cult,null); } //AssemblyRef assemRef = new AssemblyRef(name,majVer,minVer,bldNo,revNo,flags,pKey,cult,null); assemRef.ReadAsDef(); return assemRef; }
internal void CheckParent(MethodDef paren, PEReader buff) { if (paren == buff.GetCodedElement(CIx.TypeOrMethodDef,parentIx)) { parent = paren; paren.InsertGenericParam(this); } }
internal FieldMarshal(PEReader buff) { parentIx = buff.GetCodedIndex(CIx.HasFieldMarshal); ntIx = buff.GetBlobIx(); sortTable = true; tabIx = MDTable.FieldMarshal; }
internal static void Read(PEReader buff, TableRow[] fMarshal) { for (int i=0; i < fMarshal.Length; i++) fMarshal[i] = new FieldMarshal(buff); }
internal static void Read(PEReader buff, TableRow[] layouts) { for (int i=0; i < layouts.Length; i++) layouts[i] = new FieldLayout(buff); }
internal override sealed void Resolve(PEReader buff) { field = (FieldDef)buff.GetElement(MDTable.Field,fieldIx); field.SetOffset(offset); }
internal FieldLayout(PEReader buff) { offset = buff.ReadUInt32(); fieldIx = buff.GetIndex(MDTable.Field); tabIx = MDTable.FieldLayout; }
internal void Resolve(PEReader buff, uint fIx) { /* if ((flags & HasFieldMarshal) != 0) marshalType = FieldMarshal.FindMarshalType(buff,this, buff.MakeCodedIndex(CIx.HasFieldMarshal,MDTable.Field,fIx)); if ((flags & HasFieldRVA) != 0) initVal = FieldRVA.FindValue(buff,this,fIx); if ((flags & HasDefault) != 0) constVal = ConstantElem.FindConst(buff,this, buff.MakeCodedIndex(CIx.HasConstant,MDTable.Field,fIx)); long offs = FieldLayout.FindLayout(buff,this,fIx); if (offs > -1){ hasOffset = true; offset = (uint)offs; } */ buff.currentClassScope = parent; type = buff.GetFieldType(sigIx); buff.currentClassScope = null; }
internal static void Read(PEReader buff, TableRow[] fields) { for (int i=0; i < fields.Length; i++) fields[i] = new FieldDef(buff); }
internal static void Read(PEReader buff, TableRow[] table, PEFile pefile) { for (int i=0; i < table.Length; i++) { HashAlgorithmType hAlg = (HashAlgorithmType)buff.ReadUInt32(); ushort majVer = buff.ReadUInt16(); ushort minVer = buff.ReadUInt16(); ushort bldNo = buff.ReadUInt16(); ushort revNo = buff.ReadUInt16(); uint flags = buff.ReadUInt32(); byte[] pKey = buff.GetBlob(); string name = buff.GetString(); string cult = buff.GetString(); table[i] = new Assembly(name,hAlg,majVer,minVer,bldNo,revNo,flags,pKey,cult,pefile); } }
internal override void Resolve(PEReader buff) { field = buff.GetCodedElement(CIx.HasFieldMarshal,parentIx); nt = buff.GetBlobNativeType(ntIx); if (field is FieldDef) { ((FieldDef)field).SetMarshalType(nt); } else { ((Param)field).SetMarshalType(nt); } }
internal FloatConst(PEReader buff) { val = buff.ReadSingle(); size = 4; type = ElementType.R4; }
internal override Member ResolveParent(PEReader buff) { if (parent != null) return this; MetaDataElement paren = buff.GetCodedElement(CIx.MemberRefParent,parentIx); //Console.WriteLine("parentIx = " + parentIx); //Console.WriteLine("paren = " + paren); if (paren is ClassDef) return((ClassDef)paren).GetField(this.name); //if (paren is ClassSpec) // paren = ((ClassSpec)paren).GetParent(); if (paren is ReferenceScope) parent = ((ReferenceScope)paren).GetDefaultClass(); if (paren is TypeSpec) parent = new ConstructedTypeSpec((TypeSpec)paren); else parent = (Class)paren; if (parent != null) { Field existing = (Field)((Class)parent).GetFieldDesc(name); if (existing != null) { return existing; } } parent.AddToFieldList(this); return this; }
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 FieldRVA(PEReader buff) { rva = buff.ReadUInt32(); fieldIx = buff.GetIndex(MDTable.Field); tabIx = MDTable.FieldRVA; }
internal GenericParamConstraint(PEReader buff) { parentIx = buff.GetIndex(MDTable.GenericParam); constraintIx = buff.GetCodedIndex(CIx.TypeDefOrRef); tabIx = MDTable.GenericParamConstraint; }
internal static void Read(PEReader buff, TableRow[] fRVAs) { for (int i=0; i < fRVAs.Length; i++) fRVAs[i] = new FieldRVA(buff); }
internal override void Resolve(PEReader buff) { parent = (GenericParam)buff.GetElement(MDTable.GenericParam,parentIx); parent.AddConstraint((Class)buff.GetCodedElement(CIx.TypeDefOrRef,constraintIx)); }
internal override sealed void Resolve(PEReader buff) { field = (FieldDef)buff.GetElement(MDTable.Field,fieldIx); field.AddDataValue(buff.GetDataConstant(rva,field.GetFieldType())); }
internal override void Resolve(PEReader buff) { meth = (MethodDef)buff.GetCodedElement(CIx.MemberForwarded,memForIndex); importScope = (ModuleRef)buff.GetElement(MDTable.ModuleRef,scopeIx); if (meth != null) meth.AddPInvokeInfo(this); }
internal FileRef(PEReader buff) { flags = buff.ReadUInt32(); name = buff.GetString(); hashBytes = buff.GetBlob(); tabIx = MDTable.File; }
internal InterfaceImpl(PEReader buff) { classIx = buff.GetIndex(MDTable.TypeDef); interfacesIndex = buff.GetCodedIndex(CIx.TypeDefOrRef); tabIx = MDTable.InterfaceImpl; }
internal static void Read(PEReader buff, TableRow[] files) { for (int i=0; i < files.Length; i++) { uint flags = buff.ReadUInt32(); if (flags == HasMetaData) files[i] = new ModuleFile(buff.GetString(),buff.GetBlob()); else files[i] = new ResourceFile(buff.GetString(),buff.GetBlob()); } }
internal override void Resolve(PEReader buff) { theClass = (ClassDef)buff.GetElement(MDTable.TypeDef,classIx); theInterface = (Class)buff.GetCodedElement(CIx.TypeDefOrRef,interfacesIndex); theClass.AddImplementedInterface(this); }
internal FieldDef(PEReader buff) : base(null,null,null) { flags = buff.ReadUInt16(); name = buff.GetString(); sigIx = buff.GetBlobIx(); tabIx = MDTable.Field; }