//////////////////////////////////////////////////////////////////////////////// // // File Name: Setup.rul // // Description: InstallShield script // // Comments: This script was generated based on the selections you made in // the Project Wizard. Refer to the help topic entitled "Modify // the script that the Project Wizard generates" for information // on possible next steps. // //////////////////////////////////////////////////////////////////////////////// // Include header files #include "ifx.h" ////////////////////// string defines //////////////////////////// // these macros should match the MSI properties with the same names #define GSDL "gsdl" #define GSDL_COLLECTION "bbc" #define GSDL_SUBCOLLECTION "bfi1" //////////////////// installation declarations /////////////////// // ----- DLL function prototypes ----- // your DLL function prototypes // ---- script function prototypes ----- // your script function prototypes prototype check_registry(); prototype edit_gsdlsite(); // your global variables BOOL bIsMulti; STRING szInstallDir; ////////////////////////////////////////////////////////////////////////////// // // FUNCTION: OnFirstUIBefore // // EVENT: FirstUIBefore event is sent when installation is run for the first // time on given machine. In the handler installation usually displays // UI allowing end user to specify installation parameters. After this // function returns, FeatureTransferData is called to perform file // transfer. // /////////////////////////////////////////////////////////////////////////////// function OnFirstUIBefore() number nResult; string szTitle, szMsg; string szTargetPath; string szDir, svSetupType; number nvSize; begin // TO DO: if you want to enable background, window title, and caption bar title // SetTitle( @PRODUCT_NAME, 24, WHITE ); // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION ); // Enable( FULLWINDOWMODE ); // Enable( BACKGROUND ); // SetColor(BACKGROUND,RGB (0, 128, 128)); SHELL_OBJECT_FOLDER = @PRODUCT_NAME; svSetupType = "Full"; szDir = INSTALLDIR; // check if this collection is a second or subsequent volume // in a multi-volume set (check_registry sets the bIsMulti and // szInstallDir variables) bIsMulti = FALSE; szInstallDir = ""; check_registry(); Dlg_Start: // beginning of dialogs label Dlg_SdWelcome: szTitle = ""; szMsg = ""; nResult = SdWelcome( szTitle, szMsg ); if (nResult = BACK) goto Dlg_Start; // If we're installing a subsequent volume of a multi-volume set // we won't give the user the option of where to install it. We'll // just force them to install it in the same place as the previous // volume. Dlg_SdAskDestPath: if (!bIsMulti) then szTitle = ""; szMsg = ""; nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 ); INSTALLDIR = szDir; if (nResult = BACK) goto Dlg_SdWelcome; else szDir = szInstallDir; INSTALLDIR = szDir; endif; Dlg_SetupType: szTitle = ""; szMsg = ""; nResult = SdSetupTypeEx ( szTitle , szMsg , "" , svSetupType , 0 ); if (nResult = BACK) then if (bIsMulti) then goto Dlg_SdWelcome; else goto Dlg_SdAskDestPath; endif; else szTargetPath = INSTALLDIR; nvSize = 0; FeatureCompareSizeRequired(MEDIA,szTargetPath,nvSize); if (nvSize != 0) then MessageBox( szSdStr_NotEnoughSpace, WARNING ); goto Dlg_SetupType; endif; endif; Enable(STATUSEX); return 0; end; /////////////////////////////////////////////////////////////////////////////// // // FUNCTION: OnMaintUIBefore // // EVENT: MaintUIBefore event is sent when end user runs installation that // has already been installed on the machine. Usually this happens // through Add/Remove Programs applet. In the handler, installation // usually displays UI allowing end user to modify existing installation // or uninstall application. After this function returns, // FeatureTransferData is called to perform file transfer. // /////////////////////////////////////////////////////////////////////////////// function OnMaintUIBefore() NUMBER nResult, nType; STRING szTitle, szMsg, svDir, svResult, szCaption; begin // TO DO: if you want to enable background, window title, and caption bar title // SetTitle( @PRODUCT_NAME, 24, WHITE ); // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION ); // SetColor(BACKGROUND,RGB (0, 128, 128)); // Enable( FULLWINDOWMODE ); // Enable( BACKGROUND ); Dlg_Start: Disable(BACKBUTTON); nType = SdWelcomeMaint(szTitle, szMsg, MODIFY); Enable(BACKBUTTON); if (nType = REMOVEALL) then svResult = SdLoadString(IFX_MAINTUI_MSG); szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION); nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult); if (nResult = IDCANCEL) goto Dlg_Start; endif; nResult = NEXT; Dlg_SdFeatureTree: if (nType = MODIFY) then szTitle = ""; szMsg = ""; nResult = SdFeatureTree(szTitle, szMsg, TARGETDIR, "", 2); if (nResult = BACK) goto Dlg_Start; endif; switch(nType) case REMOVEALL: ComponentRemoveAll(); case REPAIR: ComponentReinstall(); endswitch; Enable(STATUSEX); end; /////////////////////////////////////////////////////////////////////////////// // // FUNCTION: OnFirstUIAfter // // EVENT: FirstUIAfter event is sent after file transfer, when installation // is run for the first time on given machine. In this event handler // installation usually displays UI that will inform end user that // installation has been completed successfully. // /////////////////////////////////////////////////////////////////////////////// function OnFirstUIAfter() STRING szTitle, szMsg1, szMsg2, szOption1, szOption2; NUMBER bOpt1, bOpt2; STRING szGSDLHOME, szGDBMHOME; begin Disable(STATUSEX); // edit the gsdlsite.cfg file edit_gsdlsite(); bOpt1 = FALSE; bOpt2 = FALSE; szMsg1 = SdLoadString(IFX_SDFINISH_MSG1); SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); end; // check the registry to find out if this collection is the second // or subsequent volume of a multi-volume set function check_registry () STRING szKey, szName, svValue; NUMBER nvType, nvSize; begin bIsMulti = FALSE; szInstallDir = ""; szKey = "SOFTWARE\\" + GSDL + "\\" + @PRODUCT_VERSION + "\\" + GSDL_COLLECTION; szName = "gsdlhome"; RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); if (RegDBGetKeyValueEx(szKey, szName, nvType, svValue, nvSize) == 0) then bIsMulti = TRUE; szInstallDir = svValue; endif; end; // edit the gsdlsite.cfg file - this should be done after // the files have been copied across // note the the gsdlsite.cfg component should have its "never // overwrite" attribute set so that subsequent volumes of a // multi-volume set don't overwrite the existing file function edit_gsdlsite () STRING szFileName, svResult; BOOL bIsFullInstall; begin szFileName = INSTALLDIR ^ "gsdlsite.cfg"; bIsFullInstall = FeatureIsItemSelected(MEDIA, "full_install"); if (!bIsMulti) then // set top level gsdlhome and gdbmhome fields // only if this isn't the second or subsequent // volume if (bIsFullInstall) then WriteProfString(szFileName, "gsdl", "gsdlhome", INSTALLDIR); else WriteProfString(szFileName, "gsdl", "gsdlhome", SRCDIR ^ "gsdl"); endif; WriteProfString(szFileName, "gsdl", "gdbmhome", INSTALLDIR); // set the "collections" line WriteProfString(szFileName, "gsdl", "collections", GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION); else // append this volume to the existing "collections" line GetProfString(szFileName, "gsdl", "collections", svResult); if (StrLengthChars(svResult) > 0) then svResult = svResult + ","; endif; svResult = svResult + GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION; WriteProfString(szFileName, "gsdl", "collections", svResult); endif; // add the "collection#volume" section if (bIsFullInstall) then WriteProfString(szFileName, GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION, "gsdlhome", INSTALLDIR); else WriteProfString(szFileName, GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION, "gsdlhome", SRCDIR ^ "gsdl"); endif; WriteProfString(szFileName, GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION, "gdbmhome", INSTALLDIR); end;