home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hacker Chronicles 2
/
HACKER2.BIN
/
610.GEPASI.MS_
/
610.GEPASI.MS
Wrap
Text File
|
1992-11-21
|
12KB
|
404 lines
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
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 CUSTINST = 6200
CONST TOOBIG = 6300
CONST BADPATH = 6400
CONST LOGO = 1
CONST APPFILES = 1
CONST OPTFILES1 = 2
CONST OPTFILES2 = 3
GLOBAL DEST$
GLOBAL DEST_EX$
GLOBAL DEST_MAN$
GLOBAL COMMPATH$
GLOBAL WINDRIVE$
GLOBAL OPT1OPT$
GLOBAL OPT2OPT$
GLOBAL NEEDSYS%
GLOBAL APPNEEDS$
GLOBAL OPT1NEEDS$
GLOBAL OPT2NEEDS$
GLOBAL EXTRACOSTS$
GLOBAL BIGLIST$
GLOBAL CHECKSTATES$
GLOBAL STATUSTEXT$
GLOBAL DRIVETEXT$
DECLARE SUB AddOptFilesToCopyList (ftype%)
DECLARE SUB RecalcOptFiles (ftype%)
DECLARE SUB RecalcPath
DECLARE SUB SetDriveStatus
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
CUIDLL$ = "mscuistf.dll"
HELPPROC$ = "FHelpDlgProc"
SetBitmap CUIDLL$, LOGO
SetTitle "GEPASI Setup"
SetAbout "GEPASI version 2", "This package is free software. It is provided as is WITHOUT ANY WARRANTY! ⌐ 1989/1992 Pedro Mendes"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "GEPASI.INF"
END IF
ReadInfFile szInf$
NEEDSYS% = 0
IF GetWindowsMajorVersion() = 3 THEN
IF GetWindowsMinorVersion() = 0 THEN
NEEDSYS% = 1
END IF
END IF
IF GetWindowsMajorVersion() < 3 THEN
NEEDSYS% = 1
END IF
WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
DEST$ = WINDRIVE$ + ":\GEPASI"
DEST_EX$ = DEST$ + "\EXAMPLES"
DEST_MAN$ = DEST$ + "\DOCS"
CHECKSTATES$ = "CheckItemsState"
STATUSTEXT$ = "StatusItemsText"
DRIVETEXT$ = "DriveStatusText"
FOR i% = 1 TO 3 STEP 1
AddListItem CHECKSTATES$, "ON"
NEXT i%
FOR i% = 1 TO 3 STEP 1
AddListItem STATUSTEXT$, ""
NEXT i%
FOR i% = 1 TO 7 STEP 1
AddListItem DRIVETEXT$, ""
NEXT i%
ReplaceListItem DRIVETEXT$, 7, DEST$
APPNEEDS$ = "AppNeeds"
OPT1NEEDS$ = "Opt1Needs"
OPT2NEEDS$ = "Opt2Needs"
EXTRACOSTS$ = "ExtraCosts"
BIGLIST$ = "BigList"
FOR i% = 1 TO 3 STEP 1
AddListItem BIGLIST$, ""
NEXT i%
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "0"
NEXT i%
RecalcPath
SetDriveStatus
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
CUSTINST:
sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
FOR i% = 1 TO 3 STEP 1
IF GetListItem(BIGLIST$, i%) <> "" THEN
GOSUB TOOBIG
GOTO CUSTINST
END IF
NEXT i%
UIPop 1
GOTO INSTALL
ELSEIF sz$ = "PATH" THEN
GOTO GETPATH
ELSEIF sz$ = "CHK1" THEN
RecalcOptFiles APPFILES
SetDriveStatus
GOTO CUSTINST
ELSEIF sz$ = "CHK2" THEN
RecalcOptFiles OPTFILES1
SetDriveStatus
GOTO CUSTINST
ELSEIF sz$ = "CHK3" THEN
RecalcOptFiles OPTFILES2
SetDriveStatus
GOTO CUSTINST
ELSEIF sz$ = "REACTIVATE" THEN
RecalcPath
SetDriveStatus
GOTO CUSTINST
ELSE
GOSUB ASKQUIT
GOTO CUSTINST
END IF
INSTALL:
ClearCopyList
IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
AddOptFilesToCopyList APPFILES
CreateDir DEST$, cmoNone
END IF
IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
AddOptFilesToCopyList OPTFILES1
CreateDir DEST_EX$, cmoNone
END IF
IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
AddOptFilesToCopyList OPTFILES2
CreateDir DEST_MAN$, cmoNone
END IF
CopyFilesInCopyList
IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
CreateProgmanGroup "GEPASI", "", cmoNone
ShowProgmanGroup "GEPASI", 1, cmoNone
CreateProgmanItem "GEPASI", "Gepasi Simulation", MakePath(DEST$,"gwsim.exe"), "", cmoOverwrite
CreateProgmanItem "GEPASI", "Gepasi Topology", MakePath(DEST$,"gwtop.exe"), "", cmoOverwrite
IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
CreateProgmanItem "GEPASI", "gepasi.wri", "write.exe "+MakePath(DEST_MAN$,"gepasi.wri"), "", cmoOverwrite
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, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
olddest$ = DEST$
DEST$ = GetSymbolValue("EditTextOut")
DEST_EX$ = DEST$ + "\EXAMPLES"
DEST_MAN$ = DEST$ + "\DOCS"
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
IF LEN(DEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 7, DEST$
END IF
IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
RecalcPath
SetDriveStatus
END IF
olddest$ = ""
GOTO CUSTINST
ELSEIF sz$ = "REACTIVATE" THEN
RecalcPath
SetDriveStatus
GOTO GETPATHL1
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO GETPATHL1
ELSE
UIPop 1
GOTO CUSTINST
END IF
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
RecalcPath
SetDriveStatus
GOTO TOOBIG
END IF
UIPop 1
RETURN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
RecalcPath
SetDriveStatus
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
'** Purpose:
'** Adds the specified option files to the copy list.
'** Arguments:
'** ftype% - type of files to add, one of the following:
'** APPFILES, OPTFILES1, OPTFILES2
'** Returns: none.
'*************************************************************************
SUB AddOptFilesToCopyList (ftype%) STATIC
IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
SrcDir$ = GetSymbolValue("STF_SRCDIR")
IF ftype% = APPFILES THEN
AddSectionFilesToCopyList "APPFILES", SrcDir$, DEST$
IF NEEDSYS% = 1 THEN
COMMPATH$ = MakePath(DEST$,"COMMDLG.DLL")
AddSpecialFileToCopyList "SYSFILES", "1", SrcDir$, COMMPATH$
END IF
ELSEIF ftype% = OPTFILES1 THEN
AddSectionFilesToCopyList "OPTFILES1", SrcDir$, DEST_EX$
ELSEIF ftype% = OPTFILES2 THEN
AddSectionFilesToCopyList "OPTFILES2", SrcDir$, DEST_MAN$
END IF
SrcDir$ = ""
END IF
END SUB
'** Purpose:
'** Recalculates disk space for the given option files and sets
'** the status info symbol "StatusItemsText".
'** Arguments:
'** ftype% - type of files to add, one of the following:
'** APPFILES, OPTFILES1, OPTFILES2
'** Returns: none.
'*************************************************************************
SUB RecalcOptFiles (ftype%) STATIC
CursorSave% = ShowWaitCursor()
ClearCopyList
AddOptFilesToCopyList ftype%
fExtra% = 0
IF ftype% = APPFILES THEN
ListSym$ = APPNEEDS$
IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
ReplaceListItem EXTRACOSTS$, ndrive%, "1024"
fExtra% = 1
END IF
ELSEIF ftype% = OPTFILES1 THEN
ListSym$ = OPT1NEEDS$
ELSEIF ftype% = OPTFILES2 THEN
ListSym$ = OPT2NEEDS$
END IF
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
cost& = 0
FOR i% = 1 TO 26 STEP 1
cost& = cost& + VAL(GetListItem(ListSym$, i%))
NEXT i%
ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
IF StillNeed& > 0 THEN
ReplaceListItem BIGLIST$, ftype%, "YES"
ELSE
ReplaceListItem BIGLIST$, ftype%, ""
END IF
IF fExtra% THEN
ReplaceListItem EXTRACOSTS$, ndrive%, "0"
END IF
RestoreCursor CursorSave%
ListSym$ = ""
END SUB
'** Purpose:
'** Recalculates disk space and sets option status info according
'** to the current destination path.
'** Arguments: none.
'** Returns: none.
'*************************************************************************
SUB RecalcPath STATIC
CursorSave% = ShowWaitCursor()
RecalcOptFiles APPFILES
RecalcOptFiles OPTFILES1
RecalcOptFiles OPTFILES2
RestoreCursor CursorSave%
END SUB
'** Purpose:
'** Sets drive status info according to latest disk space calcs.
'** Arguments: none.
'** Returns: none.
'*************************************************************************
SUB SetDriveStatus STATIC
drive$ = MID$(DEST$, 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
free& = GetFreeSpaceForDrive(drive$)
ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
IF drive$ = WINDRIVE$ THEN
ReplaceListItem DRIVETEXT$, 4, ""
ReplaceListItem DRIVETEXT$, 5, ""
ReplaceListItem DRIVETEXT$, 6, ""
ELSE
ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
IF cost& = 0 THEN
ReplaceListItem DRIVETEXT$, 4, ""
ReplaceListItem DRIVETEXT$, 5, ""
ReplaceListItem DRIVETEXT$, 6, ""
ELSE
free& = GetFreeSpaceForDrive(WINDRIVE$)
ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
END IF
END IF
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