//////////////////////////////////////////////////////////////////////////////// // // IIIIIII SSSSSS // II SS InstallShield (R) // II SSSSSS (c) 1996-1997, InstallShield Software Corporation // II SS (c) 1990-1996, InstallShield Corporation // IIIIIII SSSSSS All Rights Reserved. // // // This code is generated as a starting setup template. You should // modify it to provide all necessary steps for your setup. // // // File Name: Setup.rul // // Description: InstallShield script // // Comments: This template script performs a basic setup. With minor // modifications, this template can be adapted to create // new, customized setups. // //////////////////////////////////////////////////////////////////////////////// // Include header files #include "sdlang.h" #include "sddialog.h" ////////////////////// string defines //////////////////////////// #define UNINST_LOGFILE_NAME "Uninst.isu" //////////////////// installation declarations /////////////////// // ----- DLL function prototypes ----- // your DLL function prototypes // ---- script function prototypes ----- // generated by the Project Wizard prototype ShowDialogs(); prototype MoveFileData(); prototype HandleMoveDataError( NUMBER ); prototype ProcessBeforeDataMove(); prototype ProcessAfterDataMove(); prototype SetupRegistry(); prototype SetupFolders(); prototype CleanUpInstall(); prototype SetupInstall(); prototype SetupScreen(); prototype CheckRequirements(); prototype DialogShowSdLicense(); prototype DialogShowSdFinishReboot(); // your script function prototypes prototype DialogSelectCollections(); prototype DialogGetAdminPassword(); prototype SetAdminPassword(); prototype CheckWin32s(); // ----- global variables ------ // generated by the Project Wizard BOOL bIsShellExplorer, bInstallAborted, bIs32BitSetup; STRING svDir; STRING svName, svCompany, svSerial; STRING svDefGroup; STRING szAppPath; STRING svSetupType; // your global variables STRING svAdminPassword, svLogFile; BOOL bWinNT; /////////////////////////////////////////////////////////////////////////////// // // MAIN PROGRAM // // The setup begins here by hiding the visible setup // window. This is done to allow all the titles, images, etc. to // be established before showing the main window. The setup is // then performed in a series of calls to script defined functions, // with error checking at each step. // /////////////////////////////////////////////////////////////////////////////// program Disable( BACKGROUND ); CheckRequirements(); SetupInstall(); SetupScreen(); CheckWin32s(); if (ShowDialogs()<0) goto end_install; if (ProcessBeforeDataMove()<0) goto end_install; if (MoveFileData()<0) goto end_install; if (ProcessAfterDataMove()<0) goto end_install; if (SetupRegistry()<0) goto end_install; if (SetupFolders()<0) goto end_install; end_install: CleanUpInstall(); // If an unrecoverable error occurred, clean up // the partial installation. Otherwise, exit normally. if (bInstallAborted) then abort; endif; endprogram /////////////////////////////////////////////////////////////////////////////// // // Function: ShowDialogs // // Purpose: This function manages the display and navigation of // the standard dialogs that exist in a setup. // /////////////////////////////////////////////////////////////////////////////// function ShowDialogs() NUMBER nResult; begin Dlg_Start: // beginning of dialogs label Dlg_SdLicense: nResult = DialogShowSdLicense(); if (nResult = BACK) goto Dlg_Start; Dlg_SelectCollections: nResult = DialogSelectCollections(); if (nResult = BACK) goto Dlg_SdLicense; Dlg_GetAdminPassWord: nResult = DialogGetAdminPassword(); if (nResult = BACK) goto Dlg_SelectCollections; return 0; end; /////////////////////////////////////////////////////////////////////////////// // // Function: ProcessBeforeDataMove // // Purpose: This function performs any necessary operations prior to the // actual file transfer. // /////////////////////////////////////////////////////////////////////////////// function ProcessBeforeDataMove() NUMBER nResult; begin // Create app information, uninstallation, and App Paths registry keys. InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY ); svLogFile = UNINST_LOGFILE_NAME; nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 ); if (nResult < 0) then MessageBox( @ERROR_UNINSTSETUP, WARNING ); endif; szAppPath = TARGETDIR; if ((bIs32BitSetup) && (bIsShellExplorer)) then RegDBSetItem( REGDB_APPPATH, szAppPath ); RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY ); RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME ); endif; // TO DO : any other tasks you want to perform before file transfer return 0; end; /////////////////////////////////////////////////////////////////////////////// // // Function: MoveFileData // // Purpose: This function handles the file transfer for // the setup. // /////////////////////////////////////////////////////////////////////////////// function MoveFileData() NUMBER nResult, nDisk; begin nDisk = 1; SetStatusWindow( 0, "" ); Disable( DIALOGCACHE ); Enable( STATUS ); StatusUpdate( ON, 100 ); nResult = ComponentMoveData( MEDIA, nDisk, 0 ); HandleMoveDataError( nResult ); Disable( STATUS ); return nResult; end; /////////////////////////////////////////////////////////////////////////////// // // Function: HandleMoveDataError // // Purpose: This function handles the error (if any) during the file transfer // operation. // /////////////////////////////////////////////////////////////////////////////// function HandleMoveDataError( nResult ) STRING szErrMsg, svComponent , svFileGroup , svFile; begin svComponent = ""; svFileGroup = ""; svFile = ""; switch (nResult) case 0: return 0; default: ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult ); szErrMsg = @ERROR_MOVEDATA + "\n\n" + @ERROR_COMPONENT + " " + svComponent + "\n" + @ERROR_FILEGROUP + " " + svFileGroup + "\n" + @ERROR_FILE + " " + svFile; SprintfBox( SEVERE, @TITLE_CAPTIONBAR, szErrMsg, nResult ); bInstallAborted = TRUE; return nResult; endswitch; end; /////////////////////////////////////////////////////////////////////////////// // // Function: ProcessAfterDataMove // // Purpose: This function performs any necessary operations needed after // all files have been transferred. // /////////////////////////////////////////////////////////////////////////////// function ProcessAfterDataMove() STRING szReferenceFile; begin SetAdminPassword(); szReferenceFile = svDir ^ @PRODUCT_KEY; DeinstallSetReference( szReferenceFile ); return 0; end; /////////////////////////////////////////////////////////////////////////////// // // Function: SetupRegistry // // Purpose: This function makes the registry entries for this setup. // /////////////////////////////////////////////////////////////////////////////// function SetupRegistry() NUMBER nResult; begin // TO DO : Add all your registry entry keys here. // Call registry functions and/or create keys from // the InstallShield IDE's Resources pane. nResult = CreateRegistrySet( "" ); return nResult; end; /////////////////////////////////////////////////////////////////////////////// // // Function: SetupFolders // // Purpose: This function creates all the folders and shortcuts for the // setup. This includes program groups and items for Windows 3.1. // /////////////////////////////////////////////////////////////////////////////// function SetupFolders() NUMBER nResult; STRING szIsData; NUMBER nType; begin if (Is(USER_ADMINISTRATOR,szIsData)==TRUE) then nType = COMMON; else nType = PERSONAL; endif; ProgDefGroupType(nType); if (CreateProgramFolder(@FOLDER_NAME) < 0) then MessageBox("CreateProgramFolder failed.", SEVERE); endif; // The following adds the shortcuts. if (AddFolderIcon(@FOLDER_NAME, @README, "\"" + TARGETDIR ^ "README.TXT\"", "", "", 0, "", REPLACE) < 0) then MessageBox("AddFolderIcon failed.", SEVERE); endif; if (AddFolderIcon(@FOLDER_NAME, @TEXT_UNINSTALL, UNINST + " -f\"" + svLogFile + "\"", "", "", 0, "", REPLACE) < 0) then MessageBox("AddFolderIcon failed.", SEVERE); endif; if (AddFolderIcon(@FOLDER_NAME, @FOLDER_NAME, "\"" + TARGETDIR ^ "server.exe\"", "", "", 0, "", REPLACE) < 0) then MessageBox("AddFolderIcon failed.", SEVERE); endif; nResult = CreateShellObjects( "" ); return nResult; end; /////////////////////////////////////////////////////////////////////////////// // // Function: CleanUpInstall // // Purpose: This cleans up the setup. Anything that should // be released or deleted at the end of the setup should // be done here. // /////////////////////////////////////////////////////////////////////////////// function CleanUpInstall() begin if (bInstallAborted) then return 0; endif; DialogShowSdFinishReboot(); if (BATCH_INSTALL) then // ensure locked files are properly transferred CommitSharedFiles(0); endif; return 0; end; /////////////////////////////////////////////////////////////////////////////// // // Function: SetupInstall // // Purpose: This will initialize the setup. Any general initialization // needed for the installation should be performed here. // /////////////////////////////////////////////////////////////////////////////// function SetupInstall() begin Enable( CORECOMPONENTHANDLING ); bInstallAborted = FALSE; svDir = PROGRAMFILES ^ "gsdl"; TARGETDIR = svDir; SdProductName( @PRODUCT_NAME ); Enable( DIALOGCACHE ); return 0; end; /////////////////////////////////////////////////////////////////////////////// // // Function: SetupScreen // // Purpose: This function establishes the screen look. This includes // colors, fonts, and text to be displayed. // /////////////////////////////////////////////////////////////////////////////// function SetupScreen() begin Enable( FULLWINDOWMODE ); Enable( INDVFILESTATUS ); SetTitle( @TITLE_MAIN, 24, WHITE ); SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text. Enable( BACKGROUND ); Delay( 1 ); end; /////////////////////////////////////////////////////////////////////////////// // // Function: CheckRequirements // // Purpose: This function checks all minimum requirements for the // application being installed. If any fail, then the user // is informed and the setup is terminated. // /////////////////////////////////////////////////////////////////////////////// function CheckRequirements() NUMBER nvDx, nvDy, nvResult; STRING svResult, szIsData; begin bWinNT = FALSE; bIsShellExplorer = FALSE; // Check screen resolution. GetExtents( nvDx, nvDy ); if (nvDy < 480) then MessageBox( @ERROR_VGARESOLUTION, WARNING ); abort; endif; // set 'setup' operation mode bIs32BitSetup = TRUE; GetSystemInfo( ISTYPE, nvResult, svResult ); if (nvResult = 16) then bIs32BitSetup = FALSE; // running 16-bit setup return 0; // no additional information required endif; // --- 32-bit testing after this point --- // Determine the target system's operating system. GetSystemInfo( OS, nvResult, svResult ); if (nvResult = IS_WINDOWSNT) then // Running Windows NT. bWinNT = TRUE; // Check to see if the shell being used is EXPLORER shell. if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then if (nvResult >= 4) then bIsShellExplorer = TRUE; endif; endif; elseif (nvResult = IS_WINDOWS95) then bIsShellExplorer = TRUE; endif; end; /////////////////////////////////////////////////////////////////////////////// // // Function: DialogShowSdLicense // // Purpose: This function displays the license agreement dialog. // // /////////////////////////////////////////////////////////////////////////////// function DialogShowSdLicense() NUMBER nResult; STRING szTitle, szMsg, szQuestion, szLicenseFile; begin szLicenseFile = SUPPORTDIR ^ "license.txt"; szTitle = ""; szMsg = ""; szQuestion = ""; nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile ); return nResult; end; /////////////////////////////////////////////////////////////////////////////// // // Function: DialogShowSdFinishReboot // // Purpose: This function will show the last dialog of the product. // It will allow the user to reboot and/or show some readme text. // /////////////////////////////////////////////////////////////////////////////// function DialogShowSdFinishReboot() NUMBER nResult, nDefOptions; STRING szTitle, szMsg1, szMsg2, szOption1, szOption2; NUMBER bOpt1, bOpt2; begin szTitle = ""; szMsg1 = @TEXT_FINISH1; szMsg2 = ""; bOpt1 = TRUE; bOpt2 = FALSE; szOption1 = @TEXT_README; szOption2 = ""; nResult = SdFinish(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); if (bOpt1 = TRUE) then LaunchAppAndWait("notepad", TARGETDIR ^ "README.TXT", WAIT); endif; return 0; end; function DialogSelectCollections() NUMBER nResult; STRING szTitle, szMsg; begin szTitle = @TEXT_SELECT_COLLECTIONS; szMsg = @TEXT_SELECT_COLLECTIONS_DESC; nResult = SdComponentDialog(szTitle, szMsg, svDir, "collections"); TARGETDIR = svDir; return nResult; end; function DialogGetAdminPassword() STRING szTitle, szMsg, szField1; NUMBER nResult; begin svAdminPassword = "admin"; // the default szTitle = @TEXT_ADMIN_PW; szMsg = @TEXT_ADMIN_PW_DESC; szField1 = @TEXT_PW; nResult = SdShowDlgEdit1(szTitle, szMsg, szField1, svAdminPassword); return nResult; end; // use setpw to set the admin password in the users.db database function SetAdminPassword() STRING cmd, cmdline, dbfile; begin dbfile = TARGETDIR ^ "etc" ^ "users.db"; cmd = TARGETDIR ^ "setpw.exe"; cmdline = " -u admin -p " + svAdminPassword + " -o " + dbfile; if (LaunchApp(cmd, cmdline) != 0) then MessageBox(@TEXT_SETPW_FAIL, WARNING); endif; end; function CheckWin32s() STRING szTitle, szMsg, svResult, szInfo, svPath, svVersionNumber; NUMBER nvResult,nResult, nvWin32, nvOSTYPE, nvOLDWIN32S, nvWIN32SINSTALLED; begin if (GetSystemInfo (OS, nvOSTYPE, svResult) < 0) then MessageBox("Couldn't get Operating System info.", SEVERE); endif; // get information about win32s nvOLDWIN32S=0; GetSystemInfo (WIN32SINSTALLED, nvWIN32SINSTALLED, svResult); if (nvWIN32SINSTALLED == TRUE) then GetSystemInfo (WIN32SMAJOR, nvWin32, svResult); if (nvWin32 == 0) then nvOLDWIN32S = 1; else GetSystemInfo (WIN32SMINOR, nvWin32, svResult); if (nvWin32 < 30) then nvOLDWIN32S = 1; endif; endif; endif; // run Win32s installation if required. if ((nvOSTYPE == IS_WINDOWS) || (nvOSTYPE == IS_WIN32S)) then if ((nvWIN32SINSTALLED == 0)) then if (CreateProgramFolder(@FOLDER_NAME) < 0) then MessageBox("CreateProgramFolder failed.", SEVERE); endif; if (AddFolderIcon(@FOLDER_NAME, @INSTALL_GSDL, "\"" + SRCDIR ^ "setup.exe\"", "", "", 0, "", REPLACE) < 0) then MessageBox("AddFolderIcon failed.", SEVERE); endif; MessageBox(@TEXT_ERROR_NO_WIN32S, INFORMATION); LaunchApp(SRCDIR ^ "bin" ^ "windows" ^ "win32s" ^ "setup.exe",""); exit; else if (nvOLDWIN32S == 1) then MessageBox(@TEXT_ERROR_OLD_WIN32S, INFORMATION); endif; endif; endif; end; /////////////////////////////////////////////////////////////////////////////// // // // /////////////////////////////////////////////////////////////////////////////// // --- include script file section --- #include "sddialog.rul"