home *** CD-ROM | disk | FTP | other *** search
Wrap
'**************************************************************************** '** ROMT Install Script - Doc Apps ** '**************************************************************************** DIM Arg$(4) '' Set maximum command line arguments to 4 GOSUB CmdLine '' MUST be done BEFORE including 'setupapi.inc' IF Arg$(3) = "NOAUDIO" THEN '' Check user argument 1 NOAUDIO% = 1 GOTO INCs END IF IF Arg$(4) = "NOAUDIO" THEN '' Check user argument 2 NOAUDIO% = 1 GOTO INCs END IF '$DEFINE AUDIO_ENABLED '' User hasn't turned audio off, so play it INCs: '$INCLUDE 'setupapi.inc' '$INCLUDE 'msdetect.inc' '$INCLUDE 'romt.inc' '$IFDEF AUDIO_ENABLED '' User has turned audio off, so don't load func DECLARE FUNCTION sndPlaySound LIB "MMSYSTEM.DLL" (AudFilename$, Flags%) AS INTEGER '$ENDIF ''AUDIO_ENABLED '**************************************************************************** Group$ = "Rom Tech Software" '' Group name for Shell AppTitle$ = "Exploring Civilizations" '' Application Title for Shell AppExeName$ = "\CV.EXE" '' Application Executable Name for Shell AppDir$ = "\CVEXE" '' Application directory on CD-ROM ProgRoot$ = "\CV" '' Application default directory on HD RT$ = "\RUNTIME\" '' Directory on CD-ROM where VfW Runtime resides MSOBitmap$ = "CV.BMP" '' MS Office bitmap file for AppTitle$ Win3xInfoEXE$ = "WRITE.EXE" '' Windows 3.x Application to handle InfoFile$ Win95InfoEXE$ = "WORDPAD.EXE" '' Windows 95 Application to handle InfoFile$ InfoFile$ = "\README.WRI" '' Information filename - must be compatible with InfoExe$ OtherAppsTitle$ = "Other RomTech Applications" '' Title for Other Apps Help File OtherAppsFile$ = "\Others.hlp" '' Other Apps Help Filename WantedDiskSize& = 2048000 '' Disk space needed for minimum installation FullWantedDiskSize& = 40960000 '' Disk space needed for full installation '**************************************************************************** '**************************************************************************** '** Beginning of script ** '**************************************************************************** INIT: WIN32ENABLED% = 0 VfWFailed% = 0 SrcDir$ = GetSymbolValue("STF_SRCDIR") SrcDrive$ = MID$(SrcDir$,1,1) + ":" WinDir$ = GetWindowsDir() WinSysDir$ = GetWindowsSysDir() WinSys32Dir$ = WinDir$ + "system32" OpenLogFile WinDir$ + "ROMT.LOG", 0 WriteToLogFile "" WriteToLogFile " ROMT Install LOG file" WriteToLogFile "" WriteToLogFile "Windows directory is " + WinDir$ WriteToLogFile "" WriteToLogFile "Group = " + Group$ WriteToLogFile "AppTitle = " + AppTitle$ WriteToLogFile "AppDir = " + AppDir$ WriteToLogFile "AppExeName = " + AppExeName$ WriteToLogFile "SrcDrive = " + SrcDrive$ WriteToLogFile "" IF NOAUDIO% = 0 THEN WriteToLogFile "Audio Enabled." ELSE WriteToLogFile "Audio Disabled by user." END IF WriteToLogFile "" CUIDLL$ = "mscuistf.dll" ''RomTech user interface dll HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure MajorVer% = GetWindowsMajorVersion() MinorVer% = GetWindowsMinorVersion() WriteToLogFile "WindowsMajorVersion = " + STR$(MajorVer%) WriteToLogFile "WindowsMinorVersion = " + STR$(MinorVer%) IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software. Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) WriteToLogFile "ERROR: Microsoft Windows version was " + str$(MajorVer%) + "." + str$(MinorVer%) CloseLogFile END END IF ' Use Wowexec to determine version of NT. 3.1 did not stamp wowexec and wow returns 3.1 as version IF OnWindowsNT() THEN OnNT$ = "TRUE" WowVersion$ = GetVersionOfFile(WinSys32Dir$ + "\wowexec.exe") IF WowVersion$ = "" THEN i% = DoMsgBox("Video for Windows does not run on Windows NT 3.1. Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) WriteToLogFile "ERROR: Microsoft Windows NT running." CloseLogFile END END IF END IF SetBitmap CUIDLL$, LOGO SetTitle AppTitle$ + " - Installation Program" szInf$ = GetSymbolValue("STF_SRCINFPATH") IF szInf$ = "" THEN szInf$ = GetSymbolValue("STF_CWDDIR") + "ROMT.INF" END IF ReadInfFile szInf$ WinDrive$ = MID$(WinDir$, 1, 1) DEST$ = WinDrive$ + ":" + ProgRoot$ '** '** Purpose: '** Show and process WELCOME dialog '**************************************************************************** WELCOME: IF NOAUDIO% = 0 THEN r% = PlayWAV(SrcDrive$ + "\welcome.wav") END IF sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN UIPop 1 ELSE UIPopAll r% = PlayWAV("") GOSUB ASKQUIT GOTO WELCOME END IF r% = PlayWAV("") OpProc% = 1 Install GOTO VfW '** '** Purpose: '** Check for and optionally install MS Video for Windows 1.1 '**************************************************************************** VfW: ' If running Windows95, do not install VFW... IF (MajorVer% = 3 AND MinorVer%<=95) THEN AVI$ = GetIniKeyString$("WIN.INI", "mci extensions", "avi") IF AVI$ = "AVIVideo" THEN sz$ = UIStartDlg(CUIDLL$, DO_AVI_YN, "FQuitDlgProc", 0, "") IF sz$ = "CONTINUE" THEN VfW_ANSWER$ = "Yes" WriteToLogFile "Answer to VfW question = " + VfW_ANSWER$ GOSUB InstallVfW UIPopAll ELSEIF sz$ = "REACTIVATE" THEN GOTO VfW ELSEIF sz$ = "EXIT" THEN VfW_ANSWER$ = "No" WriteToLogFile "Answer to VfW question = " + VfW_ANSWER$ UIPopAll END IF ELSE VfW_ANSWER$ = "Yes" WriteToLogFile "Answer to VfW question = " + VfW_ANSWER$ GOSUB InstallVfW END IF END IF '** '** Purpose: '** Ask if user wishes to view OTHERS.HLP '**************************************************************************** OTHERS: IF NOAUDIO% = 0 THEN r% = PlayWAV(SrcDrive$ + "\other.wav") END IF sz$ = UIStartDlg(CUIDLL$, DO_OTHERS_YN, "FQuitDlgProc", 0, "") IF sz$ = "CONTINUE" THEN r% = PlayWAV("") ChDrive(SrcDrive$) ChDir(AppDir$) Run (WinDir$ + "winhelp " + SrcDrive$ + AppDir$ + "\others.hlp") OTHERS_ANSWER$ = "Yes" UIPopAll ELSEIF sz$ = "REACTIVATE" THEN r% = PlayWAV("") GOTO OTHERS ELSEIF sz$ = "EXIT" THEN r% = PlayWAV("") OTHERS_ANSWER$ = "No" UIPopAll END IF WriteToLogFile "Answer to OTHERS question = " + OTHERS_ANSWER$ WriteToLogFile "" '** '** Purpose: '** Handle quit messages from SUBs, et al '**************************************************************************** QUIT: ON ERROR GOTO ERRQUIT IF ERR = 0 THEN IF NOAUDIO% = 0 THEN r% = PlayWAV(SrcDrive$ + "\success.wav") END IF dlg% = EXITSUCCESS dialog$ = "EXITSUCCESS" ELSEIF ERR = STFQUIT THEN IF NOAUDIO% = 0 THEN r% = PlayWAV(SrcDrive$ + "\ninstall.wav") END IF dlg% = EXITQUIT dialog$ = "EXITQUIT" ' VfWFailed% = 1 ELSEIF ERR = STFPROBLEM THEN IF NOAUDIO% = 0 THEN r% = PlayWAV(SrcDrive$ + "\problem.wav") END IF dlg% = EXITQUIT dialog$ = "EXITQUIT" VfWFailed% = 1 ELSE IF NOAUDIO% = 0 THEN r% = PlayWAV(SrcDrive$ + "\fatal.wav") END IF dlg% = EXITFAILURE dialog$ = "EXITFAILURE" VfWFailed% = 1 END IF WriteToLogFile "" WriteToLogFile "ExitDialog = " + dialog$ WriteToLogFile "" QUITL1: sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "") r% = PlayWAV("") IF sz$ = "REACTIVATE" THEN GOTO QUITL1 END IF UIPopAll IF VfW_ANSWER$ = "Yes" THEN IF VfWFailed% = 0 THEN GOTO RESTART END IF CloseLogFile END ELSE CloseLogFile END END IF ERRQUIT: IF NOAUDIO% = 0 THEN r% = PlayWAV(SrcDrive$ + "\fatal.wav") END IF i% = DoMsgBox("Install sources were corrupted, call AOMC Tech Support!", "Install Fatal Message", MB_OK+MB_TASKMODAL+MB_ICONHAND) WriteToLogFile "FATAL ERROR: Install sources were corrupted." CloseLogFile END '**************************************************************************** '** SUBs and FUNCTIONS ** '**************************************************************************** '** '** Purpose: '** Show and process ASKQUIT2 dialog '**************************************************************************** ASKQUIT: sz$ = UIStartDlg(CUIDLL$, ASKQUIT2, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO ASKQUIT ELSE UIPop 1 END IF RETURN '** '** Purpose: '** Show BADPATH dialog '**************************************************************************** BADPATH: sz$ = UIStartDlg(CUIDLL$, BADPATH2, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO BADPATH END IF UIPop 1 RETURN '** '** Purpose: '** Install VfW 1.1 stuff '**************************************************************************** InstallVfW: ''Prepare Copy list and check size ClearCopyList '' Remove DCISVGA file AddSectionFilesToCopyList "remove", SrcDrive$ + RT$, WinSysDir$ '' Runtime files (on Windows disk) '' Do not install OLE or MPlayer if on next release of NT or Windows IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN 'These files not necessary on Windows NT AddSectionFilesToCopyList "MPlayer", SrcDrive$ + RT$, WinDir$ AddSectionFilesToCopyList "OLE2", SrcDrive$ + RT$, WinSysDir$ END IF AddSectionFilesToCopyList "VfW Runtime", SrcDrive$ + RT$, WinSysDir$ AddSectionFilesToCopyList "ACM Drivers", SrcDrive$ + RT$, WinSysDir$ AddSectionFilesToCopyList "AVICodecs", SrcDrive$ + RT$, WinSysDir$ IF OnNT$ = "TRUE" THEN AddSectionFilesToCopyList "NT MSVideo", SrcDrive$ + RT$, WinSys32Dir$ ENDIF 'Check windrive diskspace UIPopAll sz$ = UIStartDlg(CUIDLL$, VFWINFO, "FModelessDlgProc", 0, "") c% = ShowWaitCursor() VfWSizeReq& = GetCopyListCost ("","", "") ' VfWSizeReq& = VfWSizeReq& + 1 ' i% = DoMsgBox(STR$(VfWSizeReq&), "VfW CopyListCost", MB_OK+MB_TASKMODAL) WriteToLogFile "VfW CopyListCost was " + STR$(VfWSizeReq&) RestoreCursor c% UIPopAll IF VfWSizeReq& <> 0 THEN GOSUB VfWTooBig ' ERROR STRQUIT END IF SetRestartDir WinDir$ CopyFilesInCopyList WriteToLogFile "Copied Files in CopyList." ''Updating WIN.INI and SYSTEM.INI ''Only update SYSTEM.INI on NT or next version of Windows for other codecs IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN IF VflatdPresent() = 0 THEN CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite END IF END IF CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite I% = DoesIniKeyExist ("system.ini", "Drivers", "VIDC.RT21") IF I% = 0 THEN CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite END IF CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite CreateIniKeyValue WinDir$ + "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 WriteToLogFile "Updated INI files." ''Do not register components not installed with Video for Windows on NT or next version of Windows. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg")) Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg")) Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg")) WriteToLogFile "Reg Database updated." '' Mplayer CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite ShowProgmanGroup Group$, 1, cmoNone END IF Run ("profdisp.exe") WriteToLogFile "Profile Display has been run." WriteToLogFile "" RETURN '** '** Purpose: '** Builds the copy list and performs all installation operations. '**************************************************************************** SUB Install STATIC CWDDir$ = GetSymbolValue("STF_CWDDDIR") CreateProgmanGroup Group$, "", cmoVital ShowProgmanGroup Group$, 1, cmoNone IF OpProc% = 1 THEN ' i% = DoMsgBox(Group$+", "+AppTitle$+", "+SrcDrive$ + AppDir$ + AppExeName$, "Icon Working Directory - CD", MB_OK+MB_TASKMODAL) CreateProgmanItem Group$, AppTitle$, SrcDrive$ + AppDir$ + AppExeName$, "", cmoOverwrite ' i% = DoMsgBox(Group$+", "+AppTitle$+" ReadMe"+", "+SrcDrive$ + AppDir$ + InfoFile$, "ReadMe...", MB_OK+MB_TASKMODAL) CreateProgmanItem Group$, AppTitle$+" ReadMe", SrcDrive$ + AppDir$ + InfoFile$, "", cmoOverwrite ' i% = DoMsgBox(Group$+", "+OtherAppsTitle$+", "+SrcDrive$ + AppDir$ + AppExeName$, "Others...", MB_OK+MB_TASKMODAL) CreateProgmanItem Group$, OtherAppsTitle$, SrcDrive$ + AppDir$ + OtherAppsFile$, "", cmoOverwrite ELSEIF OpProc% = 2 THEN ' i% = DoMsgBox(Group$+", "+AppTitle$+", "+DEST$ + AppDir$ + AppExeName$, "Icon Working Directory - HD", MB_OK+MB_TASKMODAL) CreateProgmanItem Group$, AppTitle$, DEST$ + AppDir$ + AppExeName$, "", cmoOverwrite ' i% = DoMsgBox(Group$+", "+OtherAppsTitle$+", "+SrcDrive$ + AppDir$ + AppExeName$, "Others...", MB_OK+MB_TASKMODAL) CreateProgmanItem Group$, OtherAppsTitle$, SrcDrive$ + AppDir$ + OtherAppsFile$, "", cmoOverwrite ' i% = DoMsgBox(Group$+", "+OtherAppsTitle$+", "+SrcDrive$ + AppDir$ + AppExeName$, "Others...", MB_OK+MB_TASKMODAL) CreateProgmanItem Group$, OtherAppsTitle$, SrcDrive$ + AppDir$ + OtherAppsFile$, "", cmoOverwrite END IF END SUB '** '** Purpose: '** Displays TOOBIG dialog. (VfW) '**************************************************************************** VfWTooBig: VfWFailed% = 1 sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ELSEIF sz$ = "REACTIVATE" THEN GOTO VfWTooBig ELSE UIPopAll END IF i% = DoMsgBox(STR$(VfWSizeReq&) + " bytes more space is required on your Windows drive.", "Needed Windows drive space", MB_OK+MB_TASKMODAL) WriteToLogFile "Free space on Windows drive was insufficient." WriteToLogFile "" ERROR STFPROBLEM RETURN '** '** Purpose: '** Displays TOOBIG2 dialog. (Full install of program) '**************************************************************************** FullTooBig: sz$ = UIStartDlg(CUIDLL$, TOOBIG2, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFPROBLEM ELSEIF sz$ = "REACTIVATE" THEN GOTO FullTooBig END IF UIPopAll WriteToLogFile "Free space on " + CheckedDrive$ + " drive was insufficient." WriteToLogFile "" RETURN '** '** Purpose: '** Determine if Install has to update through DOS. '** Restart Windows: if it has to update ACM from DOS, it restarts Windows automatically '** else, it gives the user the choice '**************************************************************************** RESTART: RESTRT% = RestartListEmpty () Exe$ = DEST$ + "\_msrstrt.exe" Batch$ = DEST$ + "\_mssetup.bat" empty$ = "" RESTARTL1: IF RESTRT% = 0 THEN sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO RESTARTL1 END IF I% = ExitExecRestart () RemoveFile Exe$, cmoForce RemoveFile Batch$, cmoForce WriteToLogFile "" WriteToLogFile "Restart for DOS finish." WriteToLogFile "" CloseLogFile END ELSE sz$ = UIStartDlg(CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "") IF sz$ = "CONTINUE" THEN I% = ExitWindowsExec (Exe$, empty$) IF I% = 0 THEN GOTO RESTARTL1 ELSE WriteToLogFile "" WriteToLogFile "Restart accepted." WriteToLogFile "" CloseLogFile END END IF ELSEIF sz$ = "EXIT" THEN UIPopAll WriteToLogFile "" WriteToLogFile "Restart declined." WriteToLogFile "" CloseLogFile END ELSEIF sz$ = "REACTIVATE" THEN GOTO RESTARTL1 ELSE UIPop 1 END IF END IF RETURN '** '** 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: '** Determine space available and compare it to space needed. '** Arguments: '** szDir$ - full directory path (with optional ending "\") '** szFile$ - filename to append to directory '** Returns: '** Resulting fully qualified path name. '**************************************************************************** FUNCTION PlayWAV(AudFile$) STATIC AS INTEGER IF AudFile$ = "" THEN aret% = sndPlaySound(NULL, 0) ELSE aret% = sndPlaySound(AudFile$, SND_ASYNC+SND_NODEFAULT) ENDIF ' i% = DoMsgBox(STR$(aret%), "WaveAudio return", MB_OK+MB_TASKMODAL) IF aret% <> 0 THEN PlayWAV = 1 ELSE PlayWAV = 0 END IF END FUNCTION '** '** Purpose: '** Subroutine to get command line and split into arguments. '** NumArgs : Number of args found. '** Args$() : Array in which to return arguments. '** MaxArgs : Maximum number of arguments. '**************************************************************************** CmdLine: MaxArgs% = 4 NOAUDIO% = 0 NumArgs% = 0 InIt% = 0 Cl$ = COMMAND$ L% = LEN(Cl$) FOR I% = 1 TO L% '' Go through the command line a character at a time C1$ = MID$(Cl$, I%, 1) IF C1$ <> " " THEN ''Test for a blank '' Not a blank IF InIt% = 0 THEN '' Test already inside an argument '' start of a new argument IF NumArgs% = MaxArgs% THEN '' Test for too many arguments EXIT FOR END IF NumArgs% = NumArgs% + 1 InIt% = 1 END IF '' Add character to current argument Arg$(NumArgs%) = Arg$(NumArgs%) + UCASE$(C1$) ELSE '' Found a blank InIt% = 0 '' Set 'Not in an argument' flag to 0 END IF NEXT I '' Reset COMMAND$ without extra arguments COMMAND$ = Arg$(1) + " " + Arg$(2) ' FOR Z% = 1 TO NumArgs% ' i% = DoMsgBox(COMMAND$ + ", " + Arg$(3), "COMMAND$", MB_OK+MB_TASKMODAL) ' NEXT RETURN