Class: Exerb::Win32::Struct::ImageNtHeaders32

Inherits:
Base
  • Object
show all
Defined in:
lib/exerb/win32/struct/image_nt_headers32.rb

Overview

#

Constant Summary collapse

SIGNATURE =
0x00004550

Instance Attribute Summary collapse

Attributes inherited from Base

#position

Instance Method Summary collapse

Methods inherited from Base

read, #size, #update

Constructor Details

#initializeImageNtHeaders32

Returns a new instance of ImageNtHeaders32.



25
26
27
28
29
# File 'lib/exerb/win32/struct/image_nt_headers32.rb', line 25

def initialize
  @signature       = 0
  @file_header     = nil
  @optional_header = nil
end

Instance Attribute Details

#file_headerObject

Returns the value of attribute file_header.



31
32
33
# File 'lib/exerb/win32/struct/image_nt_headers32.rb', line 31

def file_header
  @file_header
end

#optional_headerObject

Returns the value of attribute optional_header.



31
32
33
# File 'lib/exerb/win32/struct/image_nt_headers32.rb', line 31

def optional_header
  @optional_header
end

#signatureObject

Returns the value of attribute signature.



31
32
33
# File 'lib/exerb/win32/struct/image_nt_headers32.rb', line 31

def signature
  @signature
end

Instance Method Details

#packObject



33
34
35
# File 'lib/exerb/win32/struct/image_nt_headers32.rb', line 33

def pack
  return [signature].pack('L') + @file_header.pack + @optional_header.pack
end

#read(io) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/exerb/win32/struct/image_nt_headers32.rb', line 41

def read(io)
  @position        = io.pos
  @signature       = io.read(4).unpack('L')[0]
  raise('nt headers have invalid signature') unless @signature == SIGNATURE
  @file_header     = Exerb::Win32::Struct::ImageFileHeader.read(io)
  @optional_header = Exerb::Win32::Struct::ImageOptionalHeader32.read(io)
  return self
end

#unpackObject

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/exerb/win32/struct/image_nt_headers32.rb', line 37

def unpack
  raise NotImplementedError
end