home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Microsoft Cinemania 1994 (Preview Edition)
/
Microsoft-CinemaniaPreviewEdition94-Win31.iso
/
msstp
/
cinsetup.mst
< prev
next >
Wrap
Text File
|
1993-08-25
|
30KB
|
852 lines
'***************************************************************************
'* Cinemania '94 Setup
'* Microsoft Multimedia Publishing Group
'* March 1993
'***************************************************************************
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'** Dialog ID's - Defined in dialogs.h
CONST WELCOME_SCREEN = 100
CONST WELCOME_HELP = 101
CONST GENERIC_HELP = 102
CONST FIX_VGA_DRIVER = 150
CONST FIX_VGA_HELP = 151
CONST SYSERROR_DOS_WIN = 200
CONST SYSERROR_VGA = 301
CONST SYSERROR_VIEWER = 400
CONST SYSWAIT_MPC = 500
CONST SYSCHECK_MPC = 501
CONST SYSDISPLAY_MPC = 502
CONST DELETE_OLD_CINEMANIA92 = 600
CONST PROGRAM_GROUP = 700
CONST PROGRAM_GROUP_BOXLIST = 701
CONST ASK_HOTSPOT = 800
CONST SYSERROR_WINDISKFULL = 900
CONST COPYING_FILES = 1000
CONST INSTALL_FONTS = 1100
CONST INSTALL_DIR = 1200
CONST INSTALL_DIR_HELP = 1201
CONST SYSERROR_BADPATH = 1202
CONST SYSERROR_DISKFULL = 1203
CONST SETUPQUIT_CONFIRM = 10000
CONST SETUPQUIT_FAILURE = 10001
CONST SETUPQUIT_OVERVIEW = 10002
CONST SETUPQUIT_QUIT = 10003
CONST RESTART_WINDOWS = 10020
'** Bitmap ID - Defined in dialogs.rc
CONST WELCOME_BMP = 1
'** Global Definitions
GLOBAL DEST$ 'Cinemania directory
GLOBAL CUIDLL$ 'Custom user interface dll
GLOBAL PROGGRP$ 'Default program group
GLOBAL DELETEOLD% 'Counter to delete old Cinemania
GLOBAL FOUNDOLD% 'Found old Cinemania
GLOBAL CREATEICON% 'Counter to create program group icons
GLOBAL SETJUMP% 'Counter to change hotspot colors or not
GLOBAL VIEWERDIR$ 'Viewer directory
GLOBAL CIN94DIR$ 'Old Cinemania 94 directory
GLOBAL SRCDIR$ 'Setup's root directory (where setup.exe is)
GLOBAL WININI$ 'Full pathname to WIN.INI
GLOBAL SYSINI$ 'Full pathname to SYSTEM.INI
GLOBAL ShouldRestart% 'Whether Windows should be restarted after setup
GLOBAL VGADRV% 'Whether VGAPAL driver is currently installed
GLOBAL Misc%
'** Function Prototypes
DECLARE SUB Install
DECLARE SUB InstallFonts
'** Function Prototypes
DECLARE FUNCTION GetModuleHandle LIB "kernel" (a$) AS INTEGER
DECLARE FUNCTION WinExec LIB "kernel" (a$, b%) AS INTEGER
DECLARE FUNCTION GetActiveWindow LIB "user" AS INTEGER
DECLARE FUNCTION ShowWindow LIB "user" (a%, b%) AS INTEGER
DECLARE FUNCTION MessageBox lib "User" (hwnd%, lpstr$, lpstr$, uint%) as integer
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION GetFilename (szPath$) AS STRING
DECLARE FUNCTION UpdateSize (szSection$, szKey$, szDestDir$) AS LONG
DECLARE FUNCTION WillCopy (szSection$, szKey$, szDestDir$) AS INTEGER
DECLARE FUNCTION CmpVersion (VerOld$, VerNew$) AS INTEGER
DECLARE FUNCTION IsDateLater (DateOld$, DateNew$) AS INTEGER
DECLARE FUNCTION DeleteOldCinemania LIB "mscuistf.dll" (ver%) AS INTEGER
DECLARE FUNCTION CheckForCD LIB "mscuistf.dll" (a$) AS INTEGER
DECLARE SUB CopyListMakerFiles LIB "mscuistf.dll" (a$,b$,c%)
'$INCLUDE 'mmperf.inc'
'$INCLUDE 'mmcat.inc'
' '$INCLUDE 'upgrade.inc'
'****************************************************************************
'** General Installation Script
'****************************************************************************
INIT:
CUIDLL$ = "mscuistf.dll" 'Custom user interface dll
ShouldRestart% = 0 'Becomes 1 if drivers were installed
SetBitmap CUIDLL$, WELCOME_BMP
SetTitle "Cinemania '94 Setup Window"
'** Find pathname for Cinemania .INF file for reading
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "CINSETUP.INF"
END IF
ReadInfFile szInf$
SRCDIR$ = GetSymbolValue("STF_SRCDIR")
WININI$ = MakePath(GetWindowsDir(), "WIN.INI")
SYSINI$ = MakePath(GetWindowsDir(), "SYSTEM.INI")
ERR = 0
'**************************************************************************
'** Check to see if this is an upgrade disk
'**************************************************************************
Upgrade = 0
' GoSub UPGRADECHECK
' Now Upgrade = 1 if there was an upgrade welcome and dialogue
'**************************************************************************
'** Welcome screen startup
'**************************************************************************
WELCOME:
IF Upgrade = 0 THEN
'** Bring up WELCOME dialog with WELCOME_HELP as help dialog
sz$ = UIStartDlg(CUIDLL$, WELCOME_SCREEN, "FInfoDlgProc", WELCOME_HELP, "FHelpDlgProc")
IF sz$ = "REACTIVATE" THEN
GOTO WELCOME
ELSEIF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB DIAG_QUIT 'must have been exit command, verify exit
GOTO WELCOME 'doesn't want to exit, continue with setup
END IF
ENDIF
'**************************************************************************
'** Check the system's MPC performance
'**************************************************************************
GoSub SYSCHECK
'Check FCancel symbol!
'**************************************************************************
'** Check to make sure Viewer isn't running
'**************************************************************************
ISVIEWERRUNNING:
MVrunning% = GetModuleHandle("MVIEWER2")
IF (MVrunning% <> 0) THEN
VIEWERISRUNNING:
ShouldRestart% = 1
' sz$ = UIStartDlg(CUIDLL$, SYSERROR_VIEWER, "FInfoDlgProc", 0, "")
' IF sz$ = "REACTIVATE" THEN
' GOTO VIEWERISRUNNING
' ELSEIF sz$ = "CONTINUE" THEN
' UIPop 1
' GOTO ISVIEWERRUNNING
' END IF
' UIPop 1
' dlg% = SETUPQUIT_FAILURE
' GOTO QUIT_FAILURE
END IF
'**************************************************************************
'** Check for older versions of Cinemania
'**************************************************************************
CHECKOLDCIN:
OLDCIN92% = 0
OLDCIN94% = 0
'Check for remote.dll to determine if old version exists
' older Cinemania '92 versions
VIEWERDIR$ = GetIniKeyString(WININI$, "Multimedia Viewer", "ViewerPath")
IF DoesFileExist(MakePath(VIEWERDIR$, "remote.dll"), femExists) THEN
OLDCIN92% = 1
END IF
' older Cinemania '94 versions
'ViewerIni$ = MakePath(WinDir$, "viewer.ini")
'CIN94DIR$ = GetIniKeyString(ViewerIni$, "Files", "CNMNIA94.DLL")
'IF CIN94DIR$ <> "" THEN
' I% = InStr(CIN94DIR$, ",")
' IF I% > 0 THEN
' CIN94DIR$ = Mid$(CIN94DIR$, 1, I%-1)
' END IF
' IF DoesFileExist(MakePath(CIN94DIR$, "CNMNIA94.DLL"), femExists) THEN
' OLDCIN94% = 1
' END IF
'END IF
DELETEOLD% = 0
FOUNDOLD% = 0
IF OLDCIN92% = 1 THEN
DELETEOLDCIN:
sz$ = UIStartDlg(CUIDLL$, DELETE_OLD_CINEMANIA92, "FDeleteOldDlgProc", GENERIC_HELP, "FHelpDlgProc")
FOUNDOLD% = 1
IF sz$ = "REACTIVATE" THEN
GOTO DELETEOLDCIN
ELSEIF sz$ = "NONE" THEN
DELETEOLD% = 0
ELSEIF sz$ = "CIN92" THEN
DELETEOLD% = 1
ELSEIF sz$ = "CIN94" THEN
DELETEOLD% = 2
ELSEIF sz$ = "ALL" THEN
DELETEOLD% = 3
ELSEIF sz$ = "EXIT" THEN
GOSUB DIAG_QUIT
GOTO DELETEOLDCIN
END IF
UIPop 1
END IF
'**************************************************************************
'** Check for VGAPAL.DRV and ask if the user wants to change to VGA
'**************************************************************************
VGADRV% = 0
IF UCase$(GetIniKeyString (SYSINI$, "Boot", "Display.Drv")) = "VGAPAL.DRV" THEN
VGADRV% = 1 ' Fix it
END IF
'**************************************************************************
'** Ask user for Directory to install to
'**************************************************************************
ASKDIRECTORY:
DEST$ = "C:\CINMANIA" 'default destination directory
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "ALL"
GETDIRECTORY:
'** Get directory to install to
sz$ = UIStartDlg(CUIDLL$, INSTALL_DIR, "FInstallDirDlgProc", INSTALL_DIR_HELP, "FHelpDlgProc")
IF sz$ = "REACTIVATE" THEN
GOTO GETDIRECTORY
ELSEIF sz$ = "EXIT" THEN
GOSUB DIAG_QUIT
GOTO GETDIRECTORY
END IF
DEST$ = GetSymbolValue("EditTextOut")
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETDIRECTORY
END IF
UIPop 1
'**************************************************************************
'** Ask user for Program Group to install to
'**************************************************************************
' Check if user is using Program Manager as Shell. Better solution would be
' to check if Program Manager is running.
PROGGRP$ = ""
sz$ = GetIniKeyString(SYSINI$, "boot", "shell")
IF sz$ <> "progman.exe" THEN
CREATEICON% = 1
GOTO SETJUMPCOLOR
END IF
ASKPROGMAN:
'** Get the Program Group Name to install Cinemania '94 to
sz$ = UIStartDlg(CUIDLL$, PROGRAM_GROUP, "FPrgGroupDlgProc", GENERIC_HELP, "FHelpDlgProc")
IF sz$ = "REACTIVATE" THEN
GOTO ASKPROGMAN
ELSEIF sz$ = "EXIT" THEN
GOSUB DIAG_QUIT
GOTO ASKPROGMAN
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETDIRECTORY
END IF 'else would be a valid group name
UIPop 1
' Now we can't pass commas or close-parenthesis in Program Group
' names because the DDE passes the argument directly as a string
' parameter (e.g., CreateGroup(PROGGRP$, whatever)) and the commas
' and close-parenthesis mess it up. So we can quote the string,
' but then you can't have quotation marks inside the string.
' Best solution is to remove all quotation marks, then quote
' the string. This allows commas, which are probably more common
' than quotation marks, and also avoid problems like: "Real" Good
' which also crashes.
STRIP_PAREN:
N = INSTR(1, sz$, """") ' Look for "
IF N > 0 THEN
sz$ = MID$(sz$,1,N-1) + MID$(sz$,N+1,100)
GOTO STRIP_PAREN
END IF
IF sz$ = "" THEN
sz$ = "Microsoft Multimedia"
END IF
PROGGRP$ = """" + sz$ + """"
SetSymbolValue "TARGETGROUP", PROGGRP$
CREATEICON% = 1
'**************************************************************************
'** Ask user to change hotspot colors
'**************************************************************************
SETJUMPCOLOR:
'If user already has it set, don't bother.
JumpColor$ = GetIniKeyString(WININI$, "Multimedia Viewer", "JumpColor")
PopUpColor$ = GetIniKeyString(WININI$, "Multimedia Viewer", "PopupColor")
IF ((JumpColor$ = "0 0 127") AND (PopUpColor$ = "0 0 127")) THEN
SETJUMP = 0
GOTO BEGIN_INSTALL
END IF
ASKHOTSPOTS:
sz$ = UIStartDlg(CUIDLL$, ASK_HOTSPOT, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO ASKHOTSPOTS
ELSEIF sz$ = "EXIT" THEN ' actually isn't EXIT but DON'T CHANGE COLOR
SETJUMP = 0
ELSE
SETJUMP = 1
END IF
UIPop 1
BEGIN_INSTALL:
'AddToBillboardList CUIDLL$, COPYING_FILES, "FMailmanDlgProc", 1000
Install
'*************************************************************************
'** Check if Windows has to be restarted because drivers were installed
'*************************************************************************
RESTART_WINDOWS_AGAIN:
IF ShouldRestart% THEN
sz$ = UIStartDlg(CUIDLL$, RESTART_WINDOWS, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO RESTART_WINDOWS_AGAIN
ELSEIF sz$ = "EXIT" THEN
GOSUB DIAG_QUIT
GOTO RESTART_WINDOWS_AGAIN
ELSEIF sz$ = "OK" THEN
ForceRestartOn
result% = ExitExecRestart ()
' If ExitExitRestart returns, then not all apps wanted to close
GOTO RESTART_WINDOWS_AGAIN
END IF
END IF
UIPop 1
'*************************************************************************
'** Cinemania Overview
'*************************************************************************
OVERVIEW:
sz$ = UIStartDlg(CUIDLL$, SETUPQUIT_OVERVIEW, "FOverviewDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO OVERVIEW
ELSEIF sz$ = "README" THEN
RUN MakePath(GetWindowsDir(), "NOTEPAD.EXE") + " " + MakePath(SRCDIR$, "misc\cnmnia94.txt"), NOWAIT
GOTO OVERVIEW
ELSEIF sz$ = "RUN_CINEMANIA" THEN
demo% = ShowWindow (GetActiveWindow(), 0) ' Hide setup
RUN MakePath(GetWindowsSysDir(), "mviewer2.exe cnmnia94.mvb"), NOWAIT
ELSEIF sz$ = "RUN_DEMO" THEN
demo% = ShowWindow (GetActiveWindow(), 0) ' Hide setup
' Demo sounds requires you to be in that directory
OldDrive$ = CurDir$
ChDrive Mid$(SRCDIR$, 1, 2)
ChDir MakePath(SRCDIR$, "DEMO")
'demo% = WinExec("CINEOVR.EXE", 0)
RUN "CINEOVR.EXE", NOWAIT
ChDrive Mid$(OldDrive$, 1, 2)
ChDir OldDrive$
END IF
'**************************************************************************
'** Quit and Setup Error handling routines
'**************************************************************************
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
GOTO QUIT2
END IF
QUIT_FAILURE:
dlg% = SETUPQUIT_FAILURE
UIPopAll ' remove all other dialogs
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUIT_FAILURE
END IF
QUIT2:
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call Microsoft Product Support Services for assistance.", "Cinemania '94 Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
'**************************************************************************
'** Misc. error messages
'**************************************************************************
DIAG_QUIT:
sz$ = UIStartDlg(CUIDLL$, SETUPQUIT_CONFIRM, "FInfoDlgProc", 0, "")
' The "Exit" button generates a "Continue" so that double-clicking
' on the close box will generate an "Exit", which is equivalent to
' the "Continue" button.
IF sz$ = "CONTINUE" THEN
UIPopAll
'ERROR STFQUIT
END
ELSEIF sz$ = "REACTIVATE" THEN
GOTO DIAG_QUIT
ELSE
UIPop 1
END IF
RETURN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, SYSERROR_BADPATH, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
DRIVEISFULL:
sz$ = UIStartDlg(CUIDLL$, SYSERROR_DISKFULL, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO DRIVEISFULL
ELSEIF sz$ = "EXIT" THEN
dlg% = SETUPQUIT_FAILURE
GOTO QUIT_FAILURE
END IF
UIPop 1
RETURN
'**************************************************************************
'** Purpose:
'** Checks to see if a file is already on the hard disk.
'** Arguments:
'** Section in INF file, key of file, and destination directory on disk.
'** Returns:
'** The size of the file if it needs to be copied, or 0 otherwise
'**************************************************************************
FUNCTION UpdateSize (szSection$, szKey$, szDestDir$) STATIC AS LONG
IF WillCopy (szSection$, szKey$, szDestDir$) THEN
UpdateSize = GetSectionKeySize (szSection$, szKey$)
ELSE
UpdateSize = 0
END IF
END FUNCTION
'**************************************************************************
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'**************************************************************************
SUB Install STATIC
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowsSysDir()
SetRestartDir DEST$
sz$ = UIStartDlg (CUIDLL$, COPYING_FILES, "FMailmanDlgProc", 0, "")
COPY_SIZE& = 0
'** find out which Viewer files need to be copied
AddSectionFilesToCopyList "Viewer", SRCDIR$, WinSysDir$
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "CTL3D", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVAPI2", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVBMP2", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVBRKR2", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVFS2", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVFTSUI2", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVMCI2", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVSRCH2", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVTITLE2", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVIEWER2", WinSysDir$)
'** copy Cinemania files
AddSectionFilesToCopyList "Cinemania", SRCDIR$, DEST$
'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "CNMNIA94")
'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "ICON")
'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "MOVIE")
'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "MOVIELST")
'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "CNFTSUI2")
'** find out which fonts files need to be copied
AddSectionFilesToCopyList "Fonts", SRCDIR$, WinSysDir$
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V1SP", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V2SP", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V3SP", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V4SP", WinSysDir$)
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V7SP", WinSysDir$)
'** find out which drivers files need to be copied
AddSectionFilesToCopyList "Drivers", SRCDIR$, WinSysDir$
OLD_SIZE& = COPY_SIZE&
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MCIAVI", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSVIDC", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "ICCVID", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSVIDEO", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSACM", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSADPCM", WinSysDir$)
IF OLD_SIZE& <> COPY_SIZE& THEN
ShouldRestart% = 1
END IF
DISK_SPACE_CHECK:
'** Verify that there is enough space on drive
IF GetCopyListCost ("", "", "") <> 0 THEN
WINDRIVEISFULL:
sz$ = UIStartDlg(CUIDLL$, SYSERROR_WINDISKFULL, "FInfoDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPop 1
QUIT:
sz$ = UIStartDlg(CUIDLL$, SETUPQUIT_FAILURE, "FInfoDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPop 1
END
ELSE
GOTO QUIT
END IF
ELSEIF sz$ = "CONTINUE" THEN
UIPop 1
GOTO DISK_SPACE_CHECK
ELSE
GOTO WINDRIVEISFULL
END IF
END IF
'** Delete old Cinemania if requested
IF DELETEOLD% > 0 THEN
'Check for Cinemania '92, in \viewer directory. Don't delete Viewer
'stuff because other programs may use it.
IF ((DELETEOLD% = 1) OR (DELETEOLD% = 3)) THEN
RemoveFile MakePath(VIEWERDIR$, "REMOTE.DLL"), cmoNone
RemoveFile MakePath(VIEWERDIR$, "CINMANIA.ICO"), cmoNone
RemoveFile MakePath(VIEWERDIR$, "MVOPTCIN.EXE"), cmoNone
RemoveFile MakePath(VIEWERDIR$, "MOVIE.DLL"), cmoNone
RemoveFile MakePath(VIEWERDIR$, "MOVIELST.EXE"), cmoNone
RemoveFile MakePath(VIEWERDIR$, "MUSCROLL.DLL"), cmoNone
CopyListMakerFiles VIEWERDIR$, DEST$, 1
ENDIF
'Check for Cinemania '94 in Windows directory
IF ((DELETEOLD% = 2) OR (DELETEOLD% = 3)) THEN
RemoveFile MakePath(CIN94DIR$, "CNMNIA94.DLL"), cmoNone
RemoveFile MakePath(CIN94DIR$, "CINMANIA.ICO"), cmoNone
RemoveFile MakePath(CIN94DIR$, "CNFTSUI2.DLL"), cmoNone
RemoveFile MakePath(CIN94DIR$, "MOVIELST.EXE"), cmoNone
RemoveFile MakePath(CIN94DIR$, "MOVIE.DLL"), cmoNone
CopyListMakerFiles CIN94DIR$, DEST$, 1
END IF
i% = DeleteOldCinemania(DELETEOLD%)
ELSE
'** Not deleting old, but still might move files from there:
IF ((FOUNDOLD% = 1) OR (FOUNDOLD% = 3)) THEN
CopyListMakerFiles VIEWERDIR$, DEST$, 0
END IF
IF ((FOUNDOLD% = 2) OR (FOUNDOLD% = 3)) THEN
CopyListMakerFiles CIN94DIR$, DEST$, 0
END IF
END IF
'** Check if VGAPAL.DRV should be replaced with VGA.DRV:
IF VGADRV% = 1 THEN
CreateIniKeyValue SYSINI$, "Boot", "Display.Drv", "VGA.DRV", cmoOverwrite
CreateIniKeyValue SYSINI$, "Boot.Description", "Display.Drv", "VGA", cmoOverwrite
ShouldRestart% = 1
END IF
SetCopyGaugePosition 25, 120
CopyFilesInCopyList
UIPop 1
SetupMMCatalog
IF RestartListEmpty() = 0 THEN
ShouldRestart% = 1
END IF
InstallFonts
'** Add driver information to system.ini
CreateIniKeyValue SYSINI$, "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
CreateIniKeyValue SYSINI$, "drivers", "Wavemapper", "msacm.drv", cmoOverwrite
CreateIniKeyValue SYSINI$, "drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
CreateIniKeyValue SYSINI$, "drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
CreateIniKeyValue SYSINI$, "msacm", "Install", "msadpcm.acm", cmoOverwrite
'** Add driver information to win.ini
CreateIniKeyValue WININI$, "mci extensions", "avi", "AVIVideo", cmoOverwrite
'** Add Cinemania entry to viewer.ini
ViewerIni$ = MakePath(WinDir$, "viewer.ini")
temp$ = SRCDIR$ + ", Please insert the Cinemania '94 CD into drive " + Mid$(SRCDIR$, 1, 2)
CreateIniKeyValue ViewerIni$, "Files", "cnmnia94.mvb", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "cin94hlp.mvb", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "cin94idx.mvb", temp$, cmoOverwrite
temp$ = DEST$ + "\" + ", Cinemania file missing - please reinstall Cinemania '94 CD"
CreateIniKeyValue ViewerIni$, "Files", "cnmnia94.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "cinlst94.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "cnftsui2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "cnmnia94", "path", DEST$ + "\", cmoOverwrite
temp$ = GetWindowsSysDir() + ", Viewer file missing - please reinstall Cinemania '94 CD"
CreateIniKeyValue ViewerIni$, "Files", "ctl3d.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mvapi2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mvbmp2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mvbrkr2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mvfs2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mvftsui2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mvmci2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mvsrch2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mvtitle2.dll", temp$, cmoOverwrite
CreateIniKeyValue ViewerIni$, "Files", "mmp.dll", temp$, cmoOverwrite
'** Change Jump color if requested
IF SETJUMP% = 1 THEN
CreateIniKeyValue WININI$, "Multimedia Viewer", "JumpColor", "0 0 127", cmoOverwrite
CreateIniKeyValue WININI$, "Multimedia Viewer", "PopupColor", "0 0 127", cmoOverwrite
END IF
'** Put some Cinemania stuff in WIN.INI
CreateIniKeyValue WININI$, "Cinemania", "Cin94Path", DEST$, cmoOverwrite
UIPop 1
'** Done installing all the files, create Program Group
IF CREATEICON% = 1 THEN
If PROGGRP$ = "" Then
PROGGRP$ = "Microsoft Multimedia"
End If
CreateProgmanGroup PROGGRP$, "", cmoNone
ShowProgManGroup PROGGRP$, 2, cmoNone
ShowProgManGroup PROGGRP$, 1, cmoNone
CreateProgmanItem PROGGRP$, "Cinemania '94", "MVIEWER2.EXE cnmnia94.mvb", MakePath(DEST$, "cinmania.ico")+",,,,"+DEST$, cmoOverwrite
CreateProgmanItem PROGGRP$, "Read Me: Cinemania '94 Tips", MakePath(SRCDIR$, "misc\cnmnia94.txt"), "", cmoOverwrite
ShowProgmanGroup PROGGRP$, 1, cmoNone
END IF
MMCatSetProgman
END SUB
'*************************************************************************
'**
'** InstallFonts
'** ------------
'**
'** Purpose:
'** Install special Screen (raster) fonts
'** Arguments:
'** none.
'** Returns:
'** none.
'** Comments:
'** ensure that the font files are copied
'*************************************************************************
SUB InstallFonts STATIC
'** Add fonts to WIN.INI
szKey$ = "V1 Lucida Sans"
CreateIniKeyValue WININI$, "fonts", szKey$, "V1SP.FON", cmoNone
szKey$ = "V2 Lucida Sans"
CreateIniKeyValue WININI$, "fonts", szKey$, "V2SP.FON", cmoNone
szKey$ = "V3 Lucida Sans"
CreateIniKeyValue WININI$, "fonts", szKey$, "V3SP.FON", cmoNone
szKey$ = "V4 Lucida Sans"
CreateIniKeyValue WININI$, "fonts", szKey$, "V4SP.FON", cmoNone
szKey$ = "V7 Lucida Sans"
CreateIniKeyValue WININI$, "fonts", szKey$, "V7SP.FON", cmoNone
'** Make fonts immediately available.
sz$ = UIStartDlg(CUIDLL$, INSTALL_FONTS, "FInstallFontsDlgProc", 0, "")
UIPop 1
END SUB
'***************************************************************************
'** Purpose:
'** 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
'** Returns:
'** Resulting fully qualified path name.
'***************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
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
'***************************************************************************
'** Purpose:
'** To extract the filename from the pathname
'** Arguments:
'** szPath$ - full pathname
'** Returns:
'** The filename
'***************************************************************************
FUNCTION GetFilename (szPath$) STATIC AS STRING
FOR i% = LEN(szPath$) TO 1 STEP -1
IF MID$(szPath$, i%, 1) = "\" THEN
GetFilename = MID$(szPath$, i% + 1, LEN(szPath$) - i%)
Exit FOR
END IF
NEXT
IF i% = 0 THEN ' No "\" in pathname, must all be filename
GetFilename = szPath$
END IF
END FUNCTION
FUNCTION WillCopy (szSection$, szKey$, szDestDir$) STATIC AS INTEGER
WillCopy = 0
Filename$ = GetSectionKeyFilename (szSection$, szKey$)
szOldFile$ = MakePath (szDestDir$, GetFilename (Filename$))
szNewFile$ = MakePath (SRCDIR$, Filename$)
If DoesFileExist(szOldFile, femExists) <> 0 Then
i% = CmpVersion(GetVersionOfFile(szOldFile$), GetVersionOfFile(szNewFile$))
If i% = -1 Then
'New version is older, won't copy.
exit function
Endif
If i% = 0 Then
'Versions are same go by date.
If IsDateLater(GetDateOfFile(szOldFile$), GetDateOfFile(szNewFile$)) = 0 Then
'New file is same or older, won't copy.
exit function
Endif
Endif
Endif
WillCopy = 1
END FUNCTION
'*************************************************************************
'**
'** IsDateLater
'** --------
'** Purpose:
'** Compares two file dates
'** Arguments:
'** DateOld$ in YYYY-MM-DD-HH-MM-SS format
'** DateNew$ in YYYY-MM-DD-HH-MM-SS format
'** Returns:
'** 1 if new date is later, 0 if new date is older or the same
'*************************************************************************
FUNCTION IsDateLater (DateOld$, DateNew$) STATIC AS INTEGER
' Can't you do a straight string compare here?
'First compare year
OldYear% = GetYearFromDate (DateOld$)
NewYear% = GetYearFromDate (DateNew$)
If NewYear% < OldYear% Then
IsDateLater = 0
ElseIf NewYear% = OldYear% Then
'If year is the same, compare month
OldMonth% = GetMonthFromDate (DateOld$)
NewMonth% = GetMonthFromDate (DateNew$)
If NewMonth% < OldMonth% Then
IsDateLater = 0
ElseIf NewMonth% = OldMonth% Then
'If month is the same, compare day
OldDay% = GetDayFromDate (DateOld$)
NewDay% = GetDayFromDate (DateNew$)
If NewDay% <= OldDay% Then
IsDateLater = 0
Else
IsDateLater = 1
End If
Else
IsDateLater = 1
End If
Else
IsDateLater = 1
ENDIF
END FUNCTION
'*************************************************************************
'**
'** CmpVersion
'** --------
'** Purpose:
'** Compares two file versions
'** Arguments:
'** VerOld$ - Old file version string (in format N.N.N.N)
'** VerNew$ - New file version string (in format N.N.N.N)
'** Returns:
'** 1 if new version is later, -1 if new version is older, 0 if the same
'*************************************************************************
FUNCTION CmpVersion (VerOld$, VerNew$) STATIC AS INTEGER
CmpVersion = 0
FOR I=1 TO 4
VOld = GetVersionNthField (VerOld$, I)
VNew = GetVersionNthField (VerNew$, I)
If VNew > VOld Then
CmpVersion = 1
Goto LBL_CmpVersionEnd
Endif
If VNew < VOld Then
CmpVersion = -1
Goto LBL_CmpVersionEnd
End If
NEXT I
LBL_CmpVersionEnd:
END FUNCTION