home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer 2.2 / 1996-03_Disc_2.2.iso / setup.ms_ / setup.ms
Text File  |  1995-12-20  |  18KB  |  587 lines

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