InstallShield Internal Library Function 8 File Configuration Function

zhaozj2021-02-17  38

InstallShield Internal Library Function 8 File Configuration Function

8.1 Advanced Profile Function

Advanced profile functions are provided to advanced developers greater flexibility than the EZ configuration file function and more control over system configuration. To use these advanced functions to access and edit a system profile, you can start with CONFIGFileLoad. Most other functions can only be called after the system profile has been turned on by configFileLoad. When you end the editing system configuration file, call ConfigFileSave to save your changes. Note that the function configGetFileName and ConfigSetFileName can also be used with advanced configuration file functions and EZ configuration file functions.

Do not mix the EZ configuration file function and the advanced profile function. After calling configfileload until you call ConfigFileSave, you can use the EZ configuration file function after you save your modification.

ConfigAdd

Add a statement to a system profile that has been loaded into the memory.

Configdelete

Remove one from a system configuration file.

ConfigfileLoad

Mount a system profile into memory.

CONFIGFIESAVE

Save a system profile that has been loaded by ConfigFileLoad.

Configfind

Find a project in a system profile.

ConfiggetFileName

Retrieve fully qualified names for default system configuration files.

Configgetint

Retrieve a value from a system profile.

Configmove

Move an item in a system configuration file.

ConfigsetFileName

Specifies the full qualification of a system configuration file.

Configsetint

Set a value in the system configuration file.

related functions:

SDShowFileMods

Create a dialog, display the recommended file modification and how to make options.

8.1.1 ConfigAdd

Grammar: ConfigAdd (Szkey, SzValue, Szrefkey, NOPTIONS);

Note: The configAdd function adds a statement to a system configuration file that has been loaded into the memory by ConfigFileLoad. You can specify that the statement is relative to a reference word, or you can add statements to the file header or last row. You can also replace a line already existing in the file. Before calling configAdd, you must call ConfigFileLoad to load the system configuration file into memory. After you edit the file, call ConfigFileSave saved files.

parameter:

SZKey

Specifies the keywords for statements being added to the system configuration file.

SzValue

Specifies the value of the keyword added to the system configuration file.

Szrefkey

Specifies a reference word to the SZKEY you add in the system configuration file. If you pass an empty string (""), the row is added as the first line or end of the file, which depends on the predefined constant passed to NOPTIONS.

NOPTIONS

Specifies whether the line is added to the front or behind the row containing the reference word, or whether the line is replaced. One of the following predefined constants in this parameter location:

Before: This statement is added to the front of the row containing szrefkey. If szrefkey is an empty string (""), the statement is added to the file first line.

After: This statement is added to the back of the row containing the szrefkey. If Szrefkey is an empty string (""), the statement is added to the file last line.

REPLACE: This statement will exist in the replacement file. If there is a multi-line, only the last line is replaced. If the row to be replaced does not exist in the file, the new row is added to the end of the file.

return value:

0: ConfigAdd successfully added statement to the specified system configuration file.

<0: ConfigAdd failed to add a statement to the specified system configuration file.

Note: • When the configAdd function replaces a line in a system configuration file, it compares the reference words in both lines:

· A reference word is a substring that identifies the row. For example, in the following example, the reference word is Kybrd.drv.

Device = C: /Windows/system/kybrd.drv / 1024 / c: 345

In the next statement, the reference word is PATH:

SET PATH = C: / Windows; C: / Windows / SYSTEM

8.1.2 ConfigDelete

Syntax: configDelete (szkey);

Note: The configDete function delete rows in the system configuration file that has been loaded by ConfigFileLoad. Parameters szkey specifies a reference word to identify the row to be deleted. After editing the file using the Advanced Profile Function, you call ConfigFileSave saved files.

parameter:

SZKey

Specifies the reference word to be deleted to be deleted. Common references include Himem.sys, FILES, and Stacks.

return value:

0: ConfigDelete successfully deletes the system configuration file containing the reference word.

<0: configDelete does not delete the specified line.

8.1.3 ConfigFileLoad

Syntax: configfileload (szconfigfile);

Note: The configFileLoad function is loaded into the copy to memory of the specified system configuration file, so that other advanced configuration file functions can be called to operate the file. In parameter szconfigfile Specifies the name of the system profile you want to edit or passes an empty string to Szconfigfile to edit the default system profile (initially set by InstallShield as the system used for the system).

To get the full qualification of the default system profile, call ConfiggetFileName. When another file is the default system profile, call ConfigSetFileName.

Note: You can call ConfigFileLoad to create a new configuration file. In order to do this, you can deliver a file name that does not exist for Szconfigfile. Then call other configuration functions to edit new files. Finally, call ConfigFileSave to save the new file to disk.

Before using any advanced configuration file function, you must first call ConfigFileLoad to load the system configuration file into memory. After you modify the file, call ConfigFileSave to save it to disk.

parameter:

Szconfigfile

Specifies the full qualification of the system configuration file loaded into the memory. To load the default system profile, pass the parameters ("").

return value:

0: ConfigFileLoad successfully loads the specified system profile into memory.

<0: ConfigFileLoad failed to load the specified system configuration file into memory.

8.1.4 Configfilesave

Grammar: configfilesave (szbackupfile);

Note: The configfilesave function saves the system profile of the ConfigFileLoad function to the disk. The file is saved for its original name. If you specify a file name in szbackupfile, the original name of the edited file is written to the previous name of the disk is renamed. If the szbackupfile contains an empty string (""), the original file is replaced by this modified file. If you end with the Advanced Profile Function to modify a system configuration file, there is no call for configfilesave, and all modifications will be lost.

parameter:

Szbackupfile

Specifies whether to back up a copy of the original file before editing is saved.

If you do not need to create a backup file, specify an empty string for this parameter. If the original file must be backed up with a specific name, pass the file name to this parameter. The file name must be unlimited (i.e., no one drive and / or path). Note If the file with the specified name already exists, ConfigFileSave will generate a unique file extension, such as described in the board.

If the original file backup must have an extension of the installed file, specify a wildcard "" as a file extension (for example, "config."). Then the installation will assign a numeric value, starting from 1001 as an extension. If a file with this extension already exists, the extension name will be increased until a unique file name.

Once a backup is created, InstallShield saves the backup file name to the system variable infofilename.

Note the following important facts: 1) If the last configibleLoad is not existent, the backup file will be the same as the configuration file created by calling ConfigFilesave. 2) If SZBAKUPFILE specifies the original configuration file name, a backup file will not be created.

return value:

0: ConfigFileSave successfully writes files from memory to disk.

<0: configfilesave failed to write files to disk.

8.1.5 Configfind

Syntax: configfind (SzrefKey, SvResult, NOPTIONS);

Note: The configfind function looks for a system configuration file that has been loaded into the memory by the function configfileload. The parameter szrefkey is a reference word to specify the lookup target in the file. If the reference word is found, its value returns to the parameter svresult. To find all where SzrefKey appears, set the parameters NOPTIONS to Continue Repeat the function. To find the file from the file head, specify the NOPTIONS as a constant RESTART. After you edit the file, call ConfigFileSave to save it.

parameter:

Szrefkey

Specify the reference word to find. If the reference is a file name without a file extension, all file extensions will be included in the lookup. For example, if you specify Win.com, look for this reference word. If you specify WIN, WIN.EXE files, win.dll files, win.sys files, etc. are all returned.

SvResult

Returns the value of the reference word found in the system configuration file.

NOPTIONS

Indicates whether to start looking up from the beginning of the file or continue from the previous lookup interruption. One of the following predefined constants in this parameter location:

Restart: Start looking up at the beginning of the file.

Continue: Find from the current location of the system profile.

Command: Indicates the reference word at Szrefkey is a command instead of an environment variable. Command constants can be combined with RESTART constants or Continue constants by using a bit or operator (|), as shown in the following example:

Configfind ("Vga.drv", SvResult, Continue | Command;

return value:

0: Configfind successfully found the specified reference word and returned at SvResult.

<0: configfind failed to find the specified reference word.

annotation:

A system profile can contain environment variables and commands. To distinguish the same name environment variables and commands, use the Command constant to specify that you are looking for an executable command.

8.1.6 ConfiggetFileName

Syntax: configGetFileName (SVFileName); Description: ConfiggetFileName function Retrieves the default system profile (initially set by InstallShield to the config.sys file that is executed when the target system is started).

parameter:

svfilename

Returns the list of default system profiles.

return value:

0: ConfiggetFileName successfully retrieves the list of default system configuration files.

<0: ConfiggetFileName failed to retrieve fully qualified names for default system configuration files.

annotation:

There are very few cases of InstallShield may not be able to determine the list of default configuration files. In this case, SVFileName will be an empty string ("").

8.1.7 ConfiggetInt

Syntax: configgetint (szkey, nvvalue);

Description: The configgetint function retrieves an integer value of a reference word in a system configuration file that is loaded into the memory by function configFileLoad. ConfiggetInt retrieves the value from the right side of the equal sign. ConfiggetInt does not work in a command with more than one value. For example, the configGetint recognizes statement files = 20 and returns the number 20, but it does not recognize statements stacks = 9, 128.

Before calling configGetint, you must first call ConfiggetLoad to load the system configuration file into memory. After you edit the file, call ConfigFileSave to save the file.

parameter:

SZKey

Specifies the reference word to the statement to retrieve the integer value.

NVValue

Returns the integer value of the reference word.

return value:

0: ConfiggetInt successfully retrieves an integer value.

<0: ConfiggetInt failed to retrieve the integer value.

8.1.8 Configmove

Syntax: Configmove (Szmove, Szrefkey, NOPTIONS);

Note: The configmove function moves a line in a system configuration file that is loaded into the memory by the function configFileLoad. The row can be moved to the front and last of the file, or a particular row in the file or behind.

Before calling the configmove function, you must first call ConfigFileLoad to load the config.sys file to memory. After you edit the file, call ConfigFileSave to save the file.

parameter:

Szmove

Specifies the row to move.

Szrefkey

Specifies the keyword identified by the reference line, and the reference line is used to locate the row to be moved. The location of the row to be moved is determined by the value of the parameter noptions.

NOPTIONS

Specify the front or back of the row you want to move to move the parameter szmove to the row containing the reference word specified by szrefkey. One of the following predefined constants in this parameter location:

Before: The row specified by Szmove is placed in front of the row containing SzrefKey. If Szmove is an empty string (""), the row is placed in front of the system configuration file.

After: The row specified by Szmove is placed behind the row containing szrefkey. If Szmove is an empty string ("), the row is placed behind the end of the system configuration file.

return value:

0: Configmove successfully mobile system configuration files.

<0: Configmove failed to move the line.

8.1.9 ConfigSetFileName

Syntax: configSetFileName (szconfigfile);

Description: configSetFileName function Specifies the full qualification of the file you want to use to default system configuration files. During the installation initialization, the installshield identifies the config.sys file that is executed when the target system is started and will use it as the default system configuration file. If this is the unique system profile that will edit in your installation, it is not necessary to call the function. The EZ configuration file will use this file, the advanced configuration file function configFileLoad will open the file when its parameter is an empty string (""). However, if you want to use an EX configuration file function to modify a configuration file other than the bootstrap Config.sys file, you must call ConfigSetFileName to modify the default system profile. For example, assume that you want to create a config.sys file that is not used when you boost on the target system. You must set a file name in the application directory. The EZ configuration file function will then operate on the file; if you call configFileLoad with an empty string, the file will be loaded into memory, you can use the advanced file function to edit it.

parameter:

Szconfigfile

Specifies the full qualification of the file set to the default system configuration file.

return value:

0: ConfigSetFileName successfully retrieves the specified default system profile.

<0: ConfigSetFileName failed to retrieve the specified file.

annotation:

• The ConfigSetFileName function cannot load a system configuration file into memory. You must use configFileLoad to load a file into memory.

• ConfigSetFileName does not verify the name of the file you specified. If you specify an invalid file name, all future configuration file functions will fail.

8.1.10 ConfigsetInt

Grammar: configsetint (Szkey, NValue);

Description: The configsetint function modifies a specified integer value in the system configuration file that is loaded by the function configfileload into the memory. ConfigsetInt only sets the value in the right of the right side of the right. Configsetint does not work in a command with more than one value. For example, configsetint recognition statement files = 20 and modify 20 as other values, but it cannot recognize statements stacks = 9,128.

Before calling configsetint, you must first call ConfigSetLoad to load the system profile into memory. After you edit the file, call ConfigFileSave to save the file.

parameter:

SZKey

Specifies the reference word for the command to be set to be set.

Nvalue

Specify the integer value you want to set in szkey as the command.

return value:

0: ConfigsetInt successfully sets the specified integer in the system configuration file.

<0: Configsetint failed to set the specified integer.

8.2 EZ configuration file function

The EZ configuration file function modifies the default system profile. This file is the config.sys file that is executed at startup at startup.

Do not mix the EZ configuration file function and the advanced profile function. After calling configfileload until you call ConfigFileSave, you can use the EZ configuration file function after you save your modification.

These functions each open the default system profile, execute the task it specified, and save the file back to the disk. You can't load and save the configuration file as you do in the advanced configuration file function.

Ezconfigadddriver

Add a device driver statement in the default system profile.

Ezconfigaddstring

Add a statement or a line text in the default system profile.

EzconfiggetValue

Retrieve the value of the system configuration file parameter, such as Files or Buffers. EzconfigSetValue

Set the value of the system configuration file parameter, such as Files or Buffers.

8.2.1 EzconfigadDdriver

Syntax: ezconfigadddriver (szdriver, szrefkey, nposition);

Note: The ezconfigadddriver function adds a device driver statement in the default system configuration file. You can specify the location of the driver statement relative to another driver statement. For example, an application can require a device driver after the Windows Himem.sys driver.

The default system profile is the config.sys file that is executed when the default system profile is started by calling configSetFileName. To call another file as the default system configuration file, call ConfigSetFileName. To determine the fully qualified name of the default system profile, call ConfiggetFileName.

parameter:

SZDriver

Specifies the full qualification of the driver to be added to the file. If the driver already exists in one or more locations of the system configuration file, this function replaces only the last line containing the driver name.

Szrefkey

Specifies the name of the device driver relative to which you are adding szdriver.

Specifies the reference device driver name relative to the SZDriver you want to add.

NPosition

Indicates that SZDriver is still behind the driver specified by SzrefKey or later. One of the following predefined constants in this parameter location:

Before: The statement is added to the front of the row that contains szrefkey. If SzrefKey contains an empty string (""), the driver is inserted into the system configuration file as the first driver.

After: The statement is added to the back of the row that contains szrefkey. If SzrefKey contains an empty string (""), the driver is inserted into the system configuration file as the last driver.

return value:

0: EzconfigadDriver successfully adds the device driver statement to the file.

<0: Ezconfigadddriver WAS Unable to add the driver stat.

EzconfigAddriver fails to add driver statements.

8.2.2 EzconfigAddstring

Syntax: ezconfigaddstring (Szline, Szrefkey, NOPTION);

Description: The ezconfigaddstring function adds a line of text to the default system profile. You can specify the location of the line you want to add to another statement in the file.

The default system profile is the config.sys file that is executed when the default system profile is started by calling configSetFileName. To call another file as the default system configuration file, call ConfigSetFileName. To determine the fully qualified name of the default system profile, call ConfiggetFileName.

parameter:

Szline

Specifies the text line to add to the system configuration file.

Szrefkey

Specifies the reference to the SZLINE you want to place in the system configuration file. EzconfigAddString looks for the reference word in the system configuration file and places the contents of the parameter SZLINE that contains the word or later, depending on the content that is passed to NOPTIONS.

NOPTIONS

Indicates that the row specified by SZLINE is to be added to the front or behind it contains the row of szrefKey. One of the following predefined constants in this parameter location:

Before: Add the row specified by SZLINE to the front of the row that contains szrefkey. If SzrefKey contains an empty string (""), Szline is inserted into the system configuration file as the head. After: Adding rows specified by SZLINE to the back of rows that contain szrefKey. If SzrefKey contains an empty string (""), Szline is inserted into the system configuration file as the end.

return value:

0: EZConfigAddString Successfully Adds a string to the default system profile.

<0: WAS Unable to add the text string.

EzconfigAddstring failed to add text lines.

8.2.3 EzconfiggetValue

Syntax: EzconfiggetValue (Szrefkey, NVValue);

Description: The EzconfiggetValue function retrieves numerical values ​​of a parameter in the default system configuration file, such as Files or Buffers. The default system profile is the config.sys file that is executed in the startup sequence unless modified by calling configSetFileName. To call another file as the default system configuration file, call ConfigSetFileName. To determine the fully qualified name of the default system profile, call ConfiggetFileName.

parameter:

Szrefkey

Specifies the name of the parameter to be retrieved.

NVValue

Returns the value value of the keyword specified by szrefkey.

return value:

0: EZConfiggetValue successfully retrieves this value.

<0: EZConfiggetValue failed to retrieve this value.

8.2.4 EzconfigSetValue

Syntax: EzconfigSetValue (Szrefkey, NValue);

Description: The EzconfigSetValue function sets a command value in the default system configuration file. The default system profile is the config.sys file that is executed when the default system profile is started by calling configSetFileName. To call another file as the default system configuration file, call ConfigSetFileName. To determine the fully qualified name of the default system profile, call ConfiggetFileName.

parameter:

Szrefkey

Specify its value to be modified or added to the command in the default system configuration file. If this keyword does not exist in the file, it will be added.

Nvalue

Specifies the new value of the command specified by szrefkey.

return value:

0: EZConfigSetValue Successfully sets this value.

<0: EzconfigSetValue is not capable of setting this value.

转载请注明原文地址:https://www.9cbs.com/read-30519.html

New Post(0)