home *** CD-ROM | disk | FTP | other *** search
- '' ****************************************************************
- '* POWER.MST
- '**************************************************************************
-
- '' Global variables
-
- GLOBAL update_error%
- GLOBAL SrcDrive$
- GLOBAL TitleShortName$
- GLOBAL TitleLongName$
- GLOBAL PromptForPath%
- GLOBAL DefaultPath$
- GLOBAL ProgManGroup$
- GLOBAL ProgManItem$
- GLOBAL szTitleDir$
-
- '' ****************************************************************
- '' ** Setup Variables
- '' ****************************************************************
-
- TitleShortName$ = "PowerHouse"
- TitleLongName$ = "PowerHouse"
- PromptForPath% = 1 '' we prompt for the install path
- DefaultPath$ = "C:\POWER" '' default install path when prompt is displayed
- ProgManGroup$ = "PowerHouse" '' program manager group
- ProgManItem$ = "PowerHouse" '' program manager item title
-
- '***********************************************************************
- '** Mainline
- '***********************************************************************
-
- GLOBAL CUIDLL$
-
- '' Include files
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
- CUIDLL$ = "mscuistf.dll" '' Custom UI dll
-
- '' Dialog ID's
- CONST DESTPATH = 1000
- CONST APPHELP = 2000
- CONST TOOBIG = 3000
- CONST BADPATH = 4000
- CONST SUCCESS = 5000
- CONST CONT_PH_SETUP = 101
- CONST EXIT_PH_SETUP = 102
- CONST UPDATE_FAIL = 1001 '' update fail dlg box
-
- CONST LOGO = 100 '' bitmap resource id
-
- '' Functions and subroutines
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
- DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
- DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
- DECLARE SUB ModifyProgramManager
- DECLARE SUB ShowSuccess
-
- '' functions from WinG install
- DECLARE FUNCTION GetRealWindowsSysDir AS STRING
- DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
-
- '' return value displayer for debug purposes
- ''i% = DoMsgBox(STR$(i%), "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
-
- INIT:
- bInstallDVA% = 0
-
- '' init error flag
- update_error = 0
-
- CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to
- '' alter the banner bitmap.
-
- SetTitle "PowerHouse"
- SetBitmap CUIDLL$, LOGO
-
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- SrcDrive$ = MID$(SrcDir$,1,1)
-
- POWER:
-
- i% = SetSizeCheckMode(scmOff)
-
-
- '' Read in the INF file.
-
- ReadInfFile GetSymbolValue("STF_CWDDIR") + "POWER.INF"
-
- '' Decide where to put title files
- IF PromptForPath% = 1 THEN
- szTitleDir$ = GetTitleDir(DefaultPath$)
- IF szTitleDir$ = "" THEN
- ERROR STFQUIT
- GOTO QUIT
- ENDIF
- ELSE
- ''szTitleDir$ = GetWindowsDir()
- szTitleDir$ = "C:\POWER"
- ENDIF
-
- '' check to see if there is a powerhouse file in the specified directory
- '' if not then we exit the update and report error
- ret_val% = DoesFileExist(szTitleDir$+"\repair.edy",femRead)
- IF ret_val% = 0 THEN
- update_error% = 1
- GOTO QUIT
- ENDIF
-
- '' Copy files
- IF CopyFiles(szTitleDir$) = 0 THEN
- GOTO QUIT
- ENDIF
-
- ModifyProgramManager
- ShowSuccess
- END
-
- QUIT:
- ON ERROR GOTO ERRQUIT
-
- '' if we had an update error then do the error message
- IF update_error% = 1 THEN
- dlg% = UPDATE_FAIL
- GOTO DLG
- END IF
-
- IF ERR = 0 THEN
- dlg% = EXITSUCCESS
- ELSEIF ERR = STFQUIT THEN
- dlg% = EXITQUIT
- ELSEIF ERR = EXIT_PH_SETUP THEN
- dlg% = EXIT_PH_SETUP
- ELSE
- dlg% = EXITFAILURE
- END IF
-
-
- DLG:
- ''i% = DoMsgBox(STR$(ERR)+" "+STR$(dlg%), "PowerHouse Update Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
-
- UIPop 1
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
- END
-
- ERRQUIT:
- i% = DoMsgBox("Setup sources were corrupted, please call Impressions 001 61722 50500", "PowerHouse Update Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
- END
-
-
- '*************************************************************************
- '** Purpose:
- '** Prompts the user for a path for the title files
- '** Arguments:
- '** szDefault$ - default path
- '** Returns:
- '** New valid path name, or "" if the user quit.
- '*************************************************************************
-
- FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
-
- SetSymbolValue "String", TitleShortName$
- SetSymbolValue "EditTextIn", szDefault$
- SetSymbolValue "EditFocus", "ALL"
-
- GETPATH:
-
- sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
-
- IF sz$ = "CONTINUE" THEN
- szTitleDir$ = GetSymbolValue("EditTextOut")
- IF IsDirWritable(szTitleDir$) = 0 THEN
-
- BADPATH:
-
- sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO BADPATH
- END IF
- UIPop 1
- GOTO GETPATH
- END IF
- UIPop 1
- CreateDir szTitleDir$, cmoNone
-
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO GETPATH
- ELSE
- szTitleDir$ = ""
-
- END IF
-
- GetTitleDir = szTitleDir$
-
- END FUNCTION
-
-
- '*************************************************************************
- '** Purpose:
- '** Copies the files in the INF file
- '** Arguments:
- '** szTitleDir$ - destination directory for the title files
- '** Returns
- '** 1 if files were copied, 0 otherwise
- '*************************************************************************
-
- FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
-
- '' Add all of the title files to the copy list
- AddSectionFilesToCopyList "UPDATE FILES", GetSymbolValue("STF_SRCDIR"), szTitleDir$
-
- '' Check size
- szExtras$ = "Extra"
- szCosts$ = "Costs"
- szNeededs$ = "Neededs"
- FOR i% = 1 TO 26 STEP 1
- AddListItem szExtras$, "0"
- NEXT i%
-
- '' We assume that VIEWER.INI will take another 4K
- ReplaceListItem szExtras$, ASC(MID$(UCASE$(GetWindowsDir()), 1, 1)) - ASC("A") + 1, STR$(4096)
-
- '' Get amount of space required
- StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
-
- '' Put up a message if there is not enough space
- FOR i% = 1 TO 26 STEP 1
- IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
-
- SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
- SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
-
- TOOBIG:
-
- sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO TOOBIG
- END IF
- UIPop 1
- CopyFiles = 0
- GOTO DONTCOPY
- END IF
- NEXT i%
-
- '' Copy the files
- CopyFilesInCopyList
-
- CopyFiles = 1
-
- DONTCOPY:
-
- END FUNCTION
-
- '*************************************************************************
- '** Purpose:
- '** Puts up a success dialog
- '*************************************************************************
-
- SUB ShowSuccess STATIC
-
- SUCCESS:
-
- SetSymbolValue "String1", TitleShortName$
- sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO SUCCESS
- END IF
- UIPop 1
-
- END SUB
-
- '*************************************************************************
- '** Purpose:
- '** Creates program manager entries for the title
- '*************************************************************************
-
- SUB ModifyProgramManager STATIC
-
- CreateProgmanItem ProgmanGroup$, ProgmanItem$, szTitleDir$+"\POWHS.EXE",szTitleDir$+"\POWERH.ICO",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$), 1) = "\" THEN
- MakePath = szDir$ + szFile$
- ELSE
- MakePath = szDir$ + "\" + szFile$
- END IF
- END FUNCTION
-
-
- FUNCTION GetRealWindowsSysDir STATIC AS STRING
- szBuf$ = string$(260, 32)
- cbBuf% = GetRealSystemDir(szBuf$, 260)
- IF cbBuf% = 0 THEN
- ERROR STFERR
- ELSE
- IF cbBuf% > 259 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
- GetRealWindowsSysDir = szBuf$
- END IF
-
- szBuf$ = ""
- END FUNCTION
-
-
-