GetDiskInfo

InstallShield 2019 » InstallScript Language Reference

The GetDiskInfo function gets information about a specified disk drive. By inspecting the values assigned to members of this variable, your script can determine the information about a disk drive.

Syntax

GetDiskInfo ( _DISK_INFO& pdi );

Parameters

GetDiskInfo Parameters

Parameter

Description

_DISK_INFO& pdi

Specifies a pointer to an existing _DISK_INFO structure (allocated by the installation before calling the function) that specifies the information to retrieve and contains the specified information after the function returns.

The following table shows the meaning of each _DISK_INFO member:

_DISK_INFO Members

Member

Meaning

szDiskPath[_MAX_PATH]

Specifies the fully qualified path of the drive to return the information for.

nInfoToQuery

Specifies the information to query. Possible values are the following:

DISK_INFO_QUERY_ALL—Queries all information about the disk drive.
DISK_INFO_QUERY_BYTES_PER_CLUSTER—Queries the bytes per cluster (cluster-size) of the drive.
DISK_INFO_QUERY_DISK_TOTAL_SPACE—Queries the total space on the drive.
DISK_INFO_QUERY_DISK_FREE_SPACE—Queries the free space on the drive.
DISK_INFO_QUERY_DRIVE_TYPE—Queries the drive type.

nBytesPerCluster

Returns the number of bytes per cluster if DISK_INFO_QUERY_BYTES_PER_CLUSTER was specified in nInfoToQuery.

nTotalSpaceHigh

Returns the upper 31 bits of the total space on the target drive.

nTotalSpaceLow

Returns the lower 31 bits of the total space on the target drive.

nFreeSpaceHigh

Returns the upper 31 bits of the free space on the target drive.

nFreeSpaceLow

Returns the lower 31 bits of the free space on the target drive.

nDriveType

Returns the drive type using the same constants returned by the Windows API GetDriveType. For convenience, the following constants are predefined:

DRIVE_UNKNOWN—The drive type is unknown.
DRIVE_NO_ROOT_DIR—The drive type is defined as no root directory.
DRIVE_REMOVABLE—The drive type is defined as removable.
DRIVE_FIXED—The drive type is defined as fixed.
DRIVE_REMOTE—The drive type is defined as remote.
DRIVE_CDROM—The drive type is defined as a CD-ROM.
DRIVE_RAMDISK—The drive type is defined as a RAM DISK.

nResultDiskSpace

This member contains valid information on return when any of the following flags are specified:

DISK_INFO_QUERY_BYTES_PER_CLUSTER
DISK_INFO_QUERY_DISK_TOTAL_SPACE
DISK_INFO_QUERY_DISK_FREE_SPACE

This member returns the result of querying the information.

Return Values

GetDiskInfo Return Values

Return Value

Description

ISERR_SUCCESS

Indicates that the function was successful.

< ISERR_SUCCESS

Indicates that the function was unsuccessful. If a null pointer is passed to the function, this value is returned.

You can check the nResultDiskSpace member to determine whether the query was successful.

See Also