ConvertSizeToUnits

InstallShield 2018 » InstallScript Language Reference

The ConvertSizeToUnits function converts the size specified through nSizeSrcHigh and nSizeSrcLow in nUnitsSrc into nvSizeTargetHigh and nvSizeTargetLow in nUnitsTarget. You can also use this function to determine the best units to use for a particular size value that is not known until the setup is run.

Syntax

ConvertSizeToUnits ( nSizeSrcHigh, nSizeSrcLow, nUnitsSrc, nvSizeTargetHigh, nvSizeTargetLow, nvUnitsTarget );

Parameters

CovertSizeToUnits Parameters

Parameter

Description

nSizeSrcHigh

Specifies the upper 31 bits of the size to be converted.

nSizeSrcLow

Specifies the lower 31 bits of the size to be converted.

nUnitsSrc

The units of nSizeSrcHigh and nSizeSrcLow. Specify one of the following values:

BYTES—The value is in bytes.
KBYTES—The value is in kilobytes.
MBYTES—The value is in megabytes.
GBYTES—The value is in gigabytes.
TBYTES—The value is in terabytes.

nvSizeTargetHigh

Returns the upper 31 bits of converted size.

nvSizeTargetLow

Returns the lower 31 bits of converted size.

nUnitsTarget

Specifies (and returns if -1 is specified) the units of nvSizeTargetHigh and nvSizeTargetLow. Specify one of the following values. (You can also specify -1 or any negative value. In this case, the function sets nUnitsTarget to the smallest units that ensures that nvSizeTargethigh is 0):

BYTES—The value is in bytes.
KBYTES—The value is in kilobytes.
MBYTES—The value is in megabytes.
GBYTES—The value is in gigabytes.
TBYTES—The value is in terabytes.

Return Values

ConvertSizeToUnits Return Values

Return Value

Description

ISERR_SUCCESS

Indicates that the function was successful.

< ISERR_SUCCESS

Indicates that the function was not successful.

ISERR_INVALID_ARG

Indicates that either nSizeSrcHigh or nSizeSrcLow is negative.