VI Explorer Source code

The Source of this php-vi-Eplorer project code can be found at GitHub
https://github.com/tomsoftware/VI-Explorer

Short description

A .VI File is a container based file format. All the parts (I call them "Block"s) have names like "BDPW" or "FPHx" (the "x" stands for letter that indicates the Version of this Block eg. "a" or "b").
Every Block can (not very often) hold several subblocks (actually I don't know why).
Some Blocks are compress with the ZLIB data format (PHP: gzcompress()).
(see clLabView.php)

Block diagram

The block diagram is stored in the "BDHx"-block. It uses a binary tree format to store hierarchy structures. They use a kind of "tags" to open and close objects.

(see clObjFile.php for the binary Format and clBDHx.php)

Front panel

The binary format is the same as of the Block diagram but with slightly different types.

(see clObjFile.php for the binary Format and clFPHx.php)

Icons

For the different color-modes for the icons there are different Blocknames (e.g. "icl8", "icl4", "ICON"). The images are stored as binary bitmaps.

(see clIcon.php)

Version of the File

The Version of the vi file is stored in the "LVSR" and the "vers"-blocks.

(see clLVSR.php)

Terminals / Connections

All terminals for al used .VIs and the .VI itself are stored in the "VCTP"-block. The VCTP contains bottom-up objects. This means that objects can inherit from previous defined objects. So to define a cluster they define every element and than add a cluster-object with a index-table to the previous elements to be contained.
(see clVCTP.php)

Password protection

Every vi-File has the "BDPW"-Block that contains three 16-Byte binary md5 hashes.

The first is the hashed password.
The second is made from the first, the two blocks "LIBN", "LVSR" and since LV2012 a salt.
The third hash is created from the second and the Block diagram "BDHc"-block

The salt is a made from three 32-bit-intager values. These numbers are the count of the therminals (numbers, strings, paths) used in the vi file (see [Terminals / Connections]).

(see clBDPW.php - function getHash() )