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 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 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 FileRef(PEReader buff) { flags = buff.ReadUInt32(); name = buff.GetString(); hashBytes = buff.GetBlob(); tabIx = MDTable.File; }
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 DeclSecurity(PEReader buff) { action = (SecurityAction)buff.ReadUInt16(); parentIx = buff.GetCodedIndex(CIx.HasDeclSecurity); permissionSet = buff.GetBlob(); sortTable = true; tabIx = MDTable.DeclSecurity; }
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 static AssemblyRef Read(PEReader buff) { 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(); byte[] hBytes = buff.GetBlob(); AssemblyRef assemRef; if (name.ToLower() == "mscorlib") { assemRef = MSCorLib.mscorlib; assemRef.AddVersionInfo(majVer,minVer,bldNo,revNo); assemRef.AddHash(hBytes); 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,hBytes); } return assemRef; }