home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer 2.4 / 1996-05_-_Disc_2.4.bin / setup.ms_ / setup.ms
Text File  |  1996-02-13  |  19KB  |  596 lines

  1. '**************************************************************************
  2. '*                       PC-Gamer Setup
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. CONST TITLE_NAME$ = "PC Gamer"
  11. CONST TITLE_SETUPDLG$ = "PC Gamer Setup"
  12. CONST GROUP_NAME$ = "PC Gamer CD"
  13. CONST TITLE_ENGINE$ = "PCGAMER.EXE"
  14. CONST MSG_BEGVPROFILE$ = "We need to analyze your video system to ensure maximum performance. "
  15. CONST MSG_BEGVPROFILE1$ = "This procedure may take several minutes. "
  16. CONST MSG_STARTVPROFILE$ = "Select OK to start the analysis."
  17.  
  18.  
  19. ''Dialog ID's
  20. CONST WELCOME       = 100
  21. CONST ASKQUIT       = 200
  22. CONST DESTPATH      = 300
  23. CONST EXITFAILURE   = 400
  24. CONST EXITQUIT      = 600
  25. CONST EXITSUCCESS   = 700
  26. CONST BADPATH       = 6400
  27. CONST RESTART       = 1300
  28. CONST RESTARTII     = 2700
  29. CONST TOOBIG        = 6300
  30.  
  31. ''Bitmap ID
  32. CONST LOGO = 1
  33.  
  34. GLOBAL DESTDRIVE$
  35. GLOBAL DEST$        ''Default destination directory.
  36. GLOBAL OPTCUR$      ''Option selection from option dialog.
  37. GLOBAL CUIDLL$
  38. GLOBAL APPCMD$
  39. 'GLOBAL APPCMD1$
  40. GLOBAL UNIPATH$
  41.  
  42. ''Symbols for communicating with MSCUISTF.DLL dialog procs
  43. GLOBAL SPACEEXTRA$
  44. GLOBAL SPACECOST$
  45. GLOBAL SPACENEEDED$
  46. GLOBAL AMOUNTNEEDED$
  47.  
  48.  
  49. DECLARE SUB DestDriveTooSmall
  50. DECLARE SUB UpdateINI_and_Reg
  51. DECLARE SUB UpdateProgramMngr
  52. DECLARE SUB BuildInstallList
  53. DECLARE SUB NotifyBadPath
  54. DECLARE SUB MaximizeSetupWnd
  55. DECLARE SUB ShowWelcome
  56. DECLARE SUB Ask_Quit
  57. DECLARE SUB GetDestDir
  58. DECLARE SUB Install
  59. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  60. DECLARE FUNCTION CheckDiskSpace () as Integer
  61.  
  62. DECLARE FUNCTION ShowWindow       LIB "User" (hWnd%, iShow%) AS INTEGER
  63. DECLARE FUNCTION SetWindowLong    LIB "User" (hWnd%, offset%, style& ) AS LONG
  64. DECLARE FUNCTION ExitWindowsExec LIB "User" (Exec$, Param$) AS INTEGER
  65. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  66. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  67. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  68. DECLARE FUNCTION SetFocus LIB "User" (hWnd%) AS INTEGER
  69.  
  70.     ' Constants for Windows API functions
  71. CONST WS_VISIBLE      = &H10000000
  72. CONST WS_BORDER           = &H00800000
  73. CONST WS_CLIPCHILDREN = &H02000000
  74. CONST GWL_STYLE       = -16
  75. CONST SW_SHOWMAXIMIZED= 3       
  76.  
  77. ''System Location variables
  78. GLOBAL WinDir$
  79. GLOBAL WinSysDir$
  80. GLOBAL WinSys32Dir$
  81. GLOBAL RealWinSysDir$
  82. GLOBAL WINDRIVE$    ''Windows Drive Letter.
  83. GLOBAL MinorVer%
  84. GLOBAL OnNT$                     
  85.  
  86. GLOBAL TitleINI$
  87. GLOBAL SysINI$
  88. GLOBAL CtlINI$
  89. GLOBAL WinINI$
  90.  
  91. INIT:
  92.         '--------------------------------------------------------
  93.     ' the following line causes the setup background window
  94.     ' to be maximized
  95.     '--------------------------------------------------------
  96.  
  97.      MaximizeSetupWnd
  98.  
  99.     SPACEEXTRA$  = "SpaceExtra"  
  100.     SPACECOST$   = "SpaceCost"
  101.     SPACENEEDED$ = "SpaceNeeded"
  102.     AMOUNTNEEDED$ = "DiskSpaceNeeded"
  103.     CHECKSYSSYM$ = "SysFac"
  104.                  
  105.     FOR i%=1 TO 26 STEP 1
  106.         AddListItem SPACEEXTRA$, "0"
  107.         AddListItem SPACECOST$, "0"
  108.         AddListItem SPACENEEDED$, "0"
  109.     NEXT i%             
  110.  
  111.     
  112.     bInstallDVA% = 0
  113.  
  114.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  115.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  116.  
  117.     SetBitmap CUIDLL$, LOGO
  118.  
  119.  
  120.     WinDir$ = GetWindowsDir()
  121.     WinSysDir$ = GetWindowsSysDir()
  122. '    RealWinSysDir$ = GetRealWindowsSysDir()
  123. '    WinSys32Dir$ = WinDir$ + "system32"
  124. '    WINDRIVE$ = Mid$(WinDir$, 1, 1) 
  125.     
  126.     SetRestartDir WinDir$
  127.     
  128.     TitleINI$ = WinDir$ + "pcgamer.ini"
  129.     SysINI$ = WinDir$ + "system.ini"
  130.     CtlINI$ = WinDir$ + "control.ini"
  131.     WinINI$ = WinDir$ + "win.ini"
  132.  
  133.  
  134.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  135.     IF szInf$ = "" THEN
  136.     szInf$ = GetSymbolValue("STF_CWDDIR") + "setup.INF"
  137.     END IF
  138.     ReadInfFile szInf$
  139.  
  140.     OPTCUR$ = "1"
  141.     DEST$ = "C:\UGROUND"
  142.     DESTDRIVE$ = "C"
  143.  
  144.     ShowWelcome
  145.  
  146. GETDEST:
  147.     DESTDRIVE$ = DESTDRIVE$ + ":"
  148.     GetDestDir
  149.  
  150.     BuildInstallList
  151.  
  152.  
  153.     IF CheckDiskSpace() = 0 THEN 
  154.         GOTO GETDEST
  155.     ENDIF
  156.  
  157.  
  158.     Install
  159.  
  160.         '--------------------------------------------------------
  161.         ' Profile display for video components
  162.         '--------------------------------------------------------
  163.          
  164.     j% = DoMsgBox(MSG_BEGVPROFILE$+ MSG_BEGVPROFILE1$ + NL$ + NL$ +MSG_STARTVPROFILE$, TITLE_SETUPDLG$, MB_OK)
  165.     ' profile the display (needed by Video for Windows)
  166.     Run ("profdisp.exe")   
  167.     ' perform the WinG video profiling exercise
  168.     Run ("profwing.exe")      
  169.  
  170.  
  171. '' Restart Windows: if it has to update ACM from DOS, it restarts Windows 
  172. '' automatically else, it gives the user the choice
  173.     RESTRT% = RestartListEmpty ()
  174.     Exe$ = DEST$ + "\_msrstrt.exe"
  175.     Batch$ = DEST$ + "\_mssetup.bat"
  176.     empty$ = ""
  177.  
  178. RESTART:
  179.     IF RESTRT% = 0 THEN
  180.         sz$ = UIStartDlg(cuidll$, RESTART, "FInfo0DlgProc", 0, "")
  181.         IF sz$ = "REACTIVATE" THEN
  182.             GOTO RESTART
  183.         ENDIF
  184.         I% = RestartWindows
  185. ''       I% = ExitExecRestart ()
  186.        
  187.         RemoveFile Exe$, cmoForce
  188.         RemoveFile Batch$, cmoForce
  189.         END
  190.     ELSE
  191.         sz$ = UIStartDlg(CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "")
  192.         IF sz$ = "CONTINUE" THEN
  193.             I% = ExitWindowsExec (Exe$, empty$)
  194.             IF I% = 0 THEN
  195.                 GOTO RESTART
  196.             ELSE
  197.                 END
  198.             ENDIF
  199.         ELSEIF sz$ = "EXIT" THEN
  200.             UIPopAll
  201.             END
  202.         ELSEIF sz$ = "REACTIVATE" THEN
  203.             GOTO RESTART
  204.         ELSE
  205.             UIPop 1
  206.             END
  207.         END IF
  208.     END IF
  209.  
  210.  
  211. QUIT:
  212.     ON ERROR GOTO ERRQUIT
  213.  
  214.     IF ERR = 0 THEN
  215.     dlg% = EXITSUCCESS
  216.     ELSEIF ERR = STFQUIT THEN
  217.     dlg% = EXITQUIT
  218.     ELSE
  219.     dlg% = EXITFAILURE
  220.     END IF
  221. QUITL1:
  222.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  223.     IF sz$ = "REACTIVATE" THEN
  224.     GOTO QUITL1
  225.     END IF
  226.     UIPop 1
  227.  
  228.     END
  229.  
  230. ERRQUIT:
  231.     i% = DoMsgBox("Setup sources were corrupted, unable to contine", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  232.     END
  233.  
  234.  
  235.  
  236.  
  237. '*************************************************************************
  238. '** Build the list of files which must be installed and determine how
  239. '**    they must be installed
  240. '*************************************************************************
  241.  
  242. SUB BuildInstallList STATIC
  243.     
  244.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  245.  
  246.     ClearCopyList
  247.     
  248.     AddSectionFilesToCopyList "Uground", SrcDir$, DEST$
  249.     AddSectionFilesToCopyList "Audio", SrcDir$, DEST$ + "\AUDIO"
  250.     AddSectionFilesToCopyList "MediaView", SrcDir$, DEST$ + "\MV"
  251.     AddSectionFilesToCopyList "Sentinal", SrcDir$, DEST$ + "\TEMP"
  252.  
  253.  
  254.         '------------------------------------------------------------
  255.         ' handle DVA.386, OLE and MPlayer
  256.         ' KentD change -- don't need OLE or MPlayer so I removed 2/96
  257.         '         only install if ver 3.1 (not NT or Win95)
  258.         '------------------------------------------------------------
  259.     IF OnWin3x() = 1 THEN
  260.         AddSectionFilesToCopyList "dva", SrcDir$, WinSysDir$
  261.         'AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$
  262.         'AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$
  263.     END IF
  264.  
  265.         '------------------------------------------------------------
  266.         ' handle Video for Windows
  267.         '------------------------------------------------------------
  268.         AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
  269.         AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
  270.         AddSectionFilesToCopyList "AVICodecs", SrcDir$, WinSysDir$
  271.         
  272.         '------------------------------------------------------------
  273.         ' Add WinG files to the list
  274.         '------------------------------------------------------------
  275.     AddSectionFilesToCopyList "WinG", SrcDir$, WinSysDir$
  276.  
  277.         '------------------------------------------------------------
  278.         ' handle WinG32 - 32 bit version
  279.         '------------------------------------------------------------
  280. '       AddSectionFilesToCopyList "WinG32", SrcDir$, RealWinSysDir$
  281. '               Dest1$ = MakePath(RealWinSysDir$,"wing32.dll")
  282. '               Dest2$ = MakePath(RealWinSysDir$,"wing32.xxx")
  283. '       RenameFilePlease Dest1$,Dest2$
  284.     
  285.         '------------------------------------------------------------
  286.         ' handle WinToon
  287.         '------------------------------------------------------------
  288. '       AddSectionFilesToCopyList "Wintoon", SrcDir$, WinSysDir$
  289.         
  290. END SUB
  291.  
  292.  
  293.  
  294. SUB Install STATIC
  295.     Dim hWnd%, hWndOther%
  296.     
  297.     ' get our source dir & create the dest dir (if it doesn't exist)    
  298.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  299.     CreateDir DEST$, cmoNone
  300.     CreateDir DEST$ + "\AUDIO", cmoNone
  301.     CreateDir DEST$ + "\MV", cmoNone
  302.     CreateDir DEST$ + "\TEMP", cmoNone
  303.  
  304.     'DumpCopyList "copylist.log"
  305.     
  306.     ' have the files we need copied to the users disk
  307.     CopyFilesInCopyList
  308.  
  309.     'Update Wing32 if needed
  310. '       UpdateWinG32 RealWinSysDir$
  311.     
  312.     ' add our icon to the appropriate program group (creating it if necessary) 
  313.     UpdateProgramMngr
  314.     
  315.     ' update the INI files and the registry with VFW stuff
  316.     UpdateINI_and_Reg
  317.      
  318.     hWnd% = HwndFrame()
  319.     hWndOther% = SetFocus(hWnd%)
  320.  
  321.     ' Assuming DOS is in path, set file attribute to hidden
  322.     CMDLINE$ = "ATTRIB +h " + DEST$ + "\TEMP\_GUARD"
  323.     RUN CMDLINE$
  324.  
  325. END SUB
  326.  
  327.  
  328. '**
  329. '** Purpose:
  330. '**     Appends a file name to the end of a directory path,
  331. '**     inserting a backslash character as needed.
  332. '** Arguments:
  333. '**     szDir$  - full directory path (with optional ending "\")
  334. '**     szFile$ - filename to append to directory
  335. '** Returns:
  336. '**     Resulting fully qualified path name.
  337. '*************************************************************************
  338. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  339.     IF szDir$ = "" THEN
  340.     MakePath = szFile$
  341.     ELSEIF szFile$ = "" THEN
  342.     MakePath = szDir$
  343.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  344.     MakePath = szDir$ + szFile$
  345.     ELSE
  346.     MakePath = szDir$ + "\" + szFile$
  347.     END IF
  348. END FUNCTION
  349.  
  350. '*************************************************************************
  351. '** Subroutine which will maximize the Setup Programs frame window    
  352. '*************************************************************************
  353.     
  354. SUB MaximizeSetupWnd STATIC
  355.      
  356.     Dim hWnd%, PrevVisibility%
  357.     Dim OldStyle&
  358.      
  359.     hWnd% = HwndFrame()
  360.     OldStyle& = SetWindowLong ( hWnd%, GWL_STYLE, WS_VISIBLE+WS_BORDER + WS_CLIPCHILDREN )
  361.     PrevVisibility% = ShowWindow ( hWnd%, SW_SHOWMAXIMIZED )
  362.  
  363. END SUB
  364.  
  365.  
  366. '*************************************************************************
  367. '** Tell the user what they are running & give them a chance to get out
  368. '*************************************************************************
  369. SUB ShowWelcome STATIC
  370.  
  371. WELCOME:
  372.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", 0, "")
  373.     IF sz$ = "CONTINUE" THEN
  374.     UIPop 1
  375.      ELSE
  376.     Ask_Quit
  377.     GOTO WELCOME
  378.     END IF
  379.  
  380. END SUB    
  381.  
  382.  
  383. '*************************************************************************
  384. '** Ask the user to confirm that they want to abort setup    
  385. '*************************************************************************
  386. SUB Ask_Quit STATIC
  387.  
  388. ASKQUIT:
  389.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  390.  
  391.     IF sz$ = "EXIT" THEN
  392.     UIPopAll
  393. ''        ERROR STFQUIT
  394.     END
  395.      ELSEIF sz$ = "REACTIVATE" THEN
  396.     GOTO ASKQUIT
  397.      ELSE
  398.     UIPop 1
  399.     END IF
  400.  
  401. END SUB
  402.  
  403.  
  404. '*************************************************************************
  405. '** subroutine to display message if path specified by use is not usable 
  406. '*************************************************************************
  407. SUB NotifyBadPath STATIC
  408.  
  409. BADPATH:
  410.  
  411.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  412.     IF sz$ = "REACTIVATE" THEN
  413.     GOTO BADPATH
  414.     END IF
  415.     UIPop 1
  416.  
  417. END SUB
  418.  
  419.  
  420. '*************************************************************************
  421. '** Get the destination directory from the user
  422. '*************************************************************************
  423. SUB GetDestDir STATIC
  424.     
  425. GETPATH:
  426.     SetSymbolValue "EditTextIn", DESTDRIVE$
  427.     SetSymbolValue "EditFocus", "END"
  428. GETPATHL1:    
  429.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", 0, "")
  430.     DESTDRIVE$ = GetSymbolValue("EditTextOut")
  431.  
  432.     DESTDRIVE$ = MID$(DESTDRIVE$, 1, 2)
  433.     IF MID$(DESTDRIVE$, 2, 1) <> ":" THEN
  434.         DESTDRIVE$ = MID$(DESTDRIVE$, 1, 1) + ":"
  435.     ENDIF
  436.  
  437.     IF sz$ = "CONTINUE" THEN
  438.     DEST = DESTDRIVE + "\UGROUND"
  439.     IF IsDirWritable(DEST$) = 0 THEN
  440.         NotifyBadPath
  441.         GOTO GETPATHL1
  442.     END IF
  443.     UIPop 1
  444.     ELSEIF sz$ = "REACTIVATE" THEN
  445.     GOTO GETPATHL1
  446.     ELSEIF sz$ = "BACK" THEN
  447.     UIPop 1
  448.     GOTO GETPATH
  449.     ELSE
  450.     Ask_Quit
  451.     GOTO GETPATH
  452.     END IF
  453. END SUB
  454.  
  455.  
  456. '*************************************************************************
  457. '** subroutine to add our app to Program Manager
  458. '*************************************************************************
  459. SUB UpdateProgramMngr STATIC
  460.  
  461.     ' Create a program manager group with the same name as our title 
  462.     
  463.     CreateProgmanGroup GROUP_NAME$, "", cmoNone
  464.  
  465.     ' Have the new group displayed as a normal window within Program manager 
  466.     
  467.     ShowProgmanGroup  GROUP_NAME$, 1, cmoNone
  468.     
  469.     ' Add our entry to the new groups - entry will have title name
  470.     '   note: if entry of this name is already in group, will replace with 
  471.     '         new one 
  472.     
  473.     ' Include the universe file in command line
  474.     UNIPATH = MakePath(DEST$, "PCGMR01.UNV")
  475.     APPCMD$ =  MakePath(DEST$,TITLE_ENGINE$) + " " + UNIPATH$
  476.     CreateProgmanItem GROUP_NAME$, TITLE_NAME$, APPCMD$, "", cmoOverwrite
  477.  
  478. END SUB 
  479.  
  480.  
  481. '*************************************************************************
  482. '** Subroutine to update the Windows and SYSTEM.INI files and the 
  483. '**      system Registry (with video for windows stuff
  484. '*************************************************************************
  485. SUB UpdateINI_and_Reg STATIC
  486.    
  487.     IF OnWin3x() = 1 THEN
  488.      IF VflatdPresent() = 0 THEN
  489.        CreateSysIniKeyValue SysINI$, "386Enh", "device", "dva.386", cmoOverwrite
  490.        bInstallDVA% = 1
  491.      END IF  
  492.     END IF
  493.     
  494.     'Set the CDDrive entry equal to installation drive
  495.     CD$ = GetSymbolValue("STF_SRCDIR")
  496.     CD$ = MID$(CD$, 1, LEN(CD$) - 1)
  497.  
  498.     ' Create a pcgamer.ini file in the windows directory
  499.     CreateIniKeyValue TitleINI$, "Menu", "Ambience", "1", cmoPrepend
  500.     CreateIniKeyValue TitleINI$, "Menu", "Effects", "1", cmoPrepend
  501.     CreateIniKeyValue TitleINI$, "Files", "CDDrive", CD$, cmoOverwrite
  502.     CreateIniKeyValue TitleINI$, "Files", "CurDir", DEST$, cmoOverwrite
  503.     CreateIniKeyValue TitleINI$, "Files", "UnvFile", UNIPATH$, cmoOverwrite
  504.     CreateIniKeyValue TitleINI$, "Files", "Run", APPCMD$, cmoOverwrite
  505.     CreateIniKeyValue TitleINI$, "General", "Version", "100", cmoOverwrite
  506.     CreateIniKeyValue TitleINI$, "General", "RunBefore", "0", cmoOverwrite
  507.  
  508.  
  509.     CreateIniKeyValue SysINI$, "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  510.     CreateIniKeyValue SysINI$, "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  511.     CreateIniKeyValue SysINI$, "Drivers", "VIDC.IV31", "ir32.dll", cmoOverwrite
  512.     CreateIniKeyValue SysINI$, "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  513.     CreateIniKeyValue SysINI$, "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  514.  
  515.     I% = DoesIniKeyExist (SysINI, "Drivers", "VIDC.RT21")
  516.     IF I% = 0  THEN
  517.        CreateIniKeyValue SysINI$, "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
  518.     END IF
  519.  
  520.     CreateIniKeyValue SysINI$, "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
  521.     CreateIniKeyValue SysINI$, "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  522.     CreateIniKeyValue SysINI$, "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  523.     CreateIniKeyValue SysINI$, "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  524.     CreateIniKeyValue SysINI$, "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  525.  
  526.     CreateIniKeyValue SysINI$, "Drivers", "VIDC.RT21", "indeo.drv", cmoOverwrite
  527.     CreateIniKeyValue WinINI$, "mci extensions", "avi", "AVIVideo", cmoOverwrite
  528.  
  529.     CreateIniKeyValue CtlINI$, "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  530.     CreateIniKeyValue CtlINI$, "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  531.     CreateIniKeyValue CtlINI$, "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  532.  
  533.     'Do not register components not installed with Video for Windows for NT or next version of windows
  534. '       IF ((NOT onNT$ = "TRUE") AND MinorVer% < 50) THEN
  535. '       Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  536. '       Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  537. '       Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  538.     
  539. '           ' Uncomment the next line to have the media player icon added to the Accessories program group 
  540. '           ' CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
  541.     
  542. '    END IF
  543.     
  544. END SUB
  545.  
  546.  
  547. '*************************************************************************
  548. '** Check to see that we have enough space for the files on the chosen 
  549. '**    destination drive and on the drive containing the windows 
  550. '**    directories (if the drives are different)
  551. '*************************************************************************
  552.  
  553. FUNCTION CheckDiskSpace () STATIC as Integer
  554.     DIM DriveLtr%
  555.                                       
  556.     CheckDiskSpace = 1                                      
  557.     DestDrive$ = Mid$(DEST$, 1, 1)
  558.     
  559.     SizeReq& = GetCopyListCost ( SPACEEXTRA$, SPACECOST$, SPACENEEDED$)
  560.     
  561.     ' if SizeReq& is not zero, we are short of space somewhere    
  562.     IF SizeReq& <> 0 THEN
  563.  
  564.         DriveLtr% = ASC(UCASE$(DestDrive$))    
  565.         ndrive% = DriveLtr% - ASC("A") + 1
  566.         need$ = GetListItem (SPACENEEDED$, nDrive%)
  567.         IF VAL(need$) > 0 THEN
  568.             need$ = "An additional" + STR$(VAL(need$)/1024)+ "KB are needed on drive " + DestDrive$ + "."
  569.             SetSymbolValue AMOUNTNEEDED$, need$
  570.             DestDriveTooSmall
  571.             CheckDiskSpace = 0
  572.             RemoveSymbol AMOUNTNEEDED$
  573.             EXIT FUNCTION
  574.         END IF
  575.     END IF
  576.  
  577. END FUNCTION
  578.  
  579.  
  580. '*************************************************************************
  581. '** Subroutine to inform the user if they don't have enough space on  
  582. '**      chosen destination drive
  583. '*************************************************************************
  584.        
  585. SUB DestDriveTooSmall STATIC
  586.  
  587. SMALLDEST:
  588.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  589.     IF sz$ = "REACTIVATE" THEN
  590.         GOTO SMALLDEST
  591.     END IF
  592.     UIPop 1
  593.  
  594. END SUB
  595.        
  596.