5.1. lf.apps.msoffice.shared — Shared Microsoft Office artifacts
This module defines classes to work with functionality shared across several
Microsoft Office products. The classes are designed to extend/override some of
the classes in lf.win.ole.ps.
5.1.1. Inheritance Diagrams
5.1.1.1. Common data types
5.1.1.2. Typed Property Value (TPV) classes
5.1.3. Common data types
-
class lf.apps.msoffice.shared.VtThumbnailValue
Represents a VtThumbnailValue structure.
-
data
- The data for the thumbnail image. If tag is 0, then this field
will contain whatever data is between the tag field and the end
of the packet.
-
tag
- The value of the cftag field. This is the format field from the
VT_CF type. If this value is 0, then the
format_id attribute is None.
-
format_id
- The format of the data in data.
-
value
- An alias for the data attribute.
-
format
- An alias for the tag attribute.
-
classmethod from_stream(stream, offset=None)
Creates a VtThumbnailValue from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
|
Return type: | VtThumbnailValue
|
Returns: | The corresponding VtThumbnailValue object.
|
-
class lf.apps.msoffice.shared.Lpstr
Represents an Lpstr structure (packet).
Note
This is essentially a CodePageString that if
properly decoded, is truncated at the first NULL character.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates an Lpstr from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | Lpstr
|
Returns: | The corresponding Lpstr object.
|
-
class lf.apps.msoffice.shared.UnalignedLpstr
Represents an UnalignedLpstr structure (packet).
Note
This is similar to a CodePageString, except
that it is NULL terminated and does not have padding.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates an UnalignedLpstr from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | UnalignedLpstr
|
Returns: | The corresponding UnalignedLpstr object.
|
-
class lf.apps.msoffice.shared.VtVecUnalignedLpstrValue
Represents a VtVecUnalignedLpstrValue structure (packet).
-
scalar_count
- The number of strings in the data.
-
value
- A list of (unaligned) strings.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtVecUnalignedLpstrValue from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtVecUnalignedLpstrValue
|
Returns: | The corresponding VtVecUnalignedLpstrValue object.
|
-
class lf.apps.msoffice.shared.Lpwstr
Represents a Lpwstr structure (packet).
Note
This class is essentially a UnicodeString
class, but was included for purposes of completeness.
-
class lf.apps.msoffice.shared.VtVecLpwstrValue
Represents a VtVecLpwstrValue structure (packet).
Note
This class is essentially a Vector class that
has a hard coded scalar type of Lpwstr.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtVecLpwstrValue from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtVecLpwstrValue
|
Returns: | The corresponding VtVecLpwstrValue object.
|
-
class lf.apps.msoffice.shared.VtHeadingPair
Represents a VtHeadingPair structure (packet).
-
heading_str
- The header string as a VtUnalignedString.
- A VT_I4 instance, where the
value attribute is the number of document
parts associated with the header.
-
value
- An alias for the heading_str attribute.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtHeadingPair from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtHeadingPair
|
Returns: | The corresponding VtHeadingPair object.
|
-
class lf.apps.msoffice.shared.VtVecHeadingPairValue
Represents a VtVecHeadingPairValue structure (packet).
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtVecHeadingPairValue from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtVecHeadingPairValue
|
Returns: | The corresponding VtVecHeadingPairValue object.
|
-
class lf.apps.msoffice.shared.VtDigSigValue
Represents a VtDigSigValue structure (packet).
-
value
- An instance of DigSigBlob.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtDigSigValue from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtDigSigValue
|
Returns: | The corresponding VtDigSigValue object.
|
-
class lf.apps.msoffice.shared.VtHyperlink
Represents a VtHyperlink structure (packet).
-
hash
- The value of the dwHash field (hash of hlink1 and
hlink2)
-
app
- The value of the dwApp field.
-
office_art
- The value of the dwOfficeArt field.
-
info
- The value of the dwInfo field.
-
hlink1
- The hyperlink target.
-
hlink2
- The hyperlink location.
-
value
- An alias for the hlink2 attribute.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtHyperlink from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtHyperlink
|
Returns: | The corresponding VtHyperlink object.
|
-
class lf.apps.msoffice.shared.VecVtHyperlink
Represents a VecVtHyperlink structure (packet).
-
hyperlinks
- A list of VtHyperlink objects.
-
value
- An alias for the hyperlinks attribute.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VecVtHyperlink from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VecVtHyperlink
|
Returns: | The corresponding VecVtHyperlink object.
|
-
class lf.apps.msoffice.shared.VtHyperlinkValue
Represents a VtHyperlinkValue structure (packet).
-
vec_hyperlinks
- An instance of VecVtHyperlink.
-
value
- An alias for the vec_hyperlinks attribute.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtHyperlinkValue from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtHyperlinkValue
|
Returns: | The corresponding VtHyperlinkValue object.
|
-
class lf.apps.msoffice.shared.DigSigBlob
Represents a DigSigBlob structure (packet).
-
sig_info_offset
- The offset of the sig_info attribute.
-
sig_info
- An instance of DigSigInfoSeralized.
-
value
- An alias for the sig_info attribute.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a DigSigBlob from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | DigSigBlob
|
Returns: | The corresponding DigSigBlob object.
|
-
class lf.apps.msoffice.shared.DigSigInfoSerialized
Represents a DigSigInfoSerialized structure (packet).
-
sig_size
- The size of the sig_buf attribute.
-
sig_offset
- The relative offset (from the parent structure) of the sig_buf
attribute. If the parent structure is a DigSigBlob then the
offset is relative to the start of the parent structure. If the parent
structure is a WordSigBlob Then the offset is relative to the
cbSigInfo field of the parent structure.
-
cert_store_size
- The size of the cert_store_buf attribute.
-
cert_store_offset
- The relative offset (from the parent structure) of the
cert_store_buf attribute. If the parent structure is a
DigSigBlob then the offset is relative to the start of the
parent structure. If the parent structure is a WordSigBlob
Then the offset is relative to the cbSigInfo field of the
parent structure.
-
proj_name_size
- The size of the proj_name_buf attribute.
-
proj_name_offset
- The relative offset (from the parent structure) of the
proj_name_buf attribute. If the parent structure is a
DigSigBlob then the offset is relative to the start of the
parent structure. If the parent structure is a WordSigBlob
Then the offset is relative to the cbSigInfo field of the
parent structure.
-
timestamp
- The value of the fTimestamp field.
-
timestamp_buf_size
- The size of the timestamp_buf attribute.
-
timestamp_buf_offset
- The relative offset (from the parent structure) of the
timestamp_buf attribute. If the parent structure is a
DigSigBlob then the offset is relative to the start of the
parent structure. If the parent structure is a WordSigBlob
Then the offset is relative to the cbSigInfo field of the
parent structure.
-
sig_buf
- The VBA digital signature.
-
cert_store_buf
- The digital certificate information of the certificate used to create
the digital signature.
-
proj_name_buf
- The rchProjectNameBuffer field.
-
timestamp_buf
- The rchTimestampBuffer field.
-
classmethod from_stream(stream, field_base, offset=None, decoder=None)
Creates a DigSigInfoSerialized from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- field_base (int) – A value to add to the various offset fields, to
determine where the corresponding fields start. For
DigSigBlob this is the start of the
DigSigBlob structure. For WordSigBlob
this is the start of the sig_info field.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtVecHeadingPairValue
|
Returns: | The corresponding VtVecHeadingPairValue object.
|
5.1.4. Typed Property Value (TPV) classes
-
class lf.apps.msoffice.shared.VtThumbnail
Represents a VtThumbnail structure (packet).
-
value
- An instance of VtThumbnailValue.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtThumbnail from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (None) – This parameter is not used.
|
Return type: | VtThumbnail
|
Returns: | The corresponding VtThumbnail object.
|
-
class lf.apps.msoffice.shared.VtVecUnalignedLpstr
Represents a VtVecUnalignedLpstr structure (packet).
-
value
- An instance of VtVecUnalignedLpstrValue.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtVecUnalignedLpstr from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtVecUnalignedLpstr
|
Returns: | The corresponding VtVecUnalignedLpstr object.
|
-
class lf.apps.msoffice.shared.VtVecLpwstr
Represents a VtVecLpwstr structure (packet).
-
value
- A list of VtVecLpwstrValue objects.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtVecLpwstr from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtVecLpwstr
|
Returns: | The corresponding VtVecLpwstr object.
|
-
class lf.apps.msoffice.shared.VtString
Represents a VtString structure (packet).
-
value
- The value of either Lpstr or Lpwstr objects,
depending on the type attribute.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtString from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtString
|
Returns: | The corresponding VtString object.
|
-
class lf.apps.msoffice.shared.VtUnalignedString
Represents a VtUnalignedString structure (packet).
-
value
- The value of either UnalignedLpstr or Lpwstr objects,
depending on the type attribute.
-
str_type
- An alias for the type field.
-
str_value
- An alias for the value field.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtUnalignedString from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtUnalignedString
|
Returns: | The corresponding VtUnalignedString object.
|
-
class lf.apps.msoffice.shared.VtVecHeadingPair
Represents a VtVecHeadingPair structure (packet).
-
value
- An instance of a VtVecHeadingPairValue.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtVecHeadingPair from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtVecHeadingPair
|
Returns: | The corresponding VtVecHeadingPair object.
|
-
class lf.apps.msoffice.shared.VtDigSig
Represents a VtDigSig structure (packet).
-
value
- An instance of VtDigSigValue.
-
classmethod from_stream(stream, offset=None, decoder=_uft16_le_decoder)
Creates a VtDigSig from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtDigSig
|
Returns: | The corresponding VtDigSig object.
|
-
class lf.apps.msoffice.shared.VtHyperlinks
Represents a VtHyperlinks structure (packet).
-
value
- An instance of VtHyperlinkValue.
-
classmethod from_stream(stream, offset=None, decoder=None)
Creates a VtHyperlinks from a stream.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | VtHyperlinks
|
Returns: | The corresponding VtHyperlinks object.
|
5.1.5. Building properties
-
class lf.apps.msoffice.shared.PropertyFactory
Makes various property objects, using the classes from this module where
appropriate.
-
classmethod make(stream, offset=None, decoder=None)
Makes a Packet object.
Parameters: |
- stream (IStream) – A stream that contains the structure.
- offset (int) – The start of the structure in stream.
- decoder (codecs.codec) – An optional codec to decode the string.
|
Return type: | Packet
|
Returns: | The corresponding Packet (or
subclass) object.
|
-
class lf.apps.msoffice.shared.Builder
Builds property set streams, property sets, and properties.
Builds a PropertySetStreamHeader from a stream.
-
classmethod build_properties(stream, property_set, offset=None, fmtid=None, decoder=None)
Builds a dictionary of PropertyPacket objects.
Parameters: |
- stream (IStream) – A stream that contains the property structures.
- fmtid (UUID) – The FMTID of the property set.
- property_set (PropertySetHeader) – A PropertySetHeader object that describes
the properties in the property set.
- offset (int) – The start of the structures in stream.
- decoder (codecs.codec) – A codec to decode string properties.
|
Return type: | dict
|
Returns: | A dictionary of property identifiers (keys) and the
corresponding PropertyPacket objects
(values).
|
-
classmethod build_summary_info_properties(stream, property_set, offset=None, fmtid=None, decoder=None)
Builds a dictionary of PropertyPacket objects.
Parameters: |
- stream (IStream) – A stream that contains the property structures.
- property_set (PropertySetHeader) – A PropertySetHeader object that describes
the properties in the property set.
- offset (int) – The start of the structures in stream.
- fmtid (UUID) – The FMTID of the property set.
- decoder (codecs.codec) – A codec to decode string properties.
|
Return type: | dict
|
Returns: | A dictionary of property identifiers (keys) and the
corresponding PropertyPacket objects
(values).
|
-
classmethod build_doc_summary_info_properties(stream, property_set, offset=None, fmtid=None, decoder=None)
Builds a dictionary of PropertyPacket objects.
Parameters: |
- stream (IStream) – A stream that contains the property structures.
- fmtid (UUID) – The FMTID of the property set.
- property_set (PropertySetHeader) – A PropertySetHeader object that describes
the properties in the property set.
- offset (int) – The start of the structures in stream.
- decoder (codecs.codec) – A codec to decode string properties.
|
Return type: | dict
|
Returns: | A dictionary of property identifiers (keys) and the
corresponding PropertyPacket objects
(values).
|
5.1.6. Metadata
-
class lf.apps.msoffice.shared.SummaryInfo
Parsed properties from a Summary Information stream.
-
title
- The title of the document.
-
subject
- The subject of the document.
-
author
- The document’s author.
-
keywords
- Keywords for the document.
- The document’s comments.
-
template
- The template used for the document.
-
last_author
- The last author who modified the document.
-
rev
- The revision number.
-
edit_time_tot
- The total time spent modifying (editing) the document.
-
print_time
- The time the document was last printed.
-
btime
- The creation time of the document.
-
mtime
- The time the document was last saved.
-
page_count
- The number of pages in the document.
-
word_count
- The number of words in the document.
-
char_count
- The number of characters in the document.
-
thumbnail
- An image used as a thumbnail of the document.
-
app_name
- The name of the application that created the document.
-
security
- The document’s security
-
classmethod from_properties(properties)
Creates a SummaryInfo from properties.
Parameter: | properties (dict) – A dictionary of property identifiers (keys) and the
corresponding PropertyPacket
objects. |
Return type: | SummaryInfo |
Returns: | The corresponding SummaryInfo object. |
-
class lf.apps.msoffice.shared.DocSummaryInfo
Parsed properties from a Document Summary Information stream.
-
category
- The document category.
-
pres_format
- The presentation format.
-
byte_count
- The size of the document in bytes.
-
para_count
- The number of paragraphs in the document.
-
slide_count
- The number of slides in the document.
-
note_count
- The number of notes in the document.
-
hidden_count
- The number of hidden slides.
-
mm_clip_count
- The number of multimedia clips in the document.
-
scale
- The value of GKPIDDSI_SCALE.
-
heading_pair
- A list of (heading string, document part count) tuples.
-
doc_parts
- A list of strings of the document parts, in the same order as the
elements of heading_pair.
-
manager
- The manager associated with the document.
-
company
- The company associated with the document.
-
links_dirty
- True if any linked properties in a User Defined Property Set have
changed outside of the application.
-
char_count_full
- The number of characters in the document, including whitespace.
-
shared_doc
- The value of GKPIDDSI_SHAREDDOC.
-
link_base
- The base URL for converting relative links.
-
hlinks
- A list of hyperlinks.
-
hyperlinks_changed
- True if the “_PID_HLINKS” property in a User Defined Property set has
changed outside of the application.
-
ver_major
- The major version of the application that wrote the document.
-
ver_minor
- The minor version of the application that wrote the document.
-
dig_sig
- A VBA digital signature.
-
content_type
- The document’s content type.
-
content_status
- The document’s content status.
-
language
- The language associated with the document.
-
doc_version
- The version of the document.
-
classmethod from_properties(properties)
Creates a DocSummaryInfo from properties.
-
class lf.apps.msoffice.shared.UserDefinedProperties
Parsed properties from a User Defined Properties property set.
-
linked
- A list of linked properties, in the form of (name, pid) tuples.
-
guid
- The _PID_GUID property (decoded if possible).
-
link_base
- The _PID_LINKBASE property (decoded if possible).
-
hlinks
- The _PID_HLINKS property. This is a list of tuples in the form of:
(hash, app, office_art, info, hlink1, hlink2)
-
classmethod from_properties(properties)
Creates a UserDefinedProperties from properties.