Commit d31c4d90778eefa0219fab30451eb8b3f23e01a6
1 parent
d57401a8
oleform: extract caption from labels
Showing
1 changed file
with
16 additions
and
1 deletions
oletools/oleform.py
| ... | ... | @@ -415,7 +415,21 @@ def consume_LabelControl(stream): |
| 415 | 415 | cbLabel = stream.unpack('<H', 2) |
| 416 | 416 | with stream.will_jump_to(cbLabel): |
| 417 | 417 | propmask = LabelPropMask(stream.unpack('<L', 4)) |
| 418 | - # Skip the DataBlock and the ExtraDataBlock | |
| 418 | + # LabelDataBlock: [MS-OFORMS] 2.2.4.3 | |
| 419 | + with stream.padded_struct(): | |
| 420 | + propmask.consume(stream, [('fForeColor', 4), ('fBackColor', 4), | |
| 421 | + ('fVariousPropertyBits', 4)]) | |
| 422 | + if propmask.fCaption: | |
| 423 | + caption_size = consume_CountOfBytesWithCompressionFlag(stream) | |
| 424 | + else: | |
| 425 | + caption_size = 0 | |
| 426 | + propmask.consume(stream, [('fPicturePosition', 4), ('fMousePointer', 1), | |
| 427 | + ('fBorderColor', 4), ('fBorderStyle', 2), | |
| 428 | + ('fSpecialEffect', 2), ('fPicture', 2), | |
| 429 | + ('fAccelerator', 2), ('fMouseIcon', 2)]) | |
| 430 | + # LabelExtraDataBlock: [MS-OFORMS] 2.2.4.4 | |
| 431 | + caption = stream.read(caption_size) | |
| 432 | + stream.read(8) | |
| 419 | 433 | # LabelStreamData: [MS-OFORMS] 2.2.4.5 |
| 420 | 434 | if propmask.fPicture: |
| 421 | 435 | consume_GuidAndPicture(stream) |
| ... | ... | @@ -423,6 +437,7 @@ def consume_LabelControl(stream): |
| 423 | 437 | consume_GuidAndPicture(stream) |
| 424 | 438 | # TextProps |
| 425 | 439 | consume_TextProps(stream) |
| 440 | + return caption | |
| 426 | 441 | |
| 427 | 442 | def consume_ScrollBarControl(stream): |
| 428 | 443 | # ScrollBarControl: [MS-OFORMS] 2.2.7.1 | ... | ... |