home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip Hitware 3
/
Chip_Hitware_Vol_03.iso
/
chiphit3
/
dfu
/
wisdn
/
sharew.mst
< prev
next >
Wrap
Text File
|
1995-10-31
|
17KB
|
541 lines
'*********************
'* ISDN WISDN Setup script : shareware version of software 5/6/95
'*********************
'**************** DECLARATIONS ****************************
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST REGISTER = 1000
CONST ASKREGISTER = 1100
CONST SAVEPASSWORDS = 1200
CONST UNREGISTERED = 1300
CONST BADPATH = 6400
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ '' Default destination directory.
GLOBAL REGNO$ '' Registration number
GLOBAL ADMINPWD$ '' Administrator password
GLOBAL OTHERSPWD$ '' All Others Password
GLOBAL CUIDLL$
''=============
GLOBAL hSetup AS INTEGER
GLOBAL fFrameInit AS INTEGER
GLOBAL fInstallInit AS INTEGER
'' DoMsgBox Flags
CONST MB_OK = 0
CONST MB_ICONHAND = 16
CONST MB_TASKMODAL = 8192
CONST MB_ICONINFORMATIOM = 64
''Command Option Flags
CONST cmoOverwrite = 1024
CONST cmoNone = 0
''General Return Codes
CONST grcUserQuit = 48
CONST cbSymValMax = 512
''ON ERROR Error Codes
CONST STFERR = 1024 ''setup system error
CONST STFQUIT = 1025 ''user quit
DECLARE FUNCTION GetWindowsDirectory LIB "kernel" (szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION GetSystemDirectory LIB "kernel" (szBuf$, cbBuf%) AS INTEGER
DECLARE SUB SetWindowText LIB "User" (hwnd%, lpString$)
DECLARE FUNCTION FSetBitmap LIB "msshlstf.dll" (szDll$, Bitmap%) AS INTEGER
DECLARE FUNCTION FSetAbout LIB "msshlstf.dll" (szAbout1$, szAbout2$) AS INTEGER
DECLARE FUNCTION HwndFrame LIB "msshlstf.dll" AS INTEGER
DECLARE FUNCTION HinstFrame LIB "msshlstf.dll" AS INTEGER
DECLARE FUNCTION FSetSymbolValue LIB "msshlstf.dll" (szSymbol$, szValue$) AS INTEGER
DECLARE FUNCTION InitializeFrame LIB "msshlstf.dll" (szCmdLine$) AS INTEGER
DECLARE FUNCTION FDoDialog LIB "msuilstf.dll" (hwnd%, szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) AS INTEGER
DECLARE FUNCTION FKillNDialogs LIB "msuilstf.dll" (n%) AS INTEGER
DECLARE FUNCTION FInitializeInstall LIB "msinsstf.dll" (hinst%, hwndFrame%) AS INTEGER
DECLARE FUNCTION FIsDirWritable LIB "msinsstf.dll" (szDir$) AS INTEGER
DECLARE FUNCTION FCreateDir LIB "msinsstf.dll" (szDir$, cmo%) AS INTEGER
DECLARE FUNCTION FCreateIniKeyValue LIB "msinsstf.dll" (szFile$, szSect$, szKey$, szValue$, cmo%) AS INTEGER
DECLARE FUNCTION FCreateProgManGroup LIB "msinsstf.dll" (szGroup$, szPath$, cmo%) AS INTEGER
DECLARE FUNCTION FCreateProgManItem LIB "msinsstf.dll" (szGroup$, szItem$, szCmd$, cmo%) AS INTEGER
DECLARE FUNCTION FShowProgManGroup LIB "msinsstf.dll" (szGroup$, szCmd$, cmo%) AS INTEGER
DECLARE FUNCTION InitSetup (szCmdLine$) AS INTEGER
DECLARE FUNCTION InitFrame (szCmdLine$) AS INTEGER
DECLARE FUNCTION FAddSectionFilesToCopyList LIB "mscomstf.dll" (szSect$, szSrc$, szDest$) AS INTEGER
DECLARE FUNCTION GrcCopyFilesInCopyList LIB "msinsstf.dll" (hInstance%) AS INTEGER
DECLARE FUNCTION CbGetSymbolValue LIB "mscomstf.dll" (szSymbol$, szValue$, Length%) AS INTEGER
DECLARE FUNCTION FOpenInf LIB "mscomstf.dll" (szFile$, fCheck%, fCheckSyms%) AS INTEGER
DECLARE FUNCTION DoMsgBox LIB "mscomstf.dll" (lpText$,lpCaption$,wType%) As INTEGER
DECLARE FUNCTION GetWindowsDir AS STRING
DECLARE FUNCTION GetWindowsSysDir AS STRING
DECLARE FUNCTION GetSymbolValue (szSymbol$) AS STRING
DECLARE FUNCTION IsDirWritable (szDir$) AS INTEGER
DECLARE FUNCTION UIStartDlg(szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) AS STRING
DECLARE SUB InitInstall
DECLARE SUB SetSymbolValue (szSymbol$, szValue$)
DECLARE SUB CreateDir (szDir$, cmo%)
DECLARE SUB SetBitmap(szDll$, Bitmap%)
DECLARE SUB SetAbout(szAbout1$, szAbout2$)
DECLARE SUB SetTitle (sz$)
DECLARE SUB ReadInfFile (szFile$)
DECLARE SUB UIPop (n%)
DECLARE SUB UIPopAll
DECLARE SUB CopyFilesInCopyList
DECLARE SUB AddSectionFilesToCopyList (szSect$, szSrc$, szDest$)
DECLARE SUB CreateIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%)
DECLARE SUB CreateProgmanGroup (szGroup$, szPath$, cmo%)
DECLARE SUB CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%)
DECLARE SUB ShowProgmanGroup (szGroup$, Cmd%, cmo%)
''=============
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
TRAP CleanupTrap From "MSSHLSTF.DLL"
End Trap
ON ERROR GOTO QUIT
'**************** END OF DECLARATIONS ****************************
'**************** Start of Script ****************************
INIT:
CUIDLL$= "mscuistf.dll" ''Custom user interface dll
hSetup = InitSetup(COMMAND$)
REGNO$= ""
SetBitmap CUIDLL$, LOGO
SetTitle "WISDN Setup"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SHAREW.INF"
END IF
ReadInfFile szInf$
WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
DEST$ = WINDRIVE$ + ":\WISDN"
AUTOEXECCUR$ = "1"
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", 0, "")
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", 0, "")
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
GOSUB ASKQUIT
GOTO GETPATH
END IF
ASKREGISTER:
sz$ = UIStartDlg(CUIDLL$, ASKREGISTER, "FInfoDlgProc", 0, "")
IF sz$ = "REGISTER" THEN
UIPop 1
GOTO GETREGNO
ELSEIF sz$ = "CONTINUE" THEN
UIPop 1
GOTO GETCOMPUTERID
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETPATH
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKREGISTER
ELSE
GOSUB ASKQUIT
GOTO ASKREGISTER
END IF
GETREGNO:
SetSymbolValue "EditTextIn", REGNO$
GETREG1:
sz$ = UIStartDlg(CUIDLL$, REGISTER, "FRegisterDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
REGNO$ = GetSymbolValue("EditTextOut")
GOTO DOINSTALL
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO ASKREGISTER
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETREG1
ELSE
GOSUB ASKQUIT
GOTO GETREG1
END IF
GETCOMPUTERID:
sz$ = UIStartDlg(CUIDLL$, UNREGISTERED, "FUnregisteredDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
REGNO$ = GetSymbolValue("EditTextOut")
GOTO DOINSTALL
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO ASKREGISTER
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETCOMPUTERID
ELSE
GOSUB ASKQUIT
GOTO GETCOMPUTERID
END IF
DOINSTALL:
SetSymbolValue "EditTextIn", REGNO$
sz$ = UIStartDlg(CUIDLL$, SAVEPASSWORDS, "FSaveRegnoDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ADMINPWD$ = GetSymbolValue("AdminPasswd")
OTHERSPWD$ = GetSymbolValue("OthersPasswd")
ELSE
i%=DoMsgBox("Couldn't save the administrator's password.", "WISDN Setup", MB_TASKMODAL+MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
Install
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
UIPopAll
END
ERRQUIT:
UIPopAll
i% = DoMsgBox("Setup sources were corrupted. Please contact your supplier.", "WISDN Setup", 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
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'**************** END of Script ****************************
'**************** FUNCTIONS ****************************
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
FUNCTION InitSetup(szCmdLine$) STATIC AS INTEGER
fFrameInit = 0
fInstallInit = 0
IF hSetup > 0 THEN
END IF
i% = InitFrame(szCmdLine$)
fFrameInit = 1
InitInstall
fInstallInit = 1
InitSetup = i%
END FUNCTION
'********************
FUNCTION InitFrame(szCmdLine$) STATIC AS INTEGER
IF hSetup > 0 THEN
ELSE
i% = InitializeFrame(szCmdLine$)
IF i% = -1 THEN
END '' NOT an error - Usage (/?) or Command line copy operation
ELSEIF i% = 0 THEN
END
ELSE
InitFrame = i%
END IF
END IF
END FUNCTION
'********************
SUB InitInstall STATIC
IF hSetup > 0 THEN
ELSEIF FInitializeInstall(HinstFrame(), HwndFrame()) = 0 THEN
END
END IF
END SUB
'********************
FUNCTION GetSymbolValue(szSymbol$) STATIC AS STRING
szValue$ = string$(cbSymValMax,32)
Length% = CbGetSymbolValue(szSymbol$, szValue$, cbSymValMax)
GetSymbolValue = szValue$
IF Length% >= cbSymValMax THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF szSymbol$ = "" THEN
ERROR STFERR
END IF
szValue$ = ""
END FUNCTION
'********************
SUB SetSymbolValue(szSymbol$, szValue$) STATIC
IF FSetSymbolValue(szSymbol$, szValue$) = 0 THEN
ERROR STFERR
END IF
END SUB
'*********************
SUB SetBitmap(szDll$, Bitmap%) STATIC
IF FSetBitmap(szDll$, Bitmap%) = 0 THEN
ERROR STFERR
END IF
END SUB
'*********************
SUB SetAbout(szAbout1$, szAbout2$) STATIC
IF FSetAbout(szAbout1$, szAbout2$) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
SUB SetTitle(sz$) STATIC
SetWindowText HwndFrame(), sz$
END SUB
'********************
SUB ReadInfFile (szFile$) STATIC
IF FOpenInf(szFile$, 1, 0) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
FUNCTION GetWindowsDir STATIC AS STRING
szBuf$ = string$(256, 32)
cbBuf% = GetWindowsDirectory(szBuf$, 256)
IF cbBuf% = 0 THEN
GetWindowsDir = ""
ERROR STFERR
ELSE
IF cbBuf% > 255 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
szBuf$ = RTRIM$(szBuf$)
IF MID$(szBuf$, 1, 1) = "\" THEN
'szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
szBuf$ = MID$(GetWindowsSysDir, 1, 2) + szBuf$
ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
szBuf$ = MID$(GetWindowsSysDir, 1, 3) + szBuf$
END IF
IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
szBuf$ = szBuf$ + "\"
END IF
GetWindowsDir = szBuf$
END IF
szBuf$ = ""
END FUNCTION
'********************
FUNCTION GetWindowsSysDir STATIC AS STRING
szBuf$ = string$(256, 32)
cbBuf% = GetSystemDirectory(szBuf$, 256)
IF cbBuf% = 0 THEN
ERROR STFERR
ELSE
IF cbBuf% > 255 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
szBuf$ = RTRIM$(szBuf$)
IF MID$(szBuf$, 1, 1) = "\" THEN
szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
END IF
IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
szBuf$ = szBuf$ + "\"
END IF
GetWindowsSysDir = szBuf$
END IF
szBuf$ = ""
END FUNCTION
'********************
FUNCTION UIStartDlg(szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) STATIC AS STRING
IF FDoDialog(HwndFrame(), szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) = 0 THEN
ERROR STFERR
ELSE
UIStartDlg = GetSymbolValue("DLGEVENT")
END IF
END FUNCTION
'********************
SUB UIPop (n%) STATIC
IF FKillNDialogs(n%) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
SUB UIPopAll STATIC
IF FKillNDialogs(65535) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
FUNCTION IsDirWritable (szDir$) STATIC AS INTEGER
IsDirWritable = FIsDirWritable(szDir$)
END FUNCTION
'********************
SUB CreateDir (szDir$, cmo%) STATIC
IF FCreateDir(szDir$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
SUB CopyFilesInCopyList STATIC
grc% = GrcCopyFilesInCopyList (HinstFrame())
IF grc% = grcUserQuit THEN
ERROR STFQUIT
ELSEIF grc% > 0 THEN
ERROR STFERR
END IF
END SUB
'********************
SUB AddSectionFilesToCopyList (szSect$, szSrc$, szDest$) STATIC
IF FAddSectionFilesToCopyList (szSect$, szSrc$, szDest$) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
SUB CreateIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%) STATIC
IF FCreateIniKeyValue(szFile$, szSect$, szKey$, szValue$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
SUB CreateProgmanGroup (szGroup$, szPath$, cmo%) STATIC
IF FCreateProgManGroup(szGroup$, szPath$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
SUB CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) STATIC
szItemNew$ = szItem$
IF szOther$ <> "" THEN
szItemNew$ = szItem$ + "," + szOther$
END IF
IF FCreateProgManItem(szGroup$, szItemNew$, szCmd$, cmo%) = 0 THEN
ERROR STFERR
END IF
szItemNew$ = ""
END SUB
'********************
SUB ShowProgmanGroup (szGroup$, Cmd%, cmo%) STATIC
IF FShowProgManGroup(szGroup$, STR$(Cmd%), cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
'********************
'********************
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
WinDir$ = GetWindowsDir()
SysDir$ = GetWindowsSysDir()
CreateDir DEST$, cmoNone
AddSectionFilesToCopyList "Main", SrcDir$, DEST$
AddSectionFilesToCopyList "Docs", SrcDir$, DEST+"\Docs"
CopyFilesInCopyList
ini$ = MakePath(WinDir$, "WISDN.INI")
CreateIniKeyValue ini$, "Environment", "WISDN directory", DEST$ , cmoOverwrite
CreateIniKeyValue ini$, "Environment", "Call log", DEST$+"\WISDN.LOG" ,cmoOverwrite
CreateIniKeyValue ini$, "Options", "Phone", "65291", cmoOverwrite
CreateIniKeyValue ini$, "Environment", "Help Path", DEST$, cmoOverwrite
CreateIniKeyValue ini$, "Options", "Status Bars", "12", cmoOverwrite
CreateIniKeyValue ini$, "Options", "Ringing Tone", "2500,20,20,30", cmoOverwrite
'For Diskmanager
CreateIniKeyValue ini$, "Disk manager", "Include", "94", cmoNone
'For Registration
CreateIniKeyValue ini$, "Security", "Administrator Password",ADMINPWD$, cmoOverwrite
CreateIniKeyValue ini$, "Security", "Registration Number",REGNO$, cmoOverwrite
ini$ = MakePath(WinDir$, "WISDNSEC.INI")
CreateIniKeyValue ini$, "<all others>", "Password",OTHERSPWD$, cmoOverwrite
' Create WISDN Program Group with documents listed
CreateProgmanGroup "WISDN", "", cmoNone
ShowProgmanGroup "WISDN", 1, cmoNone
CreateProgmanItem "WISDN", "WISDN 2", MakePath(DEST$,"wisdn.exe"), "", cmoOverwrite
CreateProgmanItem "WISDN", "WISDN 2 HELP", MakePath(WinDir$,"WINHELP "+DEST$+"\WISDN.HLP"), "", cmoOverwrite
CreateProgmanItem "WISDN", "Read Me", MakePath(WinDir$,"WRITE "+DEST$+"\docs\README.WRI"), "", cmoOverwrite
CreateProgmanItem "WISDN", "Getting Started", MakePath(WinDir$,"WRITE "+DEST$+"\docs\install.WRI"), "", cmoOverwrite
CreateProgmanItem "WISDN", "Call Control", MakePath(WinDir$,"WRITE "+DEST$+"\docs\call.WRI"), "", cmoOverwrite
CreateProgmanItem "WISDN", "Disk Manager", MakePath(WinDir$,"WRITE "+DEST$+"\docs\diskman.WRI"), "", cmoOverwrite
CreateProgmanItem "WISDN", "ISDN", MakePath(WinDir$,"WRITE "+DEST$+"\docs\isdn.WRI"), "", cmoOverwrite
CreateProgmanItem "WISDN", "WISDN Features", MakePath(WinDir$,"WRITE "+DEST$+"\docs\features.WRI"), "", cmoOverwrite
CreateProgmanItem "WISDN", "Hints and Tips", MakePath(WinDir$,"WRITE "+DEST$+"\docs\Tips.WRI"), "", cmoOverwrite
CreateProgmanItem "WISDN", "Register", MakePath(WinDir$,"NOTEPAD "+DEST$+"\docs\Register.txt"), "", cmoOverwrite
END SUB