home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Buyer 1995 November
/
SHOWCASE.ISO
/
disk1
/
install.mst
< prev
next >
Wrap
Text File
|
1995-08-03
|
10KB
|
326 lines
'**************************************************************************
'* MSSetup for Updata 'Profit
'* Adapted from standard Updata Setup by J. Thomas - July 95
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST MB_OKCANCEL = 1
CONST MB_YESNO = 4
CONST MB_ICONQUESTION = 32
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST APPHELP = 900
CONST BADPATH = 6400
CONST MODELESS = 5000
CONST CDGETNAMEORG = 7500
CONST MODELESS_1 = 10000
CONST MODELESS_2 = 10001
CONST MODELESS_3 = 10002
CONST MODELESS_4 = 10003
''CONST MODELESS_5 = 10004
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL OPTCUR$ ''Option selection from option dialog.
GLOBAL NameOut$ ''Name entered
GLOBAL OrgOut$ ''Organisation entered
GLOBAL nIniFlag% ''1 if ini file is one system
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION CreateWindow LIB "user" (szClassName$,szWindowName$,dwStyle%,nX%,nY%,nWidth%,nHeight%,hwndParent%,hMenu%,hInst%,szPnt%) AS INTEGER
DECLARE FUNCTION ShowWindow LIB "user" (hWnd%,nCmdShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user" (hWnd%,nOffset%,nVal%) AS INTEGER
DECLARE FUNCTION UserInput LIB "s_optns.dll" (hWnd%, szString3$ ) AS INTEGER
DECLARE FUNCTION EditSystemFiles LIB "s_edsys.dll" (hWnd%) AS INTEGER
DECLARE FUNCTION CheckIniEntry LIB "s_edsys.dll" (hWnd%, szString4$, szString5$) AS INTEGER
DECLARE FUNCTION WerePriceFilesChosen LIB "s_edsys.dll" ( hWnd% ) AS INTEGER
DECLARE FUNCTION UnZipFiles LIB "s_edsys.dll" ( hWnd%, szString6$ ) AS INTEGER
DECLARE FUNCTION IsStringInString LIB "mscuistf.dll" (szString1$ , szString2$) AS INTEGER
DECLARE FUNCTION ChangeDir LIB "mscuistf.dll" (szDir$) AS INTEGER
DECLARE FUNCTION WinExec LIB "kernel" (lpCmdLine$, nCmdShow% ) AS INTEGER
DECLARE SUB CreateBackDrop
DECLARE SUB SetParameters
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle "Updata Profit v1.0 Setup"
CreateBackDrop
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "FILES.INF"
END IF
DEST$ = "C:\Profit"
'$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
GETPATH:
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
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO GETPATH
END IF
WinDrive$ = GetWindowsDir()
WinFile$ = WinDrive$ + "Uswin.INI"
nIniFlag% = DoesFileExist (WinFile$,femExists )
if nIniFlag% = 0 Then
sz$ = UIStartDlg(CUIDLL$,CDGETNAMEORG,"FNameOrgDlgProc",APPHELP,HELPPROC$)
NameOut$=GetSymbolValue("NameOut")
OrgOut$=GetSymbolValue("OrgOut")
UIPop 1
end if
IF sz$ = "CONTINUE" THEN
ReadInfFile szInf$
Install
ClearBillboardList
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO GETPATH
END IF
QUIT:
SetSymbolValue "Path", DEST$
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, call 0181-874-4747!", "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
SUB SetParameters STATIC
drive$ = MID$(DEST$, 1, 1)
SizeofFreeDisk& = GetFreeSpaceForDrive(drive$)
IF SizeofFreeDisk& < 5072000 THEN
StringOne$ = "You need at least 5MB of free space on your hard disk to install the Updata for Windows Files"
StringTwo$ = ""
MessageString$ = StringOne$ + StringTwo$
i% = DoMsgBox( MessageString$, "WARNING", MB_TASKMODAL+MB_ICONHAND+MB_OK)
WriteToLogFile "Not enough space to install Profit files"
END IF
IF SizeofFreeDisk& > 5072000 THEN
WriteToLogFile "Enough space to install Profit files"
END IF
WinMajorVer% = GetWindowsMajorVersion()
WinMinorVer% = GetWindowsMajorVersion()
IF WinMajorVer% = 3 THEN
IF WinMinorVer% > 0 THEN
WriteToLogFile "Windows Version 3.1 detected."
END IF
END IF
IF WinMajorVer% = 3 THEN
IF WinMinorVer% < 1 THEN
i% = DoMsgBox("This Program requires Windows 3.1 or greater.", "ERROR", MB_TASKMODAL+MB_ICONHAND+MB_OK)
WriteToLogFile "Windows 3.0 detected."
END IF
END IF
WinDrive$ = GetWindowsDir()
SourceDrive$ = MakePath(DEST$, "Uswin.INI")
WinFile$ = WinDrive$ + "Uswin.INI"
if nIniFlag% = 0 Then
CopyFile SourceDrive$, WinFile$, cmoNone, 0
WriteToLogFile "Uswin.INI file copied OK."
''CreateIniKeyValue WinFile$,"LICENCE","NAME",NameOut$,cmoOverwrite
''CreateIniKeyValue WinFile$,"LICENCE","ORG",OrgOut$,cmoOverwrite
else
WriteToLogFile "Uswin.INI file already exists."
end if
CreateIniKeyValue WinFile$,"PATHS","UPDATA",Dest$,cmoOverwrite
Path$ = GetEnvVariableValue ( "PATH" )
i% = IsStringInString ( DEST$, Path$ )
WinDrive$ = GetWindowsDir()
WinFile$ = WinDrive$ + "Uswin.INI"
i%=DoesIniKeyExist( WinFile$, "CHARTS", "Window0" )
IF i% = 1 THEN
szEntry$= GetIniKeyString( WinFile$, "CHARTS", "Window0" )
i%=CheckIniEntry(hwndFrame,szEntry$,DEST$)
IF NOT i% = 1 THEN
RemoveIniSection WinFile$, "CHARTS", cmoNone
END IF
END IF
END SUB
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
CreateDir DEST$+"\prices", cmoNone
OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
WriteToLogFile ""
WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
WriteToLogFile " User chose option: '" + OPTCUR$ + "'"
WriteToLogFile ""
WriteToLogFile "May have had to create the directory: " + DEST$
WriteToLogFile ""
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddToBillboardList "mscuistf.dll", MODELESS_1,"Billboard_1DlgProc", 1
AddToBillboardList "mscuistf.dll", MODELESS_1,"Billboard_2DlgProc", 1
AddToBillboardList "mscuistf.dll", MODELESS_1,"Billboard_3DlgProc", 1
AddToBillboardList "mscuistf.dll", MODELESS_1,"Billboard_4DlgProc", 1
CopyFilesInCopyList
SetParameters
CreateProgmanGroup "Updata Profit", "", cmoNone
ShowProgmanGroup "Updata Profit", 1, cmoNone
CreateProgmanItem "Updata Profit", "Updata Profit v1.0", MakePath(DEST$,"profit.exe"), "", cmoOverwrite
CreateProgmanItem "Updata Profit", "Updata Profit Readme", MakePath(DEST$,"uswin.wri"), "", cmoOverwrite
CloseLogFile
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
SUB CreateBackDrop STATIC
SetWin%=SetWindowLong(HwndFrame,-16,449773568)
ShowWin%=ShowWindow(hwndFrame,3)
END SUB