From 483938f60e083577c713a026f5eafc33951c1fd7 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 16 Sep 2020 15:25:18 +0200 Subject: emf-dump: CommentIdentifier is optional, don't fail if it's missing Change-Id: Ic73a21642155dac89096dcb2d263d9f50e695306 --- msodumper/binarystream.py | 2 +- msodumper/emfrecord.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/msodumper/binarystream.py b/msodumper/binarystream.py index 9ab829d..bdd8f37 100644 --- a/msodumper/binarystream.py +++ b/msodumper/binarystream.py @@ -28,7 +28,7 @@ class BinaryStream: return attrs = "" if dict: - if value in dict or not default: + if value in dict or default is None: attrs += ' name="%s"' % dict[value] else: attrs += ' name="%s"' % default diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py index be66124..f0e38c0 100644 --- a/msodumper/emfrecord.py +++ b/msodumper/emfrecord.py @@ -297,7 +297,7 @@ class EmrComment(EMFRecord): self.printAndSet("Type", self.readuInt32()) self.printAndSet("Size", self.readuInt32(), hexdump=False) self.printAndSet("DataSize", self.readuInt32(), hexdump=False) - self.printAndSet("CommentIdentifier", self.readuInt32(), dict=CommentIdentifier) + self.printAndSet("CommentIdentifier", self.readuInt32(), dict=CommentIdentifier, default="") if self.CommentIdentifier == 0x00000000: # EMR_COMMENT_EMFSPOOL print('') elif self.CommentIdentifier == 0x2B464D45: # EMR_COMMENT_EMFPLUS @@ -305,7 +305,7 @@ class EmrComment(EMFRecord): elif self.CommentIdentifier == 0x43494447: # EMR_COMMENT_PUBLIC EmrCommentPublic(self).dump() else: - print('' % hex(commentIdentifier)) + print('' % hex(self.CommentIdentifier)) class EmrSetviewportorgex(EMFRecord): -- cgit v1.2.3