home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Directory for Kids & Parents
/
InternetDirectory.iso
/
internet
/
srfwatch
/
win311
/
surf.ms_
/
surf.ms
Wrap
Text File
|
1997-11-25
|
16KB
|
621 lines
'**************************************************************************
'* SurfWatch Setup
'**************************************************************************
'*************************** Change History *******************************
'*
'* 12/16/95 WSD Passed DateStr$ to isTrailWare to inhibit multiple purchase
'* 12/14/95 WSD Added isTrialWare purchase enabling
'* 12/13/95 WSD Added CONFIG options for ATT and TrialWare. Search for CONFIG
'*
'* 12/13/95 WSD Added GetDateTime and call to put encoded date/time into
'* into surfw.ini
'*
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100 '' CONFIG: Standard
CONST BADVERIFY = 200
CONST LEGALSTUFF = 300
CONST EXITFAILURE = 400 '' CONFIG: Standard
CONST REMOVER = 500
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST EXITSUCCESS_TRIAL = 703
CONST OPTIONS = 800
CONST OPTIONS_TRIAL = 1803
CONST EXIT_ALREADY_PURCHASE = 1903
CONST REMOVECANCEL = 900
CONST EXITUISUCCESS = 1000
CONST GETPASSWORD = 1100
CONST CONFIRMPSSWRD = 1200
CONST GETNAME = 1300
CONST EXITNOCHANGE = 1400
CONST SELECTDRIVE = 1500
CONST WINSOCKLOAD = 1600
CONST BADPASSWORD = 6000
''following were taken from windows.h. &H means they're hex
CONST WS_VISIBLE=&H10000000
CONST WS_BORDER =&H00800000
CONST WS_CLIPCHILDREN =&H02000000
CONST GWL_STYLE =-16
CONST SW_SHOWMAXIMIZED=3
DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%,iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
DECLARE FUNCTION WinExec LIB "kernel.exe" (szCmdLine$, wFlags%) AS INTEGER
DECLARE FUNCTION encrypt LIB "mscuistf.dll" (sz$) AS INTEGER
DECLARE FUNCTION SetFileAttr LIB "mscuistf.dll" (szFileName$,wAttr%) AS INTEGER
DECLARE FUNCTION SetWildAttr LIB "mscuistf.dll" (szFileName$,wAttr%) AS INTEGER
DECLARE FUNCTION KSW LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION KSU LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION Penguin LIB "mscuistf.dll" (sz$) AS INTEGER
DECLARE FUNCTION UnPenguin LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION Installed LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION InstallDrive LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION pmDeleteGroup LIB "mscuistf.dll" (szGroup$) AS INTEGER
DECLARE FUNCTION pmDeleteItem LIB "mscuistf.dll" (szItem$) AS INTEGER
DECLARE FUNCTION pmInitialize LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION pmUninitialize LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION Ostritch LIB "mscuistf.dll" (hWnd%,option%) AS INTEGER
DECLARE FUNCTION Parrot LIB "mscuistf.dll" (sz$) AS INTEGER
DECLARE FUNCTION Budgie LIB "mscuistf.dll" (sz$) AS INTEGER
DECLARE FUNCTION Duck LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION Goose LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION WinVersionCheck LIB "mscuistf.dll" () AS INTEGER
DECLARE FUNCTION GetTrialDate LIB "mscuistf.dll" (szDateSpace$) AS INTEGER
DECLARE FUNCTION GetTrialOverride LIB "mscuistf.dll" (szDateSpace$) AS INTEGER
DECLARE FUNCTION isTrialWare LIB "mscuistf.dll" (IDStr$) AS INTEGER
DECLARE FUNCTION DlgOffset LIB "mscuistf.dll" () AS INTEGER
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL OPTCUR$ ''Option selection from option dialog.
GLOBAL DOSDIR$
GLOBAL Password$
GLOBAL EXENAME$
GLOBAL DLLNAME$
GLOBAL DESTDIR$
GLOBAL DESTDRIVE$
GLOBAL EXITREASON%
GLOBAL UserName$
GLOBAL DateStr$
GLOBAL NetDriveInstall%
DECLARE SUB Install
DECLARE SUB UnInstall
DECLARE SUB AddToRunLine
DECLARE SUB RemoveFromRunLine
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION GetFileFromPath(szPath$) AS STRING
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
' Maximize the background window
hWnd%=HwndFrame()
i1&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
j1%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
SetBitmap CUIDLL$, LOGO
SetTitle "SurfWatch"
EXITREASON%=EXITSUCCESS
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SURF.INF"
END IF
ReadInfFile szInf$
szLegal$ = GetSymbolValue("STF_SRCINFPATH")
IF szLegal$ = "" THEN
szLegal$ = GetSymbolValue("STF_CWDDIR") + "LEGAL.TXT"
END IF
' Read the setup.ini file to check for network drive install
NetDriveInstall% = 0
szIniFile$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INI"
if FValidIniFile(szIniFile$) <> 0 then
Res$ = GetIniKeyString(szIniFile$,"Options","NetDrives")
NetDriveInstall% = VAL(Res$)
endif
IF WinVersionCheck()=0 THEN
i% = DoMsgBox("This is the Windows 3.1 version of SurfWatch. Please contact 415-948-9505 for Windows 95 upgrade information.","ERROR",MB_OK+MB_ICONSTOP)
END
END IF
IF NOT EXISTS( szLegal$ ) THEN
i% = DoMsgBox("Cant open legal","ERROR",MB_OK)
GOTO QUIT
ENDIF
OPTCUR$ = "1"
DESTDRIVE$ = "C"
DESTDIR$ = ":\CO_RO_NT"
DOSDIR$ = "c:\dos\"
EXENAME$ = "SURFW.EXE"
DLLNAME$ = "SWUTIL.DLL"
UserName$ = ""
DateStr$ = "MMMMMMMM"
i% = GetTrialDate(DateStr$)
WELCOME:
IF isTrialWare("") AND Installed() THEN
GOTO OPTION
ELSE
sz$ = UIStartDlg(CUIDLL$, WELCOME+DlgOffset(), "FInfoDlgProc",0,"")
ENDIF
IF sz$ = "REACTIVATE" THEN
GOTO WELCOME
ENDIF
UIPop 1
' Check for reinstall
OstritchV% = 0
IF Installed() THEN
hWnd%=HwndFrame()
OstritchV% = Ostritch(hWnd%, 0)
IF OstritchV%=0 THEN
EXITREASON%=EXITNOCHANGE
GOTO QUIT
END IF
ELSE
GOTO LEGAL
END IF
OPTION:
SetSymbolValue "RadioDefault", OPTCUR$
OPTL1:
if isTrialWare("") THEN
sz$ = UIStartDlg(CUIDLL$, OPTIONS_TRIAL, "FRadioDlgProc", 0, "")
ELSE
sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", 0, "")
ENDIF
OPTCUR$ = GetSymbolValue("ButtonChecked")
IF sz$ = "REACTIVATE" THEN
GOTO OPTL1
ENDIF
UIPop 1
IF isTrialWare("") THEN
hWnd%=HwndFrame()
IF OPTCUR$="1" THEN
i% = GetTrialOverride(DateStr$)
IF isTrialWare(DateStr$) = 0 THEN
EXITREASON% = EXIT_ALREADY_PURCHASE
GOTO QUIT
END IF
i% = GetTrialDate(DateStr$)
OstritchV% = Ostritch(hWnd%, 1)
ELSE
OstritchV% = Ostritch(hWnd%, 0)
ENDIF
IF OstritchV%=0 THEN
EXITREASON%=EXITNOCHANGE
GOTO QUIT
END IF
END IF
IF (OPTCUR$="2") AND (OstritchV% < 2) THEN
GOTO DOUNINSTALL
ENDIF
IF (isTrialWare("")) AND (OPTCUR$="1") AND (OstritchV% = 2) THEN
i% = GetTrialOverride(DateStr$)
i% = KSW()
i%= KSU()
Drive%=InstallDrive()
IF Drive%<>-1 THEN
DESTDRIVE$=CHR$(Drive%+ASC("a"))
ENDIF
DEST$ = DESTDRIVE$ + DESTDIR$
CreateProgmanGroup "startup","",cmoNone
ShowProgmanGroup "startup",6,cmoNone
Path$ = DEST$ + "\surfu.exe -s"
CreateProgmanItem "startup","SurfWatch Updater",Path$,"",cmoOverwrite
DataFile$ = DEST$ + "\surfw.dat"
IF DoesFileExist (DataFile$,femExists) THEN
RemoveFile DataFile$, cmoNone
ENDIF
IniFile$ = GetWindowsDir() + "SURFW.INI"
CreateIniKeyValue IniFile$,"SurfWatch","Code",DateStr$,cmoOverwrite
SurfW$ = DEST$ + "\" + EXENAME$
i%=WinExec(SurfW$,0)
i%=WinExec(Path$,0)
PURCHASE:
sz$ = UIStartDlg(CUIDLL$, EXITSUCCESS_TRIAL, "FInfo0DlgProc", 0, "")
IF sz$="REACTIVATE" THEN
GOTO PURCHASE
END IF
UIPop 1
END
ENDIF
LEGAL:
SetSymbolValue "EditTextIn" , szLegal$
LEGAL1:
sz$ = UIStartDlg(CUIDLL$, LEGALSTUFF, "FLegalDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO LEGAL1
ELSE
EXITREASON%=EXITQUIT
GOTO QUIT
ENDIF
DRIVECHECK:
Drive% = InstallDrive()
IF (Installed()) AND (Drive%<>-1) THEN
DESTDRIVE$=CHR$(Drive%+ASC("a"))
ELSE
GetLocalHardDrivesList("Drives")
IF NetDriveInstall%>0 THEN
GetNetworkDrivesList("NetDrives")
NumNetDrives% = GetListLength("NetDrives")
IF NumNetDrives%>0 THEN
FOR i = 1 TO NumNetDrives%
AddListItem "Drives",GetListItem("NetDrives",i)
NEXT i
END IF
END IF
NumDrives% = GetListLength("Drives")
IF NumDrives%>1 THEN
SetSymbolValue "ListItemsIn" , GetSymbolValue("Drives")
SetSymbolValue "ListItemsOut" , GetListItem("Drives",1)
DRIVECHECK1:
sz$ = UIStartDlg(CUIDLL$, SELECTDRIVE, "FListDlgProc", 0,"")
IF sz$ = "CONTINUE" THEN
UIPop 1
DESTDRIVE$ = MID$(GetSymbolValue("ListItemsOut"),1,1)
ELSEIF sz$ = "REACTIVATE" THEN
GOTO DRIVECHECK1
ELSE
EXITREASON%=EXITQUIT
GOTO QUIT
END IF
ENDIF
ENDIF
DEST$ = DESTDRIVE$ + DESTDIR$
USERNAME:
SetSymbolValue "EditTextIn" , ""
USERNAME1:
sz$ = UIStartDlg(CUIDLL$, GETNAME, "FEditDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO USERNAME1
ELSE
EXITREASON%=EXITQUIT
GOTO QUIT
END IF
UserName$ = GetSymbolValue( "EditTextOut" )
PASSWORD:
SetSymbolValue "EditTextIn", ""
PASSWORD1:
sz$ = UIStartDlg(CUIDLL$, GETPASSWORD, "FEditDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO PASSWORD1
ELSE
EXITREASON%=EXITQUIT
GOTO QUIT
END IF
PassWord$ = GetSymbolValue("EditTextOut")
IF LEN(PassWord$) = 0 THEN
GOSUB BADPASSWORD
GOTO PASSWORD
ENDIF
PASSWORD2:
sz$ = UIStartDlg(CUIDLL$,CONFIRMPSSWRD,"FEditDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO PASSWORD2
ELSE
EXITREASON%=EXITQUIT
GOTO QUIT
END IF
IF PassWord$ = GetSymbolValue("EditTextOut") THEN
GOTO DOINSTALL
ELSE
PASSWORD3:
sz$ = UIStartDlg(CUIDLL$,BADVERIFY,"FInfoDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO PASSWORD3
ELSE
EXITREASON%=EXITQUIT
GOTO QUIT
END IF
GOTO PASSWORD
ENDIF
DOINSTALL:
Install
IF isTrialWare("") THEN
Path$ = DEST$ + "\surfu.exe -t"
ELSE
Path$ = DEST$ + "\surfu.exe"
END IF
i%=WinExec(Path$,1)
DOINSTALL2:
sz$ = UIStartDlg(CUIDLL$, EXITSUCCESS, "FInfo0DlgProc", 0, "")
IF sz$="REACTIVATE" THEN
GOTO DOINSTALL2
END IF
UIPop 1
END
DOUNINSTALL:
sz$ = UIStartDlg(CUIDLL$, REMOVER, "FInfoDlgProc", 0, "")
IF sz$="CONTINUE" THEN
UIPop 1
ELSEIF sz$="REACTIVATE" THEN
GOTO DOUNINSTALL
ELSE
UIPop 1
EXITREASON%=REMOVECANCEL
GOTO QUIT
END IF
Drive%=InstallDrive()
IF Drive%<>-1 THEN
DESTDRIVE$=CHR$(Drive%+ASC("a"))
ENDIF
DEST$ = DESTDRIVE$ + DESTDIR$
Uninstall
sz$ = UIStartDlg(CUIDLL$, EXITUISUCCESS , "FInfo0DlgProc",0,"")
UIPop 1
END
QUIT:
ON ERROR GOTO ERRQUIT
dlg% = EXITREASON
IF ERR THEN
dlg% = EXITFAILURE + DlgOffset()
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup data corrupted, contact SurfWatch", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPASSWORD:
sz$ = UIStartDlg(CUIDLL$, BADPASSWORD, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPASSWORD
END IF
UIPop 1
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
i% = KSW()
i%= KSU()
i%=Parrot(DEST$)
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
CopyFilesInCopyList
SysDir$ = GetWindowsSysDir()
Ctl3d$ = SysDir$ + "ctl3d.dll"
IF NOT EXISTS (Ctl3d$) THEN
ClearCopyList
AddSectionFilesToCopyList "SYSTEM", SrcDir$ , SysDir$
CopyFilesInCopyList
END IF
FileSpec$ = DEST$ + "\surfw.dat"
IF EXISTS( FileSpec$ ) THEN
RemoveFile FileSpec$, cmoNone
END IF
AddToRunLine
i% = encrypt(PassWord$)
PassWord$ = PassWord$
IniFile$ = GetWindowsDir() + "SURFW.INI"
CreateIniKeyValue IniFile$,"SurfWatch","Owner",UserName$,cmoOverwrite
CreateIniKeyValue IniFile$,"SurfWatch","Entry",PassWord$,cmoOverwrite
CreateIniKeyValue IniFile$,"SurfWatch","Code",DateStr$,cmoOverwrite
szIniFile$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INI"
if FValidIniFile(szIniFile$) <> 0 then
Default$ = GetIniKeyString(szIniFile$,"Options","DefaultFilters")
if( Default$<>"" ) then
CreateIniKeyValue IniFile$,"SurfWatch","DefaultFilters",Default$,cmoOverwrite
endif
endif
i%=Budgie(DEST$)
i%=Penguin(DEST$)
CreateProgmanGroup "startup","",cmoNone
ShowProgmanGroup "startup",6,cmoNone
IF isTrialWare("") THEN
Path$ = DEST$ + "\surfu.exe -t"
ELSE
Path$ = DEST$ + "\surfu.exe -s"
END IF
CreateProgmanItem "startup","SurfWatch Updater",Path$,"",cmoOverwrite
Path$ = DEST$ + "\surfw.exe"
CreateProgmanItem "startup","SurfWatch",Path$,"",cmoOverwrite
' Run SurfWatch
SurfW$ = DEST$ + "\" + EXENAME$
i%=WinExec(SurfW$,0)
END SUB
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB UnInstall STATIC
i% = KSW()
i% = KSU()
i%=Parrot(DEST$)
i%=Duck()
' Erase all the files in the install directory
KillFileStr$ = DEST$ + "\*.*"
IF EXISTS(KillFileStr$) THEN
KILL KillFileStr$
ENDIF
TempDir$ = DESTDRIVE$ + ":\"
CHDIR TempDir$
IF DoesDirExist(DEST$) THEN
RMDIR DEST$
ENDIF
i%=Goose()
RemoveFromRunLine
i%=UnPenguin()
' Erase surfw.ini
IniFile$ = GetWindowsDir() + "SURFW.INI"
IF DoesFileExist (IniFile$,femExists) THEN
RemoveFile IniFile$, cmoNone
ENDIF
IF pmInitialize() THEN
CreateProgmanGroup "startup","",cmoNone
i% = pmDeleteItem("SurfWatch Updater")
i% = pmDeleteItem("SurfWatch")
i% = pmUninitialize()
ELSE
i%=DoMsgBox("Unable to remove Program Manager Items","SurfWatch Updater",MB_OK)
ENDIF
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
FUNCTION GetFileFromPath(szPath$) STATIC AS STRING
' Find the last \
FOR i = LEN(szPath$) TO 1 STEP -1
IF MID$(szPath$,i,1)="\" THEN
GetFileFromPath = MID$(szPath,i+1)
i = 1
END IF
NEXT i
END FUNCTION
SUB AddToRunLine STATIC
RemoveFromRunLine
SurfW$ = DEST$ + "\" + EXENAME$
RunStr$ = GetIniKeyString( "WIN.INI", "windows", "load" )
RunStr$ = RunStr$ + " " + SurfW$
CreateIniKeyValue "WIN.INI", "windows" , "load" , RunStr$ , cmoOverwrite
END SUB
SUB RemoveFromRunLine STATIC
SurfW$ = DESTDIR$ + "\" + EXENAME$
RunStr$ = GetIniKeyString( "WIN.INI", "windows", "load" )
i% = INSTR( RunStr$ , SurfW$ )
IF NOT i%=0 THEN
i%=i%-1
SurfW$ = DESTDIR$ + "\" + EXENAME$
Temp$ = MID$( RunStr$ , 1 , i%-1 )
i% = i% + LEN( SurfW$ )
IF i%<LEN( RunStr$ ) THEN
Temp$ = Temp$ + MID$( RunStr$ , i% )
ENDIF
CreateIniKeyValue "WIN.INI","windows","load",Temp$,cmoOverwrite
ENDIF
END SUB