Class: Mapi::Pst::RawPropertyStore

Inherits:
BlockParser show all
Includes:
Enumerable
Defined in:
lib/mapi/pst.rb

Overview

RawPropertyStore is used to iterate through the properties of an item, or the auxiliary data for an attachment. its just a parser for the way the properties are serialized, when the properties don’t have to conform to a column structure.

structure of this chunk of data is often

header, property keys, data values, and then indexes.

the property keys has value in it. value can be the actual value if its a short type, otherwise you lookup the value in the indicies, where you get the offsets to use in the main data body. due to the indirect thing though, any of these parts could actually come from a separate stream.

Constant Summary

Constants inherited from BlockParser

BlockParser::ID2_ATTACHMENTS, BlockParser::ID2_RECIPIENTS, BlockParser::IMMEDIATE_TYPES, BlockParser::INDIRECT_TYPES, BlockParser::PR_BODY_HTML, BlockParser::PR_SUBJECT, BlockParser::TYPES

Instance Attribute Summary collapse

Attributes inherited from BlockParser

#data, #data_chunks, #desc, #offset_tables

Instance Method Summary collapse

Methods inherited from BlockParser

#get_data_indirect, #get_data_indirect_io, #handle_indirect_values, #idx2, #load_header

Constructor Details

#initialize(desc) ⇒ RawPropertyStore

Returns a new instance of RawPropertyStore.

Raises:



1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
# File 'lib/mapi/pst.rb', line 1277

def initialize desc
	super
	raise FormatError, "expected type 1 - got #{@type}" unless @type == 1

	# the way that offset works, data1 may be a subset of buf, or something from id2. if its from buf,
	# it will be offset based on index_offset and offset. so it could be some random chunk of data anywhere
	# in the thing.
	header_data = get_data_indirect @offset1
	raise FormatError if header_data.length < 8
	signature, offset2 = header_data.unpack 'V2'
	#p [@type, signature]
	raise FormatError, 'unhandled block signature 0x%08x' % @type if signature != 0x000602b5
	# this is actually a big chunk of tag tuples.
	@index_data = get_data_indirect offset2
	@length = @index_data.length / 8
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



1276
1277
1278
# File 'lib/mapi/pst.rb', line 1276

def length
  @length
end

Instance Method Details

#eachObject

iterate through the property tuples



1295
1296
1297
1298
1299
1300
# File 'lib/mapi/pst.rb', line 1295

def each
	length.times do |i|
		key, type, value = handle_indirect_values(*@index_data[8 * i, 8].unpack('vvV'))
		yield key, type, value
	end
end