home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer 2.14
/
1997-03_Disc_2.14.iso
/
uground
/
setup.ms_
/
setup.ms
Wrap
Text File
|
1996-05-04
|
18KB
|
577 lines
'**************************************************************************
'* PC-Gamer Setup
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
CONST TITLE_NAME$ = "PC Gamer"
CONST TITLE_SETUPDLG$ = "PC Gamer Setup"
CONST GROUP_NAME$ = "PC Gamer CD"
CONST TITLE_ENGINE$ = "PCGAMER.EXE"
CONST MSG_BEGVPROFILE$ = "We need to analyze your video system to ensure maximum performance. "
CONST MSG_BEGVPROFILE1$ = "This procedure may take several minutes. "
CONST MSG_STARTVPROFILE$ = "Select OK to start the analysis."
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST BADPATH = 6400
CONST RESTART = 1300
CONST RESTARTII = 2700
CONST TOOBIG = 6300
''Bitmap ID
CONST LOGO = 1
GLOBAL DESTDRIVE$
GLOBAL DEST$ ''Default destination directory.
GLOBAL OPTCUR$ ''Option selection from option dialog.
GLOBAL CUIDLL$
GLOBAL APPCMD$
'GLOBAL APPCMD1$
GLOBAL UNIPATH$
''Symbols for communicating with MSCUISTF.DLL dialog procs
GLOBAL SPACEEXTRA$
GLOBAL SPACECOST$
GLOBAL SPACENEEDED$
GLOBAL AMOUNTNEEDED$
DECLARE SUB DestDriveTooSmall
DECLARE SUB UpdateINI_and_Reg
DECLARE SUB UpdateProgramMngr
DECLARE SUB BuildInstallList
DECLARE SUB NotifyBadPath
DECLARE SUB MaximizeSetupWnd
DECLARE SUB ShowWelcome
DECLARE SUB Ask_Quit
DECLARE SUB GetDestDir
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION CheckDiskSpace () as Integer
DECLARE FUNCTION ShowWindow LIB "User" (hWnd%, iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "User" (hWnd%, offset%, style& ) AS LONG
DECLARE FUNCTION ExitWindowsExec LIB "User" (Exec$, Param$) AS INTEGER
DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
DECLARE FUNCTION SetFocus LIB "User" (hWnd%) AS INTEGER
' Constants for Windows API functions
CONST WS_VISIBLE = &H10000000
CONST WS_BORDER = &H00800000
CONST WS_CLIPCHILDREN = &H02000000
CONST GWL_STYLE = -16
CONST SW_SHOWMAXIMIZED= 3
''System Location variables
GLOBAL WinDir$
GLOBAL WinSysDir$
GLOBAL WinSys32Dir$
GLOBAL WINDRIVE$ ''Windows Drive Letter.
GLOBAL MinorVer%
GLOBAL OnNT$
GLOBAL TitleINI$
GLOBAL SysINI$
GLOBAL CtlINI$
GLOBAL WinINI$
INIT:
'--------------------------------------------------------
' the following line causes the setup background window
' to be maximized
'--------------------------------------------------------
MaximizeSetupWnd
SPACEEXTRA$ = "SpaceExtra"
SPACECOST$ = "SpaceCost"
SPACENEEDED$ = "SpaceNeeded"
AMOUNTNEEDED$ = "DiskSpaceNeeded"
CHECKSYSSYM$ = "SysFac"
FOR i%=1 TO 26 STEP 1
AddListItem SPACEEXTRA$, "0"
AddListItem SPACECOST$, "0"
AddListItem SPACENEEDED$, "0"
NEXT i%
bInstallDVA% = 0
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowsSysDir()
' WinSys32Dir$ = WinDir$ + "system32"
' WINDRIVE$ = Mid$(WinDir$, 1, 1)
' BUGBUG Is this next line correct? Is that where the _mssetup.exe will
' be located?
SetRestartDir WinDir$
TitleINI$ = WinDir$ + "pcgamer.ini"
SysINI$ = WinDir$ + "system.ini"
CtlINI$ = WinDir$ + "control.ini"
WinINI$ = WinDir$ + "win.ini"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "setup.INF"
END IF
ReadInfFile szInf$
OPTCUR$ = "1"
DEST$ = "C:\UGROUND"
DESTDRIVE$ = "C"
ShowWelcome
GETDEST:
DESTDRIVE$ = DESTDRIVE$ + ":"
GetDestDir
BuildInstallList
IF CheckDiskSpace() = 0 THEN
GOTO GETDEST
ENDIF
Install
'--------------------------------------------------------
' Profile display for video components
'--------------------------------------------------------
j% = DoMsgBox(MSG_BEGVPROFILE$+ MSG_BEGVPROFILE1$ + NL$ + NL$ +MSG_STARTVPROFILE$, TITLE_SETUPDLG$, MB_OK)
' profile the display (needed by Video for Windows)
Run ("profdisp.exe")
' perform the WinG video profiling exercise
Run ("profwing.exe")
'' Restart Windows: if it has to update ACM from DOS, it restarts Windows
'' automatically else, it gives the user the choice
RESTRT% = RestartListEmpty ()
Exe$ = DEST$ + "\_msrstrt.exe"
Batch$ = DEST$ + "\_mssetup.bat"
empty$ = ""
RESTART:
IF RESTRT% = 0 THEN
sz$ = UIStartDlg(cuidll$, RESTART, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO RESTART
ENDIF
I% = RestartWindows
'' I% = ExitExecRestart ()
RemoveFile Exe$, cmoForce
RemoveFile Batch$, cmoForce
END
ELSE
sz$ = UIStartDlg(CUIDLL$, 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
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(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, unable to contine", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
'*************************************************************************
'** Build the list of files which must be installed and determine how
'** they must be installed
'*************************************************************************
SUB BuildInstallList STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR") + "uground"
ClearCopyList
AddSectionFilesToCopyList "Uground", SrcDir$, DEST$
AddSectionFilesToCopyList "Audio", SrcDir$, DEST$ + "\AUDIO"
AddSectionFilesToCopyList "MediaView", SrcDir$, DEST$ + "\MV"
AddSectionFilesToCopyList "Sentinal", SrcDir$, DEST$ + "\TEMP"
'------------------------------------------------------------
' handle DVA.386
'------------------------------------------------------------
IF OnWin3x() = 1 THEN
AddSectionFilesToCopyList "dva", SrcDir$, WinSysDir$
END IF
'------------------------------------------------------------
' handle Video for Windows
'------------------------------------------------------------
AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "AVICodecs", SrcDir$, WinSysDir$
'------------------------------------------------------------
' Add WinG files to the list
'------------------------------------------------------------
AddSectionFilesToCopyList "WinG", SrcDir$, WinSysDir$
END SUB
SUB Install STATIC
Dim hWnd%, hWndOther%
' get our source dir & create the dest dir (if it doesn't exist)
''not needed SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
CreateDir DEST$ + "\AUDIO", cmoNone
CreateDir DEST$ + "\MV", cmoNone
CreateDir DEST$ + "\TEMP", cmoNone
'DumpCopyList "copylist.log"
' have the files we need copied to the users disk
CopyFilesInCopyList
' add our icon to the appropriate program group (creating it if necessary)
UpdateProgramMngr
' update the INI files and the registry with VFW stuff
UpdateINI_and_Reg
hWnd% = HwndFrame()
hWndOther% = SetFocus(hWnd%)
' Assuming DOS is in path, set file attribute to hidden
CMDLINE$ = "ATTRIB +h " + DEST$ + "\TEMP\_GUARD"
RUN CMDLINE$
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
'*************************************************************************
'** Subroutine which will maximize the Setup Programs frame window
'*************************************************************************
SUB MaximizeSetupWnd STATIC
Dim hWnd%, PrevVisibility%
Dim OldStyle&
hWnd% = HwndFrame()
OldStyle& = SetWindowLong ( hWnd%, GWL_STYLE, WS_VISIBLE+WS_BORDER + WS_CLIPCHILDREN )
PrevVisibility% = ShowWindow ( hWnd%, SW_SHOWMAXIMIZED )
END SUB
'*************************************************************************
'** Tell the user what they are running & give them a chance to get out
'*************************************************************************
SUB ShowWelcome STATIC
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
Ask_Quit
GOTO WELCOME
END IF
END SUB
'*************************************************************************
'** Ask the user to confirm that they want to abort setup
'*************************************************************************
SUB Ask_Quit STATIC
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
'' ERROR STFQUIT
END
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
END SUB
'*************************************************************************
'** subroutine to display message if path specified by use is not usable
'*************************************************************************
SUB NotifyBadPath STATIC
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
END SUB
'*************************************************************************
'** Get the destination directory from the user
'*************************************************************************
SUB GetDestDir STATIC
GETPATH:
SetSymbolValue "EditTextIn", DESTDRIVE$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", 0, "")
DESTDRIVE$ = GetSymbolValue("EditTextOut")
DESTDRIVE$ = MID$(DESTDRIVE$, 1, 2)
IF MID$(DESTDRIVE$, 2, 1) <> ":" THEN
DESTDRIVE$ = MID$(DESTDRIVE$, 1, 1) + ":"
ENDIF
IF sz$ = "CONTINUE" THEN
DEST = DESTDRIVE + "\UGROUND"
IF IsDirWritable(DEST$) = 0 THEN
NotifyBadPath
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETPATH
ELSE
Ask_Quit
GOTO GETPATH
END IF
END SUB
'*************************************************************************
'** subroutine to add our app to Program Manager
'*************************************************************************
SUB UpdateProgramMngr STATIC
' Create a program manager group with the same name as our title
CreateProgmanGroup GROUP_NAME$, "", cmoNone
' Have the new group displayed as a normal window within Program manager
ShowProgmanGroup GROUP_NAME$, 1, cmoNone
' Add our entry to the new groups - entry will have title name
' note: if entry of this name is already in group, will replace with
' new one
' Include the universe file in command line
UNIPATH = MakePath(DEST$, "PCGMR01.UNV")
APPCMD$ = MakePath(DEST$,TITLE_ENGINE$) + " " + UNIPATH$
CreateProgmanItem GROUP_NAME$, TITLE_NAME$, APPCMD$, "", cmoOverwrite
END SUB
'*************************************************************************
'** Subroutine to update the Windows and SYSTEM.INI files and the
'** system Registry (with video for windows stuff
'*************************************************************************
SUB UpdateINI_and_Reg STATIC
IF OnWin3x() = 1 THEN
IF VflatdPresent() = 0 THEN
CreateSysIniKeyValue SysINI$, "386Enh", "device", "dva.386", cmoOverwrite
bInstallDVA% = 1
END IF
END IF
'Set the CDDrive entry equal to installation drive
CD$ = GetSymbolValue("STF_SRCDIR")
CD$ = MID$(CD$, 1, LEN(CD$) - 1)
' Create a pcgamer.ini file in the windows directory
CreateIniKeyValue TitleINI$, "Menu", "Ambience", "1", cmoPrepend
CreateIniKeyValue TitleINI$, "Menu", "Effects", "1", cmoPrepend
CreateIniKeyValue TitleINI$, "Files", "CDDrive", CD$, cmoOverwrite
CreateIniKeyValue TitleINI$, "Files", "CurDir", DEST$, cmoOverwrite
CreateIniKeyValue TitleINI$, "Files", "UnvFile", UNIPATH$, cmoOverwrite
CreateIniKeyValue TitleINI$, "Files", "Run", APPCMD$, cmoOverwrite
CreateIniKeyValue TitleINI$, "General", "Version", "100", cmoOverwrite
CreateIniKeyValue TitleINI$, "General", "RunBefore", "0", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "VIDC.IV31", "ir32.dll", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
I% = DoesIniKeyExist (SysINI, "Drivers", "VIDC.RT21")
IF I% = 0 THEN
CreateIniKeyValue SysINI$, "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
END IF
CreateIniKeyValue SysINI$, "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
CreateIniKeyValue SysINI$, "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
CreateIniKeyValue SysINI$, "Drivers", "VIDC.RT21", "indeo.drv", cmoOverwrite
CreateIniKeyValue WinINI$, "mci extensions", "avi", "AVIVideo", cmoOverwrite
CreateIniKeyValue CtlINI$, "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
CreateIniKeyValue CtlINI$, "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
CreateIniKeyValue CtlINI$, "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
'Do not register components not installed with Video for Windows for 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"))
' ' Uncomment the next line to have the media player icon added to the Accessories program group
' ' CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
' END IF
END SUB
'*************************************************************************
'** Check to see that we have enough space for the files on the chosen
'** destination drive and on the drive containing the windows
'** directories (if the drives are different)
'*************************************************************************
FUNCTION CheckDiskSpace () STATIC as Integer
DIM DriveLtr%
CheckDiskSpace = 1
DestDrive$ = Mid$(DEST$, 1, 1)
SizeReq& = GetCopyListCost ( SPACEEXTRA$, SPACECOST$, SPACENEEDED$)
' if SizeReq& is not zero, we are short of space somewhere
IF SizeReq& <> 0 THEN
DriveLtr% = ASC(UCASE$(DestDrive$))
ndrive% = DriveLtr% - ASC("A") + 1
need$ = GetListItem (SPACENEEDED$, nDrive%)
IF VAL(need$) > 0 THEN
need$ = "An additional" + STR$(VAL(need$)/1024)+ "KB are needed on drive " + DestDrive$ + "."
SetSymbolValue AMOUNTNEEDED$, need$
DestDriveTooSmall
CheckDiskSpace = 0
RemoveSymbol AMOUNTNEEDED$
EXIT FUNCTION
END IF
END IF
END FUNCTION
'*************************************************************************
'** Subroutine to inform the user if they don't have enough space on
'** chosen destination drive
'*************************************************************************
SUB DestDriveTooSmall STATIC
SMALLDEST:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO SMALLDEST
END IF
UIPop 1
END SUB