示例#1
0
 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());
         }
     }
 }
示例#2
0
 internal FileRef(PEReader buff)
 {
     flags     = buff.ReadUInt32();
     name      = buff.GetString();
     hashBytes = buff.GetBlob();
     tabIx     = MDTable.File;
 }
示例#3
0
        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);
        }
示例#4
0
 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);
     }
 }
示例#5
0
        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;

            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);
        }