//////////////////////////////////////////////////////////////////////////////// // // 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 //////////////////////////// //////////////////// installation declarations /////////////////// // ----- DLL function prototypes ----- // your DLL function prototypes // ---- script function prototypes ----- // your script function prototypes prototype DirectxCheck(); prototype RunEReg(); prototype MediaPlayerCheck(); // your global variables STRING svSetupType, szText1, szText2, szText3, szText4, szText5, szfolder; BOOL bvCheck1, bvCheck2, bvCheck3, bvCheck4, bvCheck5; ////////////////////////////////////////////////////////////////////////////// // // 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, ComponentTransferData is called to perform file // transfer. // /////////////////////////////////////////////////////////////////////////////// function OnFirstUIBefore() NUMBER nResult, nLevel, nvSize; STRING szTitle, szMsg, szLicenseFile, szQuestion, szTargetPath, szDir, szComponents, szTargetdir; LIST listStartCopy; begin // TO DO: if you want to enable background, window title, and caption bar title // SetTitle( @TITLE_MAIN, 24, WHITE ); // SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Enable( FULLWINDOWMODE ); // Enable( BACKGROUND ); // SetColor(BACKGROUND,RGB (0, 128, 128)); TARGETDIR = PROGRAMFILES ^@COMPANY_NAME ^@PRODUCT_NAME; szDir = TARGETDIR; SHELL_OBJECT_FOLDER = @COMPANY_NAME ^ @PRODUCT_NAME; Dlg_Start: // beginning of dialogs label Dlg_SdWelcome: DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "welcome.bmp", TRUE); szTitle = ""; szMsg = ""; nResult = SdWelcome( szTitle, szMsg ); if (nResult = BACK) goto Dlg_Start; Dlg_SdLicense: DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "SSITitleBar1.bmp", TRUE); szLicenseFile = SUPPORTDIR ^ "license.txt"; szTitle = " "; szMsg = ""; szQuestion = ""; nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile ); if (nResult = BACK) goto Dlg_SdWelcome; Dlg_SdAskDestPath: DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "MPTitleBar1.bmp", TRUE); szTitle = ""; szMsg = ""; nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 ); TARGETDIR = szDir; if (nResult = BACK) goto Dlg_SdLicense; Dlg_SdSetupTypeEx: DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "MPTitleBar1.bmp", TRUE); szTitle = ""; szMsg = ""; svSetupType = "Typical"; nResult = SdSetupTypeEx ( szTitle , szMsg , "" , svSetupType , 0 ); if (nResult = BACK) then goto Dlg_SdAskDestPath; else szTargetPath = TARGETDIR; nvSize = 0; ComponentCompareSizeRequired(MEDIA,szTargetPath,nvSize); if (nvSize != 0) then MessageBox( szSdStr_NotEnoughSpace, WARNING ); goto Dlg_SdSetupTypeEx; endif; endif; Dlg_ObjDialogs: nResult = ShowObjWizardPages(nResult); if (nResult = BACK) goto Dlg_SdSetupTypeEx; Dlg_SdSelectFolder: DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "MPTitleBar1.bmp", TRUE); szfolder = SHELL_OBJECT_FOLDER; szTitle = ""; szMsg = ""; nResult = SdSelectFolder( szTitle, szMsg, szfolder); SHELL_OBJECT_FOLDER = szfolder; if (nResult = BACK) goto Dlg_ObjDialogs; Dlg_AskOptions: DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "MPTitleBar1.bmp", TRUE); DirectxCheck(); MediaPlayerCheck(); szMsg = @ASK_COMPONENTS; szText4 = @INDEO; bvCheck4 = TRUE; szText3 = @SHORTCUT; bvCheck3 = TRUE; szText5 = @GAMINGZONE; bvCheck5 = TRUE; if ((svSetupType = "Spawn Minimum") || (svSetupType = "Spawn Full")) then nResult = AskOptions (NONEXCLUSIVE, szMsg, szText1, bvCheck1, szText2, bvCheck2, szText3, bvCheck3, szText4, bvCheck4); else nResult = AskOptions (NONEXCLUSIVE, szMsg, szText1, bvCheck1, szText2, bvCheck2, szText3, bvCheck3, szText4, bvCheck4, szText5, bvCheck5); endif; if (nResult = BACK) goto Dlg_SdSelectFolder; /*Dlg_SdStartCopy: szTitle = ""; szMsg = ""; listStartCopy = ListCreate( STRINGLIST ); //The following is an example of how to add a string(szName) to a list(listStartCopy). //eg. ListAddString(listStartCopy,szName,AFTER); nResult = SdStartCopy( szTitle, szMsg, listStartCopy ); ListDestroy(listStartCopy); if (nResult = BACK) goto Dlg_ObjDialogs; */ // setup default status SetStatusWindow(0, ""); Enable(STATUSEX); StatusUpdate(ON, 100); 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, // ComponentTransferData is called to perform file transfer. // /////////////////////////////////////////////////////////////////////////////// function OnMaintUIBefore() string szResult, szCaption, szTitle, szMsg; number nResult; begin // TO DO: if you want to enable background, window title, and caption bar title // SetTitle( @TITLE_MAIN, 24, WHITE ); // SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // SetColor(BACKGROUND,RGB (0, 128, 128)); // Enable( FULLWINDOWMODE ); // Enable( BACKGROUND ); Dlg_Start: Dlg_SdWelcome: DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "welcome.bmp", TRUE); Disable(BACKBUTTON); szTitle = @UNINSTALL_TITLE; szMsg = @UNINSTALL_BEFORE_TEXT; nResult = SdWelcome (szTitle, szMsg); if(nResult = NEXT) then ComponentRemoveAll(); endif; // setup default status SetStatusWindow(0, ""); Enable(STATUSEX); StatusUpdate(ON, 100); end; /////////////////////////////////////////////////////////////////////////////// // // FUNCTION: OnMaintUIAfter // // EVENT: MaintUIAfter event is sent after file transfer, 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 that will inform // end user that maintenance/uninstallation has been completed successfully. // /////////////////////////////////////////////////////////////////////////////// function OnMaintUIAfter() STRING szTitle, szMsg1, szMsg2, szOption1, szOption2; NUMBER bOpt1, bOpt2; begin Disable(STATUSEX); ShowObjWizardPages(NEXT); bOpt1 = FALSE; bOpt2 = FALSE; szMsg1 = @UNINSTALL_AFTER_TEXT; szTitle = @UNINSTALL_TITLE; SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); end; /////////////////////////////////////////////////////////////////////////////// // // FUNCTION: OnMoving // // EVENT: Moving event is sent when file transfer is started as a result of // ComponentTransferData call, before any file transfer operations // are performed. // /////////////////////////////////////////////////////////////////////////////// function OnMoving() string szAppPath; NUMBER nDy, nDx; begin nDx = 0; nDy = 0; PlaceWindow (STATUS, nDx, nDy, LOWER_LEFT); SetColor(BACKGROUND, BK_SOLIDBLACK); Enable(BACKGROUND); Enable (FULLWINDOWMODE); Disable(STATUSDLG); Enable(STATUS); // Set LOGO Compliance Application Path // TO DO : if your application .exe is in a subfolder of TARGETDIR then add subfolder szAppPath = TARGETDIR; RegDBSetItem(REGDB_APPPATH, szAppPath); RegDBSetItem(REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY); 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, szCommand1, szCmdLine1, szCommand2, szCmdLine2, szCommand3, szCmdLine3, szCommand4, szCmdLine4, szCommand5, szCmdLine5, szCommand6, szCmdLine6, szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, szShortCutKey; NUMBER nIcon, nFlag; BOOL bOpt1, bOpt2; begin CopyFile("readme.txt", "readme.txt"); XCopyFile("manual", TARGETDIR, COMP_NORMAL); if(svSetupType = "Full") then CopyFile("TheMoonProject.exe", "TheMoonProject.exe"); CopyFile("drvmgt.dll", "drvmgt.dll"); CopyFile("secdrv.sys", "secdrv.sys"); elseif(svSetupType = "Minimum") then CopyFile("TheMoonProject.exe", "TheMoonProject.exe"); CopyFile("drvmgt.dll", "drvmgt.dll"); CopyFile("secdrv.sys", "secdrv.sys"); elseif(svSetupType = "Typical") then CopyFile("TheMoonProject.exe", "TheMoonProject.exe"); CopyFile("drvmgt.dll", "drvmgt.dll"); CopyFile("secdrv.sys", "secdrv.sys"); endif; szCommand1 = SRCDIR + "Directx\\DX80eng.exe"; szCmdLine1 = ""; szCommand2 = SRCDIR + "MediaPlayer\\wmp7.exe"; szCmdLine2 = ""; szCommand3 = SRCDIR + "AutoPlay.exe"; szCmdLine3 = ""; szCommand4 = SRCDIR + "Indeo\\iv5setup.exe"; szCmdLine4 = ""; szCommand5 = WINDIR + "notepad.exe"; szCmdLine5 = SRCDIR + "Readme.txt"; szCommand6 = SRCDIR + "MSN Gaming Zone 6.60\\zonea660.exe"; szCmdLine6 = ""; Disable(BACKGROUND); Disable(FULLWINDOWMODE); Disable(STATUSEX); RunEReg(); // Desktop Shortcut if (bvCheck3 = TRUE) then if ((svSetupType = "Spawn Full") || (svSetupType = "Spawn Minimum")) then szProgramFolder = FOLDER_DESKTOP; szItemName = @PRODUCT_NAME; szCommandLine = TARGETDIR ^ "TheMoonProjectSpawn.exe"; szWorkingDir = TARGETDIR; szIconPath = TARGETDIR ^ "TheMoonProjectSpawn.exe"; nIcon = 0; szShortCutKey = ""; nFlag = REPLACE; LongPathToQuote (szCommandLine, TRUE); AddFolderIcon (szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); else szProgramFolder = FOLDER_DESKTOP; szItemName = @PRODUCT_NAME; szCommandLine = TARGETDIR ^ "TheMoonProject.exe"; szWorkingDir = TARGETDIR; szIconPath = TARGETDIR ^ "TheMoonProject.exe"; nIcon = 0; szShortCutKey = ""; nFlag = REPLACE; LongPathToQuote (szCommandLine, TRUE); AddFolderIcon (szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); endif; endif; // MediaPlayer if (bvCheck2 = TRUE) then LaunchAppAndWait (szCommand2, szCmdLine2, WAIT); endif; // MSN Gaming Zone if (bvCheck5 = TRUE) then LaunchAppAndWait (szCommand6, szCmdLine6, WAIT); endif; // Indeo if (bvCheck4 = TRUE) then LaunchAppAndWait (szCommand4, szCmdLine4, WAIT); endif; //ShowObjWizardPages(NEXT); DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "welcome.bmp", TRUE); szTitle = ""; szMsg1 = @SETUP_COMPLETE_1; szMsg2 = @SETUP_COMPLETE_2; szOption1 = @README_OPT; szOption2 = ""; bOpt1 = TRUE; bOpt2 = FALSE; SdFinish(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); // ReadMe if (bOpt1) then LaunchApp (szCommand5, szCmdLine5); endif; // Directx 7a ELSE Autorun if (bvCheck1 = TRUE) then LaunchApp (szCommand1, szCmdLine1); else LaunchApp (szCommand3, szCmdLine3); endif; end; /////////////////////////////////////////////////////////////////////////////// // // DirectX 8a Checker // Sees if user has current version // /////////////////////////////////////////////////////////////////////////////// function DirectxCheck() STRING svValue; NUMBER nvType, nResult, nvSize; begin RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); nResult = RegDBKeyExist ("Software\\Microsoft\\DirectX"); if (nResult = 1) then nResult = RegDBGetKeyValueEx ("Software\\Microsoft\\DirectX", "Version", nvType, svValue, nvSize); if (svValue >= "4.08.00.0400") then szText1 = @DIRECTX_CURRENT; bvCheck1 = FALSE; else szText1 = @DIRECTX_NEEDS; bvCheck1 = TRUE; endif; else szText1 = @DIRECTX_NEEDS; bvCheck1 = TRUE; endif; end; /////////////////////////////////////////////////////////////////////////////// // // MediaPlayer 7 Checker // Sees if user has current version // /////////////////////////////////////////////////////////////////////////////// function MediaPlayerCheck() STRING svValue; NUMBER nvType, nResult, nvSize; begin RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); nResult = RegDBKeyExist ("Software\\Microsoft\\MediaPlayer\\7.0"); if (nResult = 1) then szText2 = @MEDIAPLAYER_CURRENT; bvCheck2 = FALSE; else szText2 = @MEDIAPLAYER_NEEDS; bvCheck2 = TRUE; endif; end; /////////////////////////////////////////////////////////////////////////////// // // RunEReg() // /////////////////////////////////////////////////////////////////////////////// function RunEReg() STRING svValue, svResult, svVersionNumber, svFileName, szIniDir, szCommand, szCmdLine, szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, szShortCutKey, szTemp, szTemp2, szTemp3; NUMBER nResult, nvResult, nvValue, nIcon, nFlag; BOOL ERegIsInstalled; begin SdShowMsg ("Initializing EReg...", TRUE); //check for 16-bit OS GetSystemInfo (ISTYPE, nvResult, svResult); //EReg only works on 32-bit systems if (nvResult = 16) then MessageBox ("Sorry! Registration is not enabled for 16-bit systems.", SEVERE); return 0; endif; ERegIsInstalled = FALSE; //location of our EReg ini files - please make sure COMPANY_NAME has the same value as the 'family' variable in ereg32.ini or EReg won't work szIniDir = WINDIR ^ "BBStore\\Scopeusr\\Software" ^ "GAME Studios" ^ @COMPANY_NAME ^ @PRODUCT_NAME ^ @PRODUCT_VERSION; //see if EReg has already been run for this product if (FindFile (szIniDir, "ereg.ini", svResult) = 0) then GetProfInt (szIniDir ^ "ereg.ini", "Product Info (EReg)", "registered flag", nvValue); if (nvValue <= 0) then ERegIsInstalled = FALSE; else ERegIsInstalled = TRUE; endif; else ERegIsInstalled = FALSE; endif; //run EReg if it's never been run before if (!ERegIsInstalled) then szCommand = SRCDIR ^ "EReg\\EReg32.exe"; szCmdLine = "/chained"; SdShowMsg ("Initializing EReg...", FALSE); LaunchAppAndWait (szCommand, szCmdLine, WAIT); SdShowMsg ("Completing registration procedure...", TRUE); szIniDir = WINDIR ^ "BBStore\\Scopeusr\\Software" ^ "GAME Studios" ^ @COMPANY_NAME ^ @PRODUCT_NAME ^ @PRODUCT_VERSION; //Check if user completed EReg, if not ERegIsInstalled remains FALSE nResult = FindFile (szIniDir, "ereg.ini", svResult); if (nResult = 0) then GetProfInt (szIniDir ^ "ereg.ini", "Product Info (EReg)", "registered flag", nvValue); if (nvValue <= 0) then ERegIsInstalled = FALSE; else ERegIsInstalled = TRUE; endif; else ERegIsInstalled = FALSE; endif; endif; //if ERegIsInstalled is FALSE at this point, copy the entire EReg structure to the game directory and //and make a shortcut called Complete Registration that points to it. if (!ERegIsInstalled) then Enable (LOGGING); //all of the following may be uninstalled VarSave (SRCTARGETDIR); SRCDIR = SRCDIR ^ "EReg"; TARGETDIR = TARGETDIR ^ "EReg"; nResult = XCopyFile ("*.*", "", COMP_NORMAL); if (nResult < 0) then MessageBox ("Unable to transfer EReg.", SEVERE); else szProgramFolder = SHELL_OBJECT_FOLDER; szItemName = "Complete Registration"; szCommandLine = TARGETDIR ^ "EReg32.exe"; LongPathToQuote (szCommandLine, TRUE); szWorkingDir = TARGETDIR; szIconPath = TARGETDIR ^ "EReg32.exe"; nIcon = 0; szShortCutKey = ""; nFlag = REPLACE; nResult = AddFolderIcon (szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); endif; endif; VarRestore (SRCTARGETDIR); SdShowMsg ("Completing registration procedure...", FALSE); return 0; end; // --- include script file section ---