'*
'*            Adobe Premiere Installer
'*
'* June 5, 1993  Marshall Spight
'*
'*
'*
'*
'*

'$DEFINE DEBUG  ''Define for script development/debugging

'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'



''following were taken from windows.h. &H means they're hex
CONST WS_VISIBLE=&H10000000
CONST WS_BORDER =&H00800000
CONST WS_CLIPCHILDREN =&H02000000
CONST GWL_STYLE =-16
CONST SW_SHOWMAXIMIZED=3
CONST EW_RESTARTWINDOWS=&H00000042


DECLARE FUNCTION ShowWindow  LIB "user.exe" (hWnd%,iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
DECLARE FUNCTION ExitWindows  LIB "User" (Flag&, Param%) AS INTEGER
DECLARE fUNCTION ExitWindowsExec  LIB "User" (Exec$, Param$) AS INTEGER

''Dialog ID's
CONST ASKQUIT      = 100
CONST DESTPATH     = 200
CONST EXITFAILURE  = 300
CONST EXITQUIT     = 400
CONST EXITSUCCESS  = 500
CONST OPTIONS      = 600
CONST APPHELP      = 700
CONST CUSTINST     = 800
CONST TOOBIG       = 900
CONST BADPATH      = 1000
CONST RESTART      = 2600
CONST RESTARTII    = 2700

CONST PERSONALIZE  = 10000

''Bitmap ID
CONST LOGO         = 1

''File Types

CONST PROGRAMFILES   = 1
CONST MSVIDEOFILES   = 2
CONST QUICKTIMEFILES = 3
CONST TUTORIALFILES  = 4
CONST CAPTUREFILES   = 5

CONST	NUMGROUPS      = 5	'' Number of file groups: PROGRAM to TUTORIAL


GLOBAL DEST$        ''Default destination directory.
GLOBAL WINDRIVE$    ''Windows drive letter.
GLOBAL ENOUGHDISK%


''CustInst list symbol names

GLOBAL PROGRAMNEEDS$
GLOBAL MSVIDEONEEDS$
GLOBAL QUICKTIMENEEDS$
GLOBAL TUTORIALNEEDS$
GLOBAL CAPTURENEEDS$

GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)

''Dialog list symbol names
GLOBAL CHECKSTATES$
GLOBAL STATUSTEXT$
GLOBAL DRIVETEXT$


DECLARE SUB AddOptFilesToCopyList (ftype%)
DECLARE SUB RecalcOptFiles (ftype%)
DECLARE SUB RecalcPath
DECLARE SUB SetDriveStatus
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE SUB X1 LIB "mscuistf.dll" (arg$)
DECLARE SUB X2 LIB "mscuistf.dll" (arg$)
DECLARE SUB X3 LIB "mscuistf.dll" (arg$)
DECLARE SUB FixScreenProc LIB "mscuistf.dll" (arg%)
DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER




INIT:
	ENOUGHDISK% = 1

	hWnd%=HwndFrame()
	FixScreenProc ( hWnd% )
	SWLxx&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
	SWyy%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)

    INSTALLDLL$ = "mscuistf.dll"        ''custom functions
    HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure

    SetBitmap INSTALLDLL$, LOGO
    SetTitle "Adobe Premiere Installer"

    MajorVer% = GetWindowsMajorVersion()
    MinorVer% = GetWindowsMinorVersion()

    IF  MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
    i% = DoMsgBox("Adobe Premiere requires Microsoft Windows version 3.10 or greater.  Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
        END
    END IF

    szInf$ = GetSymbolValue("STF_SRCINFPATH")
    IF szInf$ = "" THEN
        szInf$ = GetSymbolValue("STF_CWDDIR") + "PREMIERE.INF"
    END IF
    ReadInfFile szInf$

    WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
	 DEST$ = GetIniKeyString( GetWindowsDir() + "premiere.ini", "Premiere", "PremiereDirectory" )
    IF IsDirWritable(DEST$) = 0 THEN
		 DEST$ = WINDRIVE$ + ":\PREMIERE"
    END IF
    IF DEST$ = "" THEN
		 DEST$ = WINDRIVE$ + ":\PREMIERE"
    END IF
    IF MID$( DEST, LEN(DEST), 1 ) = "\" THEN
       DEST$ = MID$( DEST, 1, LEN( DEST ) - 1 )
    END IF

    ''CustInst list symbols
    CHECKSTATES$ = "CheckItemsState"
    STATUSTEXT$  = "StatusItemsText"
    DRIVETEXT$   = "DriveStatusText"
    FOR i% = 1 TO NUMGROUPS STEP 1
        AddListItem CHECKSTATES$, "ON"
    NEXT i%
    FOR i% = 1 TO NUMGROUPS STEP 1
        AddListItem STATUSTEXT$, ""
    NEXT i%
    FOR i% = 1 TO 7 STEP 1
        AddListItem DRIVETEXT$, ""
    NEXT i%
    ReplaceListItem DRIVETEXT$, 7, DEST$

    ''Disk cost list symbols

    PROGRAMNEEDS$   = "ProgramNeeds"
    MSVIDEONEEDS$   = "MSVideoNeeds"
    QUICKTIMENEEDS$ = "QuickTimeNeeds"
    TUTORIALNEEDS$  = "TutorialNeeds"
    CAPTURENEEDS$   = "CaptureNeeds"

    EXTRACOSTS$ = "ExtraCosts"
    BIGLIST$    = "BigList"

    FOR i% = 1 TO NUMGROUPS STEP 1
        AddListItem BIGLIST$, ""
    NEXT i%
    FOR i% = 1 TO 26 STEP 1
        AddListItem EXTRACOSTS$, "0"
    NEXT i%

    RecalcPath
    SetDriveStatus

'$IFDEF DEBUG
    i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
'$ENDIF ''DEBUG



CUSTINST:
    sz$ = UIStartDlg(INSTALLDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)

    IF sz$ = "CONTINUE" THEN
        ''Install only if it will fit.
		  IF ENOUGHDISK% = 0 THEN
				 GOSUB TOOBIG
				 GOTO CUSTINST
		  END IF
        UIPop 1
        GOTO INSTALL
    ELSEIF sz$ = "PATH" THEN
        GOTO GETPATH
    ELSEIF sz$ = "CHK1" THEN
        RecalcOptFiles PROGRAMFILES
        SetDriveStatus
        GOTO CUSTINST
    ELSEIF sz$ = "CHK2" THEN
        RecalcOptFiles MSVIDEOFILES
        SetDriveStatus
        GOTO CUSTINST
    ELSEIF sz$ = "CHK3" THEN
        RecalcOptFiles QUICKTIMEFILES
        SetDriveStatus
        GOTO CUSTINST
    ELSEIF sz$ = "CHK4" THEN
        RecalcOptFiles TUTORIALFILES
        SetDriveStatus
        GOTO CUSTINST
    ELSEIF sz$ = "CHK5" THEN
        RecalcOptFiles CAPTUREFILES
        SetDriveStatus
        GOTO CUSTINST
    ELSEIF sz$ = "REACTIVATE" THEN
        RecalcPath
        SetDriveStatus
        GOTO CUSTINST
    ELSE
        GOSUB ASKQUIT
        GOTO CUSTINST
    END IF



INSTALL:


    IF GetListItem(CHECKSTATES$, PROGRAMFILES) = "ON" THEN
		 sz$ = UIStartDlg(INSTALLDLL$, PERSONALIZE, "dlgPERinstall", 0, "" )
		 IF sz$ <> "VALID" THEN
			 sz$ = UIStartDlg(INSTALLDLL$, EXITQUIT, "FInfo0DlgProc", 0, "")
			 UIPop 1
			 END
		 END IF
    END IF

    CopyFile GetWindowsDir() + "win.ini", GetWindowsDir() + "win.prm", cmoOverwrite, 0
    CopyFile GetWindowsDir() + "system.ini", GetWindowsDir() + "system.prm", cmoOverwrite, 0
    CreateDir DEST$, cmoNone

    IF GetListItem( CHECKSTATES$, PROGRAMFILES ) = "ON" THEN
        CreateDir DEST$ + "\PLUGINS", cmoNone
        CreateDir DEST$ + "\4_PSHOP", cmoNone
        CreateDir DEST$ + "\DRIVERS", cmoNone
    END IF

    IF GetListItem( CHECKSTATES$, TUTORIALFILES ) = "ON" THEN
        CreateDir DEST$ + "\SAMPLES", cmoNone
    END IF

	WinDir$ = GetWindowsDir()
	WinSysDir$ = GetWindowsSysDir()

    ClearCopyList
    AddOptFilesToCopyList PROGRAMFILES
    AddOptFilesToCopyList MSVIDEOFILES
    AddOptFilesToCopyList QUICKTIMEFILES
    AddOptFilesToCopyList TUTORIALFILES
    AddOptFilesToCopyList CAPTUREFILES
    SetRestartDir WinDir$
    CopyFilesInCopyList

	IF GetListItem( CHECKSTATES$, MSVIDEOFILES ) = "ON" THEN
		''Updating WIN.INI and SYSTEM.INI

		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "msrle.drv", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "indeov.drv", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "indeov.drv", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "indeov.drv", cmoOverwrite
		CreateIniKeyValue "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
		CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
		CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
		CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
		CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
		IF VflatdPresent() = 0 THEN
			CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
		END IF
		Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
		Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
		Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))

    END IF


    ''IF GetListItem( CHECKSTATES$, QUICKTIMEFILES ) = "ON" THEN
		''CreateIniKeyValue "win.ini", "Extensions", "mov", "mplayer.exe /play /close ^.mov", cmoNone
		''CreateIniKeyValue "win.ini", "mci extensions", "mov", "QTWVideo", cmoOverwrite
		''CreateIniKeyValue GetWindowsDir() + "system.ini", "mci", "QTWVideo", "mciqtw.drv", cmoOverwrite
    ''END IF

	IF GetListItem( CHECKSTATES$, CAPTUREFILES ) = "ON" THEN
		CreateProgmanItem "Adobe", "Capture", MakePath( DEST$, "adobecap.exe" ), "", cmoOverwrite
		RemoveFile GetWindowsDir() + "capture.ini", cmoForce
	END IF

	IF GetListItem(CHECKSTATES$, PROGRAMFILES) = "ON" THEN
		  CreateIniKeyValue "WIN.INI", "Extensions", "PPJ", DEST$ + "\PREMIERE.EXE ^.PPJ", cmoOverwrite
		  CreateIniKeyValue "WIN.INI", "Extensions", "PSQ", DEST$ + "\PREMIERE.EXE ^.PSQ", cmoOverwrite
		  CreateIniKeyValue "WIN.INI", "Extensions", "PLB", DEST$ + "\PREMIERE.EXE ^.PLB", cmoOverwrite

        RemoveFile GetWindowsDir() + "premiere.prf", cmoForce

        CreateProgmanGroup "Adobe", "", cmoNone
        ShowProgmanGroup  "Adobe", 1, cmoNone
        CreateProgmanItem "Adobe", "Premiere 1.1", MakePath( DEST$, "premiere.exe" ), "", cmoOverwrite
        CreateProgmanItem "Adobe", "Premiere ReadMe", "write.exe " + MakePath( DEST$, "prreadme.wri" ), "", cmoOverwrite
        ''CreateProgmanItem "Adobe", "QuickTime ReadMe", "write.exe " + MakePath( GetWindowsSysDir(), "qtreadme.wri" ), "", cmoOverwrite
        X$ = "                                        "
        X1 ( X$ )
        R$ = CHR$( LEN( X$ ) ) + X$
        X$ = "                                        "
        X2 ( X$ )
        R$ = R$ + CHR$( LEN( X$ ) ) + X$
        X$ = "                                        "
        X3 ( X$ )
        R$ = R$ + CHR$( LEN( X$ ) ) + X$
        StampResource "ProgramFiles", "1", DEST$, 6, 65, R$, LEN( R$ )

		  IF DoesFileExist( GetWindowsDir() + "photoshp.ini", femRead ) <> 0 THEN
		  		PHOTOSHOPPLUGINSDIR$ = GetIniKeyString( GetWindowsDir() + "photoshp.ini", "Photoshop", "PLUGINDIRECTORY" )
		      IF PHOTOSHOPPLUGINSDIR$ <> "" THEN
		      	CopyFile DEST$ + "\4_PSHOP\FILMST8B.8BI", PHOTOSHOPPLUGINSDIR$ + "\FILMST8B.8BI", cmoNone, 0
				END IF
		  END IF

		  CreateIniKeyValue GetWindowsDir() + "premiere.ini", "Premiere", "PremiereDirectory", DEST$, cmoOverwrite
		  IF GetListItem( CHECKSTATES$, CAPTUREFILES ) = "ON" THEN
			  CreateIniKeyValue GetWindowsDir() + "premiere.ini", "Premiere", "CaptureUtil", DEST$+"\adobecap.exe", cmoOverwrite
		  END IF

	END IF




'' Restart Windows: if it has to updates ACM from DOS, it restarts Windows
'' automatically; else, it gives the user the choice
	RESTRT% = RestartListEmpty ()
	Exe$ = WinDir$ + "\_msrstrt.exe"
	Batch$ = WinDir$ + "\_mssetup.bat"
    empty$ = ""
RESTART:
	IF RESTRT% = 0 THEN
		sz$ = UIStartDlg(INSTALLDLL$, RESTART, "FInfo0DlgProc", 0, "")
		IF sz$ = "REACTIVATE" THEN
			 GOTO RESTART
		ENDIF
		I% = ExitExecRestart ()
		RemoveFile Exe$, cmoForce
		RemoveFile Batch$, cmoForce
		END
	ELSE
		sz$ = UIStartDlg(INSTALLDLL$, RESTARTII, "FQuitDlgProc", 0, "")
		IF sz$ = "CONTINUE" THEN
			I% = ExitWindowsExec (Exe$, empty$)
			IF I% = 0 THEN
				GOTO RESTART
			ELSE
			END
		ENDIF
		ELSEIF sz$ = "EXIT" THEN
			UIPopAll
			END
		ELSEIF sz$ = "REACTIVATE" THEN
			GOTO RESTART
		ELSE
			UIPop 1
		END IF
	END IF



QUIT:
    ON ERROR GOTO ERRQUIT

    IF ERR = 0 THEN
        dlg% = EXITSUCCESS
    ELSEIF ERR = STFQUIT THEN
        dlg% = EXITQUIT
    ELSE
        dlg% = EXITFAILURE
    END IF
QUITL1:
    sz$ = UIStartDlg(INSTALLDLL$, dlg%, "FInfo0DlgProc", 0, "")
    IF sz$ = "REACTIVATE" THEN
        GOTO QUITL1
    END IF
    UIPop 1

    END

ERRQUIT:
    i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
    END



GETPATH:
    SetSymbolValue "EditTextIn", DEST$
    SetSymbolValue "EditFocus", "ALL"
GETPATHL1:
    sz$ = UIStartDlg(INSTALLDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)

    IF sz$ = "CONTINUE" THEN
        olddest$ = DEST$
        DEST$ = GetSymbolValue("EditTextOut")

        ''Validate new path.
        IF LEN( DEST ) < 4 THEN
            GOSUB BADPATH
            GOTO GETPATHL1
        END IF

        IF MID$( DEST, 1, 1 ) = "A" THEN
            GOSUB BADPATH
            GOTO GETPATHL1
        END IF

        IF MID$( DEST, 1, 1 ) = "B" THEN
            GOSUB BADPATH
            GOTO GETPATHL1
        END IF

        IF IsDirWritable(DEST$) = 0 THEN
            GOSUB BADPATH
            GOTO GETPATHL1
        END IF

		  IF MID$( DEST, LEN(DEST), 1 ) = "\" THEN
			  DEST$ = MID$( DEST, 1, LEN( DEST ) - 1 )
		  END IF

        UIPop 1

        ''Truncate display if too long.
        IF LEN(DEST$) > 23 THEN
            ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
        ELSE
            ReplaceListItem DRIVETEXT$, 7, DEST$
        END IF

        ''Recalc if path changed.
        IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
            RecalcPath
            SetDriveStatus
        END IF

        olddest$ = ""
        GOTO CUSTINST
    ELSEIF sz$ = "REACTIVATE" THEN
        RecalcPath
        SetDriveStatus
        GOTO GETPATHL1
    ELSEIF sz$ = "EXIT" THEN
        GOSUB ASKQUIT
        GOTO GETPATHL1
    ELSE
        UIPop 1
        GOTO CUSTINST
    END IF



TOOBIG:
    sz$ = UIStartDlg(INSTALLDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
    IF sz$ = "REACTIVATE" THEN
        RecalcPath
        SetDriveStatus
        GOTO TOOBIG
    END IF
    UIPop 1
    RETURN



BADPATH:
    sz$ = UIStartDlg(INSTALLDLL$, BADPATH, "FInfo0DlgProc", 0, "")
    IF sz$ = "REACTIVATE" THEN
        RecalcPath
        SetDriveStatus
        GOTO BADPATH
    END IF
    UIPop 1
    RETURN



ASKQUIT:
    sz$ = UIStartDlg(INSTALLDLL$, ASKQUIT, "FQuitDlgProc", 0, "")

    IF sz$ = "EXIT" THEN
        UIPopAll
        ERROR STFQUIT
    ELSEIF sz$ = "REACTIVATE" THEN
        GOTO ASKQUIT
    ELSE
        UIPop 1
    END IF
    RETURN



'**
'** Purpose:
'**     Adds the specified option files to the copy list.
'** Arguments:
'**     ftype%  - type of files to add, one of the following:
'**             PROGRAMFILES, TUTORIALFILES ...
'** Returns:
'**     none.
'*************************************************************************
SUB AddOptFilesToCopyList (ftype%) STATIC

    IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
        SrcDir$ = GetSymbolValue("STF_SRCDIR")
        IF ftype% = PROGRAMFILES THEN
            AddSectionFilesToCopyList "ProgramFiles", SrcDir$, DEST$
            AddSectionFilesToCopyList "PluginFiles", SrcDir$, DEST$ + "\plugins"
            AddSectionFilesToCopyList "ProgramWinFiles", SrcDir$, GetWindowsDir()
            AddSectionFilesToCopyList "ProgramWinSysFiles", SrcDir$, GetWindowsSysDir()
            AddSectionFilesToCopyList "PhotoshopFiles", SrcDir$, DEST$ + "\4_pshop"
            AddSectionFilesToCopyList "DriversFiles", SrcDir$, DEST$ + "\drivers"
        ELSEIF ftype% = MSVIDEOFILES THEN
            AddSectionFilesToCopyList "MSVideoFiles", SrcDir$, GetWindowsDir()
            AddSectionFilesToCopyList "MSVideoSysFiles", SrcDir$, GetWindowsSysDir()
        ELSEIF ftype% = QUICKTIMEFILES THEN
            AddSectionFilesToCopyList "QuickTimeFiles", SrcDir$, DEST$
        ELSEIF ftype% = TUTORIALFILES THEN
            AddSectionFilesToCopyList "TutorialFiles", SrcDir$, DEST$ + "\samples"
        ELSEIF ftype% = CAPTUREFILES THEN
            AddSectionFilesToCopyList "CaptureFiles", SrcDir$, DEST$
        END IF
        SrcDir$ = ""
    END IF
END SUB


'**
'** Purpose:
'**     Recalculates disk space for the given option files and sets
'**     the status info symbol "StatusItemsText".
'** Arguments:
'**     ftype% - type of files to add, one of the following:
'**             PROGRAMFILES, PLUGINFILES...
'** Returns:
'**     none.
'*************************************************************************
SUB RecalcOptFiles (ftype%) STATIC
    CursorSave% = ShowWaitCursor()
    ClearCopyList
    AddOptFilesToCopyList ftype%

    fExtra% = 0
    ndrive% = 1
    idrive% = 1
    IF ftype% = PROGRAMFILES THEN
        ListSym$ = PROGRAMNEEDS$
        IF GetListItem(CHECKSTATES$, PROGRAMFILES) = "ON" THEN
            ''Add extra cost to Windows drive for ini/progman, etc.
            ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
            ReplaceListItem EXTRACOSTS$, ndrive%, "20000"
            idrive% = ASC(ucase$(DEST$)) - ASC("A") + 1
            ReplaceListItem EXTRACOSTS$, idrive%, "200000"
            fExtra% = 1
        END IF
    ELSEIF ftype% = MSVIDEOFILES THEN
        ListSym$ = MSVIDEONEEDS$
        IF GetListItem(CHECKSTATES$, MSVIDEOFILES) = "ON" THEN
            ''Add extra cost to Windows drive for ini/progman, etc.
            ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
            ReplaceListItem EXTRACOSTS$, ndrive%, "20000"
            fExtra% = 1
        END IF
    ELSEIF ftype% = QUICKTIMEFILES THEN
        ListSym$ = QUICKTIMENEEDS$
        IF GetListItem(CHECKSTATES$, QUICKTIMEFILES) = "ON" THEN
            ''Add extra cost to Windows drive for ini/progman, etc.
            ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
            ReplaceListItem EXTRACOSTS$, ndrive%, "20000"
            fExtra% = 1
        END IF
    ELSEIF ftype% = TUTORIALFILES THEN
        ListSym$ = TUTORIALNEEDS$
        IF GetListItem(CHECKSTATES$, TUTORIALFILES) = "ON" THEN
            ''Add extra cost to Windows drive for ini/progman, etc.
            idrive% = ASC(ucase$(DEST$)) - ASC("A") + 1
            ReplaceListItem EXTRACOSTS$, idrive%, "60000"
            fExtra% = 1
        END IF
    ELSEIF ftype% = CAPTUREFILES THEN
        ListSym$ = CAPTURENEEDS$
        IF GetListItem(CHECKSTATES$, CAPTUREFILES) = "ON" THEN
            ''Add extra cost to Windows drive for ini/progman, etc.
            idrive% = ASC(ucase$(DEST$)) - ASC("A") + 1
            ReplaceListItem EXTRACOSTS$, idrive%, "60000"
            fExtra% = 1
        END IF
    END IF

    StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")

    cost& = 0
    FOR i% = 1 TO 26 STEP 1
        cost&  = cost& + VAL(GetListItem(ListSym$, i%))
    NEXT i%
    ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"

    IF StillNeed& > 0 THEN
        ReplaceListItem BIGLIST$, ftype%, "YES"
    ELSE
        ReplaceListItem BIGLIST$, ftype%, ""
    END IF

    IF fExtra% THEN
        ReplaceListItem EXTRACOSTS$, ndrive%, "0"
        ReplaceListItem EXTRACOSTS$, idrive%, "0"
    END IF
    RestoreCursor CursorSave%
    ListSym$ = ""
END SUB


'**
'** Purpose:
'**     Recalculates disk space and sets option status info according
'**     to the current destination path.
'** Arguments:
'**     none.
'** Returns:
'**     none.
'*************************************************************************
SUB RecalcPath STATIC

    CursorSave% = ShowWaitCursor()

    RecalcOptFiles PROGRAMFILES
    RecalcOptFiles MSVIDEOFILES
    RecalcOptFiles QUICKTIMEFILES
    RecalcOptFiles TUTORIALFILES
    RecalcOptFiles CAPTUREFILES

    RestoreCursor CursorSave%
END SUB


'**
'** Purpose:
'**     Sets drive status info according to latest disk space calcs.
'** Arguments:
'**     none.
'** Returns:
'**     none.
'*************************************************************************
SUB SetDriveStatus STATIC

    ENOUGHDISK% = 1


    drive$ = MID$(DEST$, 1, 1)
    ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
    cost& = VAL( GetListItem( PROGRAMNEEDS$, ndrive% ) )
    cost& = cost& + VAL( GetListItem( MSVIDEONEEDS$, ndrive% ) )
    cost& = cost& + VAL( GetListItem( QUICKTIMENEEDS$, ndrive% ) )
    cost& = cost& + VAL( GetListItem( TUTORIALNEEDS$, ndrive% ) )
    cost& = cost& + VAL( GetListItem( CAPTURENEEDS$, ndrive% ) )
    free& = GetFreeSpaceForDrive(drive$)
    ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
    ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
    ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"


    IF cost& > free& THEN
    	  ENOUGHDISK% = 0
    END IF

    IF drive$ = WINDRIVE$ THEN
        ReplaceListItem DRIVETEXT$, 4, ""
        ReplaceListItem DRIVETEXT$, 5, ""
        ReplaceListItem DRIVETEXT$, 6, ""
    ELSE
        ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
        cost& = VAL( GetListItem( PROGRAMNEEDS$, ndrive% ) )
        cost& = cost& + VAL( GetListItem( MSVIDEONEEDS$, ndrive% ) )
        cost& = cost& + VAL( GetListItem( QUICKTIMENEEDS$, ndrive% ) )
        cost& = cost& + VAL( GetListItem( TUTORIALNEEDS$, ndrive% ) )
        cost& = cost& + VAL( GetListItem( CAPTURENEEDS$, ndrive% ) )
        IF cost& = 0 THEN
            ReplaceListItem DRIVETEXT$, 4, ""
            ReplaceListItem DRIVETEXT$, 5, ""
            ReplaceListItem DRIVETEXT$, 6, ""
        ELSE
            free& = GetFreeSpaceForDrive(WINDRIVE$)
            ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
            ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
            ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
        END IF

        IF cost& > free& THEN
    	      ENOUGHDISK% = 0
        END IF

    END IF
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

