Class: Rex::PeParsey::PeBase::OptionalHeader32

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

Instance Attribute Summary

Attributes inherited from GenericStruct

#struct

Instance Method Summary collapse

Methods inherited from OptionalHeader

#FileAlignment, #ImageBase

Methods inherited from GenericStruct

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

Constructor Details

#initialize(rawdata) ⇒ OptionalHeader32

Returns a new instance of OptionalHeader32.



540
541
542
543
544
545
546
547
548
549
550
551
552
# File 'lib/rex/peparsey/pebase.rb', line 540

def initialize(rawdata)
  optional_header = IMAGE_OPTIONAL_HEADER32.make_struct

  if !optional_header.from_s(rawdata)
    raise OptionalHeaderError, "Couldn't parse IMAGE_OPTIONAL_HEADER32", caller
  end

  if optional_header.v['Magic'] != IMAGE_NT_OPTIONAL_HDR32_MAGIC
    raise OptionalHeaderError, "Magic did not match!", caller()
  end

  self.struct = optional_header
end

Dynamic Method Handling

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