Struct.new( :magic, :clsid, :minor_ver, :major_ver, :byte_order, :b_shift, :s_shift, :reserved, :csectdir, :num_bat, :dirent_start, :transacting_signature, :threshold, :sbat_start, :num_sbat, :mbat_start, :num_mbat
A class which wraps the ole header
Header.new can be both used to load from a string, or to create from defaults. Serialization is accomplished with the to_s method.
# File lib/ole/storage/base.rb, line 375 def validate! raise FormatError, "OLE2 signature is invalid" unless magic == MAGIC if num_bat == 0 or # is that valid for a completely empty file? # not sure about this one. basically to do max possible bat given size of mbat num_bat > 109 && num_bat > 109 + num_mbat * (1 << b_shift - 2) or # shouldn't need to use the mbat as there is enough space in the header block num_bat < 109 && num_mbat != 0 or # given the size of the header is 76, if b_shift <= 6, blocks address the header. s_shift > b_shift or b_shift <= 6 or b_shift >= 31 or # we only handle little endian byte_order != "\xfe\xff" raise FormatError, "not valid OLE2 structured storage file" end # relaxed this, due to test-msg/qwerty_[1-3]*.msg they all had # 3 for this value. # transacting_signature != "\x00" * 4 or if threshold != 4096 or num_mbat == 0 && mbat_start != AllocationTable::EOC or reserved != "\x00" * 6 Log.warn "may not be a valid OLE2 structured storage file" end true end
Generated with the Darkfish Rdoc Generator 2.