home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Microsoft Multimedia Moz…t - The Dissonant Quartet
/
Microsoft_Multimedia_Mozart_The_Dissonant_Quartet_Microsoft_Home_1993.iso
/
mozart
/
msstp
/
setup.mst
< prev
next >
Wrap
Text File
|
1995-03-05
|
20KB
|
686 lines
'**************************************************************************
'* Microsoft Multimedia Publishing Group Setup
'* Microsoft Music
'* (c) 1993 Microsoft Corporation. All Rights Reserved.
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'$INCLUDE 'product.inc'
'$INCLUDE 'mmperf.inc'
'$INCLUDE 'mmcat.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUITDLG = 200
CONST DESTPATH = 300
CONST DESTPATH_EXISTING = 1000
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST EXITSUCCESS_OVERVIEW = 1100
CONST EXITSUCCESS_NORESTART = 1800
CONST OPTIONS = 800
CONST APPHELP = 900
CONST BADPATH = 6400
CONST PALEXPLAIN = 1400
CONST MAILMAN = 1500
CONST ACTIVATEFONTS = 1700
CONST TOOBIG = 6300
CONST ASKCONFIGADPCM = 2200
CONST TGRPBOXID = 3742
''Bitmap ID
CONST LOGO = 1
GLOBAL SRCDIR$ '' CD root path (location of setup.exe)
GLOBAL PRODINI$ '' Fully-qualified path to products .INI
GLOBAL SYSINI$ '' Fully-qualified path to SYSTEM.INI
GLOBAL WININI$ '' Fully-qualified path to WIN.INI
GLOBAL DEST$ '' Default destination directory.
GLOBAL CUIDLL$ '' Name of Custom User Interface DLL
GLOBAL VIDACT$ '' Stores user decision to use Palettized VGA.
GLOBAL TARGRP$
GLOBAL szVideoResult$
DECLARE FUNCTION Install () AS INTEGER
DECLARE SUB InstallFonts
DECLARE FUNCTION SetADPCMIni () AS INTEGER
DECLARE FUNCTION SetCDAudioIni () AS INTEGER
DECLARE FUNCTION NumVGAColors () AS INTEGER
DECLARE SUB InstallFont (strIniKey$, strFontFile$)
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION CmpVersion (szNew$, szOld$) AS INTEGER
DECLARE FUNCTION IsDateLater(szNew$, szOld$) AS INTEGER
DECLARE FUNCTION AddIfNewer(strSec$, strSDir$, strDDir$, strFile$) AS INTEGER
CONST HWND_BROADCAST = &HFFFF
CONST WM_FONTCHANGE = &H001D
declare function SendMessage lib "User" (hwnd%, uint%, wparam%, lp as any) as long
declare function AddFontResource lib "Gdi" (lpstr$) as integer
const NUMCOLORS = 24
'**************************************************************************
'** General Installation Script
'**************************************************************************
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle strProduct$ + " Setup"
'AddToBillboardList CUIDLL$, MAILMAN, "MailmanDlgProc", 1000
szInf$ = GetSymbolValue("STF_SRCINFPATH")
If szInf$ = "" Then
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
End If
ReadInfFile szInf$
SRCDIR$ = GetSymbolValue("STF_SRCDIR")
PRODINI$ = MakePath(GetWindowsDir(),strIni$)
SYSINI$ = MakePath(GetWindowsDir(),"SYSTEM.INI")
WININI$ = MakePath(GetWindowsDir(),"WIN.INI")
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
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
'$ENDIF ''DEBUG
INITWINCHECK:
If ((GetWindowsMajorVersion() = 3) And (GetWindowsMinorVersion() >= 1)) Or (GetWindowsMajorVersion() > 3) Then
'Version of Windows is OK. Continue with Setup...
Else
i% = DoMsgBox(strProduct$ + " requires Windows 3.1 or greater.","Setup Failed", MB_TASKMODAL+MB_ICONHAND+MB_OK)
dlg% = EXITFAILURE
GOTO QUITL3
End If
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
If sz$ = "CONTINUE" Then
UIPop 1
Else
GOSUB ASKQUIT
GOTO WELCOME
End If
DOPERFCHECK:
GoSub SYSCHECK
szVideoResult$ = GetSymbolValue( "DIAG_VIDEO" )
If szVideoResult$ = "ERROR" Then
i% = DoMsgBox( strProduct$ + " requires a VGA display.", "Setup Failed", MB_OK+MB_TASKMODAL+MB_ICONHAND)
dlg% = EXITFAILURE
GOTO QUITL3
End If
If RunningNT() <> 0 Then
If szVideoResult$ = "16COLOR" Then
i% = DoMsgBox( "16-color displays not supported under Windows NT. Please consult the Read Me file for more information.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONEXCLAMATION)
dlg% = EXITFAILURE
Goto QUITL3
Endif
End If
GETPATH:
DEST$ = strDefaultDest$
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
If sz$ = "CONTINUE" Then
If IsDirWritable(DEST$) = 0 Then
GOSUB BADPATH
GOTO GETPATHL1
End If
'If GetFreeSpaceForDrive( MID$( DEST$, 1, 1 ) ) < cbDiskNeeded Then
' GOSUB DRIVEFULL
' GOTO GETPATHL1
'End If
If DoesDirExist( DEST$ ) = 0 Then
i% = DoMsgBox( "The specified directory does not exist. Do you want to create the directory?", "Install Location", 8228)
If i% = 7 Then
GOTO GETPATHL1
End If
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
SetRestartDir DEST$
''*****************************************************************
fRebootWindows% = Install()
''*****************************************************************
QUIT:
ON ERROR GOTO ERRQUIT
If ERR = STFQUIT Then
END
End if
dlg% = EXITFAILURE
If ERR = 0 Then
If fRebootWindows% <> 0 Then
If RunningNT() = 0 Then
dlg% = EXITSUCCESS_OVERVIEW
Else
'For some reason doing a restart under NT causes a crash.
dlg% = EXITSUCCESS_NORESTART
Endif
Else
dlg% = EXITSUCCESS_NORESTART
End If
sz$ = UIStartDlg(CUIDLL$, MAILMAN, "MailmanDlgProc", APPHELP, HELPPROC$)
UIPop 1
End If
QUITL3:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
If sz$ = "REACTIVATE" Then
GOTO QUITL3
ElseIf sz$ = "OVERVIEW" Then
EXEFILE$ = MakePath( DEST$, strExe$ )
RUN EXEFILE$, NOWAIT
ElseIf sz$ = "README" Then
RUN "NOTEPAD.EXE" + " " + MakePath(DEST$,"README.TXT"), NOWAIT
GOTO QUITL3
ElseIf sz$ = "RESTART" Then
ForceRestartOn
i% = ExitExecRestart()
i% = DoMsgBox( "The new system configuration will not be loaded until Windows is restarted.", "Restart Failed", MB_OK+MB_TASKMODAL+MB_ICONHAND)
ElseIf (sz$ = "EXIT") And fRebootWindows Then
i% = DoMsgBox( "The new system configuration will not be loaded until Windows is restarted.", strProduct$ + " Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
End If
UIPop 1
END
DIAG_QUIT:
dlg% = EXITFAILURE
GOTO QUITL3
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, consult your manual for a Product Support phone number.", "Setup Error", 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
DRIVEFULL:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
If sz$ = "REACTIVATE" Then
GOTO DRIVEFULL
End If
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUITDLG, "FQuitDlgProc", 0, "")
If sz$ = "EXIT" Then
UIPopAll
ERROR STFQUIT
ElseIf sz$ = "REACTIVATE" Then
GOTO ASKQUIT
Else
UIPop 1
End If
RETURN
'*************************************************************************
'**
'** Install
'** -------
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** 1 if windows should be restarted 0 otherwise.
'*************************************************************************
FUNCTION Install () STATIC AS INTEGER
Install = 0
SrcDir$ = GetSymbolValue("STF_SRCDIR") + strProductDir
CreateDir DEST$, cmoNone
WinDir$ = GetWindowsDir()
SysDir$ = GetWindowsSysDir()
ASKTARGET:
sz$ = UIStartDlg(CUIDLL$, TGRPBOXID, "GBOXDlgProc", 0, "")
If sz$ = "REACTIVATE" Then
GOTO ASKTARGET
ElseIf sz$ = "CANCELPRESSED" Then
UIPop 1
GOSUB DOYAWANNAQUIT
GOTO ASKTARGET
End If
UIPop 1
' Now we can't pass commas or close-parenthesis in Program Group
' names because the DDE passes the argument directly as a string
' parameter (e.g., CreateGroup(PROGGRP$, whatever)) and the commas
' and close-parenthesis mess it up. So we can quote the string,
' but then you can't have quotation marks inside the string.
' Best solution is to remove all quotation marks, then quote
' the string. This allows commas, which are probably more common
' than quotation marks, and also avoid problems like: "Real" Good
' which also crashes.
STRIP_PAREN:
N = INSTR(1, sz$, """") ' Look for "
IF N > 0 THEN
sz$ = MID$(sz$,1,N-1) + MID$(sz$,N+1,100)
GOTO STRIP_PAREN
END IF
IF RTRIM$(sz$) = "" THEN
sz$ = "Microsoft Multimedia"
END IF
TARGRP$ = """" + sz$ + """"
SetSymbolValue "TARGETGROUP", TARGRP$
AddSectionFilesToCopyList "Main", SrcDir$, DEST$
'If user specified a trailing \ on the destination remove it.
If MID$(DEST$,LEN(DEST$),1) = "\" Then
DEST$ = MID$(DEST$, 1, LEN(DEST$)-1)
End If
If szVideoResult$ = "16COLOR" Then
AddSectionFilesToCopyList C16_SECTION$, SrcDir$ + C16_DIR$, DEST$ + C16_DIR$
Else
AddSectionFilesToCopyList C256_SECTION$, SrcDir$ + C256_DIR$, DEST$ + C256_DIR$
End if
'Checking version numbers alone is unreliable, if we see two identical version
'numbers (or if the version number is missing) then use the dates on the files.
strSharedDir$ = SrcDir$ + "\msstp\shared"
strSection$ = "Shared"
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "bmutils.dll")
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "mci.vbx")
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "msgblast.vbx")
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "mvfs2.dll")
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "picclip.vbx")
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "rtfcc.vbx")
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "spush.vbx")
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "vbrun300.dll")
If LEN(strF1IniKey$) <> 0 Then
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, LCASE$(strF1IniVal$))
Endif
If LEN(strF2IniKey$) <> 0 Then
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, LCASE$(strF2IniVal$))
Endif
If LEN(strF3IniKey$) <> 0 Then
iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, LCASE$(strF3IniVal$))
Endif
If RunningNT() = 0 Then
If SetADPCMIni() <> 0 Then
Install = 1
End If
strSection$ = "System"
strSystemDir$ = SrcDir$ + "\msstp\system"
If AddIfNewer(strSection$, strSystemDir$, SysDir$, "msacm.drv") <> 0 Then
Install = 1
Endif
If AddIfNewer(strSection$, strSystemDir$, SysDir$, "msadpcm.acm") <> 0 Then
Install = 1
Endif
' mcicda.drv may not be present even if the system.ini says
' that it has been installed. Check to see if we need to
' install mcicda.drv regardless of what system.ini says.
If SetCDAudioIni() <> 0 Then
Install = 1
Endif
If AddIfNewer(strSection$, strSystemDir$, SysDir$, "mcicda.drv") Then
Install = 1
Endif
Endif
'** Verify that there is enough space on drive
DISK_SPACE_CHECK:
IF GetCopyListCost ("", "", "") <> 0 THEN
WINDRIVEISFULL:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO WINDRIVEISFULL
ELSEIF sz$ = "CONTINUE" THEN
UIPop 1
GOTO DISK_SPACE_CHECK
ELSE
UIPop 1
QUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUITDLG, "FInfoDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
GOTO WINDRIVEISFULL
END IF
UIPop 1
END
END IF
END IF
SetCopyGaugePosition 15, 125
CopyFilesInCopyList
If RestartListEmpty = 0 Then
Install = 1
Endif
InstallFonts
SetupMMCatalog
CreateProgManGroup TARGRP$, "", cmoNone
ShowProgManGroup TARGRP$, 1, cmoNone
EXE$ = MakePath( DEST$, strExe$ )
CreateProgManItem TARGRP$, strItemName, EXE$, EXE$, cmoOverwrite
CreateProgManItem TARGRP$, strReadMeItemName$, "NOTEPAD.EXE " + MakePath(DEST$, "readme.txt") , "", cmoOverwrite
CreateIniKeyValue PRODINI$, strIniSection$, "CDPath", SrcDir$, cmoOverwrite
CreateIniKeyValue PRODINI$, strIniSection$, "HDPath", DEST$, cmoOverwrite
MMCatSetProgman
'Previous (Beta) versions of stravinsky used to place bmutils into the \strav
'directory. This in now placed in the windows system directory, however if we
'have an old one in the "product" directory that will be bound to instead. So
'get rid of it.
RemoveFile MakePath( DEST$, "bmutils.dll"), cmoForce
'Apparently earlier versions of VB installed vbx's and dll's into the windows
'directory. Make sure we remove these or they will get bound to instead of our
'new ones.
RemoveFile MakePath( WinDir$, "mci.vbx" ), cmoForce
RemoveFile MakePath( WinDir$, "msgblast.vbx" ), cmoForce
RemoveFile MakePath( WinDir$, "mvfs2.dll" ), cmoForce
RemoveFile MakePath( WinDir$, "picclip.vbx" ), cmoForce
GOTO INSTSUBEND
DOYAWANNAQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUITDLG, "FQuitDlgProc", 0, "")
If sz$ = "EXIT" Then
UIPopAll
ERROR STFQUIT
ElseIf sz$ = "REACTIVATE" Then
GOTO DOYAWANNAQUIT
Else
UIPop 1
End If
RETURN
INSTSUBEND:
END FUNCTION
'*************************************************************************
'**
'** MakePath
'** --------
'** 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
SUB InstallFonts STATIC
InstallFont strF1IniKey$, strF1IniVal$
InstallFont strF2IniKey$, strF2IniVal$
InstallFont strF3IniKey$, strF3IniVal$
iDontCare = SendMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0 )
END SUB
SUB InstallFont (strIniKey$, strFile$) STATIC
If LEN(strIniKey$) <> 0 Then
CreateIniKeyValue "win.ini", "fonts", strIniKey$, strFile$, cmoNone
iDontCare = AddFontResource( strFile$ )
End If
END SUB
FUNCTION SetADPCMIni () STATIC AS INTEGER
SetADPCMIni = 0
strSysIni$ = GetWindowsDir() + "system.ini"
'Change WIN.INI and SYSTEM.INI for ACM driver and ADPCM compresser
strWavMapper$ = GetIniKeyString (strSysIni$, "drivers", "WaveMapper")
strInstall$ = GetIniKeyString (strSysIni$, "MSACM", "Install")
If (UCASE$(strWavMapper$) = "MSACM.DRV") And (UCASE$(strInstall$) = "MSADPCM.ACM") THEN
EXIT FUNCTION
End If
CreateIniKeyValue strSysIni$, "drivers", "WaveMapper", "msacm.drv", cmoOverwrite
CreateIniKeyValue strSysIni$, "MSACM", "Install", "msadpcm.acm", cmoOverwrite
SetADPCMIni = 1
END FUNCTION
FUNCTION SetCDAudioIni () STATIC AS INTEGER
SetCDAudioIni = 0
strSysIni$ = GetWindowsDir() + "system.ini"
If (Len(GetIniKeyString (strSysIni$, "mci", "CDAudio")) <> 0) Or (Len(GetIniKeyString (strSysIni$, "mci", "CDAudio1")) <> 0) THEN
EXIT FUNCTION
End If
CreateIniKeyValue strSysIni$, "mci", "CDAudio", "mcicda.drv", cmoOverwrite
SetCDAudioIni = 1
END FUNCTION
FUNCTION NumVGAColors () STATIC AS INTEGER
hdc% = GetDC( 0 )
NumVGAColors = GetDeviceCaps( hdc%, NUMCOLORS )
iDontCare% = ReleaseDC( 0, hdc% )
END FUNCTION
FUNCTION AddIfNewer(strSec$, strSDir$, strDDir$, strFile$) STATIC AS INTEGER
AddIfNewer = 0
strNewFile$ = MakePath (strSDir$, strFile$)
strOldFile$ = MakePath (strDDir$, strFile$)
If DoesFileExist(strOldFile, femExists) <> 0 Then
i% = CmpVersion(GetVersionOfFile(strOldFile$), GetVersionOfFile(strNewFile$))
If i% = -1 Then
'New version is older 'dont add to list
exit function
Endif
If i% = 0 Then
'Versions are same go by date.
If IsDateLater(GetDateOfFile(strOldFile$), GetDateOfFile(strNewFile$)) = 0 Then
'New file is same or older, dont add.
exit function
Endif
'Drop through to add file to copy list.
Endif
Endif
AddSpecialFileToCopyList strSec$, strFile$, strSDir$, strOldFile$
AddIfNewer = 1
END FUNCTION
'*************************************************************************
'**
'** IsDateLater
'** --------
'** Purpose:
'** Compares two file dates
'** Arguments:
'** DateOld$ in YYYY-MM-DD-HH-MM-SS format
'** DateNew$ in YYYY-MM-DD-HH-MM-SS format
'** Returns:
'** 1 if new date is later, 0 if new date is older or the same
'*************************************************************************
FUNCTION IsDateLater (DateOld$, DateNew$) STATIC AS INTEGER
'First compare year
OldYear% = GetYearFromDate (DateOld$)
NewYear% = GetYearFromDate (DateNew$)
If NewYear% < OldYear% Then
IsDateLater = 0
ElseIf NewYear% = OldYear% Then
'If year is the same, compare month
OldMonth% = GetMonthFromDate (DateOld$)
NewMonth% = GetMonthFromDate (DateNew$)
If NewMonth% < OldMonth% Then
IsDateLater = 0
ElseIf NewMonth% = OldMonth% Then
'If month is the same, compare day
OldDay% = GetDayFromDate (DateOld$)
NewDay% = GetDayFromDate (DateNew$)
If NewDay% <= OldDay% Then
IsDateLater = 0
Else
IsDateLater = 1
End If
Else
IsDateLater = 1
End If
Else
IsDateLater = 1
ENDIF
END FUNCTION
'*************************************************************************
'**
'** CmpVersion
'** --------
'** Purpose:
'** Compares two file versions
'** Arguments:
'** VerOld$ - Old file version string (in format N.N.N.N)
'** VerNew$ - New file version string (in format N.N.N.N)
'** Returns:
'** 1 if new version is later, -1 if new version is older, 0 if the same
'*************************************************************************
FUNCTION CmpVersion (VerOld$, VerNew$) STATIC AS INTEGER
CmpVersion = 0
FOR I=1 TO 4
VOld = GetVersionNthField (VerOld$, I)
VNew = GetVersionNthField (VerNew$, I)
If VNew > VOld Then
CmpVersion = 1
Goto LBL_CmpVersionEnd
Endif
If VNew < VOld Then
CmpVersion = -1
Goto LBL_CmpVersionEnd
End If
NEXT I
LBL_CmpVersionEnd:
END FUNCTION