home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------*\
- *
- * IIIIIII SSSSSS
- * II SS InstallShield (R)
- * II SSSSSS (c) 1990-1996, Stirling Technologies, Inc.
- * II SS All Rights Reserved.
- * IIIIIII SSSSSS
- *
- *
- * This code is intended as a supplement to InstallShield documentation
- * and is provided AS IS.
- *
- *
- * File Name: SETUP.RUL
- *
- * Description: License Use Runtime Client Installation
- *
- *
- * Author: Cristina D'Angelo Date: 07-96
- *
- * Comments:
- *
- *
- *
- *
- \*----------------------------------------------------------------------------*/
-
- declare
- #include "sddialog.h"
-
- // Constant declarations.
- #define SPACE_REQUIRED 7000000 // Disk space in bytes.
- #define APP_NAME "License Use Runtime - Client"
- #define PROGRAM_FOLDER_NAME "License Use Runtime"
- #define APPBASE_PATH "ifor"
- #define APPBASE_PATH_WIN32S "ifor"
- #define COMPANY_NAME "IBM"
- #define PRODUCT_NAME "License Use Runtime"
- #define PRODUCT_VERSION "1.0"
- #define PRODUCT_KEY "i4cfg.exe"
- #define DEINSTALL_KEY "IforCliDeinstKey"
- #define UNINSTALL_NAME "License Use Runtime"
-
-
- // Global variable declarations.
- STRING svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile;
- STRING svTarget, szProgram, szParam, szTemp, szAppPath, szMsg1, szMsg2;
- STRING szKey[255], szValue, svNumValue, szFindMe, szField1, szDir, szDrive;
- STRING RespFile, RspFilePath, tempstr, StringToStrip;
- BOOL bSpaceOk, bWinNT, bWin32s, bIsShellExplorer;
- NUMBER nResult, nvType, nvSize, svLen, Index, GoodIndex;
-
- // Function declarations.
- prototype SetupScreen();
- prototype CheckRequirements();
- prototype CheckReturnPerform(number);
- prototype CreateFolderIcons();
- prototype DoFileTransfer();
- prototype UpdateRegistry();
-
- program
-
- StartHere:
- Disable( BACKGROUND );
-
- // Set installation info., which is required for registry entries.
- InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
-
- // Set up thr installation screen.
- SetupScreen();
- Enable( DIALOGCACHE );
-
- // Create a Welcome dialog.
- WelcomeDlg:
- Disable( BACKBUTTON );
- Welcome( "", 0 );
- Enable( BACKBUTTON );
-
- // Test target system for proper configuration.
- CheckRequirements();
-
- // Ask user for a destination location for the installation.
- //Only the directory can be chosen. The destination path
- //must be ifor.
- szDir = TARGETDISK;
- GetTargetDirectory:
- bSpaceOk = TRUE;
-
- // Check if the product is already installed retrieving the
- // I4_INSTALL_DRIVE variable
- if (GetEnvVar("I4_INSTALL_DRIVE", szValue)) then
- szMsg = "Setup will install License Use Runtime in the following "+
- "drive. You may select a different drive by editing the "+
- "Destination field. "+
- "Click Cancel to exit the Setup program.";
- szTitle = "Choose Destination Location";
- szField1 = "Destination";
- Disable (BACKBUTTON);
- SdShowDlgEdit1( szTitle, szMsg, szField1, szDir );
- Enable (BACKBUTTON);
- if ((StrLength(szDir) > 2) || (StrLength(szDir) <= 1)) then
- MessageBox( "Only a drive can be entered for the Destination entry.", WARNING);
- goto GetTargetDirectory;
- endif;
- StrSub(szDrive, szDir, 0, 1);
- if ((ExistsDisk(szDrive) = NOTEXISTS)) then
- MessageBox ("The drive entered in the Destination field does not specify a valid drive.", SEVERE);
- goto GetTargetDirectory;
- endif;
- if (GetDiskSpace( szDir ) < SPACE_REQUIRED) then
- szMsg = "There is not enough space available on the disk\n" +
- "'" + szDir + "' \n" +
- "Please free up some space or change the target location\n" +
- "to a different disk";
- MessageBox( szMsg, WARNING );
- bSpaceOk = FALSE;
- endif;
- // If not enough space, ask user to try again.
- if (bSpaceOk = FALSE) goto GetTargetDirectory;
- else
- szDir=szValue;
- szMsg = "Setup program detected a previous installation in the " +
- szDir +" drive. The same drive will used as destination drive " +
- "in order to update the currently installed product or to " +
- "install additional components.";
- MessageBox(szMsg, INFORMATION);
- goto DeInstallInfo;
- endif;
-
-
- // Prepare InstallShield to record deinstallation information.
- DeInstallInfo:
- svTarget = szDir ^ APPBASE_PATH;
-
-
- // Prepare InstallShield to record deinstallation information.
- DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
- RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
-
-
- // Set the App Paths key for the main program.
- szAppPath = svTarget ^ "WIN" ^ "BIN";
- RegDBSetItem( REGDB_APPPATH, szAppPath );
- szProgram = svTarget ^ "WIN\\BIN\\i4cfg.exe";
- RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
-
- RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
- szKey = "SOFTWARE\\" + "IBM\\" + PRODUCT_NAME;
- RegDBCreateKeyEx( szKey, "");
- RegDBSetKeyValueEx( szKey, "Version", REGDB_STRING, PRODUCT_VERSION, -1);
-
- SetupFilesToTransfer:
- DoFileTransfer();
-
- nResult = FileSetPerformEz( szFileSet, 0 );
-
- CheckReturnPerform(nResult);
-
- Delay( 1 );
- Disable( STATUSDLG );
-
- // Run the iforreg configuration program
-
- szProgram = svTarget ^ "WIN" ^ "BIN" ^ "IFORREG.EXE";
- LaunchAppAndWait( szProgram, szDir, WAIT);
-
-
- // Update the Registries for IFOR
-
- UpdateRegistry();
-
-
- // Create the folder and icons for the IForLs component
-
- InstallProgramItems:
- CreateFolderIcons();
-
-
-
- // Global variable UNINST stores the name and location of the
- // uninstaller file.
- szProgram = WINDIR ^ "UNINST.EXE" + " -f" + svUninstLogFile;
- AddFolderIcon( svFolder, "unInstall", szProgram,
- WINDIR, "", 0, "", REPLACE );
- Delay( 1 );
-
-
- // Announce setup complete and offer to read README file.
- FinalInstallProcess:
- SetStatusWindow( 100, "Installation complete." );
-
- if (AskYesNo( "Do you want to view the README file now?", YES ) = YES) then
- LaunchApp( "NOTEPAD.EXE", svTarget ^ "READ.ME" );
- Delay( 8 );
- endif;
-
- // szMsg = "Setup is complete. You may run the installed program "+
- // "by double-clicking on the program icon.";
- // MessageBox( szMsg, INFORMATION );
-
- MessageBeep( 0 );
- szTitle = "Setup Complete";
-
- szMsg1 = "Setup has finished copying files to your computer." +
- "You can restart your computer now, or restart it later.\n" +
- "Select one of the following:";
- szMsg2 = "Click finish to complete setup.";
-
- SdFinishReboot( szTitle,
- szMsg1,
- SYS_BOOTMACHINE,
- szMsg2,
- 0);
-
- exit;
-
- #include "sddialog.rul"
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: SetupScreen
- *
- * Purpose: This function will set up the screen look. This includes
- * colors, fonts, text to be displayed, etc.
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
- function SetupScreen()
- number nDx, nDy;
- begin
- GetExtents( nDx, nDy );
-
- Enable( FULLWINDOWMODE );
- Enable( INDVFILESTATUS );
- Enable( BITMAP256COLORS );
-
- SetTitle( "Installing " + APP_NAME, 24, WHITE );
-
- SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
- SetColor( STATUSBAR, BLUE ); // Bright blue.
- SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
-
- Enable( BACKGROUND );
-
- Delay( 1 );
-
- end;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CheckRequirements
- *
- * Purpose: This function will check all minimum requirements for the
- * application being installed. If any fail, then the user
- * is informed and the installation is terminated.
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
- function CheckRequirements()
- number nvDx, nvDy;
- number nvResult;
- STRING svResult;
-
- begin
-
- // Check screen resolution.
- GetExtents( nvDx, nvDy );
- if (nvDy < 480) then
- MessageBox( "This program requires VGA or better resolution.", WARNING );
- exit;
- endif;
-
- // Determine the target system's operating system.
- GetSystemInfo( OS, nvResult, svResult );
- bWinNT = FALSE;
- bWin32s = FALSE;
- bIsShellExplorer = FALSE;
-
- if (nvResult = IS_WINDOWSNT) then
- bWinNT = TRUE; // Running Windows NT.
-
- // Check to see if NT is using EXPLORER Shell
- if( QueryShellMgr( svResult ) = 0 ) then
- if( StrCompare( svResult, "EXPLORER.EXE" ) = 0 ) then
- bIsShellExplorer = TRUE;
- endif;
- endif;
-
- elseif (nvResult = IS_WIN32S) then
- bWin32s = TRUE; // Running Win32s.
- endif;
-
- end;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CheckReturnPerform(nResult)
- *
- * Purpose: This function check the return code of FileSetPerformEz()
- * function.
- *
- *
- * Input: NUMBER nResult
- *
- \*---------------------------------------------------------------------------*/
-
- function CheckReturnPerform (nResult)
-
- begin
- switch (nResult)
-
- case FS_DONE: // Successful completion.
-
- case FS_CREATEDIR: // Create directory error.
- MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
- "Please check write access to this directory.", SEVERE );
- exit;
-
- default: // Group all other errors under default label.
- NumToStr( szTemp, nResult );
- MessageBox( "General file transfer error."+
- "Please check your target location and try again."+
- "\n\n Error Number:"+szTemp +
- "\n Related File: "+ERRORFILENAME,
- SEVERE );
- exit;
- endswitch;
- end;
-
- /*-------------------------------------------------------------------*\
- *
- *
- * function CreateFolderIcons()
- *
- * Description: Create the product folders and the icons.
- *
- *
- *
- \*-------------------------------------------------------------------*/
-
- function CreateFolderIcons()
-
- begin
- SetStatusWindow( 95, "Creating Program Folder and Icons...." );
-
- svFolder = PROGRAM_FOLDER_NAME;
- svDir = svTarget ^ "WIN" ^ "BIN";
- CreateProgramFolder( svFolder);
- ShowProgramFolder( svFolder, SW_SHOW);
- Delay(1);
-
- AddFolderIcon( svFolder,
- "Configuration Tool",
- svDir ^ "I4CONFIG.EXE",
- svDir,
- "",
- 0,
- "",
- REPLACE);
- Delay(1);
-
- AddFolderIcon( svFolder,
- "Nodelock Administration Tool",
- svDir ^ "NAT.EXE",
- svDir,
- "",
- 0,
- "",
- REPLACE);
- Delay(1);
-
- AddFolderIcon( svFolder,
- "Using License Use Runtime",
- svDir ^ "IVIEW.EXE" + " I4BU1MST.INF",
- svDir,
- "",
- 0,
- "",
- REPLACE);
- Delay(1);
-
- AddFolderIcon( svFolder,
- "Command Reference",
- svDir ^ "IVIEW.EXE" + " I4WU1CMD.INF",
- svDir,
- "",
- 0,
- "",
- REPLACE);
- Delay(1);
-
- AddFolderIcon( svFolder,
- "Message Reference",
- svDir ^ "IVIEW.EXE" + " I4DU1MSG.INF",
- svDir,
- "",
- 0,
- "",
- REPLACE);
- Delay(1);
-
- end;
-
- /*-------------------------------------------------------------------*\
- *
- *
- * function DoFileTransfer()
- *
- * Description: Prepare the FileSet and Perform the file transfer
- *
- *
- *
- \*-------------------------------------------------------------------*/
-
- function DoFileTransfer()
-
- begin
-
- szFileSet = "General";
-
- // Define the file set.
- FileSetBeginDefine( szFileSet );
-
- SetStatusWindow( -1, "Copying program files..." );
-
- TARGETDIR = svTarget;
- XCopyFile("READ.ME","READ.ME",COMP_UPDATE_DATE);
-
- TARGETDIR = svTarget ^ "LS" ^ "CONF";
- XCopyFile("I4LS.INI","I4LS.INI",COMP_UPDATE_DATE);
-
- TARGETDIR = svTarget ^ "WIN" ^ "BIN";
- CompressGet("arkbinc.z","*.*",COMP_UPDATE_DATE);
-
- TARGETDIR = svTarget ^ "LS" ^ "MSG" ^ "EN_US";
- CompressGet("arkcatc.z","*.*",COMP_UPDATE_DATE);
-
- TARGETDIR = svTarget ^ "WIN" ^ "BIN";
- CompressGet("arkdoc.z","*.*",COMP_UPDATE_DATE);
-
- TARGETDIR = svTarget ^ "WIN" ^ "BIN";
- XCopyFile("IVIEW.EXE","IVIEW.EXE",COMP_UPDATE_DATE);
-
-
- FileSetEndDefine( szFileSet );
-
- Disable (DIALOGCACHE);
- Enable (STATUSDLG);
-
- StatusUpdate ( ON,90 );
-
- end;
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: UpdateRegistry()
- *
- * Purpose: This function updates win32 Registry with
- * iFOR keys
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function UpdateRegistry()
- begin
-
- RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
- Disable( LOGGING );
-
- szKey = "SYSTEM\\" + "CurrentControlSet\\" + "Control\\" +
- "Session Manager\\" + "Environment";
- svNumValue = ""; //initialize svNumValue to null string
- RegDBGetKeyValueEx( szKey, "Path", nvType, svNumValue, nvSize);
-
- szFindMe = svTarget ^ "IFOR" ^ "WIN" ^ "BIN";
- nResult = StrFind( svNumValue, //check if the key already contains
- szFindMe); //the value
-
- if( nResult < 0 ) then
- szValue = svNumValue + ";" + szFindMe;
- RegDBSetKeyValueEx( szKey, "Path", REGDB_STRING_EXPAND, szValue, -1);
- endif;
-
- //Update of NLSPATH Environment variable
-
- svNumValue = ""; //initialize svNumValue to null string
- RegDBGetKeyValueEx( szKey, "NLSPATH", nvType, svNumValue, nvSize);
-
- szFindMe = svTarget ^ "IFOR" ^ "LS" ^ "MSG" ^ "EN_US" ^ "%N";
- nResult = StrFind( svNumValue, //check if the key already contains
- szFindMe); //the value
-
- if( nResult < 0 ) then
- if(svNumValue = "") then
- szValue = szFindMe;
- else
- szValue = svNumValue + ";" + szFindMe;
- endif;
-
- RegDBSetKeyValueEx( szKey, "NLSPATH", REGDB_STRING_EXPAND, szValue, -1);
- endif;
-
-
- //Update of the HELP Environment variable
-
- svNumValue = ""; //initialize svNumValue to null string
- RegDBGetKeyValueEx( szKey, "HELP", nvType, svNumValue, nvSize);
-
- szFindMe = svTarget ^ "IFOR" ^ "WIN" ^ "BIN";
- nResult = StrFind( svNumValue, //check if the key already contains
- szFindMe); //the value
-
- if( nResult < 0 ) then
- if(svNumValue = "") then
- szValue = szFindMe;
- else
- szValue = svNumValue + ";" + szFindMe;
- endif;
- RegDBSetKeyValueEx( szKey, "HELP", REGDB_STRING_EXPAND, szValue, -1);
- endif;
-
- //Create the I4_INSTALL_DRIVE Environment Variable
-
- RegDBSetKeyValueEx( szKey, "I4_INSTALL_DRIVE", REGDB_STRING, szDir, -1);
-
- Enable( LOGGING );
-
-
- EzBatchAddPath("PATH", svTarget ^ "WIN" ^ "BIN;", "", AFTER);
- EzBatchAddPath("NLSPATH", svTarget ^ "LS" ^ "MSG" ^ "EN_US" ^ "%N;", "", AFTER);
- EzBatchAddPath("HELP", svTarget ^ "WIN" ^ "BIN;", "", AFTER);
- // tempstr="I4_INSTALL_DRIVE="+szDir;
- // EzBatchReplace(tempstr);
-
-
- end;
-