GetSystemInfo

InstallShield 2012 Spring » InstallScript Language Reference

The GetSystemInfo function retrieves information about the target system. GetSystemInfo collects the information that it returns by using the Windows API.

Syntax

GetSystemInfo ( nItem, nvResult, svResult );

Parameters

GetSystemInfo Parameters

Parameter

Description

nItem

Specifies the type of information to retrieve.

nvResult

Returns system information in the form of numeric data.

svResult

Returns system information in the form of string data

The following table contains a list of constants that you can pass in the nItem parameter to retrieve system information. When using certain constants (such as DISK_TOTALSPACE_EX), you must specify additional information in the parameters nvResult and/or svResult before calling the function.

nItem Options

nItem Option

nvResult Returns

svResult Returns

BOOTUPDRIVE

The ID of the bootup drive, where 1= A:, 2 = B:, 3 = C:. It is possible to convert this number to the appropriate drive letter by adding 64 (DECIMAL) to the value and then setting a string variable to this value. Use the following syntax to convert:

svResult[0] = 64 + nvResult;

Returns the drive designation (the drive letter followed by a colon) of the bootup drive.

CDROM

TRUE or FALSE Indicates whether a CD-ROM is available.

Not applicable

COLORS

Returns the number of colors available on the user's system. The result is retrieved from the video driver on the target system, rather than from the monitor card. If the card can support 256 colors but the driver can handle only 16 colors, the number of colors returned is 16.

Not applicable

CPU

Note: This parameter is deprecated. Use the structure members of SYSPROCESSORINFO to determine the processor type.

One of the following constants is returned:

IS_UNKNOWN—The user's CPU is unknown.
IS_386—The user has a 386 processor.
IS_486—The user has a 486 processor.
IS_PENTIUM—The user has a PENTIUM processor.
IS_ALPHA—The user has an ALPHA processor.

Not applicable

DATE

Not applicable

The current system date in the format MM-DD-YYYY. Leading zeroes are suppressed in the month and day fields.

DISK_TOTALSPACE

Note: This parameter is obsolete. Use the parameters available with the GetDiskInfo function instead.

Returns the total capacity of the disk drive specified in svResult. The maximum value returned is 2 GB. Total disk space greater than that still returns as 2 GB.

The letter of the drive. Note that this parameter is passed to the function; that is, you must assign a value to svResult before calling GetSystemInfo. Also note that you must include the colon (:) after the drive letter; otherwise the function will fail. You can also specify a UNC path in this parameter.

DISK_TOTALSPACE_EX

Note: This parameter is obsolete. Use the parameters available with the GetDiskInfo function instead.

Specifies the measurement unit; pass one of the following predefined constants in this parameter: BYTES, KBYTES, MBYTES or GBYTES. Returns the total capacity of the disk drive specified in svResult.

The letter of the drive. Note that this parameter is passed to the function; that is, you must assign a value to svResult before calling GetSystemInfo. Also note that you must include the colon (:) after the drive letter; otherwise the function will fail. You can also specify a UNC path in this parameter.

DRIVE

Note: This parameter is obsolete. Use the parameters available with the GetDiskInfo function instead.

Returns the type of the drive specified in svResult. One of the following constants is returned:

IS_UNKNOWN—Target drive is unknown.
IS_REMOVABLE—Target drive is a floppy drive.
IS_FIXED—Target drive is a fixed drive.
IS_CDROM—Target drive is a CD-ROM drive.
IS_REMOTE—Target drive is a network drive.

The letter of the drive followed by a colon (:). Note this parameter is passed to the function; that is, you must assign a value to svResult before calling GetSystemInfo.

Due to operating system limitations, UNC paths are not supported for svResult. If you pass a UNC path in svResult, the function returns IS_UNKNOWN.

EXTENDEDMEMORY

Returns the total amount of memory installed on the machine. Due to operating system limitations, the value returned may be slightly different than the actual amount of physical memory installed on the system. This value will normally be within 100K (0.1 MB) of the actual value. Note that the value returned is a measurement in kilobytes.

GetSystemInfo (EXTENDEDMEMORY, ... ) accurately returns the amount of extended memory up to 2 terabytes (TB). If a system has more than 2 TB of extended memory, 2 TB is returned.

Not applicable

LANGUAGE

The InstallScript language constants for the target system are returned in this parameter. For more information, see Creating Multilingual Installations.

The equivalent language name string for the language constant returned in nvResult is returned in this parameter.

OS

This parameter is deprecated. Use the WIN9X.bWin9X or WINNT.bWinNT members of the SYSINFO structure variable to obtain operating system information.

You can conditionally install some or all of your product based upon operating system by using conditional logic for components, features, and custom actions. For more information, see Building Conditional Statements.

Not applicable

OSMAJOR

This parameter is deprecated. Use the nOSMajor member of the SYSINFO structure variable to obtain operating system information.

Not applicable

OSMINOR

This parameter is deprecated. Use the nOSMinor member of the SYSINFO structure variable to obtain operating system information.

Not applicable

PARALLEL

Returns the number of physical parallel ports available.

Not applicable

SERIAL

Returns the number of physical serial ports available.

Not applicable

TIME

Not applicable

Returns current system time in HH:MM:SS format.

VIDEO

Returns the type of video adapter installed. (InstallShield cannot detect CGA or monochrome video drivers.) One of the following constants is returned:

IS_UNKNOWN—The user's video is unknown.
IS_EGA—EGA resolution.
IS_VGA—VGA resolution.
IS_SVGA—Super VGA (800 x 600) resolution.
IS_XVGA—XVGA (1024 x 768) resolution.
IS_UVGA—Greater than 1024 x 768 resolution.

Not applicable

VIRTUAL_MACHINE_TYPE

Returns the type of virtual machine that is running the installation. One of the following constants is returned:

IS_VM_TYPE_HYPERV—The installation is running on a Microsoft Hyper-V machine.
IS_VM_TYPE_VMWARE—The installation is running on a VMware product such as VMware Player, VMware Workstation, or VMware Server.
IS_VM_TYPE_VIRTUALPC—The installation is running on a Microsoft Virtual PC machine.
IS_VM_TYPE_NONE—No virtual machine has been detected.
IS_VM_TYPE_UNKNOWN—The type of virtual machine is not known.

For more information, see Detecting Whether the Installation Is Being Run on a Virtual Machine.

Not applicable

VOLUMELABEL

Not applicable

Pass the drive designation—the drive letter followed by a colon—of the disk whose volume label you want to retrieve. The volume label of the specified drive is then returned in this parameter. If the drive has no volume label, a null string ("") is returned.

WINMAJOR

This parameter is deprecated. Use the nWinMajor member of the SYSINFO structure variable to obtain operating system information.

Not applicable

WINMINOR

This parameter is deprecated. Use the nWinMinor member of the SYSINFO structure variable to obtain operating system information.

Not applicable

Return Values

GetSystemInfo Return Values

Return Value

Description

0

Indicates that the function successfully returned the specified information.

< 0

Indicates that the function was unable to return the specified information.

See Also