home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Inside Multimedia 1995 December
/
IMM1295.ISO
/
share
/
grafik
/
vmpeg
/
vmpeg.mst
< prev
next >
Wrap
Text File
|
1995-07-17
|
9KB
|
312 lines
'**************************************************************************
'* VMPEG Setup Program
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST CHECK = 2500
CONST BADPATH = 6400
CONST RESTART = 1000
''File Types
CONST WING_RUNFILES = 1
CONST WING_BUILDFILES = 2
''Bitmap ID
CONST LOGO = 1
GLOBAL FILEDIALOG ''File path dialog ID
GLOBAL DEST$ ''Default destination directory.
GLOBAL CHECKSTATES$ ''Dialog list symbol names
GLOBAL WINDRIVE$ ''Windows drive letter.
GLOBAL TMPDEST$ '' tmpfile destination
GLOBAL WinDir$
GLOBAL bInstallDVA%
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$)
INIT:
bInstallDVA% = 0
WinDir$ = GetWindowsDir()
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle "VMPEG Setup"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "vmpeg.inf"
END IF
ReadInfFile szInf$
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
CHECKSTATES$ = "CheckItemsIn"
AddListItem CHECKSTATES$, "ON"
' AddListItem CHECKSTATES$, "OFF"
' AddListItem CHECKSTATES$, "ON"
CHECK:
sz$ = UIStartDlg(CUIDLL$, CHECK, "FCheckDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO CHECK
END IF
CHECKSTATES$ = "CheckItemsOut"
IF GetListItem(CHECKSTATES$, WING_RUNFILES) = "ON" THEN
SrcDir$ = GetSymbolValue("STF_SRCDIR")
DEST$ = GetWindowsSysDir
AddSectionFilesToCopyList "runtime", SrcDir$, DEST$
'
' only use DVA on Windows 3.x
'
IF OnWin3x() = 1 THEN
AddSectionFilesToCopyList "dva", SrcDir$, DEST$
IF VflatdPresent() = 0 THEN
CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite
bInstallDVA% = 1
END IF
END IF
DEST$ = GetRealWindowsSysDir
AddSectionFilesToCopyList "wing32", SrcDir$, DEST$
Dest1$ = MakePath(DEST$,"wing32.dll")
Dest2$ = MakePath(DEST$,"wing32.xxx")
RenameFilePlease Dest1$,Dest2$
CopyFilesInCopyList
UpdateWinG32 GetRealWindowsSysDir()
END IF
WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
DEST$ = WINDRIVE$ + ":\VMPEG"
FILEDIALOG = DESTPATH
GOSUB GETPATH
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoVital
AddSectionFilesToCopyList "vmpeg", SrcDir$, DEST$
AddSectionFilesToCopyList "mcivmpeg", SrcDir$, GetWindowsSysDir$
CopyFilesInCopyList
CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "mpg", "MpegVideo", cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "dat", "MpegVideo", cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "m1v", "MpegVideo", cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "mpe", "MpegVideo", cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "Extensions", "mpg", "mplayer.exe /play /close ^.MPG", cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "Extensions", "dat", "mplayer.exe /play /close ^.DAT", cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "Extensions", "m1v", "mplayer.exe /play /close ^.M1V", cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "Extensions", "mpe", "mplayer.exe /play /close ^.MPE", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "mci", "MpegVideo", "mcivmpeg.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "mcivmpeg.drv", "[MCI] VMPEG MPEG Player", cmoOverwrite
Run ("regedit.exe /s " + MakePath(SrcDir$, "vmpeg.reg"))
GOSUB ADDGROUP
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
if dlg% = EXITSUCCESS AND bInstallDVA% = 1 then
sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfoDlgProc", APPHELP, HELPPROC$)
UIPop 1
IF sz$ = "CONTINUE" THEN
rc% = RestartWindows
ENDIF
endif
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
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
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, FILEDIALOG, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO CHECK
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
RETURN
ADDGROUP:
proggroup$ = "VMPEG"
CreateProgmanGroup proggroup$, "", cmoNone
path$ = MakePath( DEST$, "vmpegwin.exe" )
CreateProgmanItem proggroup$, "VMPEG", path$, "", cmoOverwrite
path$ = MakePath( DEST$, "vmpeg.hlp" )
CreateProgmanItem proggroup$, "VMPEG Help", "winhelp " + path$, "", cmoOverwrite
path$ = MakePath( DEST$, "readme.txt" )
CreateProgmanItem proggroup$, "README", "notepad " + path$, "", cmoOverwrite
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
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