[Libreoffice-commits] mso-dumper.git: msodumper/msometa.py
Miklos Vajna
vmiklos at collabora.co.uk
Fri May 12 09:29:07 UTC 2017
msodumper/msometa.py | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
New commits:
commit 5639dd87a294023f9eec0ef8005d7e2d673a7f91
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri May 12 11:28:15 2017 +0200
msometa: dump VectorHeader
diff --git a/msodumper/msometa.py b/msodumper/msometa.py
index ed8d151..ec62103 100644
--- a/msodumper/msometa.py
+++ b/msodumper/msometa.py
@@ -308,18 +308,39 @@ class TypedPropertyValue(BinaryStream):
elif self.Type == 0x0040: # VT_FILETIME
FILETIME(self, "Value").dump()
elif self.Type == 0x001E: # VT_LPSTR
- CodePageString(self, "Value").dump()
+ CodePageString(self, "Value", self.parent.getCodePage()).dump()
+ elif self.Type == 0x101E: # VT_VECTOR | VT_LPSTR
+ VectorHeader(self, "Value", self.parent.getCodePage()).dump()
else:
print '<todo what="TypedPropertyValue::dump: unhandled Type %s"/>' % hex(self.Type)
print '</typedPropertyValue%s>' % self.index
+class VectorHeader(BinaryStream):
+ """Defined by [MS-OLEPS] 2.14.2, represents the number of scalar values in
+ a vector property type."""
+ def __init__(self, parent, name, codepage):
+ BinaryStream.__init__(self, parent.bytes)
+ self.pos = parent.pos
+ self.parent = parent
+ self.name = name
+ self.codepage = codepage
+
+ def dump(self):
+ print '<%s type="VectorHeader">' % self.name
+ self.printAndSet("Length", self.readuInt32())
+ for dummy in range(self.Length):
+ CodePageString(self, "String", self.codepage).dump()
+ print '</%s>' % self.name
+
+
class CodePageString(BinaryStream):
- def __init__(self, parent, name):
+ def __init__(self, parent, name, codepage):
BinaryStream.__init__(self, parent.bytes)
self.pos = parent.pos
self.parent = parent
self.name = name
+ self.codepage = codepage
def dump(self):
print '<%s type="CodePageString">' % self.name
@@ -330,7 +351,7 @@ class CodePageString(BinaryStream):
if c == 0:
break
bytes.append(c)
- codepage = self.parent.parent.getCodePage()
+ codepage = self.codepage
if (codepage is not None) and (codepage < 0):
codepage += 2 ** 16 # signed -> unsigned
encoding = ""
More information about the Libreoffice-commits
mailing list