10-12-2015 05:06 AM
Hi. I've been challenged with reading a LabView variant type from a binary file too and this topic has been of great help for me. I wanted to add my findings along with relevant references to help anyone tasked with the same problem.
So, to continue previous comments (new and corrected fields in bold):
Comments:
1. Variant pointer. Couldn't find a reference for this part. So no reliable links on its' structure and meaning so far.
2. Number of Type Descriptors in the file. Reference: Introduction.
3. Type Descriptor Length. Includes the size field itself, may include a control name (as it does in our case) and is rounded up to a multiple of two. References: Introduction, Section "Data Types", text after the tables.
4. Type Description. xx 30 for a string, xx - reserved bytes. Reference: Section "Data Types", second table.
5. Length. FF FF FF FF for fields of variable size. Reference: Section "String, Path, and Picture Data Types".
6. Length of a control name
7. Control name - text string (53 54 52 49 4E 47 - is "STRING" in hex values, the same as 41 42 43 is "ABC" in Data field)
8. Padding as mentioned in 3.
9. Number of type descriptors actually used. There's only 1 type in this file and it's acutally used. Note: If the value is greater than or equal to 32768, it is stored in four bytes [instead of 2] with the high bit set to one. Reference: Introduction.
10. Zero-based index for the Type Descriptor being used. Note: If the value is greater than or equal to 32768, it is stored in four bytes [instead of 2] with the high bit set to one. Reference: Introduction.
11. Length of the Data string
12. Data string ("ABC" in hex values)
13. Padding. Again, couldn't find a reference. Is it always 00 00 00 00 or is there a difference?
Hope this helps someone.
Corrections, additions and comments are appreciated.
10-12-2015 06:37 AM