ConfigFind

InstallShield 2018 » InstallScript Language Reference

The ConfigFind function searches a system configuration file that has been loaded into memory with the function ConfigFileLoad. The parameter szRefKey is a reference key that specifies the search target in that file. If the reference key is found, its value is returned in svResult. To find all occurrences of szRefKey, call this function repeatedly with nOptions set to CONTINUE. To restart the search from the top of the file, specify the constant RESTART in nOptions. After you edit the file, call ConfigFileSave to save it.

Note • Do not mix the Ez configuration file functions with the advanced configuration file functions. After calling the ConfigFileLoad function, you cannot use the Ez configuration file functions until you use the ConfigFileSave function to save your changes.

Syntax

ConfigFind (szRefKey, svResult, nOptions);

Parameters

ConfigFind Parameters

Parameter

Description

szRefKey

Specifies the reference key to search for. If the reference key is a file name without a file extension, all file extensions are included in the search. For example, if you specify Win.com, the search looks only for that reference key. If you specify WIN, the files Win.exe, Win.dll, Win.sys, etc., are all returned.

svResult

Returns the value of the reference key that was found in the system configuration file.

nOptions

Indicates whether to start the search from the beginning of the file or to continue from where the previous search was terminated. Pass one of the following predefined constants in this parameter:

RESTART—Starts the search from the beginning of the file.
CONTINUE—Starts the search from the current position in the system configuration file.
COMMAND—Indicates that the reference key in szRefKey is a command, not an environment variable. The constant COMMAND can be joined with the constant RESTART or the constant CONTINUE by using the bitwise OR operator (|), as in the following example:

ConfigFind("Vga.drv", svResult, CONTINUE | COMMAND);

Note • A system configuration file can contain both environment variables and commands. To distinguish between environment variables and commands with the same name, use the constant COMMAND to specify that you are looking for executable commands.

Return Values

ConfigFind Return Values

Return Value

Description

0

ConfigFind successfully found the specified reference key and returned it in svResult.

< 0

ConfigFind was unable to find the specified reference key.

See Also