home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Evita!
/
Evita2-de-2.iso
/
TANGO!
/
STP
/
TANGOINS.MST
< prev
Wrap
Text File
|
1997-03-21
|
19KB
|
559 lines
' ================================================================================
' Sierra 3
' ARCHIVO: TANGOINS.MST
' PROYECTO: INSTALAR (Un siglo de Tango! - Demo) VERSION: 0.0
' CULPABLE: Sergio D. Llorens FECHA: 26/10/95
' ULTIMA MODIFICACION: 26/10/95
' DESCRIPCION: Script (mstest) para instalacion de Un siglo de Tango! - Demo
' ================================================================================
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
' Dialog ID's - Definidos en dialogs.h
CONST WELCOME_SCREEN = 100
CONST WELCOME_HELP = 101
CONST GENERIC_HELP = 102
CONST FIX_VGA_DRIVER = 150
CONST FIX_VGA_HELP = 151
CONST SYSERROR_DOS_WIN = 200
CONST SYSERROR_VGA = 301
CONST SYSERROR_VIEWER = 400
CONST SYSWAIT_MPC = 500
CONST SYSCHECK_MPC = 501
CONST SYSDISPLAY_MPC = 502
CONST PROGRAM_GROUP = 700
CONST PROGRAM_GROUP_BOXLIST = 701
CONST ASK_HOTSPOT = 800
CONST FILLING_CARD = 1000
CONST INSTALL_FONTS = 1100
CONST INSTALL_DIR = 1200
CONST INSTALL_DIR_HELP = 1201
CONST SYSERROR_DISKFULL = 1203
CONST TOOBIG = 3000
CONST SYSERROR_BADPATH = 4000
CONST SETUPQUIT_CONFIRM = 10000
CONST SETUPQUIT_FAILURE = 10001
CONST SETUPQUIT_OVERVIEW = 10002
CONST SETUPQUIT_QUIT = 10003
CONST RESTART_WINDOWS = 10020
' Bitmaps IDs - Definidos en dialogs.rc
CONST WELCOME_BMP = 1
' De WINDOWS.H
CONST WS_VISIBLE = &H10000000
CONST WS_BORDER = &H00800000
CONST WS_CLIPCHILDREN = &H02000000
CONST GWL_STYLE = -16
CONST SW_SHOWMAXIMIZED = 3
' Definiciones globales
GLOBAL S3SYSDIR$ 'directorio final de librerias de Sierra 3 Multimedia
GLOBAL CUIDLL$ 'CUI dll
GLOBAL PROGGRP$ 'default program group
GLOBAL CREATEICON% 'creacion de iconos en program group
GLOBAL VIEWERDIR$ 'directorio de Viewer
GLOBAL SRCDIR$ 'directorio raiz de instalar
GLOBAL WININI$ 'path completo de WIN.INI
GLOBAL SYSINI$ 'path completo de SYSTEM.INI
GLOBAL ShouldRestart% 'indica si se debe re-arrancar Windows luego de instalar
GLOBAL ReducedInst% ' indica instalacion reducida
GLOBAL VGADRV% 'indica si VGAPAL driver esta instalado
GLOBAL Misc%
' Prototipos de SUBs
DECLARE SUB Install
DECLARE SUB Init3dCtrls
' Prototipos de funciones
DECLARE FUNCTION GetModuleHandle LIB "kernel" (a$) AS INTEGER
DECLARE FUNCTION WinExec LIB "kernel" (a$, b%) AS INTEGER
DECLARE FUNCTION GetActiveWindow LIB "user" AS INTEGER
DECLARE FUNCTION ShowWindow LIB "user" (a%, b%) AS INTEGER
DECLARE FUNCTION MessageBox lib "user" (hwnd%, lpstr$, lpstr$, uint%) as integer
DECLARE FUNCTION SetWindowLong LIB "user" (hWnd%, offset%, style&) AS LONG
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION GetFilename (szPath$) AS STRING
DECLARE FUNCTION UpdateSize (szSection$, szKey$, szDestDir$) AS LONG
DECLARE FUNCTION WillCopy (szSection$, szKey$, szDestDir$) AS INTEGER
DECLARE FUNCTION CmpVersion (VerOld$, VerNew$) AS INTEGER
DECLARE FUNCTION IsDateLater (DateOld$, DateNew$) AS INTEGER
GOTO INIT
'$INCLUDE 'stcheck.inc'
'----------------------------------------------------------------------------
' Inicializacion
'----------------------------------------------------------------------------
INIT:
hWnd%=HwndFrame()
ij&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
j%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
SRCDIR$ = GetSymbolValue("STF_SRCDIR") + "Tango!\"
WININI$ = MakePath(GetWindowsDir(), "WIN.INI")
SYSINI$ = MakePath(GetWindowsDir(), "SYSTEM.INI")
' Init3dCtrls
CUIDLL$ = "mscuistf.dll" 'CUI dll
ShouldRestart% = 0 'se vuelve TRUE si se instalan DRVs
SetBitmap CUIDLL$, WELCOME_BMP
SetTitle "Un siglo de Tango! Demo - Instalar"
' Busca path a TANGOINST.INF
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "TANGOINS.INF"
END IF
ReadInfFile szInf$
ERR = 0
'--------------------------------------------------------------------------
' Verifica el sistema
'--------------------------------------------------------------------------
GoSub SYSCHECK
'--------------------------------------------------------------------------
' Inicializacion de pantalla de bienvenida
'--------------------------------------------------------------------------
WELCOME:
' Muestra dialogo WELCOME con WELCOME_HELP como ayuda actual
sz$ = UIStartDlg(CUIDLL$, WELCOME_SCREEN, "FWelcomeDlgProc", WELCOME_HELP, "FHelpDlgProc")
IF sz$ = "REACTIVATE" THEN
GOTO WELCOME
ELSEIF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB DIAG_QUIT ' se oprimio "Salir"
GOTO WELCOME ' no se quiere salir, continua instalacion
END IF
'--------------------------------------------------------------------------
' Chequea performance
'--------------------------------------------------------------------------
' GoSub SYSCHECK ' controlar FCancel!
UIPop 1
'--------------------------------------------------------------------------
' Verifica si PROGMAN es el shell actual
'--------------------------------------------------------------------------
' Chequea si el usuario esta usando Program Manager como Shell
PROGGRP$ = ""
sz$ = GetIniKeyString(SYSINI$, "boot", "shell")
IF sz$ <> "progman.exe" THEN
CREATEICON% = 1
END IF
ASKPROGMAN:
sz$ = ""
IF sz$ = "" THEN
sz$ = "Sierra 3 Multimedia"
END IF
PROGGRP$ = """" + sz$ + """"
SetSymbolValue "TARGETGROUP", PROGGRP$
CREATEICON% = 1
BEGIN_INSTALL:
Install
'--------------------------------------------------------------------------
' Verifica si Windows tiene que ser reiniciado
'--------------------------------------------------------------------------
RESTART_WINDOWS_AGAIN:
IF ShouldRestart% THEN
sz$ = UIStartDlg(CUIDLL$, RESTART_WINDOWS, "FRestartDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO RESTART_WINDOWS_AGAIN
ELSEIF sz$ = "EXIT" THEN
GOSUB DIAG_QUIT
GOTO RESTART_WINDOWS_AGAIN
ELSEIF sz$ = "OK" THEN
ForceRestartOn
result% = ExitExecRestart ()
' Si ExitExitRestart retorna, no todas las aplicaciones quisieron
' cerrarse
GOTO RESTART_WINDOWS_AGAIN
END IF
END IF
UIPop 1
'--------------------------------------------------------------------------
' Permite configurar, ejecutar, o salir a Windows
'--------------------------------------------------------------------------
OVERVIEW:
GOTO QUIT
sz$ = UIStartDlg(CUIDLL$, SETUPQUIT_OVERVIEW, "FOverviewDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO OVERVIEW
ELSEIF sz$ = "README" THEN
RUN MakePath(GetWindowsDir(), "NOTEPAD.EXE") + " " + MakePath(SRCDIR$, "notas.txt") ', NOWAIT
GOTO OVERVIEW
ELSEIF sz$ = "CONFIG_TANGO" THEN
RUN MakePath(SRCDIR$, "DRV\TDEMO\tconfig.exe") ', NOWAIT
GOTO OVERVIEW
ELSEIF sz$ = "RUN_TANGO" THEN
' Limpieza final
UIPopAll
' IF RestartListEmpty () THEN
' result% = ExitExecRestart ()
' ENDIF
demo% = ShowWindow (GetActiveWindow(), 0) ' oculta setup
' Cambiamos de directorio
' OldDrive$ = CurDir$
' ChDrive Mid$(DEST$, 1, 2)
' ChDir DEST$
RUN MakePath(SRCDIR$, "DRV\TDEMO\tdemo.exe"), NOWAIT
' ChDrive Mid$(OldDrive$, 1, 2)
' ChDir OldDrive$
' GOTO QUIT2
END IF
'--------------------------------------------------------------------------
' Handlers de Quit y errores
'--------------------------------------------------------------------------
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
GOTO QUIT2
END IF
QUIT_FAILURE:
dlg% = SETUPQUIT_FAILURE
UIPopAll ' cierra todos los otros dialogos
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUIT_FAILURE
END IF
QUIT2:
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("El programa de instalaci≤n estß da±ado, comunφquese con Sierra 3 para obtener asistencia.", "Mensaje de Instalaci≤n de Un siglo de Tango! - Demo", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
'--------------------------------------------------------------------------
' Mensajes de error varios
'--------------------------------------------------------------------------
DIAG_QUIT:
sz$ = UIStartDlg(CUIDLL$, SETUPQUIT_CONFIRM, "FInfoDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPopAll
'ERROR STFQUIT
END
ELSEIF sz$ = "REACTIVATE" THEN
GOTO DIAG_QUIT
ELSE
UIPop 1
END IF
RETURN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, SYSERROR_BADPATH, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
DRIVEISFULL:
sz$ = UIStartDlg(CUIDLL$, SYSERROR_DISKFULL, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO DRIVEISFULL
ELSEIF sz$ = "EXIT" THEN
dlg% = SETUPQUIT_FAILURE
GOTO QUIT_FAILURE
END IF
UIPop 1
RETURN
'--------------------------------------------------------------------------
' Verifica si el archivo ya existe en el HD
' ARGS: Seccion en INF file, clave del archivo, y directorio destino
' RET: Tama#o del archivo si necesita ser copiado, o 0
'--------------------------------------------------------------------------
FUNCTION UpdateSize (szSection$, szKey$, szDestDir$) STATIC AS LONG
IF WillCopy (szSection$, szKey$, szDestDir$) THEN
UpdateSize = GetSectionKeySize (szSection$, szKey$)
ELSE
UpdateSize = 0
END IF
END FUNCTION
'--------------------------------------------------------------------------
' Verifica si CTL3D.DLL ya existe en el directorio destino, si no, la copia
'--------------------------------------------------------------------------
SUB Init3dCtrls STATIC
szDest$ = MakePath(GetWindowsSysDir(), "CTL3D.DLL")
szSrc$ = MakePath(SRCDIR$, "DRV\SYS\CTL3D.DLL")
IF NOT DoesFileExist (szDest$, femRead) THEN
CopyFile szSrc$, szDest$, cmoOverWrite, 0
END IF
END SUB
'--------------------------------------------------------------------------
' Construye la lista de copia, y realiza todas las operaciones de
' instalacion.
'--------------------------------------------------------------------------
SUB Install STATIC
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowsSysDir()
SetRestartDir "C:\~TNGINST.T"
' sz$ = UIStartDlg (CUIDLL$, FILLING_CARD, "FFillCardDlgProc", 0, "")
COPY_SIZE& = 0 ' Si cambia luego de copiar, hay que reiniciar Windows
' Copia DLLs y VBXs
AddSectionFilesToCopyList "Extras", SRCDIR$, WinSysDir$
'COPY_SIZE& = COPY_SIZE& + UpdateSize ("Extras", "CTL3D", WinSysDir$)
' Copia drivers
AddSectionFilesToCopyList "Drivers", SRCDIR$, WinSysDir$
OLD_SIZE& = COPY_SIZE&
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "AAPLAY", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "AAVGA", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "AVIFILE", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "COMPOBJ", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MCIAAP", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MCIAVI", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSVIDC", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "ICCVID", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSVIDEO", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSACM", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSACMDLL", WinSysDir$)
COPY_SIZE& = COPY_SIZE& + UpdateSize ("Drivers", "MSADPCM", WinSysDir$)
' Si se instalan drivers, hay que re-inicializar Windows
IF OLD_SIZE& <> COPY_SIZE& THEN
ShouldRestart% = 0 '1
END IF
DISK_SPACE_CHECK:
' Si no hay espacio suficiente en HD
IF GetCopyListCost ("", "", "") <> 0 THEN
WINDRIVEISFULL:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO WINDRIVEISFULL
END IF
UIPopAll
END
ENDIF
' Verifica si VGAPAL.DRV deberia ser reemplazada por VGA.DRV:
IF VGADRV% = 1 THEN
CreateIniKeyValue SYSINI$, "Boot", "Display.Drv", "VGA.DRV", cmoOverwrite
CreateIniKeyValue SYSINI$, "Boot.Description", "Display.Drv", "VGA", cmoOverwrite
ShouldRestart% = 1
END IF
SetCopyGaugePosition 25, 120
CopyFilesInCopyList
UIPop 1
IF RestartListEmpty() = 0 THEN
ShouldRestart% = 1
END IF
' Setea drivers en SYSTEM.INI
CreateIniKeyValue SYSINI$, "mci", "Animation", "mciaap.drv", 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", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
CreateIniKeyValue SYSINI$, "drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
CreateIniKeyValue SYSINI$, "msacm", "Install", "msadpcm.acm", cmoOverwrite
' Setea entradas en WIN.INI
CreateIniKeyValue WININI$, "mci extensions", "flc", "Animation", cmoOverwrite
CreateIniKeyValue WININI$, "mci extensions", "avi", "AVIVideo", cmoOverwrite
' Setea entradas en USDTDEMO.INI
TangoIni$ = MakePath(WinDir$, "usdtdemo.ini")
' CreateIniKeyValue TangoIni$, "Config", "Path", MakePath(SRCDIR$, "DRV\TDEMO\"), cmoOverwrite
CreateIniKeyValue TangoIni$, "Config", "Path", SRCDIR$, cmoOverwrite
CreateIniKeyValue TangoIni$, "Config", "Modo_de_ejecucion", "0", cmoOverwrite
CreateIniKeyValue TangoIni$, "Config", "Segundos_antes_de_reiniciar", "30", cmoOverwrite
UIPop 1
' Crea Program Group
IF CREATEICON% = 1 THEN
IF PROGGRP$ = "" THEN
PROGGRP$ = "Sierra 3 Multimedia"
END IF
CreateProgmanGroup PROGGRP$, "", cmoNone
ShowProgManGroup PROGGRP$, 2, cmoNone
ShowProgManGroup PROGGRP$, 1, cmoNone
CreateProgmanItem PROGGRP$, "Un siglo de Tango! - Demo - Configuraci≤n", MakePath(SRCDIR$, "DRV\TDEMO\TCONFIG.EXE"), ",,,,"+DEST$, cmoOverwrite
CreateProgmanItem PROGGRP$, "Un siglo de Tango! - Demo", MakePath(SRCDIR$, "DRV\TDEMO\TDEMO.EXE"), ",,,,"+DEST$, cmoOverwrite
ShowProgmanGroup PROGGRP$, 1, cmoNone
END IF
END SUB
'--------------------------------------------------------------------
' Agrega el nombre de un archivo a un path, insertando un backslash
' si es necesario
' ARGS: szDir$ - path (con "\" final opcional)
' szFile$ - nombre de archivo a agregar
' RET: path+filename
'--------------------------------------------------------------------
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
'--------------------------------------------------------------------
' Extrae el nombre de un archivo de un path
' ARGS: szPath$ - path completo
' RET: nombre del archivo
'--------------------------------------------------------------------
FUNCTION GetFilename (szPath$) STATIC AS STRING
FOR i% = LEN(szPath$) TO 1 STEP -1
IF MID$(szPath$, i%, 1) = "\" THEN
GetFilename = MID$(szPath$, i% + 1, LEN(szPath$) - i%)
Exit FOR
END IF
NEXT
IF i% = 0 THEN ' No hay "\" en el path, debe ser solo un nombre
GetFilename = szPath$
END IF
END FUNCTION
'--------------------------------------------------------------------
FUNCTION WillCopy (szSection$, szKey$, szDestDir$) STATIC AS INTEGER
WillCopy = 0
Filename$ = GetSectionKeyFilename (szSection$, szKey$)
szOldFile$ = MakePath (szDestDir$, GetFilename (Filename$))
szNewFile$ = MakePath (SRCDIR$, Filename$)
If DoesFileExist(szOldFile, femExists) <> 0 Then
i% = CmpVersion(GetVersionOfFile(szOldFile$), GetVersionOfFile(szNewFile$))
If i% = -1 Then
' La version nuestra es mas vieja, no la copia
exit function
Endif
If i% = 0 Then
' Las versiones son iguales, mira la fecha
If IsDateLater(GetDateOfFile(szOldFile$), GetDateOfFile(szNewFile$)) = 0 Then
' Nuestro archivo es igual o mas viejo, no lo copia
exit function
Endif
Endif
Endif
WillCopy = 1
END FUNCTION
'--------------------------------------------------------------------
' Compara la fecha de dos archivos
' ARGS: DateOld$ en formato YYYY-MM-DD-HH-MM-SS
' DateNew$ en formato YYYY-MM-DD-HH-MM-SS
' RET: 1 si DateNew es mas nuevo, 0 en caso contrario
'*************************************************************************
FUNCTION IsDateLater (DateOld$, DateNew$) STATIC AS INTEGER
' Compara el a#o
OldYear% = GetYearFromDate (DateOld$)
NewYear% = GetYearFromDate (DateNew$)
If NewYear% < OldYear% Then
IsDateLater = 0
ElseIf NewYear% = OldYear% Then
' Si el a#o es el mismo compara mes
OldMonth% = GetMonthFromDate (DateOld$)
NewMonth% = GetMonthFromDate (DateNew$)
If NewMonth% < OldMonth% Then
IsDateLater = 0
ElseIf NewMonth% = OldMonth% Then
' Si el mes es el mismo, compara dia
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
' -------------------------------------------------------------------
' Compara versiones de dos archivos
' ARGS: VerOld$ - version string del arch. viejo (en formato N.N.N.N)
' VerNew$ - version string del arch. nuevo (en formato N.N.N.N)
' RET: 1 si VerNew es posterior, -1 si es anterior, 0 si es la misma
'--------------------------------------------------------------------
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