Data Types and Predefined Structures

InstallShield 2014 » InstallScript Language Reference

Data Types

InstallScript supports the following data types. Note that some data types can be entered in either lowercase or uppercase letters:

Data Types

Data Type

Description

binary

BINARY

Indicates binary data (specified in a string variable) to be passed to or retrieved from an external DLL function. Unlike the STRING or WSTRING data types, when the BINARY data type is specified, the InstallScript engine does not attempt to interpret the data as a string or perform any type of data conversion or validation; thus, this data type is used when passing binary data that may or may not consist of valid string characters.

Note that this data type can be used only in a prototype of an external DLL function. If this data type is used for a variable instance or as a parameter for a non-DLL InstallScript function, compile error C8116 error occurs.

If a standard InstallScript string is passed through the BINARY data type, the characters in the string are passed as ASCII characters. Therefore, the binary type is similar to the STRING data type, not the WSTRING data type, for valid string characters.

BOOL

Boolean data: either TRUE (1) or FALSE (0). Variables of this type should not be used to store any other values. Like C++, InstallScript evaluates non-zero values as TRUE; only the value of zero is evaluated as FALSE. Normally, the value of one is used to indicate TRUE.

char

CHAR

Character data: a single 8-bit signed character. When a literal character appears in a script, it must be enclosed within single or double quotation marks. Note that you can assign a numeric ASCII value to a character value. To display a char variable as a character, use the Format Specifiers “%c” with the function SprintfBox. To display the numeric value of a char variable use the specifier “%d”.

InstallScript character variable types are signed; therefore extended ASCII characters will be interpreted as negative numbers when interpreted numerically. To avoid this problem, assign the value to a number variable; then AND (&) the number variable with the value 255 before interpreting the number.

HWND

Handle to a window. The HWND variable type also can be used to store any other type of handle valid in Windows. HWND variables are normally initialized using the CmdGetHwndDlg or GetWindowHandle functions. Internally, HWND variables are equivalent to the data type NUMBER.

int

INT

Equivalent to the number type; provided for convenience.

LIST

Pointer to an InstallScript list. LIST variables are always initialized and uninitialized using the ListCreate and ListDestroy functions. Internally, LIST variables are equivalent to the data type NUMBER.

long

LONG

Equivalent to the NUMBER type; provided for convenience.

LPSTR

Equivalent to the POINTER type; provided for convenience.

For more information, see Pointers.

LPWSTR

Equivalent to the WPOINTER type; provided for convenience.

For more information, see Pointers.

number

NUMBER

Signed four-byte integer. Number is the recommended data type for storing numeric data. The data type is similar to the LONG variable type of other programming languages. It can hold any value between -2,147,483,648 and +2,147,483,647. Note that all numeric data types in InstallScript are equivalent to the NUMBER variable type.

object

OBJECT

A reference to a COM object. The reference is returned by the CreateObject function and assigned to the object variable using the set keyword.

pointer

POINTER

A pointer to data. In the case of a pointer to a string variable, the data pointed to is an ANSI string. Pointer variables are normally initialized by using the address-of (&) operator to assign the address of a variable to the pointer variable.

For more information, see Pointers.

short

SHORT

Equivalent to the NUMBER type; provided for convenience.

string

STRING

An array of Unicode characters (two bytes per character). String variables, which are similar to arrays of characters in the C++ language, are NULL terminated. However, InstallShield does not support multiple NULL-terminated strings in the same string variable. String variables can be declared with an explicit size of up to 65,535 characters. Strings variables that are declared without an explicit size are automatically sized by InstallShield. Note that string concatenation in a setup script is performed by using the concatenation operator, which is a plus sign (+). Strings to be concatenated are positioned as operands on either side of the operator, as shown in the statement below, which appends the value of szLastName to the value of szFirstName and assigns the resulting string to szFullName:

    szFullName = szFirstName + szLastName;

To display a string variable, use the SprintfBox function with the format specifier “%s”, or use the MessageBox function.

Note: You can declare string variables as STRING in InstallScript code; string variables that are declared this way in InstallScript code are stored as Unicode strings in string tables. However, if you want to store Unicode strings in structures that are passed outside of the InstallScript code—for example, to a DLL function—you may need to use the WSTRING type when declaring the strings as structure members in your InstallScript code. For more information, see Data Structures.

variant

VARIANT

Any kind of data: character, string, numeric, object reference, and so on. It is recommended that you use the other data types whenever possible; the VARIANT data type is necessary only when declaring a script-defined function that takes an array as an argument, for example:

prototype number AverageValue( variant );

 

function OnBegin( )

    number nAverage , nArray(10);

begin

    /* Assign values to array elements here. */

 

    /* Pass the array to the function. */

    nAverage = AverageValue( nArray );

end;

Note that the VARIANT data type cannot be defined within a data structure.

void

VOID

Void is not a true data type, in the sense that a variable cannot be declared as type void. Void is only used in function prototypes to indicate that the function does not return a value, as in the following:

    prototype void Subroutine(int);

 

    function void Subroutine(int);

    begin

        // perform operations, but

        // do not return a value

    end;

wpointer

WPOINTER

A pointer to string data. The POINTER type should be used in all cases except when a pointer to Unicode string data is needed. Pointer variables are normally initialized by using the address-of (&) operator to assign the address of a variable to the pointer variable.

For more information, see Pointers.

wstring

WSTRING

Same as STRING except that, unlike STRING, it can be used when declaring DLL function calls in which a wide-character string argument or Unicode string argument is expected. For example:

prototype long Kernel32.GetWindowsDirectoryW(BYREF wstring, int);

You can pass a string variable in a WSTRING argument; for example:

wstring svWinDir;

...

GetWindowsDirectoryW(svWinDir, 1024);

Note: You can declare string variables as STRING in InstallScript code; string variables that are declared this way in InstallScript code are stored as Unicode strings in string tables. However, if you want to store Unicode strings in structures that are passed outside of the InstallScript code—for example, to a DLL function—you may need to use the WSTRING type when declaring the strings as structure members in your InstallScript code. For more information, see Data Structures.

Note: InstallScript does not provide unsigned or floating-point data types.

Predefined Structures

InstallScript supports the following predefined structures:

Predefined Structures

Predefined Structure

Description

_FONTFILEINFO

This is a data structure that is passed to the OnInstalledFontFile and OnUninstallingFontFile event handlers. It has the following members:

string szFileName[_MAX_PATH]—The complete path to the font file being installed on the system
string szFaceName[_MAX_PATH]—The face name of the font being installed (if you specify the name for the font file in InstallShield)

Note that the information in the structure is passed to the event handler so that the event handler can use the information. Thereafter, the values of the structure are used by the installation. Therefore, changing the structure members does not have any effect on the installation.

_LAAW_PARAMETERS

For a list of this data structure's members and their purposes and permitted values, see LAAW_PARAMETERS.

_SERVICE_IS_PARAMS

For a list of this data structure's members and their purposes and permitted values, see SERVICE_IS_PARAMS.

_SERVICE_IS_STATUS

For a list of this data structure's members and their purposes and permitted values, see SERVICE_IS_STATUS.

ISURL_COMPONENTS

This is a data structure that contains the constituent parts of a URL. This structure is similar to the Windows API structure URL_COMPONENTS. For an example of the use of this structure, see ParseUrl. This structure has the following members:

szScheme—String value that contains the scheme name.
nInternetScheme—Numeric value that indicates the Internet protocol scheme; equals 3 for HTTP and 4 for HTTPS.
szUserName—String value that contains the user name.
szPassword—String value that contains the password.
szHostName—String value that contains the host name.
nInternetPort—Port number.
szUrlPath—String value that contains the URL path.
szExtraInfo—String value that contains the extra information (for example, ?something or #something).

PROCESS_INFORMATION

For a list of this data structure's members and their purposes and permitted values, see LAAW_PROCESS_INFORMATION.

STARTUPINFO

For a list of this data structure's members and their purposes and permitted values, see LAAW_STARTUPINFO.