home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1995-05-10 | 33.2 KB | 1,090 lines
'************************************************************************** '* MS Test script for Win32s setup program '************************************************************************** ''$DEFINE DEBUG ''Define for script development/debugging '$INCLUDE 'setupapi.inc' '$INCLUDE 'msdetect.inc' ''Dialog ID's CONST WELCOME = 100 CONST AMADEUSWELCOME = 150 CONST ASKQUIT = 200 CONST DESTPATH = 300 CONST EXITFAILURE = 400 CONST EXITQUIT = 600 CONST EXITSUCCESS = 700 CONST OPTIONS = 800 CONST SERVEROPTION = 850 CONST BADPATH = 6400 CONST HELPWELCOME = 1000 CONST VERPATH = 1100 CONST EXITFAILNOTWIN31 = 1200 CONST EXITFAILNOTENH = 1300 CONST EXITFAILNOTPAGING = 1325 CONST EXITFAILNOTINTEL = 1350 CONST AMADEUSINST = 1400 CONST FREECELLINSTNOWIN32S = 1450 CONST FREECELLPATH = 1500 ''CONST HELPFREECELL = 1600 CONST APPHELP = 1000 CONST CUSTINST = 6200 ''Bitmap ID CONST LOGO = 1 GLOBAL bInstallDVA% GLOBAL DESTSYS$ ''Windows\System directory. GLOBAL DEST32S$ ''Windows\System\Win32s directory GLOBAL DESTWING$ ''Windows\System directory for WinG. ''File Types CONST APPFILES = 1 CONST OPT_EWAN_FILES = 2 CONST OPT_FTP_FILES = 3 CONST OPT_PS_FILES = 4 CONST OPT_SCENE_FILES = 5 CONST OPT_LOCAL_FILES = 6 CONST OPT_PS_ALONE_FILES = 7 CONST OPT_HMCARD_FILES = 8 GLOBAL DEST$ ''Destination directory GLOBAL WINDRIVE$ ''Windows drive letter. GLOBAL OPT_EWAN$ ''Option Selection for Ewan-Files GLOBAL OPT_FTP$ ''Option Selection for FTP-Files GLOBAL OPT_PS$ ''Option Selection for PS-Viewer-Files GLOBAL OPT_SCENE$ GLOBAL OPT_LOCAL$ GLOBAL OPT_PS_ALONE$ GLOBAL OPT_HMCARD$ ''CustInst list symbol names CONST MAX_CUST_OPTIONS = 5 GLOBAL APPNEEDS$ ''Option list costs per drive GLOBAL OPT_EWAN_NEEDS$ GLOBAL OPT_FTP_NEEDS$ GLOBAL OPT_PS_NEEDS$ GLOBAL OPT_SCENE_NEEDS$ GLOBAL OPT_LOCAL_NEEDS$ GLOBAL OPT_PS_ALONE_NEEDS$ GLOBAL OPT_HMCARD_NEEDS$ 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$ ''Installation mode GLOBAL INSTALLMODE% CONST MIN_INSTALL = 1 CONST CUST_INSTALL = 2 CONST MAX_INSTALL = 3 CONST SERV_INSTALL = 4 DECLARE SUB Install DECLARE SUB UpdateSystemIni DECLARE SUB RebootSystem DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING DECLARE FUNCTION GetRealWindowsSysDir AS STRING DECLARE SUB UpdateWinG32 (szOrig$) DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$) DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER DECLARE FUNCTION ShareEnabled LIB "INIUPD.DLL" AS INTEGER DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER DECLARE SUB AddOptFilesToCopyList (ftype%) DECLARE SUB RecalcOptFiles (ftype%) DECLARE SUB RecalcPath DECLARE SUB SetDriveStatus INIT: CUIDLL$ = "mscuistf.dll" ''Custom user interface dll HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure szOldVer$ ="1.00.000 " ''Reserve space in string for version bInstallDVA% = 0 WIN32ENABLED% = 0 SERVERINSTALL% = 0 ''1 ... install on a server GLOBAL AlwaysCopy% AlwaysCopy% = 0 ON ERROR GOTO ERRNORMAL SrcDir$ = GetSymbolValue("STF_SRCDIR") SetBitmap CUIDLL$, LOGO SetTitle "Amadeus Setup Program" szInf$ = GetSymbolValue("STF_SRCINFPATH") IF szInf$ = "" THEN szInf$ = GetSymbolValue("STF_CWDDIR") + "setup.inf" END IF ReadInfFile szInf$ DESTSYS$ = GetWindowsSysDir() DEST32S$ = DESTSYS + "WIN32S\" IF OnWindowsNT() THEN DESTSYS$ = MID$(DESTSYS$, 1, LEN(DESTSYS$) - 1) DESTSYS$ = DESTSYS$+ "32\" END IF WinDrive$ = MID$(GetWindowsDir, 1, 1) IF IsDriveValid(WinDrive$) = 0 THEN i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK) GOTO QUIT END IF DEST$ = WINDRIVE$ + ":\AMADEUS" ''CustInst list symbols CHECKSTATES$ = "CheckItemsState" STATUSTEXT$ = "StatusItemsText" DRIVETEXT$ = "DriveStatusText" ' all choices to on FOR i% = 1 TO 8 STEP 1 AddListItem CHECKSTATES$, "ON" NEXT i% ' clear all text for choice FOR i% = 1 TO 8 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 APPNEEDS$ = "AppNeeds" OPT_EWAN_NEEDS$ = "Opt_Ewan_Needs" OPT_FTP_NEEDS$ = "Opt_Ftp_Needs" OPT_PS_NEEDS$ = "Opt_Ps_Needs" OPT_SCENE_NEEDS = "Opt_Scene_Needs" OPT_LOCAL_NEEDS$ = "Opt_Local_Needs" OPT_PS_ALONE_NEEDS$ = "Opt_Ps_Alone_Needs" OPT_HMCARD_NEEDS$ = "Opt_HmCard_Needs" EXTRACOSTS$ = "ExtraCosts" BIGLIST$ = "BigList" FOR i% = 1 TO 8 STEP 1 AddListItem BIGLIST$, "" NEXT i% FOR i% = 1 TO 26 STEP 1 AddListItem EXTRACOSTS$, "0" NEXT i% ''File Option Variables OPT_EWAN$ = "1" OPT_FTP$ = "1" OPT_PS$ = "1" OPT_SCENE$ = "1" OPT_LOCAL$ = "1" OPT_PS_ALONE$ = "1" OPT_HMCARD$ = "1" ' RecalcPath ' SetDriveStatus '$IFDEF DEBUG i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal '$ENDIF ''DEBUG WELCOME: sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", HELPWELCOME, HELPPROC$) IF sz$ = "CONTINUE" THEN UIPop 1 ELSE GOSUB ASKQUIT GOTO WELCOME END IF CHOOSEINSTALLMODE: sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", 0, "") selectopt$ = GetSymbolValue("ButtonChecked") IF sz$ = "CONTINUE" THEN UIPop 1 ELSE GOSUB ASKQUIT GOTO CHOOSEINSTALLMODE END IF IF selectopt$ = "1" THEN INSTALLMODE% = MIN_INSTALL ELSEIF selectopt$ = "2" THEN INSTALLMODE% = CUST_INSTALL ELSEIF selectopt$ = "3" THEN INSTALLMODE% = MAX_INSTALL ELSEIF selectopt$ = "4" THEN INSTALLMODE% = SERV_INSTALL SERVERINSTALL% = 1 GOTO GETMINPATH END IF ' only TRUE for SETUP2 WIN32ENABLED% = 1 IF WIN32ENABLED% = 1 THEN GOTO AMADEUS END IF CHECK: IF GetWindowsMajorVersion < 3 THEN ExitCode% = EXITFAILNOTWIN31 GOTO QUIT END IF IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 10 THEN ExitCode% = EXITFAILNOTWIN31 GOTO QUIT END IF '' Check that we are not runnig on Chicago, including pre-released '' Chicago versions. IF GetWindowsMajorVersion * 100 + GetWindowsMinorVersion > 350 THEN ExitCode% = EXITSUCCESS WIN32ENABLED% = 1 GOTO AMADEUS END IF IF GetWindowsMode < 2 THEN IF OnWindowsNT() THEN ExitCode% = EXITFAILNOTINTEL '' Running on Windows NT (on RISC) ELSE ExitCode% = EXITFAILNOTENH '' Standard Mode Windows END IF GOTO QUIT END IF IF OnWindowsNT() THEN ExitCode% = EXITSUCCESS WIN32ENABLED% = 1 GOTO AMADEUS END IF ExitCode% = EXITSUCCESS '' Get version of Win32s to be installed from version info in file szNewVer$ = GetVersionOfFile( GetSymbolValue("STF_SRCDIR") + "WIN32S16.DLL" ) '' Check if Win32s is partially installed sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "Win32s", "Setup") '' If WIN32S.INI specifies Setup=0, then force complete Win32s file overwrite IF sz$ = "0" THEN AlwaysCopy% = 1 GOTO GETWIN32SPATH END IF '' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI IF sz$ <> "1" THEN GOTO GETWIN32SPATH END IF '' If Win32s is already installed, get running version number i% = DoesFileExist( DESTSYS$ + "W32SYS.DLL", femExists ) IF i% = 1 THEN i% = IsWin32sLoaded( szOldVer$ ) END IF IF i% = 0 THEN GOTO GETWIN32SPATH END IF IF szNewVer$ > szOldVer$ THEN GOTO GETWIN32SPATH END IF WIN32ENABLED% = 1 GOTO AMADEUS GETWIN32SPATH: IF PagingEnabled() = 0 THEN i% = DoMsgBox("Use the Control Panel 386 Enhanced icon and configure Windows using the Virtual Memory option.", "Win32s requires Virtual Memory", MB_TASKMODAL+MB_ICONHAND+MB_OK) ExitCode% = EXITFAILURE '' Enhanced mode but not paging GOTO QUIT END IF IF ShareEnabled() = 0 THEN i% = DoMsgBox( "File-sharing must be enabled. Run SHARE.EXE before starting Windows or add SHARE.EXE to your AUTOEXEC.BAT file.", "Win32s Setup: SHARE.EXE is not loaded", MB_TASKMODAL+MB_ICONEXCLAMATION+MB_OK) END IF SetSymbolValue "EditTextIn", DESTSYS$ SetSymbolValue "EditFocus", "END" GETPATHL1: sz$ = UIStartDlg(CUIDLL$, VERPATH, "FDispDlgProc", HELPWELCOME, HELPPROC$) IF sz$ = "CONTINUE" THEN IF IsDirWritable(DESTSYS$) = 0 THEN GOSUB BADPATH GOTO GETPATHL1 END IF UIPop 1 ELSEIF sz$ = "REACTIVATE" THEN GOTO GETPATHL1 ELSEIF sz$ = "BACK" THEN UIPop 1 GOTO WELCOME ELSE GOSUB ASKQUIT GOTO GETPATHL1 END IF COPYFILES: CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite '' Indicate Win32s install failure until all files known to be copied. ExitCode% = EXITFAILURE ERR = 0 CreateDir DEST32S$, cmoNone Install UpdateSystemIni '' Terminate if unhandled fatal error IF ERR <> 0 THEN GOTO QUIT END IF CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "1", cmoOverwrite CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Version", szNewVer$, cmoOverwrite CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Nls", "AnsiCP", "1252", cmoOverwrite '' Indicate Win32s correctly copied and installed. ExitCode% = EXITSUCCESS sz$ = UIStartDlg(CUIDLL$, AMADEUSINST, "FInfoDlgProc",0, "") IF sz$ = "CONTINUE" THEN UIPop 1 ELSE GOTO QUIT END IF AMADEUS: IF INSTALLMODE% = MIN_INSTALL THEN ReplaceListItem CHECKSTATES$, OPT_EWAN_FILES, "OFF" ReplaceListItem CHECKSTATES$, OPT_FTP_FILES, "OFF" ReplaceListItem CHECKSTATES$, OPT_PS_FILES, "OFF" ReplaceListItem CHECKSTATES$, OPT_SCENE_FILES, "OFF" ReplaceListItem CHECKSTATES$, OPT_LOCAL_FILES, "OFF" ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "OFF" ReplaceListItem CHECKSTATES$, OPT_HMCARD_FILES, "OFF" GOTO GETMINPATH ELSEIF INSTALLMODE% = CUST_INSTALL THEN ReplaceListItem CHECKSTATES$, OPT_LOCAL_FILES, "OFF" ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "OFF" ReplaceListItem CHECKSTATES$, OPT_HMCARD_FILES, "OFF" RecalcPath SetDriveStatus GOTO CUSTINST ELSEIF INSTALLMODE% = MAX_INSTALL THEN ReplaceListItem CHECKSTATES$, OPT_EWAN_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_FTP_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_PS_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_SCENE_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_LOCAL_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_HMCARD_FILES, "ON" GOTO GETMINPATH ELSEIF INSTALLMODE% = SERV_INSTALL THEN ReplaceListItem CHECKSTATES$, OPT_EWAN_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_FTP_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_PS_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_SCENE_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_LOCAL_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "ON" ReplaceListItem CHECKSTATES$, OPT_HMCARD_FILES, "ON" GOTO GETMINPATH END IF CUSTINST: sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$) RecalcOptFiles APPFILES SetDriveStatus IF sz$ = "CONTINUE" THEN ''Install only if it will fit. FOR i% = 1 TO 1 STEP 1 IF GetListItem(BIGLIST$, i%) <> "" THEN GOSUB TOOBIG GOTO CUSTINST END IF NEXT i% UIPop 1 GOTO INSTALLAMADEUS ELSEIF sz$ = "PATH" THEN GOTO GETAMADEUSPATH ELSEIF sz$ = "CHK1" THEN RecalcOptFiles APPFILES SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "CHK2" THEN RecalcOptFiles OPT_EWAN_FILES SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "CHK3" THEN RecalcOptFiles OPT_FTP_FILES SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "CHK4" THEN IF GetListItem(CHECKSTATES$, OPT_PS_FILES) = "OFF" THEN ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "OFF" END IF RecalcOptFiles OPT_PS_FILES RecalcOptFiles OPT_PS_ALONE_FILES SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "CHK5" THEN RecalcOptFiles OPT_SCENE_FILES SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "CHK6" THEN RecalcOptFiles OPT_LOCAL_FILES SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "CHK7" THEN IF GetListItem(CHECKSTATES$, OPT_PS_ALONE_FILES) = "ON" THEN ReplaceListItem CHECKSTATES$, OPT_PS_FILES, "ON" END IF RecalcOptFiles OPT_PS_FILES RecalcOptFiles OPT_PS_ALONE_FILES SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "CHK8" THEN RecalcOptFiles OPT_HMCARD_FILES SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "REACTIVATE" THEN RecalcPath SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "BACK" THEN UIPop 1 GOTO CHOOSEINSTALLMODE ELSE GOSUB ASKQUIT GOTO CUSTINST END IF INSTALLSERVER: ExitCode% = EXITFAILURE ERR = 0 ClearCopyList AddSectionFilesToCopyList "ServerWin32s", SrcDir$, DEST$ AddOptFilesToCopyList APPFILES AddOptFilesToCopyList OPT_EWAN_FILES AddOptFilesToCopyList OPT_FTP_FILES AddOptFilesToCopyList OPT_PS_FILES AddOptFilesToCopyList OPT_SCENE_FILES AddOptFilesToCopyList OPT_LOCAL_FILES AddOptFilesToCopyList OPT_PS_ALONE_FILES AddOptFilesToCopyList OPT_HMCARD_FILES AddSectionFilesToCopyList "ServerFiles", SrcDir$, DEST$ CreateDir DEST$, cmoNone IF GetListItem(CHECKSTATES$, OPT_PS_FILES) = "ON" THEN CreateDir DEST$ + "\gs", cmoNone END IF CopyFilesInCopyList IF ERR = 0 THEN RenameFile DEST$ + "\server.lst", "setup.lst" END IF IF ERR = 0 THEN i% = DoMsgBox("Amadeus was successfully installed.", "Amadeus Setup", MB_OK+MB_TASKMODAL) END END IF GOTO QUIT INSTALLAMADEUS: ExitCode% = EXITFAILURE ERR = 0 ClearCopyList AddOptFilesToCopyList APPFILES AddOptFilesToCopyList OPT_EWAN_FILES AddOptFilesToCopyList OPT_FTP_FILES AddOptFilesToCopyList OPT_PS_FILES AddOptFilesToCopyList OPT_SCENE_FILES AddOptFilesToCopyList OPT_LOCAL_FILES AddOptFilesToCopyList OPT_PS_ALONE_FILES AddOptFilesToCopyList OPT_HMCARD_FILES CreateDir DEST$, cmoNone IF GetListItem(CHECKSTATES$, OPT_PS_FILES) = "ON" THEN CreateDir DEST$ + "\gs", cmoNone END IF ' ######## WinG ######### SrcDir$ = GetSymbolValue("STF_SRCDIR") DESTWING$ = GetWindowsSysDir AddSectionFilesToCopyList "runtime", SrcDir$, DESTWING$ ' ' only use DVA on Windows 3.x ' IF OnWin3x() = 1 THEN AddSectionFilesToCopyList "dva", SrcDir$, DESTWING$ IF VflatdPresent() = 0 THEN CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite bInstallDVA% = 1 END IF END IF DESTWING$ = GetRealWindowsSysDir AddSectionFilesToCopyList "wing32", SrcDir$, DESTWING$ Dest1$ = MakePath(DEST$,"wing32.dll") Dest2$ = MakePath(DEST$,"wing32.xxx") RenameFilePlease Dest1$,Dest2$ ' ######## WinG ######### CopyFilesInCopyList IF ERR <> 0 THEN GOTO QUIT END IF IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN CopyFile DEST$ + "\ctl3d32.dll", DESTSYS$ + "ctl3d32.dll", cmoOverwrite, 0 RemoveFile DEST$ + "\ctl3d32.dll", cmoNone RemoveIniSection "WIN.INI", "Amadeus", cmoNone CreateIniKeyValue "WIN.INI", "Amadeus", "Dir", DEST$, cmoNone CreateProgmanGroup "Amadeus", "Amadeus", cmoNone CreateProgmanItem "Amadeus", "Amadeus", MakePath(DEST$,"amadeus.exe"), "", cmoOverwrite CreateIniKeyValue DEST$ + "\Amadeus.ini", "TextViewer", "StyleDirectory", DEST$, cmoOverwrite END IF IF GetListItem(CHECKSTATES$, OPT_EWAN_FILES) = "ON" THEN CopyFile DEST$ + "\ctl3dv2.dll", DESTSYS$ + "ctl3dv2.dll", cmoOverwrite, 0 RemoveFile DEST$ + "\ctl3dv2.dll", cmoNone CopyFile DEST$ + "\bwcc.dll", DESTSYS$ + "bwcc.dll", cmoOverwrite, 0 RemoveFile DEST$ + "\bwcc.dll", cmoNone CreateIniKeyValue GetWindowsDir() + "Ewan.ini", "Terminal", "Emulation", "VT100.DLL" , cmoNone END IF ' create icon for Scene viewer IF GetListItem(CHECKSTATES$, OPT_SCENE_FILES) = "ON" THEN CreateProgmanGroup "Amadeus", "Amadeus", cmoNone CreateProgmanItem "Amadeus", "Scene Viewer", MakePath(DEST$,"scene.exe"), "", cmoOverwrite END IF ' create icon for Stand alone PS viewer IF GetListItem(CHECKSTATES$, OPT_PS_ALONE_FILES) = "ON" THEN CreateProgmanGroup "Amadeus", "Amadeus", cmoNone CreateProgmanItem "Amadeus", "Postscript Viewer", MakePath(DEST$,"psview.exe"), "", cmoOverwrite END IF ' create icon for Local Amadeus IF GetListItem(CHECKSTATES$, OPT_LOCAL_FILES) = "ON" THEN CreateProgmanGroup "Amadeus", "Amadeus", cmoNone CreateProgmanItem "Amadeus", "Local Amadeus", MakePath(DEST$,"locamad.exe"), "", cmoOverwrite END IF UpdateWinG32 GetRealWindowsSysDir() IF ERR = 0 THEN if bInstallDVA% = 1 then i% = DoMsgBox("Amadeus was successfully installed. To complete the installation Windows has to be restarted !", "Amadeus Setup", MB_OK+MB_TASKMODAL) rc% = RestartWindows end if i% = DoMsgBox("Amadeus was successfully installed.", "Amadeus Setup", MB_OK+MB_TASKMODAL) END END IF ERR = 0 QUIT: '' Install error handler for final message box routines ON ERROR GOTO ERRQUIT IF ERR = 0 THEN dlg% = ExitCode% ELSEIF ERR = STFQUIT THEN dlg% = EXITQUIT ExitCode% = EXITQUIT ELSE dlg% = EXITFAILURE ExitCode% = EXITQUIT END IF QUITL1: IF WIN32ENABLED% = 1 THEN UIPop 1 END END IF sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO QUITL1 END IF UIPop 1 ' ######## WinG ######### if bInstallDVA% = 1 then rc% = RestartWindows end if ' ######## WinG ######### IF ExitCode% = EXITSUCCESS THEN RebootSystem CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite i% = DoMsgBox("Win32s is not properly configured and Win32s Setup must be run again.", "Unable to Restart Windows", MB_ICONEXCLAMATION+MB_OK+MB_TASKMODAL) END IF END '' Fatal error handler for error message routine ERRQUIT: i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND) END '' Bypass run-time errors. Let final dialog box display fatal error message. ERRNORMAL: '' Check if user cancelled setup IF ERR = STFQUIT THEN GOTO QUIT END IF RESUME NEXT GETMINPATH: SetSymbolValue "EditTextIn", DEST$ SetSymbolValue "EditFocus", "END" GETMINPATHL1: sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN DEST$ = GetSymbolValue("EditTextOut") IF IsDirWritable(DEST$) = 0 THEN GOSUB BADPATH GOTO GETMINPATHL1 END IF UIPop 1 ELSEIF sz$ = "BACK" THEN UIPop 1 GOTO CHOOSEINSTALLMODE ELSEIF sz$ = "REACTIVATE" THEN GOTO GETMINPATHL1 ELSE GOSUB ASKQUIT GOTO GETMINPATHL1 END IF IF INSTALLMODE% = SERV_INSTALL THEN GOTO INSTALLSERVER ELSE GOTO INSTALLAMADEUS END IF GETAMADEUSPATH: SetSymbolValue "EditTextIn", DEST$ SetSymbolValue "EditFocus", "END" GETAMADEUSPATHL1: sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN olddest$ = DEST$ DEST$ = GetSymbolValue("EditTextOut") ''Validate new path. IF IsDirWritable(DEST$) = 0 THEN GOSUB BADPATH GOTO GETAMADEUSPATHL1 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 GETAMADEUSPATHL1 ELSEIF sz$ = "EXIT" THEN GOSUB ASKQUIT GOTO GETAMADEUSPATHL1 ELSE UIPop 1 GOTO CUSTINST END IF TOOBIG: sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN RecalcPath SetDriveStatus GOTO TOOBIG END IF UIPop 1 RETURN BADPATH: sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO BADPATH END IF UIPop 1 RETURN ASKQUIT: sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO ASKQUIT ELSE UIPop 1 END IF RETURN '** '** Purpose: '** Builds the copy list and performs all installation operations. '** Arguments: '** none. '** Returns: '** none. '************************************************************************* SUB Install STATIC ClearCopyList SrcDir$ = GetSymbolValue("STF_SRCDIR") '' Check if overwrite required. '' Use file layout sections that specify OLDER file version/time check AddSectionFilesToCopyList "WindowsSystem", SrcDir$, DESTSYS$ AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\" '' Add obsolete files to be removed AddSectionFilesToCopyList "Win32sSystemObsoleteFiles", SrcDir$, DESTSYS$ + "WIN32S\" SetRestartDir GetWindowsDir() CopyFilesInCopyList END SUB SUB UpdateSystemIni STATIC VxDPath$ = DEST32S$ + "W32S.386" SystemIniPath$ = GetWindowsDir() t% = MakeSystemIni(SystemIniPath$, VxdPath$) END SUB SUB RebootSystem STATIC ' Check if any files were locked during install. If the RestartList ' is not empty, ExitExecRestart() will restart Windows, cleanup setup ' files, and copy over locked files before Windows restarts. i% = RestartListEmpty() IF i% = 0 THEN ' ExitExecRestart() only returns if applications refuse to be shutdown. ' Win32s is installed but will not operate until Windows is restarted ' and the Win32s VxD is loaded. i% = ExitExecRestart() ELSE ' If the RestartList list is empty, it is necessary to restart windows ' directly. The MSSETUP program creates _MSRSTRT.EXE and _MSSETUP.BAT ' in the restart directory. This program should be exec'd to handle ' proper MSSETUP cleanup (temp files) and restart Windows. i% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" ) 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 '** '** Purpose: '** Adds the specified option files to the copy list. '** Arguments: '** ftype% - type of files to add, one of the following: '** APPFILES '** Returns: '** none. '************************************************************************* SUB AddOptFilesToCopyList (ftype%) STATIC IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN SrcDir$ = GetSymbolValue("STF_SRCDIR") IF ftype% = APPFILES THEN AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$ ELSEIF ftype% = OPT_EWAN_FILES THEN AddSectionFilesToCopyList "Opt_Ewan_Files", SrcDir$, DEST$ ELSEIF ftype% = OPT_FTP_FILES THEN AddSectionFilesToCopyList "Opt_Ftp_Files", SrcDir$, DEST$ ELSEIF ftype% = OPT_PS_FILES THEN AddSectionFilesToCopyList "Opt_Ps_Files", SrcDir$, DEST$ + "\gs" ELSEIF ftype% = OPT_SCENE_FILES THEN AddSectionFilesToCopyList "Opt_Scene_Files", SrcDir$, DEST$ ELSEIF ftype% = OPT_LOCAL_FILES THEN AddSectionFilesToCopyList "Opt_Local_Files", SrcDir$, DEST$ ELSEIF ftype% = OPT_PS_AlONE_FILES THEN AddSectionFilesToCopyList "Opt_Ps_Alone_Files", SrcDir$, DEST$ ELSEIF ftype% = OPT_HMCARD_FILES THEN AddSectionFilesToCopyList "Opt_HmCard_Files", 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: '** APPFILES '** Returns: '** none. '************************************************************************* SUB RecalcOptFiles (ftype%) STATIC CursorSave% = ShowWaitCursor() ClearCopyList AddOptFilesToCopyList ftype% fExtra% = 0 IF ftype% = APPFILES THEN ListSym$ = APPNEEDS$ IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN ''Add extra cost to Windows drive for ini/progman, etc. ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1 ReplaceListItem EXTRACOSTS$, ndrive%, "10240" fExtra% = 1 END IF ELSEIF ftype% = OPT_EWAN_FILES THEN ListSym$ = OPT_EWAN_NEEDS$ ELSEIF ftype% = OPT_FTP_FILES THEN ListSym$ = OPT_FTP_NEEDS$ ELSEIF ftype% = OPT_PS_FILES THEN ListSym$ = OPT_PS_NEEDS$ ELSEIF ftype% = OPT_SCENE_FILES THEN ListSym$ = OPT_SCENE_NEEDS$ ELSEIF ftype% = OPT_LOCAL_FILES THEN ListSym$ = OPT_LOCAL_NEEDS$ ELSEIF ftype% = OPT_PS_ALONE_FILES THEN ListSym$ = OPT_PS_ALONE_NEEDS$ ELSEIF ftype% = OPT_HMCARD_FILES THEN ListSym$ = OPT_HMCARD_NEEDS$ 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" 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 APPFILES RecalcOptFiles OPT_EWAN_FILES RecalcOptFiles OPT_FTP_FILES RecalcOptFiles OPT_PS_FILES RecalcOptFiles OPT_SCENE_FILES RecalcOptFiles OPT_LOCAL_FILES RecalcOptFiles OPT_PS_ALONE_FILES RecalcOptFiles OPT_HMCARD_FILES RestoreCursor CursorSave% END SUB '** '** Purpose: '** Sets drive status info according to latest disk space calcs. '** Arguments: '** none. '** Returns: '** none. '************************************************************************* SUB SetDriveStatus STATIC drive$ = MID$(DEST$, 1, 1) ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1 cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_EWAN_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_FTP_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_PS_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_SCENE_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_LOCAL_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_PS_ALONE_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_HMCARD_NEEDS$, ndrive%)) free& = GetFreeSpaceForDrive(drive$) ReplaceListItem DRIVETEXT$, 1, drive$ + ":" ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K" ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K" IF drive$ = WINDRIVE$ THEN ReplaceListItem DRIVETEXT$, 4, "" ReplaceListItem DRIVETEXT$, 5, "" ReplaceListItem DRIVETEXT$, 6, "" ELSE ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1 cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_EWAN_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_FTP_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_PS_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_SCENE_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_LOCAL_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_PS_ALONE_NEEDS$, ndrive%)) cost& = cost& + VAL(GetListItem(OPT_HMCARD_NEEDS$, 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 END IF END SUB FUNCTION GetRealWindowsSysDir STATIC AS STRING szBuf$ = string$(260, 32) cbBuf% = GetRealSystemDir(szBuf$, 260) IF cbBuf% = 0 THEN ERROR STFERR ELSE IF cbBuf% > 259 THEN res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ERROR STFERR END IF szBuf$ = RTRIM$(szBuf$) IF MID$(szBuf$, 1, 1) = "\" THEN szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$ ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$ END IF IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN szBuf$ = szBuf$ + "\" END IF GetRealWindowsSysDir = szBuf$ END IF szBuf$ = "" END FUNCTION SUB UpdateWinG32 (szOrig$) STATIC ' ' Here we check the version ourselves of wing32.dll, since ' we can't get version checking for Win32 apps from Win16 ' FileNew$ = MakePath(szOrig$, "wing32.dll") FileOrig$ = MakePath(szOrig$, "wing32.xxx") IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN RemoveFile FileOrig$, cmoForce ELSE RemoveFile FileNew$, cmoForce ' get rid of new file RenameFilePlease FileOrig$,FileNew$ ' put back old file END IF END SUB