Modifying INI Files
INI files are a hold-over from Windows 3.1 and earlier, where they were used extensively to store system and application settings. Since the introduction of Windows 95, Microsoft recommends that you use the Windows registry instead of INI files for those purposes. However, there may be situations where you still need to install or modify an INI file, either one used by your own application, or a system file.
InstallMate has a full complement of INI file editing functions, including the ability to selectively replace or append existing values in any INI file on the customer's computer. INI file modifications are automatically installed and removed with the rest of you application, and InstallMate's Setup program is smart enough to remove only the parts that you added to appended INI file values.
Note 1 - If, after uninstallation of your application and reversing any modifications that were made to INI files, one or more INI files turn out to be empty, they are automatically removed by InstallMate. Occasionally this fails, because on some systems Windows caches INI file contents and does not allow an INI file to be deleted immediately. In that case, a 0-sized file may remain behind.
Note 2 - Although Windows NT systems nominally have the standard Windows INI files Win.ini and System.ini, they map their contents to registry settings. This mapping occurs transparently to applications that use standard Windows functions like GetPrivateProfileString (including InstallMate's Setup program), but may in some situations lead to unexpected results. Therefore, be sure to test your application thoroughly if it depends on these or other potentially mapped INI files.
How to specify INI file modifications
To specify INI file modifications with InstallMate, act as follows.
- Decide upon the extent of the modifications. If you want to install a completely new INI file, it might be easiest to prepare a template file, install that file as per usual (see Installing Files for more information), then add any detailed modifications as described below. Because file installation takes place before system modifications such as INI file editing, this works as expected. Of course, if you want to edit an existing file such as Win.ini, the template file method is not applicable.
- Go to the INI files project page.
- Right-click anywhere in the list to open its context menu.
- On the context menu that appears, choose New INI Value.
InstallMate creates a new INI file key. In its INI Value attributes pane, set the following options:
- Name - Enter the key name. It may not contain the '=' character and must be unique within the same section of the INI file, except if you create duplicate key names without component overlap.
- Value - Enter the text data associated with the key name.
- Section - Enter the name of the INI file section for the key.
- INI file - Enter the name of the INI file. The default value is <WindowsFolder>\win.ini, which represents the standard Windows Win.ini file. However, you may enter any suitable file path here. To refer to an INI file that is installed along with the rest of your application (see step 1), click on the button to the right of the text field, then choose Browse for File... from the menu that appears and select the desired installation file.
- Install action - Choose the appropriate action. See INI Value attributes for an explanation of the available options.
- Remove action - Choose the appropriate action. The safest option is Remove partial value; this will actually clean up the entire value if it becomes empty.
- Separator - Enter the separator character to be used if you selected Prepend to exisiting value or Append to existing value in the Install action field. If you leave this field blank, no separator is used.
- Repeat steps 3-5 as required for other INI file keys.