home *** CD-ROM | disk | FTP | other *** search
Wrap
'******************************************************** '* '* Jasmine Catalog Installation Script '* '* Copyright 1993 Jasmine Multimedia Publishing '* '* V1.0 12/1/93 Marshall Robin '* '* V1.1 12/22/93 Updated for Video for Windows 1.1 MR '* '* V1.11 1/13/94 Bug fixes - Restart and PATH setting - MR '* '* V1.11TD 4/5/94 Without VFW for Test Drive '* '******************************************************** '$DEFINE DEBUG '$INCLUDE 'setupapi.inc' '$INCLUDE 'msdetect.inc' '$INCLUDE 'jasmine.inc' '******************************************************** ''Dialog ID's CONST WELCOME = 100 CONST ASKQUIT = 200 CONST DESTPATH = 300 CONST EXITFAILURE = 400 CONST EXITQUIT = 600 CONST EXITSUCCESS = 700 CONST APPHELP = 900 CONST INFO = 6300 CONST RESTARTI = 2600 CONST RESTARTII = 2700 '******************************************************** '' GLOBAL VARS AND CONSTANTS. CONST INFNAME$ = "setup.inf" ' Name of INF file CONST MINWINDMAJ = 3 ' Minimum version of Windows required (MAJOR) CONST MINWINDMIN = 10 ' Minimum version of Windows required (MINOR) CONST MINDOSMAJ = 3 ' Minimum version of DOS required (MAJOR) CONST MINDOSMIN = 10 ' Minimum version of DOS required (MINOR) CONST MINMEM = 4096 ' Minimum system memory required CONST MINCPU = 386 ' Minimum CPU required CONST MINCOLORS = 256 ' Minimum screen colors required '' For ExitInstall call CONST QUIT = 0 CONST FAIL = 1 CONST SUCCESS = 2 '' for GetDeviceCaps call CONST BITSPIXEL = 12 '' for ShowWindow call CONST SW_SHOWMAXIMIZED = 3 CONST LOGO = 1 ' Bitmap ID CONST CUIDLL$ = "mscuistf.dll" ' Custom User Interface CONST HELPPROC$ = "FHelpDlgProc" ' Help dialog procedure GLOBAL SrcDir$ ' Source Directory GLOBAL SrcDrv$ ' Source Drive GLOBAL WinDir$ ' Windows Directory GLOBAL WinSysDir$ ' Windows System Directory GLOBAL DestDir$ ' Destination directory GLOBAL SaveCursor% ' Temporary save for cursor GLOBAL Cancel% ' True if user cancelled install GLOBAL WinVersion$ ' String to hold Windows version status GLOBAL DOSVersion$ ' String to hold DOS version status GLOBAL CPUType$ ' String to hold CPU type status GLOBAL NumColors$ ' String to hold number of system colors '******************************************************** '' Function Prototypes DECLARE SUB SetupInstall DECLARE FUNCTION CheckSystem AS INTEGER DECLARE SUB ShowSystemAttribs DECLARE SUB WriteIniFiles DECLARE SUB CreateProgGroups DECLARE SUB ExitInstall(code%) DECLARE FUNCTION MakePath (szDir$,szFile$) AS STRING DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER DECLARE SUB Reboot LIB "iniupd.dll" '' System DLL Calls DECLARE FUNCTION CreateDC LIB "gdi.exe" (driver$, device&, port&, initdata&) AS INTEGER DECLARE SUB DeleteDC LIB "gdi.exe" (hdc%) DECLARE FUNCTION GetDeviceCaps LIB "gdi.exe" (hdc%, capability%) AS INTEGER DECLARE FUNCTION ShowWindow LIB "USER" (hwnd%, nCmdShow%) AS INTEGER '******************************************************** '' Main Routine '' Init installer. SaveCursor% = ShowWaitCursor SetupInstall '' Exit if user is running Windows NT IF OnWindowsNT() THEN i% = DoMsgBox("Jasmine Catalog does not run on Windows NT.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) END END IF '' Welcome the user i% = ShowWindow(HwndFrame(),SW_SHOWMAXIMIZED) RestoreCursor SaveCursor% i% = DoMsgBox("Jasmine Catalog Install"+CHR$(13)+CHR$(13)+"Press OK to continue.","Jasmine Multimedia Publishing",MB_ICONINFORMATION+MB_OK) SaveCursor% = ShowWaitCursor '' Check the system to make sure that it is up to minimum requirements. '' Warn the user if it isn't, but allow them to continue if they choose. '' Procedure returns the success status of the call. IF CheckSystem = 0 THEN ShowSystemAttribs RestoreCursor SaveCursor% sz$ = "Your computer does not meet the"+CHR$(13)+"minimum system requirements for running the Jasmine Catalog."+CHR$(13)+CHR$(13)+"Do you wish to continue anyway?" i% = DoMsgBox(sz$,"Jasmine Multimedia Publishing",MB_ICONQUESTION+MB_YESNO) SaveCursor% = ShowWaitCursor IF i% = IDNO THEN ExitInstall(QUIT) END IF END IF '' Modify INI files. sz$ = UIStartDlg(CUIDLL$, INFO, "FModelessDlgProc", APPHELP, HELPPROC$) WriteIniFiles UIPop 1 ' Create icons for the catalog CreateProgGroups ' Exit the installation QUIT: ON ERROR GOTO ERRQUIT IF ERR = 0 THEN ExitInstall(SUCCESS) ELSEIF ERR = STFQUIT THEN SaveCursor% = ShowWaitCursor ExitInstall(QUIT) ELSE RestoreCursor SaveCursor% i% = DoMsgBox("Error: "+ERROR$+" "+STR$(ERR)+" on line "+STR$(ERL), "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) i% = DoMsgBox("There is an installation problem, call the included support number.", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) END END IF ERRQUIT: i% = DoMsgBox("Error: "+ERROR$+" "+STR$(ERR)+" on line "+STR$(ERL), "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) i% = DoMsgBox("There is an installation problem, call the included support number.", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) END '******************************************************** SUB SetupInstall STATIC '[OK] ' Set install defaults. ' ' Needed globals: ' CUIDLL$ : Custom UI DLL name ' INFNAME$ : Name of default .INF file ' DEFAULTDEST$ : Default installation directory ' ' Modified variables: ' SrcDir$ : Source directory ' WinDir$ : Windows directory ' WinSysDir$ : Windows system directory ' ' Return value: None. ' ' Called from: MAIN ' ' ----------------------------------------------------------- ' Initialize screen appearance ' SetBitmap CUIDLL$, LOGO SetTitle "Jasmine Multimedia Publishing" ' Load the INF file which lists the files to be installed sz$ = GetSymbolValue("STF_SRCINFPATH") IF sz$ = "" THEN sz$ = GetSymbolValue("STF_CWDDIR") + INFNAME$ END IF ReadInfFile sz$ ' Initialize source and destination globals SrcDir$ = GetSymbolValue("STF_SRCDIR") SrcDrv$ = MID$(SrcDir$,1,1) WinDir$ = GetWindowsDir() WinSysDir$ = GetWindowsSysDir() END SUB '******************************************************** FUNCTION CheckSystem STATIC AS INTEGER '[OK] ' Test the system attributes to see if it meets the minimum ' requirements for running the Jasmine Catalog. If they ' do not meet or exceed the minimum platform requirements, return ' 0, else return 1. ' ' Needed variables: none. ' ' Modified variables: ' WinVersion$ : String to hold Windows version status ' DOSVersion$ : String to hold DOS version status ' CPUType$ : String to hold CPU type status ' NumColors$ : String to hold number of system colors ' ' Return value: Success code. ' ' Called from: MAIN ' ' Calls to: none. ' ' ----------------------------------------------------------- ' Set default return value ret% = 1 ' Check system software. Catalog requires Windows 3.1 and DOS 3.1 or better. ' Check Windows sz$ = MID$(STR$(GetWindowsMajorVersion()),2)+"."+MID$(STR$(GetWindowsMinorVersion()),2) IF (GetWindowsMajorVersion() < MINWINDMAJ) THEN WinVersion$ = sz$ + CHR$(13)+ " (need at least "+ MID$(STR$(MINWINDMAJ),2) + "." + MID$(STR$(MINWINDMIN),2) +")" ret% = 0 ELSEIF (GetWindowsMajorVersion() = MINWINDMAJ) AND (GetWindowsMinorVersion() < MINWINDMIN) THEN WinVersion$ = sz$ + CHR$(13)+ " (need at least "+ MID$(STR$(MINWINDMAJ),2) + "." + MID$(STR$(MINWINDMIN),2) +")" ret% = 0 ELSE WinVersion$ = sz$ END IF ' Check DOS sz$ = MID$(STR$(GetDOSMajorVersion()),2)+"."+MID$(STR$(GetDOSMinorVersion()),2) IF (GetDOSMajorVersion() < MINDOSMAJ) THEN DOSVersion$ = sz$ + CHR$(13)+ " (need at least "+ MID$(STR$(MINDOSMAJ),2) + "." + MID$(STR$(MINDOSMIN),2) +")" ret% = 0 ELSEIF (GetDOSMajorVersion() = MINDOSMAJ) AND (GetDOSMinorVersion() < MINDOSMIN) THEN DOSVersion$ = sz$ + CHR$(13)+ " (need at least "+ MID$(STR$(MINDOSMAJ),2) + "." + MID$(STR$(MINDOSMIN),2) +")" ret% = 0 ELSE DOSVersion$ = sz$ END IF ' Determine type of CPU, Catalog requires a 80386 or better i% = GetProcessorType() IF i% = 0 THEN CPUType$ = "8086"+ CHR$(13)+ " (80386 or better required)" ret% = 0 ELSEIF i% = 1 THEN CPUType$ = "80186"+ CHR$(13)+ " (80386 or better required)" ret% = 0 ELSEIF i% = 2 THEN CPUType$ = "80286"+ CHR$(13)+ " (80386 or better required)" ret% = 0 ELSEIF i% = 3 THEN CPUType$ = "80386" ELSEIF i% = 4 THEN CPUType$ = "80486" ELSE CPUType$ = "Unrecognized by this software" END IF ' Determine available colors, Catalog requires 256 or more ' GetDeviceCaps returns 0 for 16 or 24 bit color hdc%=CreateDC ("DISPLAY", 0, 0, 0) bitspxl% = GetDeviceCaps (hdc%, BITSPIXEL) DeleteDC (hdc%) ' Exponent function j% = 1 FOR i% = 1 TO bitspxl% STEP 1 j% = j% * 2 NEXT bitspxl% = j% IF bitspxl% = 0 THEN NumColors$ = " > 256" ELSEIF bitspxl% < 256 THEN NumColors$ = STR$(bitspxl%) + CHR$(13)+ " (need at least 256 colors)" ret% = 0 ELSE NumColors$ = STR$(bitspxl%) END IF CheckSystem = ret% END FUNCTION '******************************************************** SUB ShowSystemAttribs STATIC '[OK] ' Display the system attributes to the user. This is called only ' if there is a problem with their system configuration. ' ' Needed variables: ' WinVersion$ : String to hold Windows version status (initialized by CheckSystem) ' DOSVersion$ : String to hold DOS version status (initialized by CheckSystem) ' CPUType$ : String to hold CPU type status (initialized by CheckSystem) ' NumColors$ : String to hold number of system colors (initialized by CheckSystem) ' ' Modified variables: none. ' ' Return value: none. ' ' Called from: MAIN ' ' Calls to: none. ' ' ----------------------------------------------------------- ' Prepare strings for the dialog, to overcome Microsoft Test ' 256 char per line limitation szA$ = "Here is a summary of your system."+CHR$(13) szB$ = "(Please note the listed incompatibilities)"+CHR$(13)+CHR$(13) szC$ = "Operating System Version: "+DOSVersion$+CHR$(13) szD$ = "Windows Version: "+WinVersion$+CHR$(13) szE$ = "CPU Type: "+CPUType$+CHR$(13) szF$ = "Number of Colors: "+NumColors$+CHR$(13) RestoreCursor SaveCursor% i% = DoMsgBox(szA$+szB$+szC$+szD$+szE$+szF$,"System Incompatibility",MB_ICONINFORMATION+MB_OK) SaveCursor% = ShowWaitCursor END SUB '******************************************************** SUB WriteIniFiles STATIC '[OK] ' Writes profile value to WIN.INI. ' ' Needed variables: none. ' ' Modified variables: none. ' ' Return value: none. ' ' Called from: MAIN ' ' Calls to: MakePath ' ' ----------------------------------------------------------- ' Backup WIN.INI as WIN.BAK CopyFile MakePath(WinDir$,"WIN.INI"),MakePath(WinDir$,"WIN.BAK"),cmoNone,0 ' Write changes to WIN.INI CreateIniKeyValue MakePath(WinDir$,"WIN.INI"), "ToolBook", "StartupSysBooks", "TBKMM.SBK", cmoOverwrite END SUB '******************************************************** SUB CreateProgGroups STATIC '[OK] ' Creates a Program Manager group and icon for the Jasmine Catalog ' ' Needed variables: ' SrcDir$ : Directory the Catalog is being installed from ' ' Modified variables: none. ' ' Return value: none. ' ' Called from: MAIN ' ' Calls to: MakePath ' ' ----------------------------------------------------------- ' Create group and icons for the Jasmine Catalog CreateProgmanGroup "Jasmine Multimedia", "", cmoOverwrite ShowProgmanGroup "Jasmine Multimedia", 1, cmoNone CreateProgmanItem "Jasmine Multimedia", "Jasmine Catalog", MakePath(SrcDir$,"TBKRUN\tbook.EXE")+" "+MakePath(SrcDir$,"TBKRUN\jascat.tbk"),"", cmoOverwrite END SUB '******************************************************** SUB ExitInstall(code%) STATIC '[OK] ' Exit after successful installation. ' ' Arguments: ' code%: Code to determine type of exit, either SUCCESS, QUIT, or FAIL ' ' Needed variables: none. ' ' Modified variables: none. ' ' Return value: none. ' ' Called from: MAIN ' ' Calls to: none. ' ' ' ----------------------------------------------------------- IF code% = SUCCESS THEN dlg% = EXITSUCCESS ELSEIF code% = QUIT THEN dlg% = EXITQUIT ELSE dlg% = EXITFAILURE END IF sz$ = "REACTIVATE" WHILE sz$ = "REACTIVATE" RestoreCursor SaveCursor% sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "") WEND UIPop 1 END END SUB '******************************************************** FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING '[OK] ' Appends a file name to the end of a directory path, ' inserting a backslash character as needed. ' ' Arguments: ' szDir$ - full directory path (with optional ending "\") ' szFile$ - filename to append to directory ' ' Needed variables: none. ' ' Modified variables: none. ' ' Return value: File path ' ' Called from: MAIN,CreateProgGroups,WriteIniFiles,InstallFiles,GetTheFiles ' ' Calls to: none. ' ' ----------------------------------------------------------- IF szDir$ = "" THEN MakePath = szFile$ ELSEIF szFile$ = "" THEN MakePath = szDir$ ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN MakePath = szDir$ + szFile$ ELSE MakePath = szDir$ + "\" + szFile$ END IF END FUNCTION