internal override void Resolve(PEReader buff) { eventType = (Type)buff.GetCodedElement(CIx.TypeDefOrRef,typeIx); }
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 override void Resolve(PEReader buff) { parent = buff.GetCodedElement(CIx.HasCustomAttr,parentIx); if (parent == null) return; parent.AddCustomAttribute(this); type = (Method)buff.GetCodedElement(CIx.CustomAttributeType,typeIx); byteVal = buff.GetBlob(valIx); }
internal override void Resolve(PEReader buff) { parent = buff.GetCodedElement(CIx.HasDeclSecurity,parentIx); if (parent != null) { if (parent is ClassDef) ((ClassDef)parent).AddSecurity(this); if (parent is Assembly) ((Assembly)parent).AddSecurity(this); if (parent is MethodDef) ((MethodDef)parent).AddSecurity(this); } }
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 override void Resolve(PEReader buff) { body = (Method)buff.GetCodedElement(CIx.MethodDefOrRef,methBodyIx); header = (Method)buff.GetCodedElement(CIx.MethodDefOrRef,methDeclIx); parent = (ClassDef)buff.GetElement(MDTable.TypeDef,classIx); parent.AddMethodImpl(this); resolved = true; }
internal override void Resolve(PEReader buff) { implementation = buff.GetCodedElement(CIx.Implementation,implIx); while (implementation is ExternClass) implementation = ((ExternClass)implementation).implementation; ((ModuleFile)implementation).fileModule.AddExternClass(this); }
internal void CheckParent(MethodDef paren, PEReader buff) { if (paren == buff.GetCodedElement(CIx.TypeOrMethodDef,parentIx)) { parent = paren; paren.InsertGenericParam(this); } }
internal override void ResolveParent(PEReader buff, bool isExtern) { if (parent != null) return; CIx cIx = CIx.ResolutionScope; if (isExtern) cIx = CIx.Implementation; parent = (ClassRef)buff.GetCodedElement(cIx,resScopeIx); parent.ResolveParent(buff,isExtern); parent = (ClassRef)buff.GetCodedElement(cIx,resScopeIx); if (parent == null) return; NestedClassRef existing = parent.GetNestedClass(name); if (existing == null) { scope = parent.GetScope(); parent.AddToClassList(this); } else if (isExtern) buff.InsertInTable(MDTable.ExportedType,Row,existing); else buff.InsertInTable(MDTable.TypeRef,Row,existing); }
internal override void Resolve(PEReader buff) { parent = buff.GetCodedElement(CIx.HasConstant,parentIx); if (parent != null) { if (parent is Param) ((Param)parent).AddDefaultValue(cValue); else if (parent is FieldDef) ((FieldDef)parent).AddValue(cValue); else ((Property)parent).AddInitValue(cValue); } }
internal override void Resolve(PEReader buff) { methParent = (Method)buff.GetCodedElement(CIx.MethodDefOrRef,parentIx); buff.currentMethodScope = methParent; // set scopes - Fix by CK buff.currentClassScope = (Class)methParent.GetParent(); instTypes = buff.ReadMethSpecSig(instIx); this.unresolved = false; buff.currentMethodScope = null; buff.currentClassScope = null; }
internal override void Resolve(PEReader buff) { meth = (MethodDef)buff.GetElement(MDTable.Method,methIx); eventOrProp = (Feature)buff.GetCodedElement(CIx.HasSemantics,assocIx); eventOrProp.AddMethod(this); }
internal override Member ResolveParent(PEReader buff) { if (parent != null) return this; buff.currentMethodScope = this; MetaDataElement paren = buff.GetCodedElement(CIx.MemberRefParent,parentIx); buff.currentMethodScope = null; if (paren is MethodDef) { parent = null; varArgParent = (MethodDef)paren; //this.sig = buff.ReadMethSig(this,name,sigIx); ((MethodDef)paren).AddVarArgSig(this); return this; } else if (paren is ClassSpec) { ((ClassSpec)paren).AddMethod(this); return this; } else if (paren is PrimitiveType) { paren = MSCorLib.mscorlib.GetDefaultClass(); } else if (paren is ClassDef) { this.sig = buff.ReadMethSig(this,name,sigIx); return ((ClassDef)paren).GetMethod(this.sig); } else if (paren is TypeSpec) { paren = new ConstructedTypeSpec((TypeSpec)paren); //Console.WriteLine("Got TypeSpec as parent of Member"); //return this; //throw new Exception("Got TypeSpec as parent of Member"); //((TypeSpec)paren).AddMethod(buff,this); } if (paren is ReferenceScope) parent = ((ReferenceScope)paren).GetDefaultClass(); parent = (Class)paren; //if ((MethodRef)parent.GetMethodDesc(name) != null) throw new PEFileException("Existing method!!"); //sig = buff.ReadMethSig(this,name,sigIx); //MethodRef existing = (MethodRef)parent.GetMethod(sig); //if (existing != null) // return existing; parent.AddToMethodList(this); return this; }
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 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 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 override void Resolve(PEReader buff) { buff.currentClassScope = this; superType = (Class)buff.GetCodedElement(CIx.TypeDefOrRef,extendsIx); if ((superType != null) && superType.isValueType()) typeIndex = (byte)ElementType.ValueType; for (int i=0; fieldIx < fieldEndIx; i++, fieldIx++) { FieldDef field = (FieldDef)buff.GetElement(MDTable.Field,fieldIx); field.SetParent(this); fields.Add(field); } for (int i=0; methodIx < methodEndIx; i++, methodIx++) { MethodDef meth = (MethodDef)buff.GetElement(MDTable.Method,methodIx); if (Diag.DiagOn) Console.WriteLine("Adding method " + meth.Name() + " to class " + name); meth.SetParent(this); methods.Add(meth); } buff.currentClassScope = null; }
internal override void Resolve(PEReader buff) { parent = (GenericParam)buff.GetElement(MDTable.GenericParam,parentIx); parent.AddConstraint((Class)buff.GetCodedElement(CIx.TypeDefOrRef,constraintIx)); }
internal virtual void ResolveParent(PEReader buff, bool isExtern) { CIx cIx = CIx.ResolutionScope; if (isExtern) cIx = CIx.Implementation; if (scope != null) return; MetaDataElement parentScope = buff.GetCodedElement(cIx,resScopeIx); if (parentScope is Module) { // special code for glitch in Everett ilasm ClassDef newDef = new ClassDef((PEFile)parentScope,0,nameSpace,name); ((Module)parentScope).AddToClassList(newDef); buff.InsertInTable(MDTable.TypeRef,Row,newDef); } else { scope = (ReferenceScope)buff.GetCodedElement(cIx,resScopeIx); ClassRef existing = (ClassRef)scope.GetExistingClass(nameSpace,name); if (existing == null) { scope.AddToClassList(this); } else { if (isExtern) buff.InsertInTable(MDTable.ExportedType,Row,existing); else buff.InsertInTable(MDTable.TypeRef,Row,existing); } } }
internal override void Resolve(PEReader buff) { theClass = (ClassDef)buff.GetElement(MDTable.TypeDef,classIx); theInterface = (Class)buff.GetCodedElement(CIx.TypeDefOrRef,interfacesIndex); theClass.AddImplementedInterface(this); }
internal override void Resolve(PEReader buff) { impl = buff.GetCodedElement(CIx.Implementation,implIx); if (impl == null) { if (!buff.skipBody) resourceBytes = buff.GetResource(fileOffset); } }