Class: Rex::PeParsey::PeBase::OptionalHeader64

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) ⇒ OptionalHeader64

Returns a new instance of OptionalHeader64.



556
557
558
559
560
561
562
563
564
565
566
567
568
# File 'lib/rex/peparsey/pebase.rb', line 556

def initialize(rawdata)
  optional_header = IMAGE_OPTIONAL_HEADER64.make_struct

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

  if optional_header.v['Magic'] != IMAGE_NT_OPTIONAL_HDR64_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