home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Life 1995 June
/
Computer_Life_Magazine_June_1995_Companion_CD.iso
/
clnsweep
/
setup.ms_
/
setup.ms
Wrap
Text File
|
1995-01-16
|
8KB
|
296 lines
'**************************************************************************
'* MSSetup Toolkit Quarterdeck CleanSweep
'**************************************************************************
GLOBAL TITLE$
GLOBAL DEFAULTDESTDIR$
GLOBAL UNIN_INI$
GLOBAL UNIN_EXE$
GLOBAL UNINUNIN_EXE$
GLOBAL README_TXT$
GLOBAL GROUP_NAME$
GLOBAL UNIN_ITEM$
GLOBAL UNINUNIN_ITEM$
GLOBAL README_ITEM$
''==========================================================================
'' Translate these strings
''
'' The 3 strings at the end are the names of the items within the
'' Quarterdeck CleanSweep group within Program Manager.
''==========================================================================
TITLE$ = "Quarterdeck CleanSweep Demo Setup"
DEFAULTDESTDIR$ = "C:\CSDEMO"
UNIN_INI$ = "clnsweep.ini"
UNIN_EXE$ = "clnsweep.exe"
UNINUNIN_EXE$ = "unclnswp.exe"
README_TXT$ = "readme.wri"
GROUP_NAME$ = "Quarterdeck CleanSweep Demo" '' Group Name
UNIN_ITEM$ = "Quarterdeck CleanSweep Demo" '' Item Name
UNINUNIN_ITEM$ = "Uninstall Quarterdeck CleanSweep Demo" '' Item Name
README_ITEM$ = "Read Me" '' Item Name
''==========================================================================
'' End of strings to translate
''==========================================================================
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 110
CONST ASKQUIT = 111
CONST DESTPATH = 112
CONST EXITFAILURE = 113
CONST EXITSUCCESS = 114
CONST APPHELP_REG = 900
CONST APPHELP_PATH = 115
CONST APPHELP_WELCOME = 1010
CONST BADPATH = 6400
CONST FULLDRIVE = 6410
CONST CDGETNAMEORG = 7500
''Bitmap ID
CONST LOGO = 2
GLOBAL DEST$ ''Default destination directory.
GLOBAL custname$
GLOBAL orgname$
GLOBAL SrcDir$
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION Ctl3dRegister LIB "ctl3d.dll" (hInst%) AS INTEGER
DECLARE FUNCTION Ctl3dUnregister LIB "ctl3d.dll" (hInst%) AS INTEGER
DECLARE FUNCTION Ctl3dAutoSubclass LIB "ctl3d.dll" (hInst%) AS INTEGER
DECLARE FUNCTION Register_File LIB "qreg.dll" (szFile$) AS INTEGER
DECLARE FUNCTION GetModuleHandle LIB "kernel" (szModule$) AS INTEGER
DECLARE FUNCTION LoadString LIB "user" (hInst%, id%, szBuffer$, cbBuffer%) AS INTEGER
DECLARE FUNCTION ShowWindow LIB "user" (hWnd%, nShow%) AS INTEGER
INIT:
hInstance% = HinstFrame()
hWnd% = HwndFrame()
junk%=ShowWindow(hWnd%, 3)
ret = Ctl3dRegister(hInstance%)
ret = Ctl3dAutoSubclass(hInstance%)
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle TITLE$
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
END IF
ReadInfFile szInf$
DEST$ = DEFAULTDESTDIR$
SrcDir$ = GetSymbolValue("STF_SRCDIR")
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", 0, "")
IF sz$="CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
'' Skip over registration for Demo
GOTO GETPATH
GETNAMEORG:
'' Get user/company from user.exe
hInst% = GetModuleHandle("user")
custname$ = ""
orgname$ = ""
IF hInst% <> 0 THEN
custname$ = String$(255, 0)
ret = LoadString(hInst%, 514, custname$, Len(custname$))
orgname$ = String$(255, 0)
ret = LoadString(hInst%, 515, orgname$, Len(orgname$))
custname$ = RTRIM$(custname$)
orgname$ = RTRIM$(orgname$)
IF UCASE$(orgname$) = "UNKNOWN ORGANIZATION" THEN
orgname$ = ""
END IF
END IF
'' Try to get registration info from MS User Info section in WIN.INI
IF custname$ = "" THEN
custname$ = GetIniKeyString("WIN.INI", "MS User Info", "DefName")
orgname$ = GetIniKeyString("WIN.INI", "MS User Info", "DefCompany")
END IF
custname$ = RTRIM$(custname$)
orgname$ = RTRIM$(orgname$)
SetSymbolValue "CUSTNAME", custname$
SetSymbolValue "ORGNAME", orgname$
sz$ = UIStartDlg(CUIDLL$, CDGETNAMEORG, "FNameOrgDlgProc", APPHELP_REG, HELPPROC$)
IF sz$="CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO GETNAMEORG
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
GETPATHL1:
SetSymbolValue "EditFocus", "ALL"
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP_PATH, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
'' Make sure enough space on destination
ClearCopyList
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
cost& = GetCopyListCost("","","")
'' Add 1 cluster 16K, to account for INI file.
cost& = cost& + 16384
IF cost& > GetFreeSpaceForDrive(ucase$(MID$(DEST$, 1, 1))) THEN
GOSUB FULLDRIVE
SetSymbolValue "EditTextIn", DEST$
GOTO GETPATHL1
ENDIF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = 0
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
IF dlg% <> 0 THEN
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END IF
ExitInstance:
ret = Ctl3dUnregister(hInstance%)
END
ERRQUIT:
GOTO ExitInstance
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
FULLDRIVE:
sz$ = UIStartDlg(CUIDLL$, FULLDRIVE, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO FULLDRIVE
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.
'*************************************************************************
SUB Install STATIC
WindowsDir$ = GetWindowsDir()
CreateDir DEST$, cmoNone
'' Most of files already in Copy List
AddSectionFilesToCopyList "IniFiles", SrcDir$, WindowsDir$
CopyFilesInCopyList
nErr% = Register_File(MakePath(DEST$,UNIN_EXE$))
CreateProgmanGroup GROUP_NAME$, "", cmoNone
ShowProgmanGroup GROUP_NAME$, 1, cmoNone
CreateProgmanItem GROUP_NAME$, UNIN_ITEM$, MakePath(DEST$,UNIN_EXE$), "", cmoOverwrite
CreateProgmanItem GROUP_NAME$, UNINUNIN_ITEM$, MakePath(DEST$,UNINUNIN_EXE$), "", cmoOverwrite
CreateProgmanItem GROUP_NAME$, README_ITEM$, MakePath(DEST$,README_TXT$), "", cmoOverwrite
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$),