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, BlockParser::USE_MAIN_DATA

Instance Attribute Summary collapse

Attributes inherited from BlockParser

#data_chunks, #node

Instance Method Summary collapse

Methods inherited from BlockParser

#get_data_array, #get_data_indirect, #get_data_indirect_io, #handle_indirect_values, #load_page_header, #load_root_header

Constructor Details

#initialize(node, local_node_id = USE_MAIN_DATA) ⇒ RawPropertyStore

Will read Property Context (PC)

Parameters:

  • desc (NodePtr)
  • local_node_id (Integer) (defaults to: USE_MAIN_DATA)

Raises:

See Also:



1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
# File 'lib/mapi/pst.rb', line 1316

def initialize node, local_node_id = USE_MAIN_DATA
	super
	bTypePC = 0xbc
	raise FormatError, "expected type 188 - got #{@heap_type}" unless @heap_type == bTypePC

	# 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'
	raise FormatError, 'invalid Property Context 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

#lengthInteger (readonly)

Returns number of property tuples.

Returns:

  • (Integer)

    number of property tuples



1309
1310
1311
# File 'lib/mapi/pst.rb', line 1309

def length
  @length
end

Instance Method Details

#each {|key, type, value| ... } ⇒ Object

iterate through the property tuples

Yields:

  • (key, type, value)

Yield Parameters:

  • key (Integer)
  • type (Integer)
  • value (Object)


1339
1340
1341
1342
1343
1344
# File 'lib/mapi/pst.rb', line 1339

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