Update oleform to fix a padding bug and add an enhancement #775
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR includes one bug fix and one enhancement addition.
The properties of type String are stored in OLE form stream with a padding of multiples of four bytes as mentioned in MS-OFORMS section 2.1.1.2.4 - Padding and Alignment. Various properties which are of type String (specifically fmString) such as Name, ControlTipText, Caption etc. were being read in oleform without accounting for this padding. This often lead to prepending of 1-3 to junk bytes at the start of extracted value (and discarded an equal number of valid bytes at the end of value). 1b2cf45 fixes this bug by using
stream.will_pad()
whenever a String value is read.Controls having ClsidCacheIndex = 14, called Frame control, can have child controls embedded in them while the control itself is embedded in a parent control. In such cases, an i n child stream exists within the parent stream directory - n being the ID of the Frame control. This is described in section 2.1.2.2.2 - Embedded Parents. This i stream may contain certain properties such as Caption of the Frame Control. fd0f0c5 adds a function
consume_EmbeddedFormControl()
to extract Caption property in such cases for Frame controls. This commit also relies on bc7c53f which fixes a minor bug inFormPropMask _names
list.More information and context around these changes can be found in my blog post.