LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format of the variant in binary file

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 

variant struct.png

 

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: IntroductionSection "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.

Message 11 of 12
(773 Views)

Cool 🙂

 

I remember this spreadsheet well!  Thanks for contribuiting!


Regards,

Peter D

0 Kudos
Message 12 of 12
(753 Views)