Method: Rex::OLE::DIFAT#read

Defined in:
lib/rex/ole/difat.rb

#readObject

low-level functions



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/rex/ole/difat.rb', line 83

def read
  @entries = []

  # start with the header part
  @entries += @stg.header._sectFat

  # double indirect fat
  sect = @stg.header._sectDifStart
  while (sect != SECT_END)
    if (@entries.include?(sect))
      raise RuntimeError, 'Sector chain loop detected (0x%08x)' % sect
    end

    @entries << sect
    buf = @stg.read_sector(sect, @stg.header.sector_size)

    # the last sect ptr in the block becomes the next entry
    sect = Util.get32(buf, ((@stg.header.idx_per_sect)-1) * 4)
  end

  # don't need these free ones, but it doesn't hurt to keep them.
  #@difat.delete(SECT_FREE)
end