home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Cinemania 1994 (Preview Edition) / Microsoft-CinemaniaPreviewEdition94-Win31.iso / msstp / cinsetup.mst < prev    next >
Text File  |  1993-08-25  |  30KB  |  852 lines

  1. '***************************************************************************
  2. '*                          Cinemania '94 Setup
  3. '*                 Microsoft Multimedia Publishing Group
  4. '*                             March 1993
  5. '***************************************************************************
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. '** Dialog ID's - Defined in dialogs.h
  11. CONST WELCOME_SCREEN              = 100
  12. CONST WELCOME_HELP                = 101
  13. CONST GENERIC_HELP                = 102
  14. CONST FIX_VGA_DRIVER              = 150
  15. CONST FIX_VGA_HELP                = 151
  16. CONST SYSERROR_DOS_WIN            = 200
  17. CONST SYSERROR_VGA                = 301
  18. CONST SYSERROR_VIEWER             = 400
  19. CONST SYSWAIT_MPC                 = 500
  20. CONST SYSCHECK_MPC                = 501
  21. CONST SYSDISPLAY_MPC              = 502
  22. CONST DELETE_OLD_CINEMANIA92      = 600
  23. CONST PROGRAM_GROUP               = 700
  24. CONST PROGRAM_GROUP_BOXLIST       = 701
  25. CONST ASK_HOTSPOT                 = 800
  26. CONST SYSERROR_WINDISKFULL        = 900
  27. CONST COPYING_FILES               = 1000
  28. CONST INSTALL_FONTS               = 1100
  29. CONST INSTALL_DIR                 = 1200
  30. CONST INSTALL_DIR_HELP            = 1201
  31. CONST SYSERROR_BADPATH            = 1202
  32. CONST SYSERROR_DISKFULL           = 1203
  33. CONST SETUPQUIT_CONFIRM           = 10000
  34. CONST SETUPQUIT_FAILURE           = 10001
  35. CONST SETUPQUIT_OVERVIEW          = 10002
  36. CONST SETUPQUIT_QUIT              = 10003
  37. CONST RESTART_WINDOWS             = 10020
  38.  
  39. '** Bitmap ID - Defined in dialogs.rc
  40. CONST WELCOME_BMP      = 1
  41.  
  42. '** Global Definitions
  43. GLOBAL DEST$        'Cinemania directory
  44. GLOBAL CUIDLL$      'Custom user interface dll
  45. GLOBAL PROGGRP$     'Default program group
  46. GLOBAL DELETEOLD%   'Counter to delete old Cinemania
  47. GLOBAL FOUNDOLD%    'Found old Cinemania
  48. GLOBAL CREATEICON%  'Counter to create program group icons
  49. GLOBAL SETJUMP%     'Counter to change hotspot colors or not
  50. GLOBAL VIEWERDIR$   'Viewer directory
  51. GLOBAL CIN94DIR$    'Old Cinemania 94 directory
  52. GLOBAL SRCDIR$      'Setup's root directory (where setup.exe is)
  53. GLOBAL WININI$      'Full pathname to WIN.INI
  54. GLOBAL SYSINI$      'Full pathname to SYSTEM.INI
  55. GLOBAL ShouldRestart% 'Whether Windows should be restarted after setup
  56. GLOBAL VGADRV%      'Whether VGAPAL driver is currently installed
  57. GLOBAL Misc%
  58.  
  59. '** Function Prototypes
  60. DECLARE SUB Install
  61. DECLARE SUB InstallFonts
  62.  
  63. '** Function Prototypes
  64. DECLARE FUNCTION GetModuleHandle LIB "kernel" (a$) AS INTEGER
  65. DECLARE FUNCTION WinExec LIB "kernel" (a$, b%) AS INTEGER
  66. DECLARE FUNCTION GetActiveWindow LIB "user" AS INTEGER
  67. DECLARE FUNCTION ShowWindow LIB "user" (a%, b%) AS INTEGER
  68. DECLARE FUNCTION MessageBox  lib "User" (hwnd%, lpstr$, lpstr$, uint%) as integer
  69. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  70. DECLARE FUNCTION GetFilename (szPath$) AS STRING
  71. DECLARE FUNCTION UpdateSize (szSection$, szKey$, szDestDir$) AS LONG
  72. DECLARE FUNCTION WillCopy (szSection$, szKey$, szDestDir$) AS INTEGER
  73. DECLARE FUNCTION CmpVersion (VerOld$, VerNew$) AS INTEGER
  74. DECLARE FUNCTION IsDateLater (DateOld$, DateNew$) AS INTEGER
  75.  
  76. DECLARE FUNCTION DeleteOldCinemania LIB "mscuistf.dll" (ver%) AS INTEGER
  77. DECLARE FUNCTION CheckForCD         LIB "mscuistf.dll" (a$) AS INTEGER   
  78. DECLARE SUB CopyListMakerFiles      LIB "mscuistf.dll" (a$,b$,c%)
  79.  
  80. '$INCLUDE 'mmperf.inc'
  81. '$INCLUDE 'mmcat.inc'
  82. '  '$INCLUDE 'upgrade.inc'
  83.  
  84. '****************************************************************************
  85. '** General Installation Script
  86. '****************************************************************************
  87. INIT:
  88.     CUIDLL$ = "mscuistf.dll"    'Custom user interface dll
  89.     ShouldRestart% = 0          'Becomes 1 if drivers were installed
  90.  
  91.     SetBitmap CUIDLL$, WELCOME_BMP
  92.     SetTitle "Cinemania '94 Setup Window"
  93.  
  94.     '** Find pathname for Cinemania .INF file for reading
  95.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  96.     IF szInf$ = "" THEN
  97.     szInf$ = GetSymbolValue("STF_CWDDIR") + "CINSETUP.INF"
  98.     END IF
  99.     ReadInfFile szInf$
  100.  
  101.     SRCDIR$ = GetSymbolValue("STF_SRCDIR")
  102.     WININI$ = MakePath(GetWindowsDir(), "WIN.INI")
  103.     SYSINI$ = MakePath(GetWindowsDir(), "SYSTEM.INI")
  104.     ERR = 0
  105.  
  106. '**************************************************************************
  107. '** Check to see if this is an upgrade disk
  108. '**************************************************************************
  109.     Upgrade = 0
  110.     ' GoSub UPGRADECHECK
  111.     ' Now Upgrade = 1 if there was an upgrade welcome and dialogue
  112.  
  113. '**************************************************************************
  114. '** Welcome screen startup
  115. '**************************************************************************
  116.  
  117. WELCOME:
  118.     IF Upgrade = 0 THEN
  119.       '** Bring up WELCOME dialog with WELCOME_HELP as help dialog
  120.       sz$ = UIStartDlg(CUIDLL$, WELCOME_SCREEN, "FInfoDlgProc", WELCOME_HELP, "FHelpDlgProc")
  121.       IF sz$ = "REACTIVATE" THEN
  122.       GOTO WELCOME
  123.       ELSEIF sz$ = "CONTINUE" THEN
  124.       UIPop 1
  125.       ELSE
  126.       GOSUB DIAG_QUIT    'must have been exit command, verify exit
  127.       GOTO WELCOME     'doesn't want to exit, continue with setup
  128.       END IF
  129.     ENDIF
  130.  
  131. '**************************************************************************
  132. '** Check the system's MPC performance
  133. '**************************************************************************
  134.     GoSub SYSCHECK
  135.     'Check FCancel symbol!
  136.  
  137. '**************************************************************************
  138. '** Check to make sure Viewer isn't running
  139. '**************************************************************************
  140. ISVIEWERRUNNING:
  141.     MVrunning% = GetModuleHandle("MVIEWER2")
  142.  
  143.     IF (MVrunning% <> 0) THEN
  144.     VIEWERISRUNNING:
  145.      ShouldRestart% = 1
  146. '        sz$ = UIStartDlg(CUIDLL$, SYSERROR_VIEWER, "FInfoDlgProc", 0, "")
  147. '        IF sz$ = "REACTIVATE" THEN
  148. '            GOTO VIEWERISRUNNING
  149. '        ELSEIF sz$ = "CONTINUE" THEN
  150. '            UIPop 1
  151. '            GOTO ISVIEWERRUNNING
  152. '        END IF
  153. '        UIPop 1
  154. '        dlg% = SETUPQUIT_FAILURE
  155. '        GOTO QUIT_FAILURE
  156.     END IF
  157.  
  158. '**************************************************************************
  159. '** Check for older versions of Cinemania
  160. '**************************************************************************
  161. CHECKOLDCIN:
  162.     OLDCIN92% = 0
  163.     OLDCIN94% = 0
  164.     'Check for remote.dll to determine if old version exists
  165.     ' older Cinemania '92 versions
  166.     VIEWERDIR$ = GetIniKeyString(WININI$, "Multimedia Viewer", "ViewerPath")
  167.     IF DoesFileExist(MakePath(VIEWERDIR$, "remote.dll"), femExists) THEN
  168.     OLDCIN92% = 1
  169.     END IF                                                     
  170.  
  171.     ' older Cinemania '94 versions
  172.     'ViewerIni$ = MakePath(WinDir$, "viewer.ini")
  173.     'CIN94DIR$ = GetIniKeyString(ViewerIni$, "Files", "CNMNIA94.DLL")
  174.     'IF CIN94DIR$ <> "" THEN
  175.     '  I% = InStr(CIN94DIR$, ",")
  176.     '  IF I% > 0 THEN
  177.     '   CIN94DIR$ = Mid$(CIN94DIR$, 1, I%-1)
  178.     '  END IF
  179.     '  IF DoesFileExist(MakePath(CIN94DIR$, "CNMNIA94.DLL"), femExists) THEN
  180.     '   OLDCIN94% = 1
  181.     '  END IF
  182.     'END IF
  183.  
  184.     DELETEOLD% = 0
  185.     FOUNDOLD% = 0
  186.  
  187.     IF OLDCIN92% = 1 THEN
  188. DELETEOLDCIN:
  189.       sz$ = UIStartDlg(CUIDLL$, DELETE_OLD_CINEMANIA92, "FDeleteOldDlgProc", GENERIC_HELP, "FHelpDlgProc")
  190.       FOUNDOLD% = 1
  191.      
  192.       IF sz$ = "REACTIVATE" THEN
  193.       GOTO DELETEOLDCIN
  194.       ELSEIF sz$ = "NONE" THEN
  195.       DELETEOLD% = 0
  196.       ELSEIF sz$ = "CIN92" THEN
  197.       DELETEOLD% = 1
  198.       ELSEIF sz$ = "CIN94" THEN
  199.       DELETEOLD% = 2
  200.       ELSEIF sz$ = "ALL" THEN
  201.       DELETEOLD% = 3
  202.       ELSEIF sz$ = "EXIT" THEN
  203.       GOSUB DIAG_QUIT
  204.       GOTO DELETEOLDCIN
  205.       END IF
  206.  
  207.       UIPop 1
  208.     END IF
  209.  
  210. '**************************************************************************
  211. '** Check for VGAPAL.DRV and ask if the user wants to change to VGA
  212. '**************************************************************************
  213.     VGADRV% = 0
  214.     IF UCase$(GetIniKeyString (SYSINI$, "Boot", "Display.Drv")) = "VGAPAL.DRV" THEN
  215.     VGADRV% = 1 ' Fix it
  216.     END IF
  217.  
  218. '**************************************************************************
  219. '** Ask user for Directory to install to
  220. '**************************************************************************
  221. ASKDIRECTORY:
  222.     DEST$ = "C:\CINMANIA"                    'default destination directory
  223.     SetSymbolValue "EditTextIn", DEST$
  224.     SetSymbolValue "EditFocus", "ALL"
  225.  
  226. GETDIRECTORY:
  227.     '** Get directory to install to
  228.     sz$ = UIStartDlg(CUIDLL$, INSTALL_DIR, "FInstallDirDlgProc", INSTALL_DIR_HELP, "FHelpDlgProc")
  229.     IF sz$ = "REACTIVATE" THEN
  230.     GOTO GETDIRECTORY
  231.     ELSEIF sz$ = "EXIT" THEN
  232.     GOSUB DIAG_QUIT
  233.     GOTO GETDIRECTORY
  234.     END IF
  235.     
  236.     DEST$ = GetSymbolValue("EditTextOut")
  237.     
  238.     IF IsDirWritable(DEST$) = 0 THEN
  239.     GOSUB BADPATH
  240.     GOTO GETDIRECTORY
  241.     END IF
  242.  
  243.     UIPop 1
  244.  
  245. '**************************************************************************
  246. '** Ask user for Program Group to install to
  247. '**************************************************************************
  248. ' Check if user is using Program Manager as Shell.  Better solution would be
  249. ' to check if Program Manager is running.
  250.  
  251.     PROGGRP$ = ""
  252.     sz$ = GetIniKeyString(SYSINI$, "boot", "shell")
  253.     IF sz$ <> "progman.exe" THEN
  254.     CREATEICON% = 1
  255.     GOTO SETJUMPCOLOR
  256.     END IF
  257.  
  258. ASKPROGMAN:
  259.     '** Get the Program Group Name to install Cinemania '94 to
  260.     sz$ = UIStartDlg(CUIDLL$, PROGRAM_GROUP, "FPrgGroupDlgProc", GENERIC_HELP, "FHelpDlgProc")
  261.     IF sz$ = "REACTIVATE" THEN
  262.     GOTO ASKPROGMAN
  263.     ELSEIF sz$ = "EXIT" THEN
  264.     GOSUB DIAG_QUIT
  265.     GOTO  ASKPROGMAN
  266.     ELSEIF sz$ = "BACK" THEN
  267.     UIPop 1
  268.     GOTO GETDIRECTORY
  269.     END IF                   'else would be a valid group name
  270.  
  271.     UIPop 1
  272.     ' Now we can't pass commas or close-parenthesis in Program Group
  273.     ' names because the DDE passes the argument directly as a string
  274.     ' parameter (e.g., CreateGroup(PROGGRP$, whatever)) and the commas
  275.     ' and close-parenthesis mess it up.  So we can quote the string,
  276.     ' but then you can't have quotation marks inside the string.
  277.     ' Best solution is to remove all quotation marks, then quote
  278.     ' the string.  This allows commas, which are probably more common
  279.     ' than quotation marks, and also avoid problems like: "Real" Good
  280.     ' which also crashes.
  281.     STRIP_PAREN:
  282.     N = INSTR(1, sz$, """")  ' Look for "
  283.     IF N > 0 THEN
  284.       sz$ = MID$(sz$,1,N-1) + MID$(sz$,N+1,100)
  285.       GOTO STRIP_PAREN
  286.     END IF
  287.     IF sz$ = "" THEN
  288.       sz$ = "Microsoft Multimedia"
  289.     END IF
  290.     PROGGRP$ = """" + sz$ + """"
  291.     SetSymbolValue "TARGETGROUP", PROGGRP$
  292.     CREATEICON% = 1
  293.  
  294. '**************************************************************************
  295. '** Ask user to change hotspot colors
  296. '**************************************************************************
  297. SETJUMPCOLOR:
  298.     'If user already has it set, don't bother.
  299.     JumpColor$ = GetIniKeyString(WININI$, "Multimedia Viewer", "JumpColor")
  300.     PopUpColor$  = GetIniKeyString(WININI$, "Multimedia Viewer", "PopupColor")
  301.     IF ((JumpColor$ = "0 0 127") AND (PopUpColor$ = "0 0 127")) THEN
  302.     SETJUMP = 0
  303.     GOTO BEGIN_INSTALL
  304.     END IF
  305.     
  306. ASKHOTSPOTS:
  307.     sz$ = UIStartDlg(CUIDLL$, ASK_HOTSPOT, "FInfoDlgProc", 0, "")
  308.     IF sz$ = "REACTIVATE" THEN
  309.     GOTO ASKHOTSPOTS
  310.     ELSEIF sz$ = "EXIT" THEN     ' actually isn't EXIT but DON'T CHANGE COLOR
  311.     SETJUMP = 0    
  312.     ELSE
  313.     SETJUMP = 1
  314.     END IF
  315.  
  316.     UIPop 1
  317.  
  318. BEGIN_INSTALL:
  319.     'AddToBillboardList CUIDLL$, COPYING_FILES, "FMailmanDlgProc", 1000
  320.     Install
  321.  
  322. '*************************************************************************
  323. '** Check if Windows has to be restarted because drivers were installed
  324. '*************************************************************************
  325. RESTART_WINDOWS_AGAIN:
  326.     IF ShouldRestart% THEN
  327.       sz$ = UIStartDlg(CUIDLL$, RESTART_WINDOWS, "FInfoDlgProc", 0, "")
  328.       IF sz$ = "REACTIVATE" THEN
  329.       GOTO RESTART_WINDOWS_AGAIN
  330.       ELSEIF sz$ = "EXIT" THEN
  331.       GOSUB DIAG_QUIT
  332.       GOTO RESTART_WINDOWS_AGAIN
  333.       ELSEIF sz$ = "OK" THEN
  334.       ForceRestartOn
  335.       result% = ExitExecRestart ()
  336.       ' If ExitExitRestart returns, then not all apps wanted to close
  337.       GOTO RESTART_WINDOWS_AGAIN
  338.       END IF
  339.     END IF
  340.     UIPop 1
  341.  
  342. '*************************************************************************
  343. '** Cinemania Overview
  344. '*************************************************************************
  345. OVERVIEW:
  346.     sz$ = UIStartDlg(CUIDLL$, SETUPQUIT_OVERVIEW, "FOverviewDlgProc", 0, "")
  347.     IF sz$ = "REACTIVATE" THEN
  348.     GOTO OVERVIEW
  349.     ELSEIF sz$ = "README" THEN
  350.     RUN MakePath(GetWindowsDir(), "NOTEPAD.EXE") + " " + MakePath(SRCDIR$, "misc\cnmnia94.txt"), NOWAIT
  351.     GOTO OVERVIEW
  352.     ELSEIF sz$ = "RUN_CINEMANIA" THEN
  353.     demo% = ShowWindow (GetActiveWindow(), 0) ' Hide setup
  354.     RUN MakePath(GetWindowsSysDir(), "mviewer2.exe cnmnia94.mvb"), NOWAIT
  355.     ELSEIF sz$ = "RUN_DEMO" THEN
  356.     demo% = ShowWindow (GetActiveWindow(), 0) ' Hide setup
  357.     ' Demo sounds requires you to be in that directory
  358.     OldDrive$ = CurDir$
  359.     ChDrive Mid$(SRCDIR$, 1, 2)
  360.     ChDir MakePath(SRCDIR$, "DEMO")
  361.     'demo% = WinExec("CINEOVR.EXE", 0)
  362.     RUN "CINEOVR.EXE", NOWAIT
  363.     ChDrive Mid$(OldDrive$, 1, 2)
  364.     ChDir OldDrive$
  365.     END IF
  366.  
  367. '**************************************************************************
  368. '** Quit and Setup Error handling routines
  369. '**************************************************************************
  370. QUIT:
  371.     ON ERROR GOTO ERRQUIT
  372.  
  373.     IF ERR = 0 THEN
  374.     GOTO QUIT2
  375.     END IF
  376. QUIT_FAILURE:
  377.     dlg% = SETUPQUIT_FAILURE
  378.     UIPopAll    ' remove all other dialogs
  379.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
  380.     IF sz$ = "REACTIVATE" THEN
  381.     GOTO QUIT_FAILURE
  382.     END IF
  383. QUIT2:  
  384.     UIPop 1
  385.  
  386.     END
  387.  
  388. ERRQUIT:
  389.     i% = DoMsgBox("Setup sources were corrupted, call Microsoft Product Support Services for assistance.", "Cinemania '94 Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  390.     END
  391.  
  392. '**************************************************************************
  393. '** Misc. error messages
  394. '**************************************************************************
  395.  
  396. DIAG_QUIT:
  397.     sz$ = UIStartDlg(CUIDLL$, SETUPQUIT_CONFIRM, "FInfoDlgProc", 0, "")
  398.  
  399.     ' The "Exit" button generates a "Continue" so that double-clicking
  400.     ' on the close box will generate an "Exit", which is equivalent to
  401.     ' the "Continue" button.
  402.     IF sz$ = "CONTINUE" THEN
  403.     UIPopAll
  404.     'ERROR STFQUIT
  405.     END
  406.     ELSEIF sz$ = "REACTIVATE" THEN
  407.     GOTO DIAG_QUIT
  408.     ELSE
  409.     UIPop 1
  410.     END IF
  411.     RETURN
  412.  
  413. BADPATH:
  414.     sz$ = UIStartDlg(CUIDLL$, SYSERROR_BADPATH, "FInfoDlgProc", 0, "")
  415.     IF sz$ = "REACTIVATE" THEN
  416.     GOTO BADPATH
  417.     END IF
  418.     UIPop 1
  419.     RETURN
  420.  
  421. DRIVEISFULL:
  422.     sz$ = UIStartDlg(CUIDLL$, SYSERROR_DISKFULL, "FInfoDlgProc", 0, "")
  423.     IF sz$ = "REACTIVATE" THEN
  424.     GOTO DRIVEISFULL
  425.     ELSEIF sz$ = "EXIT" THEN
  426.     dlg% = SETUPQUIT_FAILURE
  427.     GOTO QUIT_FAILURE
  428.     END IF
  429.     UIPop 1
  430.     RETURN
  431.  
  432. '**************************************************************************
  433. '** Purpose:
  434. '**     Checks to see if a file is already on the hard disk.
  435. '** Arguments:
  436. '**     Section in INF file, key of file, and destination directory on disk.
  437. '** Returns:
  438. '**     The size of the file if it needs to be copied, or 0 otherwise
  439. '**************************************************************************
  440. FUNCTION UpdateSize (szSection$, szKey$, szDestDir$) STATIC AS LONG
  441.     IF WillCopy (szSection$, szKey$, szDestDir$) THEN
  442.     UpdateSize = GetSectionKeySize (szSection$, szKey$)
  443.     ELSE
  444.     UpdateSize = 0
  445.     END IF
  446. END FUNCTION
  447.  
  448. '**************************************************************************
  449. '** Purpose:
  450. '**     Builds the copy list and performs all installation operations.
  451. '** Arguments:
  452. '**     none.
  453. '** Returns:
  454. '**     none.
  455. '**************************************************************************
  456. SUB Install STATIC
  457.  
  458.     WinDir$ = GetWindowsDir()
  459.     WinSysDir$ = GetWindowsSysDir()
  460.     SetRestartDir DEST$
  461.  
  462.     sz$ = UIStartDlg (CUIDLL$, COPYING_FILES, "FMailmanDlgProc", 0, "")
  463.  
  464.     COPY_SIZE& = 0
  465.  
  466.     '** find out which Viewer files need to be copied
  467.     AddSectionFilesToCopyList "Viewer", SRCDIR$, WinSysDir$
  468.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "CTL3D", WinSysDir$)
  469.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVAPI2", WinSysDir$)
  470.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVBMP2", WinSysDir$)
  471.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVBRKR2", WinSysDir$)
  472.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVFS2", WinSysDir$)
  473.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVFTSUI2", WinSysDir$)
  474.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVMCI2", WinSysDir$)
  475.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVSRCH2", WinSysDir$)
  476.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVTITLE2", WinSysDir$)
  477.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Viewer", "MVIEWER2", WinSysDir$)
  478.     
  479.     '** copy Cinemania files
  480.     AddSectionFilesToCopyList "Cinemania", SRCDIR$, DEST$
  481.     'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "CNMNIA94")
  482.     'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "ICON")
  483.     'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "MOVIE")
  484.     'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "MOVIELST")
  485.     'COPY_SIZE& = COPY_SIZE& + GetSectionKeySize("Cinemania", "CNFTSUI2")
  486.  
  487.     '** find out which fonts files need to be copied
  488.     AddSectionFilesToCopyList "Fonts", SRCDIR$, WinSysDir$
  489.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V1SP", WinSysDir$)
  490.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V2SP", WinSysDir$)
  491.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V3SP", WinSysDir$)
  492.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V4SP", WinSysDir$)
  493.     'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Fonts", "V7SP", WinSysDir$)
  494.  
  495.     '** find out which drivers files need to be copied
  496.     AddSectionFilesToCopyList "Drivers", SRCDIR$, WinSysDir$
  497.     OLD_SIZE& = COPY_SIZE&
  498.     COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MCIAVI", WinSysDir$)
  499.     COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSVIDC", WinSysDir$)
  500.     COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "ICCVID", WinSysDir$)
  501.     COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSVIDEO", WinSysDir$)
  502.     COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSACM", WinSysDir$)
  503.     COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSADPCM", WinSysDir$)
  504.     IF OLD_SIZE& <> COPY_SIZE& THEN
  505.       ShouldRestart% = 1
  506.     END IF
  507.  
  508. DISK_SPACE_CHECK:
  509.     '** Verify that there is enough space on drive
  510.     IF GetCopyListCost ("", "", "") <> 0 THEN
  511. WINDRIVEISFULL:
  512.     sz$ = UIStartDlg(CUIDLL$, SYSERROR_WINDISKFULL, "FInfoDlgProc", 0, "")
  513.     IF sz$ = "EXIT" THEN
  514.         UIPop 1
  515. QUIT:
  516.         sz$ = UIStartDlg(CUIDLL$, SETUPQUIT_FAILURE, "FInfoDlgProc", 0, "")
  517.         IF sz$ = "EXIT" THEN
  518.         UIPop 1
  519.         END
  520.         ELSE
  521.         GOTO QUIT
  522.         END IF
  523.     ELSEIF sz$ = "CONTINUE" THEN
  524.         UIPop 1
  525.         GOTO DISK_SPACE_CHECK
  526.     ELSE
  527.         GOTO WINDRIVEISFULL
  528.     END IF
  529.     END IF
  530.  
  531.     '** Delete old Cinemania if requested
  532.     IF DELETEOLD% > 0 THEN
  533.  
  534.     'Check for Cinemania '92, in \viewer directory. Don't delete Viewer
  535.     'stuff because other programs may use it.
  536.     IF ((DELETEOLD% = 1) OR (DELETEOLD% = 3)) THEN
  537.       RemoveFile MakePath(VIEWERDIR$, "REMOTE.DLL"), cmoNone
  538.       RemoveFile MakePath(VIEWERDIR$, "CINMANIA.ICO"), cmoNone
  539.       RemoveFile MakePath(VIEWERDIR$, "MVOPTCIN.EXE"), cmoNone
  540.       RemoveFile MakePath(VIEWERDIR$, "MOVIE.DLL"), cmoNone
  541.       RemoveFile MakePath(VIEWERDIR$, "MOVIELST.EXE"), cmoNone
  542.       RemoveFile MakePath(VIEWERDIR$, "MUSCROLL.DLL"), cmoNone
  543.       CopyListMakerFiles VIEWERDIR$, DEST$, 1
  544.     ENDIF
  545.     'Check for Cinemania '94 in Windows directory
  546.     IF ((DELETEOLD% = 2) OR (DELETEOLD% = 3)) THEN
  547.       RemoveFile MakePath(CIN94DIR$, "CNMNIA94.DLL"), cmoNone
  548.       RemoveFile MakePath(CIN94DIR$, "CINMANIA.ICO"), cmoNone
  549.       RemoveFile MakePath(CIN94DIR$, "CNFTSUI2.DLL"), cmoNone
  550.       RemoveFile MakePath(CIN94DIR$, "MOVIELST.EXE"), cmoNone
  551.       RemoveFile MakePath(CIN94DIR$, "MOVIE.DLL"), cmoNone
  552.       CopyListMakerFiles CIN94DIR$, DEST$, 1
  553.     END IF
  554.  
  555.     i% = DeleteOldCinemania(DELETEOLD%)
  556.  
  557.     ELSE
  558.  
  559.       '** Not deleting old, but still might move files from there:
  560.       IF ((FOUNDOLD% = 1) OR (FOUNDOLD% = 3)) THEN
  561.     CopyListMakerFiles VIEWERDIR$, DEST$, 0
  562.       END IF
  563.       IF ((FOUNDOLD% = 2) OR (FOUNDOLD% = 3)) THEN
  564.     CopyListMakerFiles CIN94DIR$, DEST$, 0
  565.       END IF
  566.  
  567.     END IF
  568.  
  569.     '** Check if VGAPAL.DRV should be replaced with VGA.DRV:
  570.     IF VGADRV% = 1 THEN
  571.     CreateIniKeyValue SYSINI$, "Boot", "Display.Drv", "VGA.DRV", cmoOverwrite
  572.     CreateIniKeyValue SYSINI$, "Boot.Description", "Display.Drv", "VGA", cmoOverwrite
  573.     ShouldRestart% = 1
  574.     END IF
  575.  
  576.     SetCopyGaugePosition 25, 120
  577.  
  578.     CopyFilesInCopyList
  579.     UIPop 1
  580.     SetupMMCatalog
  581.  
  582.     IF RestartListEmpty() = 0 THEN
  583.       ShouldRestart% = 1
  584.     END IF
  585.  
  586.     InstallFonts
  587.  
  588.     '** Add driver information to system.ini
  589.     CreateIniKeyValue SYSINI$, "mci", "AVIVideo",   "mciavi.drv", cmoOverwrite
  590.     CreateIniKeyValue SYSINI$, "drivers", "Wavemapper", "msacm.drv", cmoOverwrite
  591.     CreateIniKeyValue SYSINI$, "drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  592.     CreateIniKeyValue SYSINI$, "drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  593.     CreateIniKeyValue SYSINI$, "msacm", "Install", "msadpcm.acm", cmoOverwrite
  594.  
  595.     '** Add driver information to win.ini
  596.     CreateIniKeyValue WININI$, "mci extensions", "avi", "AVIVideo", cmoOverwrite
  597.  
  598.     '** Add Cinemania entry to viewer.ini
  599.     ViewerIni$ = MakePath(WinDir$, "viewer.ini")
  600.  
  601.     temp$ = SRCDIR$ + ", Please insert the Cinemania '94 CD into drive " + Mid$(SRCDIR$, 1, 2)
  602.     CreateIniKeyValue ViewerIni$, "Files", "cnmnia94.mvb", temp$, cmoOverwrite
  603.     CreateIniKeyValue ViewerIni$, "Files", "cin94hlp.mvb", temp$, cmoOverwrite
  604.     CreateIniKeyValue ViewerIni$, "Files", "cin94idx.mvb", temp$, cmoOverwrite
  605.  
  606.     temp$ = DEST$ + "\" + ", Cinemania file missing - please reinstall Cinemania '94 CD"
  607.     CreateIniKeyValue ViewerIni$, "Files", "cnmnia94.dll", temp$, cmoOverwrite
  608.     CreateIniKeyValue ViewerIni$, "Files", "cinlst94.dll", temp$, cmoOverwrite
  609.     CreateIniKeyValue ViewerIni$, "Files", "cnftsui2.dll", temp$, cmoOverwrite
  610.     CreateIniKeyValue ViewerIni$, "cnmnia94", "path", DEST$ + "\", cmoOverwrite
  611.  
  612.  
  613.     temp$ = GetWindowsSysDir() + ", Viewer file missing - please reinstall Cinemania '94 CD"
  614.     CreateIniKeyValue ViewerIni$, "Files", "ctl3d.dll", temp$, cmoOverwrite
  615.     CreateIniKeyValue ViewerIni$, "Files", "mvapi2.dll", temp$, cmoOverwrite
  616.     CreateIniKeyValue ViewerIni$, "Files", "mvbmp2.dll", temp$, cmoOverwrite
  617.     CreateIniKeyValue ViewerIni$, "Files", "mvbrkr2.dll", temp$, cmoOverwrite
  618.     CreateIniKeyValue ViewerIni$, "Files", "mvfs2.dll", temp$, cmoOverwrite
  619.     CreateIniKeyValue ViewerIni$, "Files", "mvftsui2.dll", temp$, cmoOverwrite
  620.     CreateIniKeyValue ViewerIni$, "Files", "mvmci2.dll", temp$, cmoOverwrite
  621.     CreateIniKeyValue ViewerIni$, "Files", "mvsrch2.dll", temp$, cmoOverwrite
  622.     CreateIniKeyValue ViewerIni$, "Files", "mvtitle2.dll", temp$, cmoOverwrite
  623.     CreateIniKeyValue ViewerIni$, "Files", "mmp.dll", temp$, cmoOverwrite
  624.  
  625.     '** Change Jump color if requested
  626.     IF SETJUMP% = 1 THEN
  627.     CreateIniKeyValue WININI$, "Multimedia Viewer", "JumpColor", "0 0 127", cmoOverwrite
  628.     CreateIniKeyValue WININI$, "Multimedia Viewer", "PopupColor", "0 0 127", cmoOverwrite
  629.     END IF
  630.  
  631.     '** Put some Cinemania stuff in WIN.INI
  632.     CreateIniKeyValue WININI$, "Cinemania", "Cin94Path", DEST$, cmoOverwrite
  633.  
  634.     UIPop 1
  635.  
  636.     '** Done installing all the files, create Program Group
  637.     IF CREATEICON% = 1 THEN
  638.     If PROGGRP$ = "" Then
  639.         PROGGRP$ = "Microsoft Multimedia"
  640.     End If
  641.     CreateProgmanGroup PROGGRP$, "", cmoNone
  642.     ShowProgManGroup   PROGGRP$, 2,  cmoNone
  643.     ShowProgManGroup   PROGGRP$, 1,  cmoNone
  644.     CreateProgmanItem  PROGGRP$, "Cinemania '94", "MVIEWER2.EXE cnmnia94.mvb", MakePath(DEST$, "cinmania.ico")+",,,,"+DEST$, cmoOverwrite
  645.     CreateProgmanItem  PROGGRP$, "Read Me: Cinemania '94 Tips", MakePath(SRCDIR$, "misc\cnmnia94.txt"), "", cmoOverwrite
  646.  
  647.     ShowProgmanGroup PROGGRP$, 1, cmoNone
  648.     END IF
  649.     MMCatSetProgman
  650.  
  651. END SUB
  652.  
  653. '*************************************************************************
  654. '**
  655. '** InstallFonts
  656. '** ------------
  657. '**
  658. '** Purpose:
  659. '**     Install special Screen (raster) fonts
  660. '** Arguments:
  661. '**     none.
  662. '** Returns:
  663. '**     none.
  664. '** Comments:
  665. '**     ensure that the font files are copied
  666. '*************************************************************************
  667. SUB InstallFonts STATIC
  668.  
  669.     '** Add fonts to WIN.INI
  670.  
  671.     szKey$ = "V1 Lucida Sans"    
  672.     CreateIniKeyValue WININI$, "fonts", szKey$, "V1SP.FON", cmoNone
  673.     szKey$ = "V2 Lucida Sans"    
  674.     CreateIniKeyValue WININI$, "fonts", szKey$, "V2SP.FON", cmoNone
  675.     szKey$ = "V3 Lucida Sans"    
  676.     CreateIniKeyValue WININI$, "fonts", szKey$, "V3SP.FON", cmoNone
  677.     szKey$ = "V4 Lucida Sans"    
  678.     CreateIniKeyValue WININI$, "fonts", szKey$, "V4SP.FON", cmoNone
  679.     szKey$ = "V7 Lucida Sans"    
  680.     CreateIniKeyValue WININI$, "fonts", szKey$, "V7SP.FON", cmoNone
  681.  
  682.     '** Make fonts immediately available.
  683.     sz$ = UIStartDlg(CUIDLL$, INSTALL_FONTS, "FInstallFontsDlgProc", 0, "")
  684.     UIPop 1
  685. END SUB
  686.  
  687. '***************************************************************************
  688. '** Purpose:
  689. '**     Appends a file name to the end of a directory path,
  690. '**     inserting a backslash character as needed.
  691. '** Arguments:
  692. '**     szDir$  - full directory path (with optional ending "\")
  693. '**     szFile$ - filename to append to directory
  694. '** Returns:
  695. '**     Resulting fully qualified path name.
  696. '***************************************************************************
  697.  
  698. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  699.     IF szDir$ = "" THEN
  700.     MakePath = szFile$
  701.     ELSEIF szFile$ = "" THEN
  702.     MakePath = szDir$
  703.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  704.     MakePath = szDir$ + szFile$
  705.     ELSE
  706.     MakePath = szDir$ + "\" + szFile$
  707.     END IF
  708. END FUNCTION
  709.  
  710. '***************************************************************************
  711. '** Purpose:
  712. '**     To extract the filename from the pathname
  713. '** Arguments:
  714. '**     szPath$ - full pathname
  715. '** Returns:
  716. '**     The filename
  717. '***************************************************************************
  718.  
  719. FUNCTION GetFilename (szPath$) STATIC AS STRING
  720.     FOR i% = LEN(szPath$) TO 1 STEP -1
  721.     IF MID$(szPath$, i%, 1) = "\" THEN
  722.         GetFilename = MID$(szPath$, i% + 1, LEN(szPath$) - i%)
  723.         Exit FOR
  724.     END IF
  725.     NEXT
  726.     IF i% = 0 THEN     ' No "\" in pathname, must all be filename
  727.     GetFilename = szPath$
  728.     END IF
  729. END FUNCTION
  730.  
  731. FUNCTION WillCopy (szSection$, szKey$, szDestDir$) STATIC AS INTEGER
  732.  
  733.   WillCopy = 0
  734.  
  735.   Filename$ = GetSectionKeyFilename (szSection$, szKey$)
  736.   szOldFile$ = MakePath (szDestDir$, GetFilename (Filename$))
  737.   szNewFile$ = MakePath (SRCDIR$, Filename$)
  738.   If DoesFileExist(szOldFile, femExists) <> 0 Then
  739.  
  740.     i% = CmpVersion(GetVersionOfFile(szOldFile$), GetVersionOfFile(szNewFile$))
  741.  
  742.     If i% = -1 Then
  743.       'New version is older, won't copy.
  744.       exit function
  745.     Endif
  746.  
  747.     If i% = 0 Then
  748.       'Versions are same go by date.
  749.       If IsDateLater(GetDateOfFile(szOldFile$), GetDateOfFile(szNewFile$)) = 0 Then
  750.     'New file is same or older, won't copy.
  751.     exit function
  752.       Endif
  753.     Endif
  754.   Endif
  755.  
  756.   WillCopy = 1
  757. END FUNCTION
  758.  
  759. '*************************************************************************
  760. '**
  761. '** IsDateLater
  762. '** --------
  763. '** Purpose:
  764. '**     Compares two file dates
  765. '** Arguments:
  766. '**     DateOld$ in YYYY-MM-DD-HH-MM-SS format
  767. '**     DateNew$ in YYYY-MM-DD-HH-MM-SS format
  768. '** Returns:
  769. '**     1 if new date is later, 0 if new date is older or the same
  770. '*************************************************************************
  771. FUNCTION IsDateLater (DateOld$, DateNew$) STATIC AS INTEGER
  772.   
  773.   ' Can't you do a straight string compare here?
  774.  
  775.   'First compare year
  776.  
  777.   OldYear% = GetYearFromDate (DateOld$)
  778.   NewYear% = GetYearFromDate (DateNew$)
  779.  
  780.   If NewYear% < OldYear% Then
  781.     IsDateLater = 0
  782.  
  783.   ElseIf NewYear% = OldYear% Then
  784.  
  785.     'If year is the same, compare month
  786.     
  787.     OldMonth% = GetMonthFromDate (DateOld$)
  788.     NewMonth% = GetMonthFromDate (DateNew$)
  789.  
  790.     If NewMonth% < OldMonth% Then
  791.       IsDateLater = 0
  792.  
  793.     ElseIf NewMonth% = OldMonth% Then
  794.  
  795.       'If month is the same, compare day
  796.  
  797.       OldDay% = GetDayFromDate (DateOld$)
  798.       NewDay% = GetDayFromDate (DateNew$)
  799.  
  800.       If NewDay% <= OldDay% Then
  801.     IsDateLater = 0
  802.       Else
  803.     IsDateLater = 1
  804.       End If
  805.      
  806.     Else
  807.       IsDateLater = 1
  808.     End If
  809.  
  810.   Else
  811.     IsDateLater = 1
  812.   ENDIF
  813.   
  814. END FUNCTION
  815.  
  816. '*************************************************************************
  817. '**
  818. '** CmpVersion
  819. '** --------
  820. '** Purpose:
  821. '**     Compares two file versions
  822. '** Arguments:
  823. '**     VerOld$ - Old file version string (in format N.N.N.N)
  824. '**     VerNew$ - New file version string (in format N.N.N.N)
  825. '** Returns:
  826. '**     1 if new version is later, -1 if new version is older, 0 if the same
  827. '*************************************************************************
  828. FUNCTION CmpVersion (VerOld$, VerNew$) STATIC AS INTEGER
  829.  
  830.   CmpVersion = 0
  831.  
  832.   FOR I=1 TO 4 
  833.  
  834.     VOld = GetVersionNthField (VerOld$, I)
  835.     VNew = GetVersionNthField (VerNew$, I)
  836.  
  837.     If VNew > VOld Then 
  838.       CmpVersion = 1
  839.       Goto LBL_CmpVersionEnd
  840.     Endif
  841.  
  842.     If VNew < VOld Then
  843.       CmpVersion = -1
  844.       Goto LBL_CmpVersionEnd
  845.     End If
  846.  
  847.   NEXT I
  848.  
  849. LBL_CmpVersionEnd:
  850.  
  851. END FUNCTION
  852.