Class: Resilience::MBR
Constant Summary
collapse
- SIG_ADDRESS =
0x1FE
- SIG =
[0x55, 0xAA]
- PARTITION_ADDRESSES =
[0x1C6, 0x1D6, 0x1E6, 0x1F6]
Constants inherited
from BootTable
BootTable::SECTOR_SIZE
Instance Method Summary
collapse
Methods inherited from BootTable
#refs_offset, #refs_offsets
Methods included from OnImage
#image, image, included, restore_pos, #restore_pos, store_pos, #store_pos
Instance Method Details
#detected? ⇒ Boolean
33
34
35
36
37
|
# File 'lib/resilience/tables/boot.rb', line 33
def detected?
image.seek SIG_ADDRESS
sig = image.read(2)
sig == SIG
end
|
#fs_offsets ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/resilience/tables/boot.rb', line 39
def fs_offsets
offsets = []
PARTITION_ADDRESSES.each do |address|
image.seek address
address = image.read(4).unpack('V').first
offsets << address * SECTOR_SIZE unless address == 0
end
offsets
end
|
#gpt_offset ⇒ Object
59
60
61
|
# File 'lib/resilience/tables/boot.rb', line 59
def gpt_offset
gpt_offsets.first
end
|
#gpt_offsets ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/resilience/tables/boot.rb', line 49
def gpt_offsets
offsets = []
fs_offsets.each do |address|
image.seek address
sig = image.read(GPT::SIG.size).unpack('C*')
offsets << address if sig == GPT::SIG
end
offsets
end
|