InstallShield 2019 » InstallScript Language Reference
Note • To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.
/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the EzConfigAddString function.
*
* This example calls EzConfigAddString to add four lines to a
* configuration file.
*
* -- The first call adds a new line of text at the end of
* the file.
*
* -- The second call adds a new line of text at the top of
* the file.
*
* -- The third call adds the line FASTOPEN=512 after the key
* LASTDRIVE.
*
* -- The fourth call adds the line EXAPPHI=ON before the key
* EXAPPHI.SYS.
*
* Note: Before running this script, create a configuration
* file named ISExampl.sys and store it in the root of
* drive C. For best effect, that file should include
* the following lines:
*
* LASTRDRIVE=F
* DEVICE=Exapphi.sys
*
\*--------------------------------------------------------------*/
#define EXAMPLE_SYS "C:\\ISExampl.sys"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_EzConfigAddString(HWND);
function ExFn_EzConfigAddString(hMSI)
STRING szLine, szRefKey;
begin
// Set the default configuration file.
ConfigSetFileName (EXAMPLE_SYS);
// Set up parameters for next call to EzConfigAddString.
szLine = "SHELL=C:\\COMMAND.COM /P /E:512";
szRefKey = "";
// Add a line to the end of the file.
if (EzConfigAddString (szLine, szRefKey, AFTER) < 0) then
MessageBox ("First call to EzConfigAddString failed.", SEVERE);
else
MessageBox ("First call to EzConfigAddString succeeded.", INFORMATION);
endif;
szLine = "DEVICE=C:\\System\\Dmdrvr.bin";
szRefKey = "";
// Add a line to the top of the file.
if (EzConfigAddString (szLine, szRefKey, BEFORE) < 0) then
MessageBox ("Second call to EzConfigAddString failed.", SEVERE);
else
MessageBox ("Second call to EzConfigAddString succeeded.", INFORMATION);
endif;
// Set up parameters for next call to EzConfigAddString.
szLine = "FASTOPEN=512";
szRefKey = "LASTDRIVE";
// Add a line to the file after the key "LASTDRIVE".
if (EzConfigAddString (szLine, szRefKey, AFTER) < 0) then
MessageBox ("Third call to EzConfigAddString failed.", SEVERE);
else
MessageBox ("Third call to EzConfigAddString succeeded.", INFORMATION);
endif;
// Set up parameters for next call to EzConfigAddString.
szLine = "EXAPPHI=ON";
szRefKey = "EXAPPHI.SYS";
// Add a line to the file before the key "Exapphi.sys".
if (EzConfigAddString (szLine, szRefKey, BEFORE) < 0) then
MessageBox ("Fourth call to EzConfigAddString failed.", SEVERE);
else
MessageBox ("Fourth call to EzConfigAddString succeeded.", INFORMATION);
endif;
end;
InstallShield 2019 Help LibraryApril 2019 |
Copyright Information | Flexera |