Class: Exerb::Win32::Struct::ImageDosHeader

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

Overview

#

Constant Summary collapse

FORMAT =
'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSL'
SIGNATURE =
0x5A4D

Instance Attribute Summary collapse

Attributes inherited from Base

#position

Instance Method Summary collapse

Methods inherited from Base

read, #read, #size, #update

Constructor Details

#initializeImageDosHeader

Returns a new instance of ImageDosHeader


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 24

def initialize
  @magic                       = 0
  @last_page_size              = 0
  @total_pages_in_file         = 0
  @relocation_items            = 0
  @paragraphs_in_header        = 0
  @minimum_extra_paragraphs    = 0
  @maximum_extra_paragraphs    = 0
  @initial_stack_segment       = 0
  @initial_stack_pointer       = 0
  @complemented_checksum       = 0
  @initial_instraction_pointer = 0
  @initial_code_segment        = 0
  @relocation_table_offset     = 0
  @overlay_number              = 0
  @reserved1_1                 = 0
  @reserved1_2                 = 0
  @reserved1_3                 = 0
  @reserved1_4                 = 0
  @oem_identifier              = 0
  @oem_information             = 0
  @reserved2_1                 = 0
  @reserved2_2                 = 0
  @reserved2_3                 = 0
  @reserved2_4                 = 0
  @reserved2_5                 = 0
  @reserved2_6                 = 0
  @reserved2_7                 = 0
  @reserved2_8                 = 0
  @reserved2_9                 = 0
  @reserved2_10                = 0
  @offset_to_new_header        = 0
end

Instance Attribute Details

#complemented_checksumObject

Returns the value of attribute complemented_checksum


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def complemented_checksum
  @complemented_checksum
end

#initial_code_segmentObject

Returns the value of attribute initial_code_segment


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def initial_code_segment
  @initial_code_segment
end

#initial_instraction_pointerObject

Returns the value of attribute initial_instraction_pointer


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def initial_instraction_pointer
  @initial_instraction_pointer
end

#initial_stack_pointerObject

Returns the value of attribute initial_stack_pointer


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def initial_stack_pointer
  @initial_stack_pointer
end

#initial_stack_segmentObject

Returns the value of attribute initial_stack_segment


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def initial_stack_segment
  @initial_stack_segment
end

#last_page_sizeObject

Returns the value of attribute last_page_size


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def last_page_size
  @last_page_size
end

#magicObject

Returns the value of attribute magic


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def magic
  @magic
end

#maximum_extra_paragraphsObject

Returns the value of attribute maximum_extra_paragraphs


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def maximum_extra_paragraphs
  @maximum_extra_paragraphs
end

#minimum_extra_paragraphsObject

Returns the value of attribute minimum_extra_paragraphs


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def minimum_extra_paragraphs
  @minimum_extra_paragraphs
end

#oem_identifierObject

Returns the value of attribute oem_identifier


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def oem_identifier
  @oem_identifier
end

#oem_informationObject

Returns the value of attribute oem_information


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def oem_information
  @oem_information
end

#offset_to_new_headerObject

Returns the value of attribute offset_to_new_header


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def offset_to_new_header
  @offset_to_new_header
end

#overlay_numberObject

Returns the value of attribute overlay_number


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def overlay_number
  @overlay_number
end

#paragraphs_in_headerObject

Returns the value of attribute paragraphs_in_header


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def paragraphs_in_header
  @paragraphs_in_header
end

#relocation_itemsObject

Returns the value of attribute relocation_items


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def relocation_items
  @relocation_items
end

#relocation_table_offsetObject

Returns the value of attribute relocation_table_offset


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def relocation_table_offset
  @relocation_table_offset
end

#reserved1_1Object

Returns the value of attribute reserved1_1


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved1_1
  @reserved1_1
end

#reserved1_2Object

Returns the value of attribute reserved1_2


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved1_2
  @reserved1_2
end

#reserved1_3Object

Returns the value of attribute reserved1_3


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved1_3
  @reserved1_3
end

#reserved1_4Object

Returns the value of attribute reserved1_4


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved1_4
  @reserved1_4
end

#reserved2_1Object

Returns the value of attribute reserved2_1


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_1
  @reserved2_1
end

#reserved2_10Object

Returns the value of attribute reserved2_10


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_10
  @reserved2_10
end

#reserved2_2Object

Returns the value of attribute reserved2_2


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_2
  @reserved2_2
end

#reserved2_3Object

Returns the value of attribute reserved2_3


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_3
  @reserved2_3
end

#reserved2_4Object

Returns the value of attribute reserved2_4


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_4
  @reserved2_4
end

#reserved2_5Object

Returns the value of attribute reserved2_5


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_5
  @reserved2_5
end

#reserved2_6Object

Returns the value of attribute reserved2_6


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_6
  @reserved2_6
end

#reserved2_7Object

Returns the value of attribute reserved2_7


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_7
  @reserved2_7
end

#reserved2_8Object

Returns the value of attribute reserved2_8


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_8
  @reserved2_8
end

#reserved2_9Object

Returns the value of attribute reserved2_9


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def reserved2_9
  @reserved2_9
end

#total_pages_in_fileObject

Returns the value of attribute total_pages_in_file


58
59
60
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 58

def total_pages_in_file
  @total_pages_in_file
end

Instance Method Details

#packObject


60
61
62
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 60

def pack
  return [@magic, @last_page_size, @total_pages_in_file, @relocation_items, @paragraphs_in_header, @minimum_extra_paragraphs, @maximum_extra_paragraphs, @initial_stack_segment, @initial_stack_pointer, @complemented_checksum, @initial_instraction_pointer, @initial_code_segment, @relocation_table_offset, @overlay_number, @reserved1_1, @reserved1_2, @reserved1_3, @reserved1_4, @oem_identifier, @oem_information, @reserved2_1, @reserved2_2, @reserved2_3, @reserved2_4, @reserved2_5, @reserved2_6, @reserved2_7, @reserved2_8, @reserved2_9, @reserved2_10, @offset_to_new_header].pack(FORMAT)
end

#unpack(bin) ⇒ Object


64
65
66
67
68
# File 'lib/exerb/win32/struct/image_dos_header.rb', line 64

def unpack(bin)
  @magic, @last_page_size, @total_pages_in_file, @relocation_items, @paragraphs_in_header, @minimum_extra_paragraphs, @maximum_extra_paragraphs, @initial_stack_segment, @initial_stack_pointer, @complemented_checksum, @initial_instraction_pointer, @initial_code_segment, @relocation_table_offset, @overlay_number, @reserved1_1, @reserved1_2, @reserved1_3, @reserved1_4, @oem_identifier, @oem_information, @reserved2_1, @reserved2_2, @reserved2_3, @reserved2_4, @reserved2_5, @reserved2_6, @reserved2_7, @reserved2_8, @reserved2_9, @reserved2_10, @offset_to_new_header = bin.unpack(FORMAT)
  raise("dos header has invalid signature") unless @magic == SIGNATURE
  return self
end