Task 796: .VST File Format

Task 796: .VST File Format

File Format Specifications for the .VST File Format

The .VST file format is associated with Microsoft Visio templates. These files serve as templates for creating new Visio drawings, incorporating default layouts, settings, and elements such as shapes, styles, and themes. The format is a legacy binary format used in Visio versions prior to 2013, based on the Microsoft Compound File Binary Format (MS-CFB), an OLE compound document structure. While the overall MS-CFB specification is documented by Microsoft, the specific internal streams and data structures for Visio content are proprietary and not publicly detailed. The format supports vector graphics and can be exported to other formats like PDF or PNG.

1. List of All Properties of This File Format Intrinsic to Its File System

The properties intrinsic to the file system for a .VST file are the metadata maintained by the operating system. These are standard for any file but are listed here as they apply to .VST files. The following is a comprehensive list based on typical Unix-like systems (similar attributes exist in Windows with minor variations):

  • File Name
  • File Path
  • Size (in bytes)
  • Device ID
  • Inode Number
  • Number of Hard Links
  • User ID of Owner
  • Group ID of Owner
  • Mode (permissions, e.g., read/write/execute for owner/group/others)
  • Creation Time (birth time, if supported by the file system)
  • Access Time
  • Modification Time
  • Change Time

3. Ghost Blog Embedded HTML JavaScript for Drag and Drop .VST File to Dump Properties

VST File Properties Dumper
Drag and drop a .VST file here

4. Python Class for Opening, Decoding, Reading, Writing, and Printing .VST File Properties

import os
import time
import pwd
import grp

class VSTFile:
    def __init__(self, filename):
        self.filename = filename
        self.properties = {}

    def read(self):
        stat = os.stat(self.filename)
        self.properties['File Name'] = os.path.basename(self.filename)
        self.properties['File Path'] = os.path.abspath(self.filename)
        self.properties['Size'] = stat.st_size
        self.properties['Device ID'] = stat.st_dev
        self.properties['Inode Number'] = stat.st_ino
        self.properties['Number of Hard Links'] = stat.st_nlink
        self.properties['User ID of Owner'] = stat.st_uid
        self.properties['Group ID of Owner'] = stat.st_gid
        self.properties['Mode'] = oct(stat.st_mode)
        self.properties['Access Time'] = time.ctime(stat.st_atime)
        self.properties['Modification Time'] = time.ctime(stat.st_mtime)
        self.properties['Change Time'] = time.ctime(stat.st_ctime)
        try:
            self.properties['Owner'] = pwd.getpwuid(stat.st_uid).pw_name
            self.properties['Group'] = grp.getgrgid(stat.st_gid).gr_name
        except KeyError:
            self.properties['Owner'] = 'Unknown'
            self.properties['Group'] = 'Unknown'

    def print_to_console(self):
        for key, value in self.properties.items():
            print(f"{key}: {value}")

    def write(self, modification_time=None, permissions=None):
        if modification_time:
            os.utime(self.filename, (os.stat(self.filename).st_atime, modification_time))
        if permissions:
            os.chmod(self.filename, permissions)

5. Java Class for Opening, Decoding, Reading, Writing, and Printing .VST File Properties

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileOwnerAttributeView;
import java.nio.file.attribute.PosixFileAttributes;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class VSTFile {
    private String filename;
    private Map<String, Object> properties = new HashMap<>();

    public VSTFile(String filename) {
        this.filename = filename;
    }

    public void read() throws IOException {
        File file = new File(filename);
        BasicFileAttributes attrs = Files.readAttributes(file.toPath(), BasicFileAttributes.class);
        properties.put("File Name", file.getName());
        properties.put("File Path", file.getAbsolutePath());
        properties.put("Size", attrs.size());
        properties.put("Creation Time", attrs.creationTime());
        properties.put("Access Time", attrs.lastAccessTime());
        properties.put("Modification Time", attrs.lastModifiedTime());
        FileOwnerAttributeView ownerView = Files.getFileAttributeView(file.toPath(), FileOwnerAttributeView.class);
        properties.put("Owner", ownerView.getOwner().getName());
        if (attrs instanceof PosixFileAttributes) {
            PosixFileAttributes posixAttrs = (PosixFileAttributes) attrs;
            properties.put("Group", posixAttrs.group().getName());
            properties.put("Permissions", PosixFilePermissions.toString(posixAttrs.permissions()));
        }
    }

    public void printToConsole() {
        for (Map.Entry<String, Object> entry : properties.entrySet()) {
            System.out.println(entry.getKey() + ": " + entry.getValue());
        }
    }

    public void write(long modificationTimeMillis, Set<PosixFilePermission> permissions) throws IOException {
        File file = new File(filename);
        file.setLastModified(modificationTimeMillis);
        if (permissions != null) {
            Files.setPosixFilePermissions(file.toPath(), permissions);
        }
    }
}

6. JavaScript Class for Opening, Decoding, Reading, Writing, and Printing .VST File Properties

const fs = require('fs');
const path = require('path');

class VSTFile {
  constructor(filename) {
    this.filename = filename;
    this.properties = {};
  }

  read() {
    const stat = fs.statSync(this.filename);
    this.properties['File Name'] = path.basename(this.filename);
    this.properties['File Path'] = path.resolve(this.filename);
    this.properties['Size'] = stat.size;
    this.properties['Device ID'] = stat.dev;
    this.properties['Inode Number'] = stat.ino;
    this.properties['Number of Hard Links'] = stat.nlink;
    this.properties['User ID of Owner'] = stat.uid;
    this.properties['Group ID of Owner'] = stat.gid;
    this.properties['Mode'] = stat.mode.toString(8);
    this.properties['Access Time'] = stat.atime.toISOString();
    this.properties['Modification Time'] = stat.mtime.toISOString();
    this.properties['Change Time'] = stat.ctime.toISOString();
    this.properties['Creation Time'] = stat.birthtime.toISOString();
  }

  printToConsole() {
    for (const [key, value] of Object.entries(this.properties)) {
      console.log(`${key}: ${value}`);
    }
  }

  write(modificationTime, permissions) {
    if (modificationTime) {
      fs.utimeSync(this.filename, new Date(), new Date(modificationTime));
    }
    if (permissions) {
      fs.chmodSync(this.filename, permissions);
    }
  }
}

7. C Class for Opening, Decoding, Reading, Writing, and Printing .VST File Properties

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <pwd.h>
#include <grp.h>
#include <utime.h>

typedef struct {
    char *filename;
    struct stat stat_info;
    char *owner;
    char *group;
} VSTFile;

VSTFile* vstfile_create(const char *filename) {
    VSTFile *vst = malloc(sizeof(VSTFile));
    vst->filename = strdup(filename);
    vst->owner = NULL;
    vst->group = NULL;
    return vst;
}

void vstfile_read(VSTFile *vst) {
    if (stat(vst->filename, &vst->stat_info) == 0) {
        struct passwd *pw = getpwuid(vst->stat_info.st_uid);
        struct grp *gr = getgrgid(vst->stat_info.st_gid);
        vst->owner = pw ? strdup(pw->pw_name) : "Unknown";
        vst->group = gr ? strdup(gr->gr_name) : "Unknown";
    }
}

void vstfile_print_to_console(VSTFile *vst) {
    printf("File Name: %s\n", vst->filename);
    printf("Size: %ld bytes\n", vst->stat_info.st_size);
    printf("Device ID: %ld\n", vst->stat_info.st_dev);
    printf("Inode Number: %ld\n", vst->stat_info.st_ino);
    printf("Number of Hard Links: %ld\n", vst->stat_info.st_nlink);
    printf("User ID of Owner: %d\n", vst->stat_info.st_uid);
    printf("Group ID of Owner: %d\n", vst->stat_info.st_gid);
    printf("Mode: %o\n", vst->stat_info.st_mode);
    printf("Access Time: %s", ctime(&vst->stat_info.st_atime));
    printf("Modification Time: %s", ctime(&vst->stat_info.st_mtime));
    printf("Change Time: %s", ctime(&vst->stat_info.st_ctime));
    printf("Owner: %s\n", vst->owner);
    printf("Group: %s\n", vst->group);
}

void vstfile_write(VSTFile *vst, time_t modification_time, mode_t permissions) {
    if (modification_time > 0) {
        struct utimbuf times;
        times.actime = vst->stat_info.st_atime;
        times.modtime = modification_time;
        utime(vst->filename, &times);
    }
    if (permissions > 0) {
        chmod(vst->filename, permissions);
    }
}

void vstfile_destroy(VSTFile *vst) {
    free(vst->filename);
    free(vst->owner);
    free(vst->group);
    free(vst);
}