//////////////////////////////////////////////////////////////////////////////// // // IIIIIII SSSSSS // II SS InstallShield (R) // II SSSSSS (c) 1996-1998, 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 "CM8kUninst.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 DialogShowSdWelcome(); prototype DialogShowSdLicense(); prototype DialogShowSdFinishReboot(); // your script function prototypes prototype DialogShowSdSetupTypeEx(); prototype DialogShowSdComponentDialogAdv(); prototype DialogShowSdAskDestPath(); prototype RunEReg(); prototype DialogShowAskOptions(); prototype FindFont(); // from IS website prototype ReadComponentFile ( STRING, STRING ); prototype SetComponentSelections ( STRING ); // ----- global variables ------ // generated by the Project Wizard BOOL bIsWindowsNT4, bIsWindowsNT351, bIsWindows98, bIsWindows95; BOOL bIsShellExplorer, bInstallAborted, bIs32BitSetup; STRING svDir; STRING svName, svCompany, svSerial; STRING svDefGroup; STRING szAppPath; STRING svSetupType; // your global variables STRING szComponentFile; // complist.txt (workaround to allow file management over multiple // disks). components are defined before compile time in a text file // and pointed at certain disks - this occurs in MoveFileData. IS // refers to the text file in DialogShowSdComponentDialogAdv. // independent storage of compact, typical, and custom component definitions // to allow a back button in DialogShowSdComponentDialogAdv - which fo unknown // reasons destroys MEDIA and component definitions if you back out of it. // STRING szComponentSet; // current component selections (pointer from user defined selections) // STRING szComponentSetCompactSelect; // store compact component selections // STRING szComponentSetTypicalSelect; // store typical component selections STRING szComponentSetCustomSelect; // store custom component selections (user defined) // independent storage of compact, typical, and custom MEDIA definitions for // the same reason listed above. STRING szComponentSetCompactMedia; // store compact MEDIA value STRING szComponentSetTypicalMedia; // store typical MEDIA value STRING szComponentSetCustomMedia; // store custom MEDIA value STRING szComponentSetTypicalwDBMedia; // store typical with database MEDIA value BOOL bIsTutorialSelected; // 2nd disk BOOL bvCheck1, bvCheck2, bFontFound, bvCheck7; /////////////////////////////////////////////////////////////////////////////// // // 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 ); // bIsTutorialSelected = FALSE; SHELL_OBJECT_FOLDER = @PRODUCT_NAME; CheckRequirements(); SetupInstall(); SetupScreen(); FindFont(); 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; RunEReg(); 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, nType; begin Dlg_Start: // beginning of dialogs label Dlg_SdWelcome: nResult = DialogShowSdWelcome(); if (nResult = BACK) goto Dlg_Start; Dlg_SdLicense: nResult = DialogShowSdLicense(); if (nResult = BACK) goto Dlg_SdWelcome; Dlg_AskOptions: nResult = DialogShowAskOptions(); if (nResult = BACK) goto Dlg_SdLicense; // custom or 'choose destination' dialog Dlg_SdSetupTypeEx: nResult = DialogShowSdSetupTypeEx(); if (nResult = BACK) goto Dlg_AskOptions; if (svSetupType = "Custom") then Dlg_SdComponentDialogAdv: nResult = DialogShowSdComponentDialogAdv(); if (nResult = BACK) goto Dlg_SdSetupTypeEx; else Dlg_SdAskDestPath: nResult = DialogShowSdAskDestPath(); if (nResult = BACK) goto Dlg_SdSetupTypeEx; endif; return 0; end; /////////////////////////////////////////////////////////////////////////////// // // Function: ProcessBeforeDataMove // // Purpose: This function performs any necessary operations prior to the // actual file transfer. // /////////////////////////////////////////////////////////////////////////////// function ProcessBeforeDataMove() STRING svLogFile, szProgram; 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; // TO DO : if your application .exe is in a subfolder // of TARGETDIR then add subfolder 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 // // If you are installing self-registering files using the // batch method, remove the slashes from the line below: // // Enable ( SELFREGISTERBATCH ); return 0; end; /////////////////////////////////////////////////////////////////////////////// // // Function: MoveFileData // // Purpose: This function handles the file transfer for // the setup. // /////////////////////////////////////////////////////////////////////////////// function MoveFileData() NUMBER nResult, nDisk; begin VarSave(SRCTARGETDIR); TARGETDIR = TARGETDIR ^ "Personalities\\"; CopyFile("André.CMP", "André.CMP"); VarRestore(SRCTARGETDIR); CopyFile("chessmaster.exe", "chessmaster.exe"); CopyFile("readme.txt", "readme.txt"); nDisk = 1; SetStatusWindow( 0, "" ); Disable( DIALOGCACHE ); Disable (FEEDBACK_FULL); Enable( STATUS ); if (bIsTutorialSelected = TRUE) then StatusUpdate( ON, 82 ); else StatusUpdate( ON, 100 ); endif; // use compact, typical, or custom MEDIA Enable(LOGGING); if (svSetupType = "Custom") then MEDIA = szComponentSetCustomMedia; SetComponentSelections ( szComponentSetCustomSelect ); /*if (bFontFound = FALSE) then ComponentSelectItem (MEDIA, "Font", TRUE); else ComponentSelectItem (MEDIA, "Font", FALSE); endif;*/ ComponentSelectItem (MEDIA, "Chessmaster 8000 application", TRUE); ComponentInitialize (MEDIA, "Data1.cab"); elseif (svSetupType = "Compact") then bIsTutorialSelected = FALSE; MEDIA = szComponentSetCompactMedia; /*if (bFontFound = FALSE) then ComponentSelectItem (MEDIA, "Font", TRUE); else ComponentSelectItem (MEDIA, "Font", FALSE); endif;*/ ComponentInitialize (MEDIA, "Data1.cab"); else bIsTutorialSelected = FALSE; MEDIA = szComponentSetTypicalMedia; /*if (bFontFound = FALSE) then ComponentSelectItem (MEDIA, "Font", TRUE); else ComponentSelectItem (MEDIA, "Font", FALSE); endif;*/ ComponentInitialize (MEDIA, "Data1.cab"); endif; nResult = ComponentMoveData( MEDIA, nDisk, 0 ); if (bIsTutorialSelected = TRUE) then // 2nd disk (custom only) //from IS website // Set value of MEDIA for second file transfer operation. MEDIA = "Second"; // Reset ComponentMoveData for second file transfer operation. nResult = ComponentMoveData ("", nDisk, 0); //Prompt user for the second disk. Check for Data2.tag file // to verify that second disk is in the drive. EnterDisk ( "Please remove Disk 1 and insert Disk 2." , "data2.tag" ); //Initialize media name to file media library on second disk. nResult = ComponentInitialize (MEDIA, "Data1.cab"); // Set selections of components in second disk's file media library // according to the user's selections. SetComponentSelections ( szComponentSetCustomSelect ); // Set progress indicator to reach 100% after first file transfer operation. StatusUpdate (ON, 100); // Perform second file transfer operation. nDisk = 1; //end from IS website nResult = ComponentMoveData ( MEDIA, nDisk, 0 ); //CreateShellObjects( "" ); MEDIA = szComponentSetCustomMedia; endif; 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, szMsg; begin // TO DO : update self-registered files and other processes that // should be performed after the files have been transferred. // // If you are installing self-registering files using the // batch method, remove the slashes from the lines below: // // if Do ( SELFREGISTRATIONPROCESS ) < 0 then // szMsg = "File(s) failed to self-register: \n" + ERRORFILENAME; // MessageBox (szMsg, WARNING); // endif; // DeinstallSetReference specifies a file to be checked before // uninstallation. If the file is in use, uninstallation will not proceed. szReferenceFile = svDir ^ @PRODUCT_KEY; // TO DO : If your file is in a // subfolder of svDir add that here 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( "" ); RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE); RegDBSetKeyValueEx ("SOFTWARE\\Mindscape\\Chessmaster 8000", "Directory", REGDB_STRING, TARGETDIR, -1); RegDBSetKeyValueEx ("SOFTWARE\\Mindscape\\Chessmaster 8000", "Install Version", REGDB_STRING, @PRODUCT_VERSION, -1); RegDBSetKeyValueEx ("SOFTWARE\\Mindscape\\Chessmaster 8000", "Current Version", REGDB_STRING, @PRODUCT_VERSION, -1); // Direct Play Values RegDBSetKeyValueEx ("Software\\Microsoft\\DirectPlay\\Applications\\Chessmaster 8000", "CommandLine", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("Software\\Microsoft\\DirectPlay\\Applications\\Chessmaster 8000", "CurrentDirectory", REGDB_STRING, TARGETDIR, -1); RegDBSetKeyValueEx ("Software\\Microsoft\\DirectPlay\\Applications\\Chessmaster 8000", "File", REGDB_STRING, "Chessmaster.exe", -1); RegDBSetKeyValueEx ("Software\\Microsoft\\DirectPlay\\Applications\\Chessmaster 8000", "Guid", REGDB_STRING, "{C8B094A9-D745-47bd-B2C2-863CA660A80C}", -1); RegDBSetKeyValueEx ("Software\\Microsoft\\DirectPlay\\Applications\\Chessmaster 8000", "Path", REGDB_STRING, TARGETDIR, -1); RegDBSetDefaultRoot (HKEY_CURRENT_USER); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\Checkmate", "", REGDB_STRING, "Checkmate", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\Check", "", REGDB_STRING, "Check", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\Capture", "", REGDB_STRING, "Capture", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\Promotion", "", REGDB_STRING, "Promotion", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\Draw", "", REGDB_STRING, "Draw", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\BlackMove", "", REGDB_STRING, "Black Move", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\WhiteMove", "", REGDB_STRING, "White Move", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\Castle", "", REGDB_STRING, "Castle", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\WindowClose", "", REGDB_STRING, "Window Close", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\ChessBeep", "", REGDB_STRING, "Default Sound", -1); RegDBSetKeyValueEx ("AppEvents\\EventLabels\\IllegalMove", "", REGDB_STRING, "Illegal Move", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster", "", REGDB_STRING, "Chessmaster", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Checkmate", "", REGDB_STRING, "Checkmate", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Checkmate\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Check", "", REGDB_STRING, "Check", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Check\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Capture", "", REGDB_STRING, "Capture", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Capture\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Castle", "", REGDB_STRING, "Castle", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Castle\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\BlackMove", "", REGDB_STRING, "Black Move", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\BlackMove\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\WhiteMove", "", REGDB_STRING, "White Move", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\WhiteMove\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Draw", "", REGDB_STRING, "Draw", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Draw\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Promotion", "", REGDB_STRING, "Promotion", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Promotion\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\WindowClose", "", REGDB_STRING, "Window Close", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\WindowClose\\.current", "", REGDB_STRING, TARGETDIR ^ "\\close.wav", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\ChessBeep", "", REGDB_STRING, "Default Sound", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\ChessBeep\\.current", "", REGDB_STRING, "", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\IllegalMove", "", REGDB_STRING, "Illegal Move", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\IllegalMove\\.current", "", REGDB_STRING, TARGETDIR ^ "\\illegal.wav", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Tell", "", REGDB_STRING, "Tell", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Tell\\.current", "", REGDB_STRING, TARGETDIR ^ "\\chattell.wav", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Announce", "", REGDB_STRING, "Announce", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Announce\\.current", "", REGDB_STRING, TARGETDIR ^ "\\announce.wav", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Challenge", "", REGDB_STRING, "Challenge", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Challenge\\.current", "", REGDB_STRING, TARGETDIR ^ "\\gamechal.wav", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Buddy", "", REGDB_STRING, "Buddy", -1); RegDBSetKeyValueEx ("AppEvents\\Schemes\\Apps\\Chessmaster\\Buddy\\.current", "", REGDB_STRING, TARGETDIR ^ "\\buddy.wav", -1); 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; begin // TO DO : Add all your folders (or program groups) along with shortcuts (or // program items). Call CreateProgramFolder and AddFolderIcon, and/or create // shortcuts etc. from the InstallShield IDE's Resources pane. // // Note : for 16-bit setups you should add an uninstaller icon pointing to // your log file. Under 32-bit this is automatically done by Windows. 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; if (bIs32BitSetup) then svDir = PROGRAMFILES ^ @PRODUCT_NAME; else svDir = PROGRAMFILES ^ @PRODUCT_NAME16; // use short names endif; 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() STRING szName; begin szName = SUPPORTDIR ^ "Tile.bmp"; Enable( FULLWINDOWMODE ); Enable( INDVFILESTATUS ); SetTitle( "", 24, WHITE ); SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text. PlaceBitmap (szName, 0, 0, 0, TILED); SetColor (BACKGROUND, BLACK); 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; begin bIsShellExplorer = FALSE; bIsWindowsNT4 = FALSE; bIsWindowsNT351 = FALSE; bIsWindows95 = FALSE; bIsWindows98 = 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 // Check to see if OS is Windows NT 4.0 or Windows NT 3.51, // and if the shell being used is the Explorer shell. if (GetSystemInfo( WINMAJOR, nvResult, svResult ) = 0) then if (nvResult >= 4) then bIsShellExplorer = TRUE; bIsWindowsNT4 = TRUE; else bIsWindowsNT351 = TRUE; endif; endif; elseif (nvResult = IS_WINDOWS9X) then bIsShellExplorer = TRUE; // Check to see if OS is Windows 95 or Windows 98 GetSystemInfo (WINMINOR, nvResult, svResult); if (nvResult < 10) then bIsWindows95 = TRUE; else bIsWindows98 = TRUE; endif; endif; end; /////////////////////////////////////////////////////////////////////////////// // // RunEReg() // /////////////////////////////////////////////////////////////////////////////// function RunEReg() STRING szERegCommand1, szERegCmdLine1, szERegIniDir, svResult,szERegCommand2, szERegIcon; NUMBER nvValue, nResult; BOOL EReg; begin EReg = FALSE; if(bvCheck7) then szERegCommand1 = SRCDIR ^ "EReg\\EReg32.exe"; szERegCmdLine1 = "/chained"; LaunchAppAndWait( szERegCommand1, szERegCmdLine1, WAIT ); szERegIniDir = WINDIR ^ "BBStore\\Scopeusr\\Software" ^ "The Learning Company" ^ @COMPANY_NAME ^ @PRODUCT_NAME ^ @PRODUCT_VERSION; if (FindFile( szERegIniDir, "ereg.ini", svResult ) = 0) then GetProfInt( szERegIniDir ^ "ereg.ini", "Product Info (EReg)", "registered flag", nvValue ); if (nvValue = 1) then EReg = TRUE; endif; endif; if (!EReg) then VarSave( SRCTARGETDIR ); SRCDIR = SRCDIR ^ "EReg"; TARGETDIR = TARGETDIR ^ "EReg"; XCopyFile( "*.*", "", COMP_NORMAL ); szERegCommand2 = TARGETDIR ^ "EReg32.exe"; LongPathToQuote( szERegCommand2, TRUE ); szERegCommand2 = szERegCommand2 + " /chained"; szERegIcon = TARGETDIR ^ "EReg32.exe"; nResult = AddFolderIcon( SHELL_OBJECT_FOLDER, "Complete Registration", szERegCommand2, TARGETDIR, szERegIcon, 0, "", NULL ); VarRestore( SRCTARGETDIR ); endif; else szERegIniDir = WINDIR ^ "BBStore\\Scopeusr\\Software" ^ "The Learning Company" ^ @COMPANY_NAME ^ @PRODUCT_NAME ^ @PRODUCT_VERSION; if (FindFile( szERegIniDir, "ereg.ini", svResult ) = 0) then GetProfInt( szERegIniDir ^ "ereg.ini", "Product Info (EReg)", "registered flag", nvValue ); if (nvValue = 1) then EReg = TRUE; endif; endif; if (!EReg) then VarSave( SRCTARGETDIR ); SRCDIR = SRCDIR ^ "EReg"; TARGETDIR = TARGETDIR ^ "EReg"; XCopyFile( "*.*", "", COMP_NORMAL ); szERegCommand2 = TARGETDIR ^ "EReg32.exe"; LongPathToQuote( szERegCommand2, TRUE ); szERegCommand2 = szERegCommand2 + " /chained"; szERegIcon = TARGETDIR ^ "EReg32.exe"; nResult = AddFolderIcon( SHELL_OBJECT_FOLDER, "Complete Registration", szERegCommand2, TARGETDIR, szERegIcon, 0, "", NULL ); VarRestore( SRCTARGETDIR ); endif; endif; end; /////////////////////////////////////////////////////////////////////////////// // // Function: DialogShowSdWelcome // // Purpose: This function handles the standard welcome dialog. // // /////////////////////////////////////////////////////////////////////////////// function DialogShowSdWelcome() NUMBER nResult; STRING szTitle, szMsg; begin szTitle = ""; szMsg = ""; DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "african.bmp", TRUE); nResult = SdWelcome( szTitle, szMsg ); return nResult; 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: DialogShowAskOption // /////////////////////////////////////////////////////////////////////////////// function DialogShowAskOptions() NUMBER nResult, nResult2; NUMBER nvType, nvSize; STRING szMsg, szText1, szText2, szText3, szText4, szText5, szText6, szText7; STRING svValue; begin DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "irish.bmp", TRUE); szMsg = @ASK; szText2 = @ASK_SHORTCUT; bvCheck2 = TRUE; szText7 = "Registration"; bvCheck7 = TRUE; /////////////////////////////////////////////////////////////////////////////// // // DirectX 7a Checker // Sees if user has current version // /////////////////////////////////////////////////////////////////////////////// RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE); nResult2 = RegDBKeyExist ("Software\\Microsoft\\DirectX"); if (nResult2 = 1) then nResult2 = RegDBGetKeyValueEx ("Software\\Microsoft\\DirectX", "Version", nvType, svValue, nvSize); if (svValue >= "4.07.00.0716") then szText1 = @CURRENT_DIRECTX; bvCheck1 = FALSE; else szText1 = @NEEDS_DIRECTX; bvCheck1 = TRUE; endif; else szText1 = @NEEDS_DIRECTX; bvCheck1 = TRUE; endif; nResult = AskOptions (NONEXCLUSIVE, szMsg, szText1, bvCheck1, szText2, bvCheck2); return nResult; end; ///////////////////// // DialogShowSdAskDestPath ///////////////////// function DialogShowSdAskDestPath() NUMBER nResult, nReserved; STRING szTitle, szMsg; begin szTitle = ""; szMsg = ""; nReserved = 0; DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "box.bmp", TRUE); nResult = SdAskDestPath (szTitle, szMsg, svDir, nReserved); TARGETDIR = svDir; return nResult; end; ///////////////////// // DialogShowSdSetupTypeEx ///////////////////// function DialogShowSdSetupTypeEx() NUMBER nResult, nReserved, nType; STRING szTitle, szMsg, szReserved, szFile; begin bIsTutorialSelected = FALSE; switch (svSetupType) case "Typical": nType = TYPICAL; case "Custom": nType = CUSTOM; case "Compact": nType = COMPACT; case "": svSetupType = "Typical"; nType = TYPICAL; endswitch; szTitle = ""; szMsg = ""; szReserved = ""; nReserved = 0; DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "desserts.bmp", TRUE); nResult = SdSetupTypeEx (szTitle, szMsg, szReserved, svSetupType, nReserved); switch (nResult) case COMPACT: svSetupType = "Compact"; case TYPICAL: svSetupType = "Typical"; case CUSTOM: svSetupType = "Custom"; endswitch; // store compact and typical MEDIA definitions if (svSetupType = "Compact") then // szComponentSetCompactSelect = szComponentSet; szComponentSetCompactMedia = MEDIA; elseif (svSetupType = "Typical") then // szComponentSetTypicalSelect = szComponentSet; szComponentSetTypicalMedia = MEDIA; endif; return nResult; end; ///////////////////// // Dialog DialogShowSdComponentDialogAdv (custom only) ///////////////////// function DialogShowSdComponentDialogAdv() NUMBER nResult, nvResult, bResult; STRING szTitle, szMsg, szDir, szComponent, svResult, svTargetDisk, svString; begin // from IS website (final integration of complist.txt into component definitions) // Read file listing components in setup's file media libraries // and generate a script-created component set. szComponentFile = "Complist.txt"; szComponentSetCustomSelect = "DisplayComps"; ReadComponentFile ( szComponentFile, szComponentSetCustomSelect ); // Save the value of MEDIA for first file transfer operation. (store custom MEDIA definition) szComponentSetCustomMedia = MEDIA; // Display component set in dialog box for user selections. (give MEDIA super powers) MEDIA = szComponentSetCustomSelect; // end from IS website szTitle = ""; szMsg = ""; szComponent = ""; DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR + "gnomes.bmp", TRUE); nResult = SdComponentDialogAdv ( szTitle , szMsg , svDir , szComponent ); TARGETDIR = svDir; ComponentGetData(MEDIA, "Tutorials", COMPONENT_FIELD_SELECTED, nvResult, svResult); // need 2nd disk? if (nvResult = TRUE) then bIsTutorialSelected = TRUE; else bIsTutorialSelected = FALSE; endif; // bring MEDIA back to reality in case user hits Back MEDIA = szComponentSetCustomMedia; 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 nIcon, nFlag, nResult; STRING szProgramFolder, szShortCutKey, szItemName, szCommandLine, szWorkingDir, szIconPath, szTitle, szMsg1, szMsg2, szOption1, szOption2, szOption3, szCommand1, szCmdLine1, szCommand2, szCmdLine2, szCommand3, szCmdLine3, szCommand4, szCmdLine4, szCommand5, szCmdLine5, szCommand6, szCmdLine6, szCommand7, szCmdLine7, szCommand8, szCmdLine8, szKey, szName; STRING svValue, svValue2, svValue3, svValue4, svValue5, svValue6; BOOL bOpt1, bOpt2; begin szCommand1 = SRCDIR + "directx7a\\dxsetup.exe"; szCmdLine1 = ""; szCommand4 = SRCDIR + "autorun.exe"; szCmdLine4 = ""; szCommand6 = WINDIR + "notepad.exe"; szCmdLine6 = "\"" + SRCDIR ^ "Readme.txt" + "\""; if (bvCheck2 = TRUE) then szProgramFolder = FOLDER_DESKTOP; szItemName = @PRODUCT_NAME; szCommandLine = TARGETDIR ^ "Chessmaster.exe"; szWorkingDir = TARGETDIR; szIconPath = TARGETDIR ^ "Chessmaster.exe"; nIcon = 0; szShortCutKey = ""; nFlag = REPLACE; LongPathToQuote (szCommandLine, TRUE); AddFolderIcon (szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); endif; szTitle = ""; szMsg1 = @START; szMsg2 = ""; szOption1 = @OPT_README; szOption2 = ""; bOpt1 = TRUE; bOpt2 = FALSE; nResult = SdFinish (szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); // Readme if (bOpt1) then LaunchApp (szCommand6, szCmdLine6); endif; if (bvCheck1 = TRUE) then // Directx 7a LaunchApp (szCommand1, szCmdLine1); else // Auto-Run LaunchApp (szCommand4, szCmdLine4); endif; return nResult; end; //from IS website (read and integrate complist.txt) // Function: // ReadComponentFile ( szCompFile, szCompSet ); // // Description: // Reads a file each of whose lines is a component's name and // size, and adds components with those names and sizes to a // script-created component set. // // Parameters: // szCompFile: // The name of the file containing the component names and // sizes. The file is assumed to be in SUPPORTDIR. // szCompSet: // The media name of the script-created component set. // // Comments: // - The file can be created by running the script file Complist.rul, // which is attached at the end of this article. // - This function assumes that the file is in SUPPORTDIR. To place it // there, click the Language Independent/Operating System Independent // folder in the Setup Files pane, right-click in the Setup Files // window, select Insert Files from the popup menu, select the // file in the resulting dialog box, and click the Open button. // - This function can be modified to read in more component // properties than size, for example, visibility and description. // See script comments for details. function ReadComponentFile ( szCompFile, szCompSet ) STRING svCompInfo, svCompName, svCompSize; LONG nvFileHandle, nResult, nvCompSize; LIST listCompInfo; begin // Open the file. OpenFileMode ( FILE_MODE_NORMAL ); OpenFile ( nvFileHandle , SUPPORTDIR , szCompFile ); // Loop through the lines in the file. nResult = GetLine ( nvFileHandle , svCompInfo ); while (nResult=0) listCompInfo = ListCreate ( STRINGLIST ); // Separate the line at each comma, turning it into a list. StrGetTokens ( listCompInfo , svCompInfo , "," ); // The first list item is the component name. ListGetFirstString ( listCompInfo , svCompName ); // The next list item is the component size. ListGetNextString ( listCompInfo , svCompSize ); // To read in additional properties needed during display // of the component selection dialog box, make additional // calls to ListGetNextString, for example: // ListGetNextString ( listCompInfo , svCompDescription ); // Convert the component size string to a number. StrToNum ( nvCompSize , svCompSize ); // Add the component to the script-created component set. ComponentAddItem ( szCompSet , svCompName , nvCompSize , TRUE ); // To specify other properties needed during display // of the component selection dialog box, call // ComponentSetData, for example: // ComponentSetData ( szCompSet, svCompName, // COMPONENT_FIELD_DESCRIPTION, 0, svCompDescription ); ListDestroy ( listCompInfo ); nResult = GetLine ( nvFileHandle , svCompInfo ); endwhile; CloseFile ( nvFileHandle ); end; // Function: // SetComponentSelections ( szCompSet ); // // Description: // Sets the component selections in the current file media // library (specified by MEDIA) to be the same as the // corresponding selections in the script-created component set // specified by szCompSet. // // Parameters: // szCompSet: // The media name of the script-created component set. function SetComponentSelections ( szCompSet ) STRING svComponent, svSubcomponent; LONG nResult, nResult2; LIST listComponents, listSubcomponents; BOOL bSelected; begin // List top level components in current file media library. listComponents = ListCreate ( STRINGLIST ); ComponentListItems ( MEDIA , "" , listComponents ); // Get first top level component in current file media library. nResult = ListGetFirstString ( listComponents , svComponent ); // Set selection of component based on user selection. bSelected = ComponentIsItemSelected ( szCompSet , svComponent ); ComponentSelectItem ( MEDIA , svComponent , bSelected ); // List subcomponents of top level component. listSubcomponents = ListCreate ( STRINGLIST ); ComponentListItems ( MEDIA , svComponent , listSubcomponents ); // Get first subcomponent. nResult = ListGetFirstString ( listSubcomponents , svSubcomponent ); // Set selection of subcomponent based on user selection. bSelected = ComponentIsItemSelected ( szCompSet , svSubcomponent ); ComponentSelectItem ( MEDIA , svSubcomponent , bSelected ); // Loop through subcomponents of first top level component. nResult = ListGetNextString ( listSubcomponents , svSubcomponent ); while (nResult=0) bSelected = ComponentIsItemSelected ( szCompSet , svSubcomponent ); // Set selection of subcomponent based on user selection. ComponentSelectItem ( MEDIA , svSubcomponent , bSelected ); nResult = ListGetNextString ( listComponents , svSubcomponent ); endwhile; ListDestroy ( listSubcomponents ); // Loop through top level components. nResult = ListGetNextString ( listComponents , svComponent ); while (nResult=0) bSelected = ComponentIsItemSelected ( szCompSet , svComponent ); ComponentSelectItem ( MEDIA , svComponent , bSelected ); // List subcomponents of top level component. listSubcomponents = ListCreate ( STRINGLIST ); ComponentListItems ( MEDIA , svComponent , listSubcomponents ); // Get first subcomponent. nResult2 = ListGetFirstString ( listSubcomponents , svSubcomponent ); // Set selection of subcomponent based on user selection. bSelected = ComponentIsItemSelected ( szCompSet , svSubcomponent ); ComponentSelectItem ( MEDIA , svSubcomponent , bSelected ); // Loop through subcomponents. nResult2 = ListGetNextString ( listSubcomponents , svSubcomponent ); while (nResult2=0) // Set selection of subcomponent based on user selection. bSelected = ComponentIsItemSelected ( szCompSet , svSubcomponent ); ComponentSelectItem ( MEDIA , svSubcomponent , bSelected ); nResult2 = ListGetNextString ( listComponents , svSubcomponent ); endwhile; nResult = ListGetNextString ( listComponents , svComponent ); endwhile; ListDestroy ( listComponents ); end; //end from IS website ////////////////////////////////////////////////////////////////////////////////////// // // Finding if cm8000.ttf font exists // ////////////////////////////////////////////////////////////////////////////////////// function FindFont() STRING szPath, szFileName, svResult; NUMBER nResult; begin szPath = WINDIR ^ "Fonts\\"; szFileName = "cm8000.ttf"; nResult = FindFile (szPath, szFileName, svResult); if (nResult = TRUE) then bFontFound = TRUE; else bFontFound = FALSE; endif; end; // --- include script file section --- #include "sddialog.rul"