コード例 #1
0
 public OptionalHeader(FileStream file, long address)
 {
     this._optionalHeader32 = (PEStream.IMAGE_OPTIONAL_HEADER32)PEStream.PEComponent.ReadData(file, address, this._optionalHeader32.GetType());
     if (this._optionalHeader32.Magic == 0x20b)
     {
         this._is64Bit          = true;
         this._optionalHeader64 = (PEStream.IMAGE_OPTIONAL_HEADER64)PEStream.PEComponent.ReadData(file, address, this._optionalHeader64.GetType());
         base._size             = base.CalculateSize(this._optionalHeader64);
         base._data             = this._optionalHeader64;
     }
     else
     {
         if (this._optionalHeader32.Magic != 0x10b)
         {
             throw new NotSupportedException(Resources.GetString("Ex_PEImageTypeNotSupported"));
         }
         this._is64Bit = false;
         base._size    = base.CalculateSize(this._optionalHeader32);
         base._data    = this._optionalHeader32;
     }
     base._address = address;
 }
コード例 #2
0
 public OptionalHeader(FileStream file, long address)
 {
     this._optionalHeader32 = (PEStream.IMAGE_OPTIONAL_HEADER32) PEStream.PEComponent.ReadData(file, address, this._optionalHeader32.GetType());
     if (this._optionalHeader32.Magic == 0x20b)
     {
         this._is64Bit = true;
         this._optionalHeader64 = (PEStream.IMAGE_OPTIONAL_HEADER64) PEStream.PEComponent.ReadData(file, address, this._optionalHeader64.GetType());
         base._size = base.CalculateSize(this._optionalHeader64);
         base._data = this._optionalHeader64;
     }
     else
     {
         if (this._optionalHeader32.Magic != 0x10b)
         {
             throw new NotSupportedException(Resources.GetString("Ex_PEImageTypeNotSupported"));
         }
         this._is64Bit = false;
         base._size = base.CalculateSize(this._optionalHeader32);
         base._data = this._optionalHeader32;
     }
     base._address = address;
 }