home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows NT Super Tune-Up Kit
/
PIE-WindowsNTSuperTuneUpKit-1997.iso
/
BNCHMARK
/
SVRBENCH
/
NW41
/
NW41CO.EXE
/
SB30.MS_
/
SB30.MS
Wrap
Text File
|
1996-01-05
|
8KB
|
294 lines
'**************************************************************************
'* MSSetup Toolkit Sample 1
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST EXITRESTART = 750
CONST OPTIONS = 800
CONST APPHELP = 900
CONST BADPATH1 = 6400
CONST BADPATH2 = 6401
CONST BADPATH3 = 6402
CONST BADPATH4 = 6403
CONST TRUE = -1
CONST FALSE = 0
''Bitmap ID
CONST LOGO = 1
CONST WS_VISIBLE=&H10000000
CONST WS_BORDER=&H00800000
CONST WS_CLIPCHILDREN=&H02000000
CONST GWL_STYLE=-16
CONST SW_SHOWMAXIMIZED=3
GLOBAL DEST$ ''Default destination directory.
GLOBAL DEST2$ ''Current Port Directory.
GLOBAL OPTCUR$ ''Option selection from option dialog.
GLOBAL DestDrive$
GLOBAL PRODUCTNAME$
GLOBAL WinDrive$
GLOBAL SrcDir$
DECLARE SUB Install
DECLARE FUNCTION CheckSpace () AS INTEGER
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%,iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%,offset%,style&) AS LONG
INIT:
PRODUCTNAME$ = "ServerBench 3.0 Controller for NetWare"
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle PRODUCTNAME$ + " Setup"
hWnd% = HwndFrame()
i1& = SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
j1% = ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
SrcDir$ = GetSymbolValue("STF_SRCDIR")
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = MakePath(GetSymbolValue("STF_CWDDIR"),"sb30.inf")
END IF
ReadInfFile szInf$
OPTCUR$ = "1"
DEST$ = "C:\SB30"
IF SrcDir$ = DEST$ THEN
DEST$ = "C:\SVRBENCH"
END IF
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
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
DEST2$=DEST$
DEST$ =DEST2$ + "\nw41"
IF sz$ = "CONTINUE" THEN
IF MakePath(SrcDir$,"") = MakePath(DEST$,"") THEN
dlg% = BADPATH1
GOSUB BADPATH
GOTO GETPATHL1
END IF
DestDrive$ = MID$(DEST$, 1, 1)
IF IsDriveValid(DestDrive$) = 0 THEN
dlg% = BADPATH2
GOSUB BADPATH
GOTO GETPATHL1
END IF
IF IsDirWritable(DEST$) = 0 THEN
dlg% = BADPATH3
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
GOTO GETPATHL1
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
IF CheckSpace() = FALSE THEN
GOTO GETPATH
END IF
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
IF RestartListEmpty() = 0 THEN
dlg% = EXITRESTART
ELSE
dlg% = EXITSUCCESS
END IF
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
IF dlg% = EXITRESTART THEN
j% = ExitExecRestart()
END IF
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call ZDBOp!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, dlg%, "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
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
STATIC FUNCTION CheckSpace() AS INTEGER
ClearCopyList
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddSectionFilesToCopyList "Suites", SrcDir$, MakePath(DEST$,"SUITES")
AddSectionFilesToCopyList "Docs", SrcDir$, MakePath(DEST$,"DOCS")
FOR i% = 1 TO 26 STEP 1
AddListItem "EXTRA", "0"
NEXT i%
wd% = ASC(ucase$(WinDrive$)) - ASC("A") + 1
dd% = ASC(ucase$(DestDrive$)) - ASC("A") + 1
ReplaceListItem "EXTRA", wd%, "10240"
spaceNeeded& = GetCopyListCost("EXTRA","COST","NEEDED")
IF spaceNeeded& = 0 THEN
CheckSpace = TRUE
ELSE
CheckSpace = FALSE
w& = VAL(GetListItem("NEEDED",wd%))
d& = VAL(GetListItem("NEEDED",dd%))
m$ = "There is not enough disk space to install ServerBench."
IF d& > 0 THEN
m$ = m$ + CHR$(10) + CHR$(10)
m$ = m$ + "You need an additional " + STR$((d&+999)/1000) + " kilobytes on drive " + DestDrive$ + "."
m$ = m$ + " Choose another installation drive, or free additional space on drive " + DestDrive$ + "."
END IF
IF (w& > 0) AND (wd% <> dd%) THEN
m$ = m$ + CHR$(10) + CHR$(10)
m$ = m$ + "You must free an additional " + STR$((w&+999)/1000) + " kilobytes on drive " + WinDrive$
m$ = m$ + " before installing ServerBench."
END IF
i% = DoMsgBox(m$,"Insufficient Disk Space",MB_TASKMODAL+MB_OK+MB_ICONHAND)
END IF
END FUNCTION
STATIC SUB Install
CreateDir DEST$, cmoNone
CreateDir MakePath(DEST$,"DOCS"), cmoNone
CreateDir MakePath(DEST$,"RESULTS"), cmoNone
CreateDir MakePath(DEST$,"SUITES"), cmoNone
SetRestartDir DEST$
CopyFilesInCopyList
CreateProgmanGroup "Ziff-Davis Benchmarks", "", cmoNone
ShowProgmanGroup "Ziff-Davis Benchmarks", 1, cmoNone
CreateProgmanItem "Ziff-Davis Benchmarks", PRODUCTNAME$, MakePath(DEST$,"sb30a.exe"), "", cmoOverwrit
' CreateProgmanItem "Ziff-Davis Benchmarks", "Readme", MakePath(DEST$,"readme.txt"), "", cmoOverwrit
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
IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = MID$(szDir$, 1, LEN(szDir$)-1)
ELSE
MakePath = szDir$
END IF
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION