示例#1
0
 // Token: 0x06000006 RID: 6 RVA: 0x00002A7C File Offset: 0x00000C7C
 public PELoader(byte[] fileBytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(fileBytes, 0, fileBytes.Length))
     {
         BinaryReader binaryReader = new BinaryReader(memoryStream);
         this.dosHeader = PELoader.FromBinaryReader <PELoader.IMAGE_DOS_HEADER>(binaryReader);
         memoryStream.Seek((long)((ulong)this.dosHeader.e_lfanew), SeekOrigin.Begin);
         uint num = binaryReader.ReadUInt32();
         this.fileHeader = PELoader.FromBinaryReader <PELoader.IMAGE_FILE_HEADER>(binaryReader);
         if (this.Is32BitHeader)
         {
             this.optionalHeader32 = PELoader.FromBinaryReader <PELoader.IMAGE_OPTIONAL_HEADER32>(binaryReader);
         }
         else
         {
             this.optionalHeader64 = PELoader.FromBinaryReader <PELoader.IMAGE_OPTIONAL_HEADER64>(binaryReader);
         }
         this.imageSectionHeaders = new PELoader.IMAGE_SECTION_HEADER[(int)this.fileHeader.NumberOfSections];
         for (int i = 0; i < this.imageSectionHeaders.Length; i++)
         {
             this.imageSectionHeaders[i] = PELoader.FromBinaryReader <PELoader.IMAGE_SECTION_HEADER>(binaryReader);
         }
         this.rawbytes = fileBytes;
     }
 }
示例#2
0
 // Token: 0x06000005 RID: 5 RVA: 0x00002978 File Offset: 0x00000B78
 public PELoader(string filePath)
 {
     using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
     {
         BinaryReader binaryReader = new BinaryReader(fileStream);
         this.dosHeader = PELoader.FromBinaryReader <PELoader.IMAGE_DOS_HEADER>(binaryReader);
         fileStream.Seek((long)((ulong)this.dosHeader.e_lfanew), SeekOrigin.Begin);
         uint num = binaryReader.ReadUInt32();
         this.fileHeader = PELoader.FromBinaryReader <PELoader.IMAGE_FILE_HEADER>(binaryReader);
         if (this.Is32BitHeader)
         {
             this.optionalHeader32 = PELoader.FromBinaryReader <PELoader.IMAGE_OPTIONAL_HEADER32>(binaryReader);
         }
         else
         {
             this.optionalHeader64 = PELoader.FromBinaryReader <PELoader.IMAGE_OPTIONAL_HEADER64>(binaryReader);
         }
         this.imageSectionHeaders = new PELoader.IMAGE_SECTION_HEADER[(int)this.fileHeader.NumberOfSections];
         for (int i = 0; i < this.imageSectionHeaders.Length; i++)
         {
             this.imageSectionHeaders[i] = PELoader.FromBinaryReader <PELoader.IMAGE_SECTION_HEADER>(binaryReader);
         }
         this.rawbytes = File.ReadAllBytes(filePath);
     }
 }