home *** CD-ROM | disk | FTP | other *** search
- '' $Keywords: net.mst 1.25 16Nov92 01:22pm$ $nokeywords$
- '**************************************************************************
- '* CorelTools setup script
- '**************************************************************************
- '' Date Name Reason
- ''-------------------------------------------------------------------------
- '' Feb 25 1992 Randall Mack Modified from sample2.mst provided with
- '' Windows SDK 3.1 Beta.
- '' Jun 1 1992 Randall Mack Modified from draw.mst and draw2.mst to
- '' serve as a net install
-
- '$INCLUDE 'setupapi.inc'
-
- ''C functions
- DECLARE SUB InitializeInstall LIB "mscuistf.dll" (hInstance%, hMainWind% )
- DECLARE SUB ShutDownInstall LIB "mscuistf.dll"
- DECLARE SUB RegisterFont LIB "mscuistf.dll" (szFOTName$, szTTFName$)
- DECLARE SUB FileChangeString LIB "mscuistf.dll" (szFile1$, szFile2$, szString1$, szString2$)
- DECLARE SUB ExecCommand LIB "mscuistf.dll" (szCommand$)
- DECLARE SUB InitPrintTestFile LIB "mscuistf.dll"
- DECLARE SUB ShutDownPrintTestFile LIB "mscuistf.dll"
- DECLARE SUB CommentIniSection LIB "mscuistf.dll" (szFileName$, szTempFile$, szSection$, szPath$ )
- DECLARE FUNCTION PrintTestFile LIB "mscuistf.dll" (szFilename$, bLast% ) AS INTEGER
- DECLARE FUNCTION ScanList LIB "mscuistf.dll" (szSymbol$, nIndex%) AS INTEGER
- DECLARE FUNCTION GetFilenameFromPath LIB "mscuistf.dll" (szPath$) AS INTEGER
- DECLARE FUNCTION IsTTFEnabled LIB "mscuistf.dll" AS INTEGER
- DECLARE FUNCTION GetMinFileSize LIB "mscuistf.dll" (szDrive%) AS INTEGER
-
- '$INCLUDE 'translat.inc'
-
- ''Strings for loading string resources
- GLOBAL szString$
- CONST STRINGLEN = 66
- szString$ = string$( STRINGLEN+1, 32 )
-
- ''setup main window
- CONST LOGO = 9100 ''must match the constant in dialogs.h
- SetTitle TR_TITLE
- InitializeInstall hinstFrame(), HwndFrame() ''corel style buttons; max window
- SetBitmap "mscuistf.dll", LOGO
-
- '$INCLUDE 'msdetect.inc'
-
- '$DEFINE DEBUG ''Define for script development/debugging
-
- ''Dialog ID's
- ''Note: These constants MUST match the constants in dialogs.h
- CONST WELCOME = 9900
- CONST ASKQUIT = 9901
- CONST DESTPATH = 9902
- CONST EXITFAILURE = 9903
- CONST EXITQUIT = 9904
- CONST BADPATH = 9909
- CONST WAIT = 9919
- CONST ASKINSTALL = 9922
- CONST BILLBOARD = 9926
- CONST UPDATEDAUTOEXEC = 9930
- CONST UPDATEAUTOEXEC = 9931
- CONST WAITREGISTER = 9932
- CONST BADGROUP = 9933
- CONST LOCPATH = 9934
- CONST WRONGDIR = 9935
- CONST PRINTTEST = 9937
- CONST SUCCESS = 9938
- CONST CDTOOBIG = 9940
- CONST NETWELCOME = 9942
- CONST NETTOOBIG = 9947
- CONST NETADDITEMFAILED = 9949
- CONST NETEXITSUCCESS = 9948
- CONST NETUSERABOUT = 9951
- CONST WELCOMEHELP = 9800
- CONST GETPATHHELP = 9802
- CONST ASKINSTALLHELP = 9808
- CONST PRINTTESTHELP = 9811
-
- ''Constants representing each line in the custinst dialog
- CONST DRAW = 1
- CONST CHART = 2
- CONST SHOW = 3
- CONST PHOTO = 4
- CONST TRACE = 5
- CONST MOSAIC = 6
- CONST FONTSYM = 7
- CONST NUMCUST = FONTSYM
- CONST MAIN = NUMCUST + 1
- CONST NUMGROUPS = MAIN
-
- CONST FALSE = 0
- CONST TRUE = 1
-
- ''used as a parm to GetCopyListCost only
- GLOBAL EXTRACOSTS$
- EXTRACOSTS$ = "ExtraCosts"
- GLOBAL bTooBig%
- bTooBig% = FALSE
- GLOBAL fInstallATM$ '' Should the type 1 fonts be installed?
- GLOBAL bInstallWinDLL% '' Should the dlls be copied to the windows system dir?
- '' Note: redists are always copied under win 3.0
- bInstallWinDLL% = FALSE
-
- ''list of sections (1..NUMGROUPS)
- GLOBAL DIR(NUMGROUPS) AS STRING ''list of directories for main options
-
- GLOBAL WINDIR$ ''Windows directory
- GLOBAL WINSYSDIR$ ''Windows directory
- GLOBAL WINDRIVE$ ''Windows drive letter
- GLOBAL szWWinDir$ ''Writable Windows directory
- GLOBAL szFontDir$ ''Location of TTF files
- GLOBAL DEST$ ''destination directory
- GLOBAL LOCATION$ ''location of network files to install
-
- GLOBAL TOOLGROUP$ '' Group in which tools are to be installed
-
- ''Windows version number
- GLOBAL WinMinor%
- GLOBAL bWindowsIsNetworked%
-
- ''Variables to fake subroutines with parameters
- GLOBAL Dialog%
-
- ''Globals for WaitOn and WaitOff
- GLOBAL nWaiting%
- GLOBAL CursorSave%
-
- Global bPathAltered% '' If set then autoexec.bat has been changed
-
- ''local MSTest functions
- DECLARE SUB WaitOnBig
- DECLARE SUB WaitOn
- DECLARE SUB WaitOff
- DECLARE SUB SetDirectories
- DECLARE SUB RecalcAll
- DECLARE SUB TestAddSectionFilesToCopyList (szSection$,szFrom$,szTo$)
- DECLARE SUB CheckBackupFile( szFile1$, szFile2$ )
- DECLARE SUB WrapCommentIniSection( szFileName$, szTempFile$, szSection$, szPath$ )
- DECLARE FUNCTION CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) AS INTEGER
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
- DECLARE FUNCTION MakeDir (szDir$) AS STRING
-
- INIT:
- '' set waiting cursor
- nWaiting% = 0
- WaitOn
-
- ''Set default directory names
- WINDIR$ = GetWindowsDir
- WINSYSDIR$ = GetWindowsSysDir
- WINDRIVE$ = MID$(WINDIR$, 1, 1)
- OpenLogfile MakePath(WINDIR$, TR_LOGFILE), 0
- WriteToLogFile TR_INSTALLNETUSER
-
- bWindowsIsNetworked% = IsDriveNetwork( MID$(WINSYSDIR$,1,1) )
- IF bWindowsIsNetworked% THEN
- szWWinDir$ = WINDIR$ '' copy files to users personal directory
- WriteToLogFile TR_NETWINDOWS
- ELSE
- szWWinDir$ = WINSYSDIR$ '' copy files to users Windows system directory
- ENDIF
-
- DEST$ = WINDRIVE$ + ":\"+TR_CORELDRW
- LOCATION$ = GetSymbolValue("STF_SRCDIR")
- SetSymbolValue EXTRACOSTS$, "{""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0""}"
-
- ''find and read .inf file
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = MakePath( GetSymbolValue("STF_CWDDIR"), "net.inf" )
- ENDIF
- ReadInfFile szInf$
- szInf$ = ""
-
- ''Set windows version - for use with installing windows 3.1 DLL's
- WinMinor% = GetWindowsMinorVersion
- IF WinMinor% = 0 THEN
- bInstallWinDLL% = TRUE
- ENDIF
-
- ''set the default progman group to put everything in
- TOOLGROUP$ = TR_TOOLGROUP
-
-
- '' Put up the Welcome dialog
- WELCOME:
- WaitOff
- sz$ = UIStartDlg( "mscuistf.dll", NETWELCOME, "FInfoDlgProc", WELCOMEHELP, "FHelpDlgProc" )
- SELECT CASE sz$
- CASE "CONTINUE"
- UIPop 1
- CASE "ABOUT"
- Dialog% = NETUSERABOUT
- GOSUB INFO
- GOTO WELCOME
- CASE "REACTIVATE"
- GOTO WELCOME
- CASE ELSE
- GOSUB ASKQUIT
- GOTO WELCOME
- END SELECT
-
- '' fall through from WELCOME
- SetDirectories '' Set DIR(..) to the location of the files on the network
- '' select destination directory for files
- GETDEST:
- EditDir$ = DEST$
- Dialog% = DESTPATH
- GOSUB GETPATH
- DEST$ = EditDir$
-
- WriteToLogFile TR_BASEDIR + DEST$
- WriteToLogFile ""
-
- '' fall through from selecting destination directory
- INSTALL:
- WaitOn
- ''Make sure there is enough space for CorelDRAW!
- RecalcAll
- IF bTooBig% = TRUE THEN
- Dialog% = NETTOOBIG
- GOSUB INFO
- GOTO GETDEST
- ENDIF
-
- ''Create all directories needed
- IF DoesFileExist( MakePath(DIR(CHART),TR_CORELCHT_INI), femExists ) = 1 THEN
- CreateDir MakePath(DEST$,TR_EFFECTS), cmoNone
- CreateDir MakePath(DEST$,TR_TEMP), cmoNone
- ENDIF
- IF DoesFileExist( MakePath(DIR(DRAW),TR_CORELDRW_INI), femExists ) = 1 THEN
- CreateDir MakePath(DEST$,TR_AUTOBACK), cmoNone
- ENDIF
-
- '' Backup files to *.cor - do not overwrite
- CheckBackupFile MakePath(WINDIR$,"win.ini"), MakePath(WINDIR$,"win.cor")
- CheckBackupFile MakePath(WINDIR$,"reg.dat"), MakePath(WINDIR$,"reg.cor")
- CheckBackupFile MakePath(WINDIR$,"progman.ini"), MakePath(WINDIR$,"progman.cor")
-
- '' Add billboards
- AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
- AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
- AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
- AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
- AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
- AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
-
- '' Disable size checking so I don't have to update the inf file
- temp% = SetSizeCheckMode( scmOff )
- ''Copy all the files over
- WaitOff
- CopyFilesInCopyList
-
- '' Register all the ttf fonts with Windows
- IF WinMinor% > 0 THEN
- IF IsTTFEnabled = 1 THEN
- sz$ = UIStartDlg("mscuistf.dll", WAITREGISTER, "FModelessDlgProc", 0, "")
- MakeListFromSectionKeys "___temp_", "Fonts"
- NeedsList$ = GetSymbolValue( "___temp_" )
- RemoveSymbol( "___temp_" )
- nIndex% = 0
- nIndexInc% = ScanList(NeedsList$,nIndex%)
- WHILE nIndexInc% > 0
- szFilename$ = GetSectionKeyFilename( "Fonts", MID$(NeedsList$, nIndex%+3, nIndexInc%-3) )
- IF DoesFileExist( MakePath(szFontDir$,szFilename$), femExists) = 1 THEN
- szFOTName$ = MID$(szFilename$,1,LEN(szFilename$)-3) + "fot"
- RegisterFont MakePath(szWWinDir$,szFOTName$), MakePath(szFontDir$,szFilename$)
- temp% = GetTypeFaceNameFromTTF( MakePath(szFontDir$,szFilename$), szString$, STRINGLEN )
- CreateIniKeyValue TR_WIN_INI, "fonts", szString$+" "+TR_TRUETYPE, UCASE$(szFOTName$), cmoOverWrite
- ENDIF
- nIndex% = nIndex% + nIndexInc%
- nIndexInc% = ScanList(NeedsList$,nIndex%)
- WEND
- UIPop 1
- ENDIF
- ENDIF
- szFilename$ = ""
- szFOTName$ = ""
- NeedsList$ = ""
-
- nAddItemFailed% = 0
-
- '' setup coreldrw.reg
- IF DoesFileExist( MakePath(DIR(DRAW),TR_CORELDRW_INI), femExists ) = 1 THEN
- FileChangeString MakePath(DEST$,TR_CORELDRW_REG), MakePath(DEST$,"___temp_"), TR_CORELDRW_EXE, MakePath(DIR(DRAW),TR_CORELDRW_EXE)
- ExecCommand TR_REGLOAD_S + " " + MakePath(DEST$,TR_CORELDRW_REG)
-
- ini$ = MakePath(DEST$, TR_CORELDRW_INI)
- CreateIniKeyValue TR_WIN_INI, "Extensions", "cdr", MakePath(DIR(DRAW),TR_CORELDRW_EXE+" ^.cdr"), cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "DrawDir", MakeDir(DEST$), cmoOverWrite
- CreateIniKeyValue ini$, "CDrawConfig", "Applic", MakeDir(DIR(DRAW)), cmoOverwrite
- CreateIniKeyValue ini$, "CDrawConfig", "ConfigDir", MakeDir(DEST$), cmoOverwrite
- CreateIniKeyValue ini$, "CDrawConfig", "FontsDir", MakeDir(DIR(FONTSYM)), cmoOverwrite
- CreateIniKeyValue ini$, "CDrawConfig", "CorelFiltersDir", MakePath(DIR(MAIN),TR_FILTERS), cmoOverwrite
- CreateIniKeyValue ini$, "CDrawConfig", "AutoBackupDir", MakePath(DEST$,TR_AUTOBACK), cmoOverwrite
- CreateIniKeyValue ini$, "Mosaic", "Applic", MakePath(DIR(MOSAIC),TR_CORELMOS_EXE), cmoOverwrite
- WrapCommentIniSection ini$, MakePath(DEST$,"___temp_"), "CDrawImportFilters", MakePath(DIR(MAIN),TR_FILTERS+"\")
- WrapCommentIniSection ini$, MakePath(DEST$,"___temp_"), "CDrawExportFilters", MakePath(DIR(MAIN),TR_FILTERS+"\")
- WrapCommentIniSection ini$, MakePath(DEST$,"___temp_"), "CorelDrwFonts", MakePath(DIR(FONTSYM),"")
- WrapCommentIniSection ini$, MakePath(DEST$,"___temp_"), "CorelDrwSymbols", MakePath(DIR(FONTSYM),"")
-
- CreateProgmanGroup TOOLGROUP$, "", cmoNone
- ShowProgmanGroup TOOLGROUP$, 1, cmoNone
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_RELEASENOTES, TR_NOTEPAD_EXE + " " + MakePath(DIR(MAIN),TR_README_TXT), "", cmoOverwrite)
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELDRAW, MakePath(DIR(DRAW),TR_CORELDRW_EXE),"", cmoOverwrite)
- ENDIF
- IF DoesFileExist( MakePath(DIR(DRAW),TR_TUTORIAL_HLP), femExists ) = 1 THEN
- IF WinMinor% = 0 THEN
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELDRAW+" "+TR_TUTORIAL, MakePath(WINSYSDIR$,TR_WINHELP)+" "+MakePath(DIR(DRAW),TR_TUTORIAL_HLP), "", cmoOverwrite)
- ELSE
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELDRAW+" "+TR_TUTORIAL, TR_WINHELP+" "+MakePath(DIR(DRAW),TR_TUTORIAL_HLP), "", cmoOverwrite)
- ENDIF
- ENDIF
-
- '' setup corelcht.reg
- IF DoesFileExist( MakePath(DIR(CHART),TR_CORELCHT_INI), femExists ) = 1 THEN
- FileChangeString MakePath(DEST$,TR_CORELCHT_REG), MakePath(DEST$,"___temp_"), TR_CORELCHT_EXE, MakePath(DIR(CHART),TR_CORELCHT_EXE)
- ExecCommand TR_REGLOAD_S + " " + MakePath(DEST$,TR_CORELCHT_REG)
-
- CreateIniKeyValue TR_WIN_INI, "Extensions", "cch", MakePath(DIR(CHART),TR_CORELCHT_EXE+" ^.cch"), cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "ChartDir", MakeDir(DEST$), cmoOverWrite
- ini$ = MakePath(WINDIR$, "CORELCHT.INI")
- CreateIniKeyValue ini$, "CorelChart", "GATO_PATH", MakeDir(DIR(CHART)), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_3DRISER", MakePath(DIR(CHART),TR_3DRISER), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_3DSCAT", MakePath(DIR(CHART),TR_3DSCAT), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_AREA", MakePath(DIR(CHART),TR_AREA), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_BAR", MakePath(DIR(CHART),TR_BAR), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_HILO", MakePath(DIR(CHART),TR_HILO), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_HIST", MakePath(DIR(CHART),TR_HIST), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_LINE", MakePath(DIR(CHART),TR_LINE), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_PICTO", MakePath(DIR(CHART),TR_PICTO), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_PIE", MakePath(DIR(CHART),TR_PIE), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_SCATTER", MakePath(DIR(CHART),TR_SCATTER), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_SPECTRAL", MakePath(DIR(CHART),TR_SPECTRAL), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3DF_TABLE", MakePath(DIR(CHART),TR_TABLE), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3FX_EFFECTS", MakePath(DEST$,TR_EFFECTS), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3FX_FILTERS", MakePath(DIR(MAIN),TR_FILTERS), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3FX_TEMPDIR", MakePath(DEST$,TR_TEMP), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "F3FX_PICTIONARY", MakePath(DIR(CHART),TR_BITMAPS), cmoOverwrite
- CreateIniKeyValue ini$, "CorelChart", "Vector_path", MakePath(DIR(CHART),TR_VECTORS), cmoOverwrite
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELCHART, MakePath(DIR(CHART),TR_CORELCHT_EXE), "", cmoOverwrite)
- ENDIF
-
- IF DoesFileExist( MakePath(DIR(SHOW),TR_CORELSHW_INI), femExists ) = 1 THEN
- '' setup corelshw.reg
- FileChangeString MakePath(DEST$,TR_CORELSHW_REG), MakePath(DEST$,"___temp_"),TR_CORELSHW_EXE, MakePath(DIR(SHOW),TR_CORELSHW_EXE)
- ExecCommand TR_REGLOAD_S + " " + MakePath(DEST$,TR_CORELSHW_REG)
-
- CreateIniKeyValue TR_WIN_INI, "Extensions", "shw", MakePath(DIR(SHOW),TR_CORELSHW_EXE+" ^.shw"), cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "Extensions", "shb", MakePath(DIR(SHOW),TR_CORELSHW_EXE+" ^.shb"), cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "ShowDir", MakeDir(DEST$), cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "AAPLAY Animation", "WaveAudio", "c,522", cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "AAPLAY Animation", "Sequencer", "x,523", cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "AAPLAY Animation", "FullScreen", "AAVGA.DLL", cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "AAPLAY Animation", "DualScreen", "no", cmoOverWrite
- ini$ = MakePath(DEST$, TR_CORELSHW_INI)
- CreateIniKeyValue ini$, "CShowConfig", "ConfigDir", MakeDir(DIR(SHOW)), cmoOverWrite
- CreateIniKeyValue ini$, "MasterBackGround", "defaultfile", MakePath(DIR(SHOW),TR_BACKGRDS+"\"+TR_SAMPLE_SHB), cmoOverwrite
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELSHOW, MakePath(DIR(SHOW),TR_CORELSHW_EXE), "", cmoOverwrite)
- ENDIF
- IF DoesFileExist( MakePath(DIR(SHOW),TR_SHOWRUN+"\"+TR_SHOWRUN_EXE), femExists ) = 1 THEN
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELSHOW_RUNTIME_PLAYER, MakePath(DIR(SHOW),TR_SHOWRUN+"\"+TR_SHOWRUN_EXE), "", cmoOverwrite)
- ENDIF
-
- IF DoesFileExist( MakePath(DIR(PHOTO),TR_CORELPNT_INI), femExists ) = 1 THEN
- '' Register photo with OLE
- FileChangeString MakePath(DEST$,TR_CORELPNT_REG), MakePath(DEST$,"___temp_"),TR_CORELPNT_EXE, MakePath(DIR(PHOTO),TR_CORELPNT_EXE)
- FileChangeString MakePath(DEST$,TR_CORELPNT_REG), MakePath(DEST$,"___temp_"),TR_PNTHNDLR_DLL, MakePath(DIR(PHOTO),TR_PNTHNDLR_DLL)
- ExecCommand TR_REGLOAD_S + " " + MakePath(DEST$,TR_CORELPNT_REG)
-
- CreateIniKeyValue TR_WIN_INI, "Extensions", "pcx", MakePath(DIR(PHOTO),TR_CORELPNT_EXE+" ^.pcx"), cmoOverWrite
- CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "PhotoPaintDir", MakeDir(DEST$), cmoOverWrite
- ini$ = MakePath(DEST$,TR_CORELPNT_INI)
- CreateIniKeyValue ini$, "CorelPaintDll", "PCX 16 Color/Gray", MakePath(DIR(PHOTO),"pcx16.dll,*.pcx"), cmoOverWrite
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELPHOTO, MakePath(DIR(PHOTO),TR_CORELPNT_EXE), "", cmoOverwrite)
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CCAPTURE, MakePath(DIR(PHOTO),TR_CCAPTURE_EXE), "", cmoOverwrite)
- ENDIF
-
- IF DoesFileExist( MakePath(DIR(TRACE),TR_CORELTRC_INI), femExists ) = 1 THEN
- CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "TraceDir", MakeDir(DEST$), cmoOverWrite
- ini$ = MakePath(DEST$,TR_CORELTRC_INI)
- CreateIniKeyValue ini$, "CorelTrace", "OutPath", MakePath(WINDIR$,""), cmoOverWrite
- CreateIniKeyValue ini$, "CorelTrace", "InPath", MakePath(WINDIR$,""), cmoOverWrite
- CreateIniKeyValue ini$, "CorelTrace", "ApplPath", MakeDir(DIR(TRACE)), cmoOverWrite
- CreateIniKeyValue ini$, "CorelTrace", "TraceFiltersDir", MakePath(DIR(MAIN),TR_FILTERS+"\"), cmoOverWrite
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELTRACE, MakePath(DIR(TRACE),TR_CORELTRC_EXE), "", cmoOverwrite)
- ENDIF
-
- IF DoesFileExist( MakePath(DIR(MOSAIC),TR_CORELMOS_EXE), femExists ) = 1 THEN
- CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "MosaicDir", MakeDir(DEST$), cmoOverwrite
- nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELMOSAIC, MakePath(DIR(MOSAIC),TR_CORELMOS_EXE), "", cmoOverwrite)
- ENDIF
- ini$ = ""
-
- IF nAddItemFailed% > 0 THEN
- Dialog% = NETADDITEMFAILED
- GOSUB INFO
- ENDIF
-
- '' Prepend the chart directory to the users path if possible
- IF WinMinor% = 0 AND DoesFileExist( MakePath(DIR(CHART),TR_CORELCHT_INI), femExists ) = 1 THEN
- bPathAltered% = FALSE
- IF DoesFileExist("C:\"+TR_AUTOEXEC_BAT,femWrite) = 1 AND DoesFileExist("C:\"+TR_AUTOEXEC_BAK,femRead) = 0 THEN
- szPath$ = GetEnvVariableValue( "path" )
- IF LEN( szPath$ ) + LEN( MakeDir(DIR(CHART)) ) < 128 THEN
- RenameFile "C:\"+TR_AUTOEXEC_BAT, TR_AUTOEXEC_BAK
- PrependToPath "C:\"+TR_AUTOEXEC_BAK, "C:\"+TR_AUTOEXEC_BAT, MakeDir(DIR(CHART)), cmoNone
- bPathAltered% = TRUE
- ENDIF
- ENDIF
- '' Display the info dialog telling the user what we did
- IF bPathAltered% = TRUE THEN
- Dialog% = UPDATEDAUTOEXEC
- GOSUB INFO
- ELSE
- Dialog% = UPDATEAUTOEXEC
- GOSUB INFO
- ENDIF
- ENDIF
-
- '' ask the user whether or not to print the test samples
- PRINTTEST:
- IF DoesFileExist( MakePath(DIR(DRAW),TR_SAMPLES+"\"+TR_SCREENS_CDR), femExists ) = 1 THEN
- WaitOff
- sz$ = UIStartDlg( "mscuistf.dll", PRINTTEST, "FButtonsDlgProc", PRINTTESTHELP, "FHelpDlgProc" )
- SELECT CASE sz$
- CASE "P"
- UIPop(1)
- ini$ = MakePath(DEST$, TR_CORELDRW_INI)
- CreateIniKeyValue ini$, "CDrawConfig", "MaximizeCDraw", "1", cmoOverwrite
- InitPrintTestFile
- IF PrintTestFile( MakePath( DIR(DRAW), TR_SAMPLES+"\"+TR_SCREENS_CDR ), FALSE ) = TRUE THEN
- bTemp% = PrintTestFile( MakePath( DIR(DRAW), TR_SAMPLES+"\"+TR_COLORBAR_CDR ), TRUE )
- ENDIF
- CreateIniKeyValue ini$, "CDrawConfig", "MaximizeCDraw", "0", cmoOverwrite
- ShutDownPrintTestFile
- CASE "D"
- UIPop(1)
- CASE ELSE
- GOTO PRINTTEST
- END SELECT
- ENDIF
-
- '' User has completed run of setup or has unconditionally decided to quit
- QUIT:
- WaitOff
- '' On MSTest errors report "setup file corrupted" and abort
- ON ERROR GOTO ERRQUIT
-
- IF ERR = 0 THEN
- sz$ = UIStartDlg("mscuistf.dll", SUCCESS, "FSuccessBitmapDlgProc", 0, "")
- dlg% = NETEXITSUCCESS
- szDlgProc$ = "FInfo075DlgProc"
- WriteToLogFile TR_SETUPSUCCEEDED
- ELSEIF ERR = STFQUIT THEN
- dlg% = EXITQUIT
- szDlgProc$ = "FInfo0DlgProc"
- WriteToLogFile TR_SETUPQUIT
- ELSE
- dlg% = EXITFAILURE
- szDlgProc$ = "FInfo0DlgProc"
- WriteToLogFile TR_SETUPFAILED
- ENDIF
- WriteToLogFile ""
-
-
- '' Put up one of the exit message dialog boxes
- QUITL1:
- sz$ = UIStartDlg("mscuistf.dll", dlg%, szDlgProc, 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO QUITL1
- ENDIF
- UIPopAll
- ShutDownInstall
- CloseLogFile
- END
-
-
- '' An error has occurred in MSTest. Tell the user and abort.
- ERRQUIT:
- i% = DoMsgBox( TR_ERRQUIT, TR_SETUPMESSAGE, MB_OK+MB_TASKMODAL+MB_ICONHAND)
- WriteToLogFile TR_SETUPCORRUPTED
- WriteToLogFile ""
- ShutDownInstall
- CloseLogFile
- END
-
-
- '' Display an information dialog
- '' Uses the global Dialog% to identify which dialog to display
- INFO:
- WaitOff
- sz$ = UIStartDlg( "mscuistf.dll", Dialog%, "FInfo0DlgProc", 0, "" )
- SELECT CASE sz$
- CASE "CONTINUE"
- ''Do nothing
- CASE "REACTIVATE"
- bRecalc% = TRUE
- GOTO INFO
- CASE "EXIT"
- GOSUB ASKQUIT
- GOTO INFO
- END SELECT
- UIPop 1
- RETURN
-
-
- '' Get the base directory under which CorelDRAW! will be installed
- GETPATH:
- SetSymbolValue "EditTextIn", EditDir$
- SetSymbolValue "EditFocus", "END"
- GETPATHL1:
- WaitOff
- sz$ = UIStartDlg("mscuistf.dll", Dialog%, "FEditDlgProc", GETPATHHELP, "FHelpDlgProc")
- SELECT CASE sz$
- CASE "CONTINUE"
- WaitOn
- olddir$ = EditDir$
- EditDir$ = GetSymbolValue("EditTextOut")
-
- ''Validate new path.
- IF IsDirWritable(EditDir$) = 0 THEN
- oldDialog% = Dialog%
- Dialog% = BADPATH
- GOSUB INFO
- Dialog% = oldDialog%
- GOTO GETPATHL1
- ENDIF
-
- ''Set Recalc and change subdirectories if EditDir$ changed
- IF (olddir$ <> EditDir$) AND (olddir$ <> EditDir$+"\") AND (olddir$+"\" <> EditDir$) THEN
- bRecalc% = TRUE
- ENDIF
- olddir$ = ""
-
- CASE "REACTIVATE"
- GOTO GETPATHL1
- CASE "CANCEL", "BACK"
- UIPop 1
- GOTO GETDEST
- CASE ELSE
- GOSUB ASKQUIT
- GOTO GETPATHL1
- END SELECT
- UIPop 1
- RETURN
-
-
- '' The user has asked to quit - confirm his decision
- ASKQUIT:
- WaitOff
- sz$ = UIStartDlg("mscuistf.dll", ASKQUIT, "FQuitDlgProc", 0, "")
- SELECT CASE sz$
- CASE "EXIT"
- UIPopAll
- ERROR STFQUIT
- CASE "REACTIVATE"
- GOTO ASKQUIT
- CASE ELSE
- ''Do nothing
- END SELECT
- UIPop 1
- RETURN
-
-
- '**
- '** Purpose:
- '** Recalculates disk space required to install all net files. Also
- '** sets the copy list to contain all files.
- '** Arguments:
- '** none
- '** Returns:
- '** none
- '*************************************************************************
- SUB RecalcAll STATIC
- ClearCopyList
- TestAddSectionFilesToCopyList "Draw", DIR(DRAW), DEST$
- TestAddSectionFilesToCopyList "Chart", DIR(CHART), DEST$
- TestAddSectionFilesToCopyList "Show", DIR(SHOW), DEST$
- TestAddSectionFilesToCopyList "Photo", DIR(PHOTO), DEST$
- TestAddSectionFilesToCopyList "Trace", DIR(TRACE), DEST$
- '' If windows is networked and a cdrmem.dll is there, don't install any of the
- '' redist stuff - assume it is on the net.
- IF bWindowsIsNetworked% = FALSE OR DoesFileExist( MakePath(WINSYSDIR$,TR_REGLOAD_EXE), femExists ) = 0 THEN
- TestAddSectionFilesToCopyList "Redist", MakePath(DIR(MAIN),TR_REDIST), szWWinDir$
- ENDIF
- TestAddSectionFilesToCopyList "Effects", MakePath(DIR(CHART),TR_EFFECTS), MakePath(DEST$,TR_EFFECTS)
- TestAddSectionFilesToCopyList "ChartIni", DIR(CHART), WINDIR$
- IF WinMinor% = 0 THEN
- bCopyRedist30% = FALSE
- IF DoesFileExist(MakePath(DIR(DRAW),"cdrmem.dll"), femExists) THEN
- IF bWindowsIsNetworked% = FALSE OR DoesFileExist( MakePath(WINSYSDIR$,"cdrmem.dll"), femExists ) = 0 THEN
- TestAddSectionFilesToCopyList "DrawDLL", DIR(DRAW), szWWinDir$
- bCopyRedist30% = TRUE
- ENDIF
- ENDIF
- IF DoesFileExist(MakePath(DIR(MOSAIC),"cdrmem.dll"), femExists) THEN
- IF bWindowsIsNetworked% = FALSE OR DoesFileExist( MakePath(WINSYSDIR$,"cdrmem.dll"), femExists ) = 0 THEN
- TestAddSectionFilesToCopyList "MosaicDLL", DIR(MOSAIC), szWWinDir$
- bCopyRedist30% = TRUE
- ENDIF
- ENDIF
- IF DoesFileExist(MakePath(DIR(SHOW),"cdrmem.dll"), femExists) THEN
- IF bWindowsIsNetworked% = FALSE OR DoesFileExist( MakePath(WINSYSDIR$,"cdrmem.dll"), femExists ) = 0 THEN
- TestAddSectionFilesToCopyList "ShowDLL", DIR(SHOW), szWWinDir$
- bCopyRedist30% = TRUE
- ENDIF
- ENDIF
- IF DoesFileExist(MakePath(DIR(PHOTO),"pcx16.dll"), femExists) THEN
- IF bWindowsIsNetworked% = FALSE OR DoesFileExist( MakePath(WINSYSDIR$,"pcx16.dll"), femExists ) = 0 THEN
- TestAddSectionFilesToCopyList "PhotoDLL", DIR(PHOTO), szWWinDir$
- bCopyRedist30% = TRUE
- ENDIF
- ENDIF
- IF bCopyRedist30% THEN
- TestAddSectionFilesToCopyList "Redist30", MakePath(DIR(MAIN),TR_REDIST), szWWinDir$
- ENDIF
- ENDIF
-
- ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
- IF WinMinor% > 0 THEN
- '' Add extra cost to Windows drive for .fot files + logfile.txt, etc.
- ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
- '' calculate how much space is needed for each .fot file
- minfilesize% = GetMinFileSize( ndrive% )
- filesize% = minfilesize%
- WHILE filesize% < 1350
- filesize% = filesize% + minfilesize%
- WEND
- filesize% = filesize% + 100
- lSpace& = filesize% * 256 + 250000
- ReplaceListItem EXTRACOSTS$, ndrive%, STR$(lSpace&)
- ELSE
- ''Add extra cost to Windows drive for logfile.txt + ini/progman, etc.
- ReplaceListItem EXTRACOSTS$, ndrive%, "250000"
- ENDIF
-
- StillNeed& = GetCopyListCost(EXTRACOSTS$, "temp", "")
- ReplaceListItem EXTRACOSTS$, ndrive%, "0"
- RemoveSymbol( "temp" )
- IF StillNeed& > 0 THEN
- bTooBig% = TRUE
- ELSE
- bTooBig% = FALSE
- ENDIF
- END SUB
-
-
- '**
- '** Purpose:
- '** Removes the optional trailing "\"
- '** Arguments:
- '** szDir$ - full directory path (with optional ending "\")
- '** Returns:
- '** szDir$ without a trailing "\"
- '*************************************************************************
- FUNCTION MakeDir (szDir$) STATIC AS STRING
- IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
- MakeDir = MID$( szDir$, 1, LEN(szDir$) - 1 )
- ELSE
- MakeDir = szDir$
- ENDIF
- END FUNCTION
-
-
- '**
- '** 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
- MakePath = MakeDir(szDir$) + "\" + szFile$
- END FUNCTION
-
-
- '** Set the subdirectories to their default values.
- '*************************************************************************
- SUB SetDirectories STATIC
- ini$ = MakePath( LOCATION$, TR_SETUP_INI )
- DIR(DRAW) = GetIniKeyString( ini$, "Directories", TR_DRAW )
- DIR(CHART) = GetIniKeyString( ini$, "Directories", TR_CHART )
- DIR(SHOW) = GetIniKeyString( ini$, "Directories", TR_SHOW )
- DIR(PHOTO) = GetIniKeyString( ini$, "Directories", TR_PHOTOPNT )
- DIR(TRACE) = GetIniKeyString( ini$, "Directories", TR_TRACE )
- DIR(MOSAIC) = GetIniKeyString( ini$, "Directories", TR_MOSAIC )
- DIR(FONTSYM) = GetIniKeyString( ini$, "Directories", TR_FONTS )
- szFontDir$ = GetIniKeyString( ini$, "Directories", TR_TTF )
- DIR(MAIN) = GetIniKeyString( ini$, "Directories", TR_MAIN )
- IF GetIniKeyString( ini$, "Directories", TR_FIXEDDRIVE ) = "FALSE" THEN
- FOR i% = DRAW TO MAIN STEP 1
- DIR(i%) = MID$( ini$, 1, 1 ) + MID$( DIR(i%), 2, LEN(DIR(i%))-1 )
- NEXT i%
- szFontDir$ = MID$( ini$, 1, 1 ) + MID$( szFontDir$, 2, LEN(szFontDir$)-1 )
- ENDIF
- END SUB
-
-
- '** Make sure that the long wait dialog is displayed and the hourglass cursor
- '** are being used
- '*************************************************************************
- SUB WaitOnBig STATIC
- IF nWaiting% = 0 THEN
- CursorSave% = ShowWaitCursor()
- sz$ = UIStartDlg("mscuistf.dll", WAIT, "FModelessDlgProc", 0, "")
- nWaiting% = 2
- ELSEIF nWaiting% = 1 THEN
- sz$ = UIStartDlg("mscuistf.dll", WAIT, "FModelessDlgProc", 0, "")
- nWaiting% = 2
- ENDIF
- END SUB
-
-
- '** Make sure that the hourglass cursor is being used
- '*************************************************************************
- SUB WaitOn STATIC
- IF nWaiting% = 0 THEN
- CursorSave% = ShowWaitCursor()
- nWaiting% = 1
- ENDIF
- END SUB
-
-
- '** Remove the long wait dialog if it is being displayed and reset the cursor
- '** back to normal if it was set to the hourglass icon
- '*************************************************************************
- SUB WaitOff STATIC
- IF nWaiting% = 2 THEN
- UIPop 1
- RestoreCursor CursorSave%
- nWaiting% = 0
- ELSEIF nWaiting% = 1 THEN
- RestoreCursor CursorSave%
- nWaiting% = 0
- ENDIF
- END SUB
-
-
- '** Adds each file in the given section to the list of files to be copied,
- '** after checking to see if the file was installed by the administrator.
- '*************************************************************************
- SUB TestAddSectionFilesToCopyList (szSection$,szFrom$,szTo$) STATIC
- MakeListFromSectionKeys "___temp_", szSection$
- NeedsList$ = GetSymbolValue( "___temp_" )
- RemoveSymbol "___temp_"
- nIndex% = 0
- nIndexInc% = ScanList(NeedsList$,nIndex%)
- WHILE nIndexInc% > 0
- szKey$ = MID$(NeedsList$, nIndex%+3, nIndexInc%-3)
- szFileName$ = GetSectionKeyFilename( szSection$, szKey$ )
- IF DoesFileExist( MakePath(szFrom$,szFileName$), femExists) = 1 THEN
- AddSectionKeyFileToCopyList szSection$, szKey$, szFrom$, szTo$
- ENDIF
- nIndex% = nIndex% + nIndexInc%
- nIndexInc% = ScanList(NeedsList$,nIndex%)
- WEND
- szFileName$ = ""
- szKey$ = ""
- NeedsList$ = ""
- END SUB
-
-
- '** If the second file does not exist, backup szFile1$ as szFile2$
- '*************************************************************************
- SUB CheckBackupFile( szFile1$, szFile2$ ) STATIC
- IF DoesFileExist(szFile2$,femExists) = 0 AND DoesFileExist(szFile1$,femExists) THEN
- CopyFile szFile1$, szFile2$, cmoNone, 0
- ENDIF
- END SUB
-
-
- '*************************************************************************
- FUNCTION CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) STATIC AS INTEGER
- szItemNew$ = szItem$
- IF szOther$ <> "" THEN
- szItemNew$ = szItem$ + "," + szOther$
- END IF
-
- IF FCreateProgManItem(szGroup$, szItemNew$, szCmd$, cmo%) = 0 THEN
- CreateProgmanItem = 1
- ELSE
- CreateProgmanItem = 0
- END IF
- szItemNew$ = ""
- END FUNCTION
-
-
- '** Wrapper function - should reduce size of code segment.
- '**
- '** CommentIniSection checks to see whether or not the files mentioned in
- '** szSection$ can be found in directory szPath$. If not, it sticks a ';'
- '** in front of that line of the ini file. Otherwise it makes sure there
- '** is not semi-colon commenting out that line.
- '** Note: this function is heavily dependent on the format of coreldrw.ini
- '*************************************************************************
- SUB WrapCommentIniSection( szFileName$, szTempFile$, szSection$, szPath$ ) STATIC
- CommentIniSection szFileName$, szTempFile$, szSection$, szPath$
- END SUB
-