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.



553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/rex/peparsey/pebase.rb', line 553

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