FileCompare

InstallShield 2020 » InstallScript Language Reference

The FileCompare function compares the size, modify dates, contents, or versions of two files.

Syntax

FileCompare ( szFileName1, szFileName2, nCompareFlag );

Parameters

FileCompare Parameters

Parameter

Description

szFileName1

Specifies the name of the first file to compare. The installation uses the system variable SRCDIR as the path of the file.

szFileName2

Specifies name of the second file to compare. The installation uses one of the following system variables as the path of the file:

TARGETDIR (in an InstallScript installation)
INSTALLDIR (in an Basic MSI or InstallScript MSI installation)

nCompareFlag

Specifies comparison options. Pass one of the following predefined constants in this parameter:

COMPARE_SIZE—Compares the size of the two files.
COMPARE_DATE—Compares the modify dates of the two files.
COMPARE_VERSION—Compares the version resource of the two files.
COMPARE_MD5_SIGNATURE—Compares the MD5 signature of the two files. If the MD5 signatures match, the contents of the files are identical.

Return Values (when COMPARE_MD5_SIGNATURE is specified)

FileCompare Return Values (COMPARE MD5_SIGNATURE)

Return Value

Description

>= ISERR_SUCCESS

The function successfully compared the files, specifically:

EQUALS—The files MD5 signatures are the same (the files contents are the same).
NOT_EQUALS—The files MD5 signatures are not the same.

<= ISERR_SUCCESS

The function failed to compare the files.

Return Values (when COMPARE_SIZE, COMPARE_DATE, or COMPARE_VERSION is specified)

FileCompare Return Values (COMPARE_SIZE, COMPARE_DATE, or COMPARE_VERSION)

Return Value

Description

>= ISERR_SUCCESS

The function successfully compared the files, specifically:

EQUALS—The first file's date, size, or version is equal to that of the second file.
GREATER_THAN—The first file is newer or larger than the second file.
LESS_THAN—The first file is older or smaller than the second file.

<= ISERR_SUCCESS

The function failed to compare the files.

See Also