Class: Rex::PeParsey::PeBase::DosHeader

Inherits:
GenericHeader show all
Defined in:
lib/rex/peparsey/pebase.rb

Instance Attribute Summary

Attributes inherited from GenericStruct

#struct

Instance Method Summary collapse

Methods inherited from GenericStruct

#[], #keys, #method_missing, #v

Constructor Details

#initialize(rawdata) ⇒ DosHeader

Returns a new instance of DosHeader


115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/rex/peparsey/pebase.rb', line 115

def initialize(rawdata)
  dos_header = IMAGE_DOS_HEADER.make_struct

  if !dos_header.from_s(rawdata)
    raise DosHeaderError, "Couldn't parse IMAGE_DOS_HEADER", caller
  end

  if dos_header.v['e_magic'] != IMAGE_DOS_SIGNATURE
    raise DosHeaderError, "Couldn't find DOS e_magic", caller
  end

  self.struct = dos_header
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rex::PeParsey::PeBase::GenericStruct

Instance Method Details

#e_lfanewObject


129
130
131
# File 'lib/rex/peparsey/pebase.rb', line 129

def e_lfanew
  v['e_lfanew']
end