home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computerworld 1996 March
/
Computerworld_1996-03_cd.bin
/
idg_cd3
/
utility
/
backdsk
/
backdesk.mst
< prev
next >
Wrap
Text File
|
1995-05-29
|
11KB
|
362 lines
'**************************************************************************
'* Microcosm Setup Program
'**************************************************************************
'$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 OPTIONS = 800
CONST APPHELP = 900
CONST BADPATH = 6400
CONST RESTART = 1100
CONST MAKESHELL = 7900
CONST PROBSYS = 8000
CONST SYSMENU = 8100
CONST SHELLRESTART = 8200
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL WINDRIVE$ ''Windows drive letter.
GLOBAL szWinDir$ ''Windows directory.
GLOBAL szWinSysDir$ ''Windows system directory
GLOBAL szDirTmp$ ''Temporary directory.
GLOBAL szIniDir$
GLOBAL szIniEntry$
GLOBAL szAutoDir$
GLOBAL CUIDLL$
GLOBAL szOut$
GLOBAL IsShell%
DECLARE SUB Install
DECLARE SUB AskQuitInstall
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION GetPrivateProfileString LIB "kernel" (szSect$, szKey$, szDefault$,szBuf$, cbBuf%, szIni$) AS INTEGER
DECLARE FUNCTION ExitWindows LIB "user" (p1&, p2%) AS INTEGER
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle "BackDesk Install Program"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "Setup.INF"
END IF
ReadInfFile szInf$
OPTCUR$ = "1"
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
szWinDir$ = GetWindowsDir()
szWinSysDir$ = GetWindowsSysDir()
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
DEST$ = MakePath(szWinDir$,"BackDesk")
'' Check Windows Version
IF (GetWindowsMajorVersion() < 3) OR ((GetWindowsMajorVersion() = 3) AND (GetWindowsMinorVersion() < 1)) THEN
i% = DoMsgBox("BackDesk requires Windows V3.1 to run.","BackDesk Install",MB_OK+MB_ICONEXCLAMATION)
END IF
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
AskQuitInstall
GOTO WELCOME
END IF
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
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
AskQuitInstall
GOTO GETPATH
END IF
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
IF IsShell% = 1 THEN
dlg% = SHELLRESTART
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
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted!", "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
''AskQuitInstall was here
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
SetRestartDir(DEST$)
OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
WriteToLogFile ""
WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
WriteToLogFile ""
WriteToLogFile "May have had to create the directory: " + DEST$
WriteToLogFile ""
AddSectionFilesToCopyList "BackDesk", SrcDir$, DEST$
AddSectionFilesToCopyList "BackDesk Tools", SrcDir$, DEST$
AddSectionFilesToCopyList "BackDrop Tools", SrcDir$, DEST$
IF IsDIRWritable(szWinSysDir$) = 0 THEN
MYSYSPROB:
sz$ = UIStartDlg(CUIDLL$, PROBSYS, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
AskQuitInstall
GOTO MYSYSPROB
END IF
AddSectionFilesToCopyList "Windows", SrcDir$, DEST$
ELSE
AddSectionFilesToCopyList "Windows", SrcDir$, szWinSysDir$
END IF
CopyFilesInCopyList
CreateIniKeyValue "WIN.INI","Extensions","GRP",MakePath(DEST$,"popgroup.exe")+" ^.GRP",cmoOverwrite
BDG$ = "BackDesk 3.10"
CreateProgmanGroup BDG$, "", cmoOverwrite
ShowProgmanGroup BDG$, 1, cmoNone
'
' Main programs
'
CreateProgmanItem BDG$, "BackMenu", MakePath(DEST$,"backmenu.exe"), "", cmoOverwrite
CreateProgmanItem BDG$, "BigDesk", MakePath(DEST$,"bigdesk.exe"), "", cmoOverwrite
CreateProgmanItem BDG$, "BackDesk Help", MakePath(DEST$,"backdesk.hlp"), "", cmoOverwrite
'
' Uninstall
'
CreateProgmanItem BDG$, "BackDesk Uninstall", MakePath(DEST$,"bduninst.exe"), "", cmoOverwrite
'
' BackDesk Tools
'
CreateProgmanItem BDG$, "BackMenu Editor", MakePath(DEST$,"bme.exe"), "", cmoOverwrite
CreateProgmanItem BDG$, "WRUN Windows Server", MakePath(DEST$,"wrunserv.exe")+" -hide", "", cmoOverwrite
'
' BackDrop Tools
'
CreateProgmanItem BDG$, "Copy Files Tool", MakePath(DEST$,"copytool.exe"), "", cmoOverwrite
CreateProgmanItem BDG$, "Drag/Drop Clipboard Tool", MakePath(DEST$,"dropclip.exe"), "", cmoOverwrite
CreateProgmanItem BDG$, "Remove Files/Aliases Tool", MakePath(DEST$,"dustbin.exe"), "", cmoOverwrite
CreateProgmanItem BDG$, "Task to Alias Tool", MakePath(DEST$,"t2alias.exe"), "", cmoOverwrite
CreateProgmanItem BDG$, "Wallpaper Changing Tool", MakePath(DEST$,"wallpapr.exe"), "", cmoOverwrite
'
' Add some interesting aliases in (but only if there aren't any
'
szOut$=""
for i%=1 to 256
szOut$=szout$+"*"
next
spserv$=MakePath(szWinDir$,"SP-SERV.INI")
i%=GetPrivateProfileString("ToolPlaces","Tool0","",szOut$,255,spserv$)
if i% = 0 THEN
CreateIniKeyValue spserv$,"ToolPlaces","Tool0","0,197,1,Notepad,"+MakePath(szWinDir$,"NOTEPAD.EXE")+",0,0,notepad.exe #", cmoOverwrite
CreateIniKeyValue spserv$,"ToolPlaces","Tool1","0,349,1,BackDesk 3.1 Help,winhelp.exe ,0,0,"+MakePath(DEST$,"BACKDESK.HLP"), cmoOverwrite
CreateIniKeyValue spserv$,"ToolPlaces","Tool2","0,121,1,Control Panel,"+MakePath(szWinDir$,"CONTROL.EXE")+",0,0,CONTROL.EXE", cmoOverwrite
CreateIniKeyValue spserv$,"ToolPlaces","Tool3","0,45,1,File Mangler,"+MakePath(szWinDir$,"WINFILE.EXE")+",0,0,{XPO=53 YPO=37 WID=580 HEI=434 NOR XDESK=0 YDESK=0 SIN TIT=""File Manager""}"+MakePath(szWinDir$,"WINFILE.EXE"), cmoOverwrite
' We'll give people program mangler as it is useful
CreateIniKeyValue spserv$,"ToolPlaces","Tool4","0,273,1,Program Mangler,"+MakePath(szWinDir$,"progman.exe")+",0,0,"+MakePath(szWinDir,"progman.exe"), cmoOverwrite
' because we can't guarantee the group name
' CreateIniKeyValue spserv$,"ToolPlaces","Tool4","0,273,1,BackDesk goodies,"+MakePath(DEST$,"popgroup.exe")+",0,0,"+MakePath(szWinDir,"BACKDESK.GRP"), cmoOverwrite
END IF
'
' Use the default menu used if theres nothing defined
'
szOut$=""
for i%=1 to 256
szOut$=szout$+"*"
next
i%=GetPrivateProfileString("Back-Menu","IniFile","",szOut$,255,spserv$)
IF i%=0 THEN
CreateIniKeyValue spserv$,"Back-Menu","IniFile",MakePath(DEST$,"BACKDESK.MNU"), cmoOverwrite
END IF
'
' Install the supplied external keywords
'
XK$ = "External Keywords"
CreateIniKeyValue spserv$,XK$,"XKeywordManager",MakePath(DEST$,"xkeyman.dll"), cmoOverwrite
CreateIniKeyValue spserv$,XK$,"Groups",MakePath(DEST$,"pmgroups.dll"), cmoOverwrite
CreateIniKeyValue spserv$,XK$,"Tasks",MakePath(DEST$,"bmkeyw.dll"), cmoOverwrite
CreateIniKeyValue spserv$,XK$,"ExitWindows",MakePath(DEST$,"bmkeyw.dll"), cmoOverwrite
CreateIniKeyValue spserv$,XK$,"About",MakePath(DEST$,"bmkeyw.dll"), cmoOverwrite
CreateIniKeyValue spserv$,XK$,"DefaultPrinter",MakePath(DEST$,"defprn.dll"), cmoOverwrite
'
' And all of Simons
'
CreateIniKeyValue spserv$,XK$,"NetConn",MakePath(DEST$,"xk_net.dll"), cmoOverwrite
CreateIniKeyValue spserv$,XK$,"NetDisc",MakePath(DEST$,"xk_net.dll"), cmoOverwrite
CreateIniKeyValue spserv$,XK$,"NetLinks",MakePath(DEST$,"xk_net.dll"), cmoOverwrite
'
' Add in BME if it isn't already there
'
szOut$=""
for i%=1 to 256
szOut$=szout$+"*"
next
i%=GetPrivateProfileString("Back-Menu","MenuEditor","",szOut$,255,spserv$)
if i% = 0 THEN
CreateIniKeyValue spserv$,"Back-Menu","MenuEditor",MakePath(DEST$,"bme.exe"), cmoOverwrite
END if
'
' Make BackMenu the shell?
'
IsShell%=0
szOut$=""
for i%=1 to 256
szOut$=szout$+"*"
next
i%=GetPrivateProfileString("boot","shell","",szOut$,255,"system.ini")
IF (instr(UCase$(szOut$),"BACKMENU") = 0) AND (instr(UCase$(szOut$),"BDSHELL") = 0) THEN
sz$ = UIStartDlg(CUIDLL$, MAKESHELL, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
CreateIniKeyValue MakePath(szWinDir$,"SYSTEM.INI"),"BOOT","BD_OldShell",szOut$,cmoOverwrite
CreateIniKeyValue MakePath(szWinDir$,"SYSTEM.INI"),"BOOT","SHELL",MakePath(DEST$,"BDSHELL.EXE"),cmoOverwrite
IsShell%=1
END IF
UIPop 1
ELSE
CreateIniKeyValue MakePath(szWinDir$,"SYSTEM.INI"),"BOOT","SHELL",MakePath(DEST$,"BDSHELL.EXE"),cmoOverwrite
IsShell%=1
END IF
'
' Any system files to copy?
'
IF RestartListEmpty() = 0 THEN
ASKRESTART:
sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
AskQuitInstall
GOTO ASKRESTART
END IF
i% = ExitExecRestart()
' i%=ExitWindows(66,66)
END IF
CloseLogFile
END SUB
SUB AskQuitInstall STATIC
LAskQuitInstall:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO LAskQuitInstall
ELSE
UIPop 1
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