Class: SlowFat::BootSector

Inherits:
Object
  • Object
show all
Defined in:
lib/slowfat/bootsect.rb

Overview

BootSector handles accessing information inside the boot sector, such as BPB, signature, and boot code.

Defined Under Namespace

Classes: DataError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ BootSector

Initialize a new BootSector object (normally only called from Filesystem)

Parameters:

  • data (String)

    raw data making up this boot sector

Raises:



16
17
18
19
# File 'lib/slowfat/bootsect.rb', line 16

def initialize(data)
  (@jmp, @oem_name, @bpb, @ebpb, @boot_code, @boot_signature) = data.unpack('a3a8a25a26a448v')
  raise DataError, "Invalid boot signature in boot sector." if(@boot_signature != 0xAA55)
end

Instance Attribute Details

#oem_nameString (readonly)

Returns the OEM Name contained in this boot sector.

Returns:

  • (String)

    the OEM Name contained in this boot sector.



6
7
8
# File 'lib/slowfat/bootsect.rb', line 6

def oem_name
  @oem_name
end

Instance Method Details

#bios_parameter_blockBiosParameterBlock

Parse out and return a BIOS Parameter Block from this boot sector

Returns:



24
25
26
# File 'lib/slowfat/bootsect.rb', line 24

def bios_parameter_block
  BiosParameterBlock.new @bpb
end

#extended_bios_parameter_blockExtendedBiosParameterBlock

Parse out and return an Extended BIOS Parameter Block from this boot sector

Returns:



31
32
33
# File 'lib/slowfat/bootsect.rb', line 31

def extended_bios_parameter_block
  ExtendedBiosParameterBlock.new @ebpb
end