62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/rex/ole/fat.rb', line 62
def write(difat)
difat.reset
fat_sects = []
left = @entries.length
while (left > 0)
if (left > @stg..idx_per_sect)
left -= @stg..idx_per_sect
else
left = 0
end
fat_sects << allocate_sector(SECT_FAT)
end
copy = @entries.dup
fat_sects.each { |fs|
part = copy.slice!(0, @stg..idx_per_sect)
sbuf = Util.pack32array(part)
if (sbuf.length != @stg..sector_size)
raise RuntimeError, 'Unsupported number of fat sectors (not multiple of idx per sect)'
end
@stg.write_sector_raw(fs, sbuf)
difat << fs
}
end
|