Contains classes used by version information resource

This unit contains classes used by TVersionResource.

Base class for version string table - related exceptions String table name not allowed error

This exception is raised when an attempt is made to set Name property of with a string that isn't an 8-cipher hexadecimal string.

Key not found error

This exception is raised when the specified key is not found in the object.

Duplicate key error

This exception is raised when an attempt is made to add an item to a object and the specified key is already present.

File or Product version type

This type is a 4-element array of words that is used to represent a file or product version.

Major version number is stored in the lowest word

Example

Product version 4.2.1.1200 can be represented this way

const myver : TFileProductVersion = (4,2,1,1200);
A language - codepage pair

This record represents a language id - codepage pair that is used by .

The language id The codepage Pointer to a TVerTranslationInfo Language independent part of version information

This class represents the language independent part of version information, and is always present in a version information resource.

TVersionResource TVersionResource.FixedInfo
The file version The product version Mask for FileFlags

This property specifies which bits of FileFlags are valid.

Usually it is VS_FFI_FILEFLAGSMASK.

The file flags

It is a combination of the following values:

  • VS_FF_DEBUG.
  • VS_FF_INFOINFERRED.
  • VS_FF_PATCHED.
  • VS_FF_PRERELEASE.
  • VS_FF_PRIVATEBUILD.
  • VS_FF_SPECIALBUILD.
The operating system the file was designed to run on

It is one of the following values:

  • VOS_UNKNOWN
  • VOS_DOS
  • VOS_OS216
  • VOS_OS232
  • VOS_NT

combined with one of the following values:

  • VOS__WINDOWS16
  • VOS__WINDOWS32
  • VOS__PM16
  • VOS__PM32

Note: some predefined combinations do exist:

  • VOS_DOS_WINDOWS16
  • VOS_DOS_WINDOWS32
  • VOS_OS216_PM16
  • VOS_OS232_PM32
  • VOS_NT_WINDOWS32
The type of the file

It can be one of the following values:

  • VFT_UNKNOWN
  • VFT_APP
  • VFT_DLL
  • VFT_DRV
  • VFT_FONT
  • VFT_VXD
  • VFT_STATIC_LIB
Additional type information

This property is meaningful only for some values of FileSubType. For all other types, this property must be zero.

If FileSubType is VFT_DRV:

  • VFT2_UNKNOWN
  • VFT2_DRV_COMM
  • VFT2_DRV_PRINTER
  • VFT2_DRV_KEYBOARD
  • VFT2_DRV_LANGUAGE
  • VFT2_DRV_DISPLAY
  • VFT2_DRV_MOUSE
  • VFT2_DRV_NETWORK
  • VFT2_DRV_SYSTEM
  • VFT2_DRV_INSTALLABLE
  • VFT2_DRV_SOUND

If FileSubType is VFT_FONT:

  • VFT2_UNKNOWN
  • VFT2_FONT_RASTER
  • VFT2_FONT_VECTOR
  • VFT2_FONT_TRUETYPE
The file creation timestamp.

It is a 64 bit timestamp.

Version information for a specific language-codepage combination

This class represents version information for a specific language-codepage combination.

It is contained in a object.

Information is stored as key-value pairs. The name of the string table specifies the language id - codepage to which the object applies.

There are some predefined keys that Microsoft Windows searches for. They are:

  • Comments
  • CompanyName
  • FileDescription
  • FileVersion
  • InternalName
  • LegalCopyright
  • LegalTrademarks
  • OriginalFilename
  • PrivateBuild (only if VS_FF_PRIVATEBUILD is set in )
  • ProductName
  • ProductVersion
  • SpecialBuild (only if VS_FF_SPECIALBUILD is set in )
Creates a new string table

Creates a new string table with the name passed as aName parameter.

aName must be a hex representation of a 4-bytes unsigned number: first 4 ciphers represent the language id, and last 4 the codepage.

Sample code

This code creates a string table for Italian, with unicode codepage.

var st : TVersionStringTable; begin //0410 = Italian //04B0 = unicode codepage st:=TVersionStringTable.Create('041004B0'); //do something useful... st.Free; end;

If name is not a valid 8-cipher hexadecimal string, an exception is raised.

The name of the string table Destroys the string table Adds a new item to the string table

This methods adds a new key-value pair to the string table.

Note that some predefined keys do exist. See for further information.

If an item with the same key already exists, an exception is raised.

The key of the item to add The value of the item to add Deletes all items

This method empties the object deleting all items.

Deletes an item

The item to delete can be specified by its index or by its key.

If aKey is not found, an exception is raised.

The index of the item to delete The key of the item to delete The name of the string table

Name must be a hex representation of a 4-bytes unsigned number: first 4 ciphers represent the language id, and last 4 the codepage.

If an attempt is made to set Name with a string that isn't an 8-cipher hexadecimal string, an exception is raised.

The number of items in the object Indexed array of keys in the object

This property can be used to access all keys in the object.

Values associated to keys are stored in ValuesByIndex property: a key and its value have the same index in the two properties.

This array is 0-based: valid elements range from 0 to Count-1.

Note that some predefined keys do exist. See for further information.

The index of the key to access. Indexed array of values in the object

This property can be used to access all values in the object.

Keys associated to values are stored in Keys property: a key and its value have the same index in the two properties.

This array is 0-based: valid elements range from 0 to Count-1.
The index of the value to access. Array of values in the object, accessed by key

This property can be used to retrieve the value of an item when the corresponding key is known.

If you need to iterate over all values of the string table, use ValuesByIndex instead.

If the key is not found, an exception is raised.

The key of the value to access Language dependent part of version information

This class represents the language dependent part of version information.

It is a list of objects, each representing information for a specific language-codepage combination.

TVersionResource TVersionResource.StringFileInfo
Destroys the object All items are destroyed as well. Adds a new string table The string table to add Deletes all string tables in the list

This method empties the object. All string tables are freed.

Deletes a string table

This method removes the string table identified by aIndex from the list. The string table is freed.

The index of the string table to delete. The number of string tables in the object Indexed array of string tables in the object

This property can be used to access all string tables in the object.

This array is 0-based: valid elements range from 0 to Count-1.
The index of the string table to access List of supported languages

This class represents the language-codepage pairs that the program or dll supports. It can be used to avoid including several RT_VERSION resources for each language-codepage supported.

It is a list of records.

TVersionResource.VarFileInfo
Destroys the object

All items are destroyed as well.

Adds a new translation information item The element to add Deletes all items

This method empties the object deleting all items.

Deletes an item The index of the item to delete The number of items in the object Indexed array of items in the object

This property can be used to access all translation information items in the object.

This array is 0-based: valid elements range from 0 to Count-1.
The index of the item to access