home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 July
/
VPR9707B.ISO
/
DRIVER
/
HP
/
WIN95
/
5LDV
/
DISK1
/
SETUP.MST
< prev
next >
Wrap
Text File
|
1996-01-08
|
39KB
|
1,093 lines
'**************************************************************************
'* MSSetup Toolkit Sample 1
'**************************************************************************
'''$DEFINE ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'$INCLUDE 'strings.inc'
''Dialog ID's (mine)
'$INCLUDE 'dialogid.inc'
'$INCLUDE 'symbols.inc'
''Const integers
CONST c_iCOMPLETE = 1501
CONST c_iCUSTOM = 1502
CONST c_iNETADMIN = 1503
CONST c_iRETRY = 1504
CONST c_iPORT = 1505
CONST c_iSKIP = 1506
CONST c_iCHANGE_OPTION = 1507
CONST c_iPATH = 1508
CONST c_iSELECT_COMPONENTS = 1509
CONST c_iSELECT_PORT = 1510
CONST c_iSELECT_PRINTER = 1511
CONST c_iRUN_FILE_MANAGER = 1512
CONST c_iREADME = 1513
CONST c_iOVERVIEW = 1514
CONST c_iREBOOT = 1515
CONST c_iRESUME = 1516
CONST c_iBACK = 1517
CONST c_iCONTINUE = 1518
CONST c_iEXIT = 1519
CONST c_iOK = 1520
CONST c_iCANCEL = 1521
CONST c_iYES = 1522
CONST c_iNO = 1523
CONST c_iINVALID = -999
CONST c_iGO_BACK = 3001
CONST EW_REBOOTSYSTEM = 67
CONST EW_RESTARTWINDOWS = 66
'' This needs to be the same number as in resource.h
const IDS_STATWIN_TITLE% = 200
CONST c_iPROGRESS_WIDTH = 220 '' Width of the progress indicator
CONST c_iPROGRESS_HEIGHT = 100 '' Height of the progress indicator
''Const DLL dialog functions
CONST c_szWELCOME_DLG_PROC$ = "WelcomeDlgProc"
CONST c_szMETHOD_DLG_PROC$ = "MethodDlgProc"
CONST c_szNETADMIN_DLG_PROC$ = "NetAdminInfoDlgProc"
CONST c_szPORT_DLG_PROC$ = "PortDlgProc"
CONST c_szBIDI_PROBLEM_DLG_PROC$ = "BidiProbDlgProc"
CONST c_szBIDI_SKIP_DLG_PROC$ = "BidiSkipDlgProc"
CONST c_szUNSUPPORTED_DLG_PROC$ = "UnsupportedDlgProc"
CONST c_szPRINTER_DLG_PROC$ = "PrinterDlgProc"
CONST c_szCOMPONENT_DLG_PROC$ = "ComponentDlgProc"
CONST c_szPATH_DLG_PROC$ = "EnterPathDlgProc"
CONST c_szNOSPACE_DLG_PROC$ = "NoSpaceDlgProc"
CONST c_szVERIFY_DLG_PROC$ = "VerifyDlgProc"
CONST c_szVERIFY_FAIL_DLG_PROC$ = "VerifyFailDlgProc"
CONST c_szFINAL_DLG_PROC$ = "FinalDlgProc"
CONST c_szFINAL_ADMIN_DLG_PROC$ = "FinalDlgProc"
CONST c_szREBOOT_DLG_PROC$ = "RebootDlgProc"
CONST c_szEXIT_DLG_PROC$ = "ExitDlgProc"
CONST c_szBILLBOARD_DLG_PROC$ = "BillboardDlgProc"
CONST c_szINVISIBLE_DLG_PROC$ = "InvisibleDlgProc"
CONST c_szASK_SOUND_DLG_PROC$ = "AskSoundDlgProc"
CONST c_szHPLOGO_DLG_PROC$ = "HPLogoDlgProc"
CONST c_szEXECUTE_DLG_PROC$ = "ExecuteDlgProc"
CONST c_szALADDIN_DLG_PROC$ = "AladdinDlgProc"
CONST c_szCOPYRIGHT_DLG_PROC$ = "CopyRightDlgProc"
''Const strings
''CONST c_szRESTART_DIR$ = ":\HPRESDIR"
CONST c_szEMPTY$ = ""
CONST c_szLOG_FILE$ = "HPLJPS.TXT"
CONST c_szDRIVER_SECTION$ = "DriverFiles"
CONST c_szINFO_FILE$ = "SETUP.INF"
CONST c_szLOG_FILE_LIST$ = "logfile"
CONST c_szFAILURE$ = "fail"
CONST c_szSUCCESS$ = "success"
CONST c_szALADDIN$ = "fontsmart.comp"
CONST c_szALADDIN_SECTION$ = "fontsmart.win31.files"
CONST c_szALADDIN_CUSTOM$ = "fontsmart.custom.fonts"
const c_szALL_FONTS$ = "fontsmart.all.fonts"
CONST c_szALADDIN_CMD_LINE$ = "fontsmrt /b "
const c_szFONTLIST_FILE$ = "fontlist.txt"
const c_szALLFONTS_FILE$ = "allfonts.txt"
const c_szALADDIN_EXIT_MSG$ = "FontSmartExiting"
CONST c_lpszSECTION_LIST$ = "ComponentSectionList"
CONST c_lpszCOMPONENT_LIST$ = "ComponentList"
CONST c_szCTRL3DFILE$ = "ctl3dv2.dll"
CONST c_szCTRL3DFILE_COMPRESSED$ = "ctl3dv2.dl_"
''Support DLL
'$INCLUDE 'support.inc'
''Bitmap ID
CONST LOGO = IDB_HP_LOGO
''Message IDs
CONST WM_USER = 1024 '' 0x0400
CONST WM_CLEANUP = WM_USER + 200
GLOBAL g_iReturn as integer
GLOBAL g_iSound as integer
GLOBAL g_dwBidiReady as long
GLOBAL g_hWndFrame as integer
GLOBAL g_iMethod as integer
GLOBAL g_iInstallOk as integer
GLOBAL g_szClose as string
GLOBAL g_pEnvironment as pointer to ENVIRONMENT
GLOBAL g_szDest as string
DECLARE FUNCTION Install() as INTEGER
DECLARE FUNCTION MakePath( szDir$, szFile$ ) AS STRING
DECLARE FUNCTION LogUserOptions() as integer
DECLARE FUNCTION LogEnvironment() as integer
DECLARE FUNCTION LogInstallation() as integer
DECLARE FUNCTION CopyFiles() as integer
DECLARE FUNCTION SetupUIDlg(szDll$, idDlg%, szDlgProc$,idHelpDlg%, szHelpProc$) as integer
DECLARE FUNCTION GetButtonId(szString$) as integer
DECLARE function MergeStrings(szStr1$, szStr2$) as string
declare function Check3D() as integer
declare function CheckLZExpand(iValue%, szFile1$, szFile2$) as integer
declare sub Clean()
declare function GetGaugeDlgUnitsX lib "mscuistf.dll" () as integer
declare function GetGaugeDlgUnitsY lib "mscuistf.dll" () as integer
declare function EnoughSpace lib "mscuistf.dll" () as integer
declare function SetExecBlock lib "mscuistf.dll" (lpszCmdLine$, lpszExitMsg$) as integer
declare function GetExecBlockReturn lib "mscuistf.dll" () as integer
'' Windows API functions
declare function GetModuleHandle lib "Kernel" (lpstr$) as integer
declare function WinExec lib "Kernel" (szCommand$, uiShow%) as integer
declare function lstrcat lib "Kernel" (g_szDest$, szSource$) as long
declare function lstrlen lib "Kernel" (szSource$) as integer
declare function GetFreeSpace lib "Kernel" (iFlags%) as long
declare function LoadString lib "user" (hHandle, iIdResource%, szBuffer$, iBufferSize%) as integer
'$IFNDEF MSTEST_20
declare function ExitWindows lib "user" (dwRestart&, iReserved%) as integer
'$ENDIF
'$IFDEF DEBUG
declare sub OutputDebugString lib "Kernel" ( szStr$)
'$ENDIF
INIT:
dim iModule as integer
dim iReturn as integer
dim szDialogProc as string
dim iIdDialog as integer
dim iSuccess as integer
dim ipSuccess as pointer to integer
ipSuccess = VARPTR( iSuccess )
RESDLL$ = "resource.dll"
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
SetTitle c_szTITLE
g_iSound = FALSE
g_hWndFrame = HwndFrame()
'' Initialize empty lists
SetSymbolValue c_szLOG_FILE_LIST , c_szEMPTY
SetSymbolValue c_szFAILURE , c_szEMPTY
SetSymbolValue c_szSUCCESS , c_szEMPTY
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = c_szEMPTY THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
END IF
ReadInfFile szInf$
g_iReturn = Initialize()
g_pEnvironment = GetInstallEnvironment()
Installed3D% = Check3D
if Installed3D = TRUE then
'' Test 3D dialogs
iModule = GetModuleHandle( "DSHELL" )
g_iReturn = Begin3d( iModule )
endif
iReturn = FixMainWindow( g_hWndFrame )
g_szDest = UIStartDlg(CUIDLL$, IDD_HPLOGO, c_szHPLOGO_DLG_PROC,0,c_szEMPTY)
g_szDest = UIStartDlg(CUIDLL$, IDD_COPYRIGHT, c_szCOPYRIGHT_DLG_PROC,0,c_szEMPTY)
'' Have the script send a beep when requesting new diskettes.
iReturn = SetBeepingMode(1)
iReturn = LogEnvironment()
szDialogProc = c_szWELCOME_DLG_PROC
iIdDialog = IDD_WELCOME
g_pEnvironment = GetInstallEnvironment
GOBACK:
WHILE szDialogProc <> c_szEMPTY
iReturn = SetupUIDlg(CUIDLL$, iIdDialog, szDialogProc, 0, c_szEMPTY)
if (iReturn = c_iEXIT) then
GOSUB ASKQUIT
else
UIPop 1
SELECT CASE iIdDialog
CASE IDD_WELCOME
g_szDest = g_pEnvironment[0].szSystemDir[0]
if (g_pEnvironment[0].iInstallType = IT_STANDALONE) or (0 = IsDirWritable(g_szDest) ) then
iIdDialog = IDD_METHOD_NONET
szDialogProc = c_szMETHOD_DLG_PROC
else
iIdDialog = IDD_METHOD
szDialogProc = c_szMETHOD_DLG_PROC
endif
CASE IDD_METHOD
g_iMethod = iReturn
if iReturn = c_iNETADMIN then
iIdDialog = IDD_ADMIN_INFO
szDialogProc = c_szNETADMIN_DLG_PROC
else
iIdDialog = IDD_SELECT_PORT
szDialogProc = c_szPORT_DLG_PROC
endif
iReturn = ReadInfoFile()
if iReturn <> 0 then
if iReturn <> c_iDO_NET_ADMIN then
iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
else
g_szDest = c_szDO_NET_ADMIN1 + c_szDO_NET_ADMIN2
iReturn = DoMsgBox( g_szDest, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
endif
goto QUIT
elseif iIdDialog <> IDD_ADMIN_INFO then
iReturn = IsSupportedPrinterAttached( ipSuccess )
if iReturn AND iSuccess = 1 then
if 0 = ReadAllFileGroups() then
if g_iMethod <> c_iCOMPLETE then
iIdDialog = IDD_SELECT_COMPONENTS
szDialogProc =c_szCOMPONENT_DLG_PROC
else
szDialogProc = c_szEMPTY
endif
else
iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
goto QUIT
endif
else
iIdDialog = IDD_SELECT_PORT
szDialogProc = c_szPORT_DLG_PROC
endif
endif
CASE IDD_METHOD_NONET
g_iMethod = iReturn
iIdDialog = IDD_SELECT_PORT
szDialogProc = c_szPORT_DLG_PROC
iReturn = ReadInfoFile()
if iReturn <> 0 then
if iReturn <> c_iDO_NET_ADMIN then
iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
else
g_szDest = c_szDO_NET_ADMIN1 + c_szDO_NET_ADMIN2
iReturn = DoMsgBox( g_szDest, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
endif
goto QUIT
else
iReturn = IsSupportedPrinterAttached( ipSuccess )
if iReturn AND iSuccess = 1 then
if 0 = ReadAllFileGroups() then
if g_iMethod <> c_iCOMPLETE then
iIdDialog = IDD_SELECT_COMPONENTS
szDialogProc =c_szCOMPONENT_DLG_PROC
else
iReturn = EnoughSpace()
if iReturn = 0 then
iIdDialog = IDD_NO_SPACE
szDialogProc = c_szNOSPACE_DLG_PROC
else
szDialogProc = c_szEMPTY
endif
endif
else
iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
goto QUIT
endif
else
iIdDialog = IDD_SELECT_PORT
szDialogProc = c_szPORT_DLG_PROC
endif
endif
CASE IDD_ADMIN_INFO
if iReturn = c_iBACK then
iIdDialog = IDD_METHOD
szDialogProc = c_szMETHOD_DLG_PROC
else
if 0 = ReadAllFileGroups() then
iIdDialog = IDD_SELECT_COMPONENTS
szDialogProc =c_szCOMPONENT_DLG_PROC
iCheckSound = 1
else
iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
goto QUIT
endif
endif
CASE IDD_SELECT_PORT
if iReturn = c_iBACK then
if g_pEnvironment[0].iInstallType = IT_STANDALONE then
iIdDialog = IDD_METHOD_NONET
szDialogProc = c_szMETHOD_DLG_PROC
else
iIdDialog = IDD_METHOD
szDialogProc = c_szMETHOD_DLG_PROC
endif
else
iReturn = TestBidi(g_pEnvironment[0].runTime.lpszPort[0])
'' The return value could be true and have no bidi
if iReturn <> 0 AND g_pEnvironment[0].runTime.bHasBidi = 0 then
'' If we get here bidi could not be established, so the port type
'' is something other than LPT
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
elseif g_pEnvironment[0].runTime.bHasBidi = 0 then
iIdDialog = IDD_BIDI_PROBLEM
szDialogProc =c_szBIDI_PROBLEM_DLG_PROC
elseif 0 < lstrlen(g_pEnvironment[0].runTime.lpszDeviceID[0]) then
iReturn = IsPrinterSupported( g_pEnvironment[0].runTime.lpszDeviceID[0])
if iReturn = 0 then
iIdDialog = IDD_UNSUPPORTED_PRINTER
szDialogProc =c_szUNSUPPORTED_DLG_PROC
else
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
endif
else
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
endif
endif
CASE IDD_BIDI_PROBLEM
if iReturn = c_iSKIP then
iIdDialog = IDD_BIDI_SKIP
szDialogProc = c_szBIDI_SKIP_DLG_PROC
elseif iReturn = c_iRETRY then
iReturn = TestBidi(g_pEnvironment[0].runTime.lpszPort[0])
if iReturn <> 0 AND g_pEnvironment[0].runTime.bHasBidi = 0 then
'' If we get here bidi could not be established, so the port type
'' is something other than LPT
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
elseif g_pEnvironment[0].runTime.bHasBidi <> 0 then
if 0 < lstrlen(g_pEnvironment[0].runTime.lpszDeviceID[0]) then
iReturn = IsPrinterSupported( g_pEnvironment[0].runTime.lpszDeviceID[0])
if iReturn = 0 then
iIdDialog = IDD_UNSUPPORTED_PRINTER
szDialogProc =c_szUNSUPPORTED_DLG_PROC
else
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
endif
else
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
endif
endif
elseif iReturn = c_iPORT then
iIdDialog = IDD_SELECT_PORT
szDialogProc = c_szPORT_DLG_PROC
endif
CASE IDD_BIDI_SKIP
if iReturn = c_iCONTINUE then
if 0 < lstrlen(g_pEnvironment[0].runTime.lpszDeviceID[0]) then
iReturn = IsPrinterSupported( g_pEnvironment[0].runTime.lpszDeviceID[0])
if iReturn = 0 then
iIdDialog = IDD_UNSUPPORTED_PRINTER
szDialogProc =c_szUNSUPPORTED_DLG_PROC
else
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
endif
else
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
endif
else
iIdDialog = IDD_BIDI_PROBLEM
szDialogProc =c_szBIDI_PROBLEM_DLG_PROC
endif
CASE IDD_SELECT_PRINTER
if iReturn = c_iBACK then
iIdDialog = IDD_SELECT_PORT
szDialogProc =c_szPORT_DLG_PROC
else
if 0 = ReadAllFileGroups() then
if g_iMethod <> c_iCOMPLETE then
iIdDialog = IDD_SELECT_COMPONENTS
szDialogProc =c_szCOMPONENT_DLG_PROC
else
iReturn = EnoughSpace()
if iReturn = 0 then
iIdDialog = IDD_NO_SPACE
szDialogProc = c_szNOSPACE_DLG_PROC
else
szDialogProc = c_szEMPTY
endif
endif
else
iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
goto QUIT
endif
endif
CASE IDD_UNSUPPORTED_PRINTER
if iReturn = c_iSELECT_PORT then
iIdDialog = IDD_SELECT_PORT
szDialogProc =c_szPORT_DLG_PROC
else
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
endif
CASE IDD_SELECT_COMPONENTS
if iReturn = c_iBACK then
if g_iMethod = c_iNETADMIN then
iIdDialog = IDD_ADMIN_INFO
szDialogProc = c_szNETADMIN_DLG_PROC
else
if iSuccess = 1 then
iIdDialog = IDD_METHOD_NONET
szDialogProc =c_szMETHOD_DLG_PROC
else
iIdDialog = IDD_SELECT_PRINTER
szDialogProc =c_szPRINTER_DLG_PROC
endif
endif
else
iReturn = EnoughSpace()
if iReturn = 0 then
iIdDialog = IDD_NO_SPACE
szDialogProc = c_szNOSPACE_DLG_PROC
else
szDialogProc = c_szEMPTY
endif
endif
CASE IDD_NO_SPACE
if iReturn = c_iSELECT_COMPONENTS then
iIdDialog = IDD_SELECT_COMPONENTS
szDialogProc =c_szCOMPONENT_DLG_PROC
else
GOTO QUIT
endif
END SELECT
end if
wend
'' Is sound already on???
'' CheckSound will return number not equal to zero if sound is not on and
'' sound component is enabled.
if CheckSound = 0 then
RESUME_SOUND:
iReturn = SetupUIDlg(CUIDLL$, IDD_SOUND, c_szASK_SOUND_DLG_PROC, 0, c_szEMPTY )
if iReturn = c_iYES then
g_iSound = TRUE '' We want to turn sound on if TRUE
elseif iReturn = c_iEXIT then
GOSUB ASKQUIT
goto RESUME_SOUND
endif
UIpop 1
endif
iReturn = FSetSymbolValue( c_lpszSECTION_LIST, c_szEMPTY)
iReturn =FSetSymbolValue( c_lpszCOMPONENT_LIST, c_szEMPTY)
SetRestartDir g_pEnvironment[0].szTempDir[0]
'$IFDEF DEBUG
WriteToLogFile "Restart Directory: "+ g_szDest
OutputDebugString("Restarting at "+g_szDest+" ..." + chr$(10))
'$ENDIF
g_szDest = UIStartDlg( CUIDLL$, IDD_INVISIBLE, c_szINVISIBLE_DLG_PROC, 0, c_szEMPTY)
iReturn = Install()
UIPop 1
if iReturn = c_iINVALID then
goto QUIT
elseif iReturn = c_iGO_BACK then
iReturn = DoMsgBox( c_szNO_SELECTIONS,c_szINSTALL_ABORT, 36)
if iReturn = 6 then
iIdDialog = IDD_SELECT_COMPONENTS
szDialogProc =c_szCOMPONENT_DLG_PROC
goto GOBACK
endif
goto QUIT
endif
if 0 = GetListLength(c_szFAILURE) then
iReturn = SetupUIDlg(CUIDLL$, IDD_VERIFICATION,c_szVERIFY_DLG_PROC , 0, c_szEMPTY )
else
iReturn = SetupUIDlg(CUIDLL$, IDD_VERIFICATION_W_FAIL, c_szVERIFY_FAIL_DLG_PROC, 0, c_szEMPTY)
endif
UIPop 1
if g_iMethod = c_iNETADMIN then
iReturn = SetupUIDlg(CUIDLL$, IDD_FINAL_ADMIN, c_szFINAL_ADMIN_DLG_PROC, 0, c_szEMPTY)
else
iReturn = SetupUIDlg(CUIDLL$, IDD_FINAL, c_szFINAL_DLG_PROC, 0, c_szEMPTY )
endif
UIPop 1
if RestartListEmpty = 0 then
WriteToLogFile "[RestartList]"
RESTART:
iReturn = SetupUIDlg(CUIDLL$, IDD_ASK_REBOOT, c_szREBOOT_DLG_PROC, 0, c_szEMPTY)
if iReturn = c_iREBOOT then
Clean
if ExitExecRestart = 0 then
'$IFDEF DEBUG
WriteToLogFile "Error restarting windows!"
OutputDebugString("Error Restarting windows")
'$ENDIF
goto RESTART
endif
endif
elseif iReturn = c_iCONTINUE AND g_pEnvironment[0].runTime.bReboot then
iReturn = SetupUIDlg(CUIDLL$, IDD_ASK_REBOOT, c_szREBOOT_DLG_PROC, 0, c_szEMPTY)
if iReturn = c_iREBOOT then
if CleanTempDir(g_pEnvironment[0].szTempDir[0]) = 0 then
'$IFDEF DEBUG
OutputDebugString("error deleting temp dir: "+ g_pEnvironment[0].szTempDir[0] + chr$(10))
'$ENDIF
endif
Clean
'$IFNDEF MSTEST_20
iReturn = ExitWindows(EW_RESTARTWINDOWS, 0)
'$ENDIF
else
if CleanTempDir( g_pEnvironment[0].szTempDir[0] ) = 0 then
'$IFDEF DEBUG
OutputDebugString("error deleting temp dir:"+g_szDest+ chr$(10))
'$ENDIF
endif
endif
endif
GOTO QUIT
QUIT:
Clean
UIPop 1
END
ASKQUIT:
iReturn = SetupUIDlg(CUIDLL$, IDD_EXIT_INCOMPLETE, c_szEXIT_DLG_PROC, 0, c_szEMPTY)
if iReturn = c_iExit then
UIPopAll
ERROR STFQUIT
else
UIPop 1
endif
RETURN
static sub Clean
'$IFDEF DEBUG
OutputDebugString "Cleaning up, CloseLogFile" + chr$(10)
'$ENDIF
CloseLogFile
'$IFDEF DEBUG
OutputDebugString "ending 3d module..."+ chr$(10)
'$ENDIF
if Installed3D then
qg_iReturn = End3d( iModule )
endif
'$IFDEF DEBUG
OutputDebugString "Releaseing info file..." +chr$(10)
'$ENDIF
iReturn = ReleaseInfoFile()
'$IFDEF DEBUG
OutputDebugString "calling support cleanup..." + chr$(10)
'$ENDIF
g_iReturn% = Cleanup()
'$IFDEF DEBUG
OutputDebugString "End of Clean up..." +chr$(10)
'$ENDIF
end sub
function CheckLZExpand( iValue%, szFile1$, szFile2$ ) statiC as integer
dim iPerformExpand as integer
dim iExpanded as integer
dim szDate1 as string
dim szDate2 as string
iPerformExpand = FALSE
iExpanded = FALSE
'$IFDEF DEBUG
OutputDebugString " Checked version for 1: "+szFile1+ "; 2: "+szFile2+ chr$(10)
'$ENDIF
SELECT CASE iValue
CASE c_iVERSION_1_NEWER
'$IFDEF DEBUG
OutputDebugString " Version 1 newer " +chr$(10)
'$ENDIF
iPerformExpand = TRUE
CASE c_iVERSION_1_NOT_FOUND
'$IFDEF DEBUG
OutputDebugString " version 1 not found" +chr$(10)
'$ENDIF
'' Problem, but will still run without 3D
CASE c_iVERSION_1_2_SAME
'$IFDEF DEBUG
OutputDebugString "versions are the same " +chr$(10)
'$ENDIF
iExpanded = TRUE
CASE c_iVERSION_1_2_NOT_FOUND
'$IFDEF DEBUG
OutputDebugString " versions 1 and 2 were not found" +chr$(10)
'$ENDIF
'' Problem, but will still run without 3D
CASE c_iVERSION_1_2_NO_VERSION
'$IFDEF DEBUG
OutputDebugString "no version info in either file " +chr$(10)
'$ENDIF
'' No version info found, voth files exist, compare dates??
szDate1 = GetDateOfFile( szFile1 )
szDate2 = GetDateOfFile( szFile2 )
'$IFDEF DEBUG
OutputDebugString "szDate1: "+szDate1+ "szDate2: "+szDate2 +chr$(10)
'$ENDIF
if szDate1 > szDate2 then
iPerformExpand = TRUE
else
iExpanded = TRUE
endif
CASE c_iVERSION_2_NEWER
'$IFDEF DEBUG
OutputDebugString " version 2 is newer" +chr$(10)
'$ENDIF
iExpanded = TRUE
CASE c_iVERSION_2_NOT_FOUND
'$IFDEF DEBUG
OutputDebugString " version 2 is not found" +chr$(10)
'$ENDIF
iPerformExpand = TRUE
END SELECT
if iPerformExpand AND ExpandFile(szFile1, szFile2) then
'$IFDEF DEBUG
OutputDebugString " Expand Succeeded" +chr$(10)
'$ENDIF
iExpanded = TRUE
endif
CheckLZExpand = iExpanded
end function
static function Check3D as integer
szDest$ = g_pEnvironment[0].szSystemDir[0]
szDest$ = MakePath(szDest, c_szCTRL3DFILE)
szTempFile$ = GetSymbolValue("STF_SRCDIR")
szSrcFile$ = MakePath( szTempFile, c_szCTRL3DFILE_COMPRESSED)
dim iCopy as integer
dim pCopy as pointer to integer
dim iExpanded as integer
iExpanded = FALSE
pCopy = VARPTR( iCopy )
'' First We do a compare on the WINDOWS\SYSTEM direcotry
iReturn = FileVersionCompare(szSrcFile, szDest, pCopy)
iExpanded = CheckLZExpand( iCopy, szSrcFile, szDest )
if iExpanded = FALSE AND IsWindowShared then
'$IFDEF DEBUG
OutputDebugString "running Shared windows..." +chr$(10)
'$ENDIF
szDest$ = g_pEnvironment[0].szWindowsDir[0]
szDest$ = MakePath(szDest, c_szCTRL3DFILE)
iReturn = FileVersionCompare(szSrcFile, szDest, pCopy)
iExpanded = CheckLZExpand( iCopy, szSrcFile, szDest)
endif
Check3D = iExpanded
END function
STATIC Function MergeStrings (szStr1$, szStr2$) as string
g_szDest = STRING$(len(szStr1) + len(szStr2) + 10, 0)
lTemp& = lstrcat(g_szDest,szStr1)
lTemp& = lstrcat(g_szDest,szStr2)
MergeStrings = g_szDest
END FUNCTION
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** 0 on success, nonzero on error.
'*************************************************************************
FUNCTION Install() STATIC AS INTEGER
dim iReturn as integer
'' Save user's options to log file
iReturn = LogUserOptions()
''handle iReturn <> 0
iReturn = PutComponentsInCopyList( c_lpszSECTION_LIST, c_lpszCOMPONENT_LIST )
'' if iReturn is true then the setup.hp file is corrupt.
if iReturn then
iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
iReturn = c_iINVALID
elseif 0 = GetListLength(c_lpszSECTION_LIST) OR 0 = GetListLength(c_lpszCOMPONENT_LIST ) then
iReturn = c_iGO_BACK
else
'' Create copy list and copy files
iReturn = CopyFiles()
''handle iReturn <> 0
'$IFDEF DEBUG
OutputDebugString( "======" + chr$(10))
OutputDebugString( "CopyFiles return: " + STR$(iReturn) + chr$(10))
'$ENDIF
if (iReturn = 0) then
iCursor% = ShowWaitCursor
'' Update .ini files
iReturn = IniActionUpdate()
''handle iReturn <> 0
'$IFDEF DEBUG
OutputDebugString( "IniActionUpdate return: " + STR$(iReturn) + chr$(10))
'$ENDIF
RestoreCursor iCursor%
endif
'$IFDEF DEBUG
OutputDebugString( "======" + chr$(10))
'$ENDIF
endif
iRet% = LogInstallation
Install = iReturn
END FUNCTION
FUNCTION LogEnvironment() STATIC as integer
g_pEnvironment = GetInstallEnvironment()
szTemp$ = g_pEnvironment[0].szWindowsDir[0]
OpenLogFile MakePath(szTemp$, c_szLOG_FILE), 0
WriteToLogFile "[System Environment]"
lFree& = GetFreeSpaceForDrive("C")
if lFree > 1000 then
lFree = lFree /1000
endif
lTotal& = GetTotalSpaceForDrive("C")
if lTotal > 1000 then
lTotal = lTotal / 1000
endif
WriteToLogFile "Disk Space: " + str$(lFree) + "K bytes free out of " + str$(lTotal) + "K bytes total space"
lFreeMem = GetFreeSpace(0)
if lFreeMem > 1000 then
lFreeMem = lFreeMem / 1000
endif
WriteToLogFile "Memory: " + str$(lFreeMem) + "K bytes free"
WriteToLogFile "Windows Version: " + str$(g_pEnvironment[0].iOSMajor) + " ." + str$(g_pEnvironment[0].iOSMinor)
WriteToLogFile "Path: " + GetEnvVariableValue("PATH")
''szTemp$ = g_pEnvironment[0].szWindowsDir[0]
WriteToLogFile MergeStrings("Windows Directory: ", g_pEnvironment[0].szWindowsDir[0])
WriteToLogFile MergeStrings("System Directory: ", g_pEnvironment[0].szSystemDir[0])
WriteToLogFile ""
WriteToLogFile ""
LogEnvironment = 0
END FUNCTION
FUNCTION LogInstallation() STATIC as integer
iLen% = GetListLength(c_szLOG_FILE_LIST)
if 0 <> iLen then
WriteToLogFile ""
WriteToLogFile "[InstallTimeModificationsAdditions]"
iStart% = 1
while iLen >= iStart
WriteToLogFile GetListItem(c_szLOG_FILE_LIST, iStart)
iStart = iStart + 1
wend
endif
LogInstallation = 0
END FUNCTION
FUNCTION LogUserOptions() STATIC as integer
DIM szTemp$
WriteToLogFile "[User Selected Options]"
g_pEnvironment = GetInstallEnvironment()
SELECT CASE g_pEnvironment[0].runTime.iInstallMethod
CASE IM_COMPLETE
szTemp = "Complete"
CASE IM_CUSTOM
szTemp = "Custom"
CASE IM_NETADMIN
szTemp = "Net Admin"
END SELECT
WriteToLogFile "Method of Installation : " + szTemp
'' szTemp$ = g_pEnvironment[0].runtime.lpszPort[0]
WriteToLogFile MergeStrings("Select Port: ", g_pEnvironment[0].runtime.lpszPort[0])
''szTemp$ = g_pEnvironment[0].runtime.lpszDeviceID[0]
WriteToLogFile MergeStrings("Select Printer: ",g_pEnvironment[0].runtime.lpszDeviceID[0] )
WriteToLogFile ""
WriteToLogFile ""
LogUserOptions = 0
END FUNCTION
FUNCTION CopyFiles() STATIC as integer
dim szSection as string
dim szDest as string
iReturn% = 0
ClearCopyList
ClearBillboardList
iGaugeX% = GetGaugeDlgUnitsX()
iGaugeY% = GetGaugeDlgUnitsY()
iX% = ((g_pEnvironment[0].iDisplayX )/2 / iGaugeX) * 4
iX = iX - (c_iPROGRESS_WIDTH)/8 ''+ ((c_iPROGRESS_WIDTH * iGaugeX)/4) /2
iY = 2
SetCopyGaugePosition iX,iY
AddToBillBoardList "mscuistf.dll", IDD_BILLBOARD_1,c_szBILLBOARD_DLG_PROC,3
''AddToBillBoardList "mscuistf.dll", IDD_BILLBOARD_2,c_szBILLBOARD_DLG_PROC,1
SrcDir$ = GetSymbolValue("STF_SRCDIR")
TempDir$ = g_pEnvironment[0].szTempDir[0]
ReadInfFile MakePath(TempDir$, c_szINFO_FILE)
iListLen% = GetListLength( c_lpszSECTION_LIST )
while iListLen > 0
szDest = GetListItem( c_lpszSECTION_LIST, iListLen )
iListLen = iListLen - 1
szSection = GetListItem( c_lpszSECTION_LIST, iListLen )
iListLen = iListLen - 1
'' If this is true then setup file is corrupted
if lstrlen(szSection) = 0 OR lstrlen(szDest) = 0 then
'$IFDEF DEBUG
OutputDebugString( "Error Adding section: " + szSection + ", to dest: " + szDest + chr$(10) )
'$ENDIF
iReturn = c_iINVALID
goto ABORT2
endif
'$IFDEF DEBUG
OutputDebugString( "Adding section: " + szSection + ", to dest: " + szDest + chr$(10) )
'$ENDIF
AddSectionFilesToCopyList szSection, srcDir, szDest '' MergeStrings(g_pEnvironment[0].szWindowsDir[0],c_szEMPTY)
wend
CopyFilesInCopyList
ClearCopyList
ClearBillboardList
''UIPop 1
''g_szDest = UIStartDlg( "mscuistf.dll", IDD_BILLBOARD_2, c_szBILLBOARD_DLG_PROC, 0, c_szEMPTY)
ALDN:
if IsComponentSelected(c_szALADDIN) then
if IsComponentSelected( c_szALADDIN_CUSTOM) then
g_szDest = UIStartDlg( "mscuistf.dll", IDD_ALADDIN, c_szALADDIN_DLG_PROC, 0, c_szEMPTY)
UIPop 1
else
szDir$ = STRING$(MAX_PATH, 0)
if GetComponentDir(c_szALADDIN, szDir) = 0 then
'' handle this later
endif
szAladdin$ = c_szEMPTY
if lstrlen(szDir) <> 0 then
szAladdin = MakePath(szDir ,c_szALADDIN_CMD_LINE)
else
szAladdin = c_szALADDIN_CMD_LINE
endif
if IsComponentSelected( c_szALL_FONTS ) then
szAladdin = szAladdin + MakePath(g_pEnvironment[0].szTempDir[0], c_szALLFONTS_FILE)
else
szAladdin = szAladdin + MakePath(g_pEnvironment[0].szTempDir[0], c_szFONTLIST_FILE)
endif
'$IFDEF DEBUG
OutputDebugString " Aladdin CommandLine: " +szAladdin+chr$(10)
'$ENDIF
if SetExecBlock(szAladdin, c_szALADDIN_EXIT_MSG) then
g_szDest = UIStartDlg( "mscuistf.dll", IDD_INVISIBLE, c_szEXECUTE_DLG_PROC, 0, c_szEMPTY)
UIPop 1
iReturn = GetExecBlockReturn()
if iReturn < 32 then
g_szDest = c_szUNABLE_ALADDIN1 +" "+ c_szUNABLE_ALADDIN2+c_szUNABLE_ALADDIN3
iRet% = DoMsgBox(g_szDest,c_szUNABLE_ALADDIN_CAP , MB_TASKMODAL+MB_ICONHAND+MB_OK)
UIPop 1
else
'' Since it worked, set iReturn to 0 so that we return success bdg 10/14/94
iReturn = 0
endif
else
'' There was a problem so tell the user how to run aladdin from the icon.
g_szDest = UIStartDlg( "mscuistf.dll", IDD_ALADDIN, c_szALADDIN_DLG_PROC, 0, c_szEMPTY)
UIPop 1
endif
endif
endif
ABORT:
ABORT2:
RemoveSymbol c_lpszSECTION_LIST
RemoveSymbol c_lpszCOMPONENT_LIST
CopyFiles = iReturn
END FUNCTION
'**
'** 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$ = c_szEMPTY THEN
MakePath = szFile$
ELSE
IF szFile$ <> c_szEMPTY THEN
IF MID$(szDir$, lstrlen(szDir$), 1) <> "\" THEN
szDir = MergeStrings(szDir, "\")
ENDIF
szDir = MergeStrings(szDir, szFile)
ENDIF
MakePath = szDir$
END IF
END FUNCTION
STATIC FUNCTION SetupUIDlg(szDll$, idDlg%, szDlgProc$, idHelpDlg%, szHelpProc$) as integer
sz$ = UIStartDlg( szDll, idDlg, szDlgProc, idHelpDlg, szHelpProc)
iReturn% = GetButtonId(sz)
SetupUIDlg = iReturn
END FUNCTION
STATIC FUNCTION GetButtonId(szString$) as integer
SELECT CASE szString
CASE IDC_COMPLETE_SYMBOL
GetButtonId = c_iCOMPLETE
CASE IDC_CUSTOM_SYMBOL
GetButtonId = c_iCUSTOM
CASE IDC_NETADMIN_SYMBOL
GetButtonId = c_iNETADMIN
CASE IDC_RETRY_SYMBOL
GetButtonId = c_iRETRY
CASE IDC_PORT_SYMBOL
GetButtonId = c_iPORT
CASE IDC_SKIP_SYMBOL
GetButtonId = c_iSKIP
CASE IDC_CHANGE_OPTION_SYMBOL
GetButtonId = c_iCHANGE_OPTION
CASE IDC_PATH_SYMBOL
GetButtonId = c_iPATH
CASE IDC_SELECT_COMPONENTS_SYMBOL
GetButtonId = c_iSELECT_COMPONENTS
CASE IDC_SELECT_PORT_SYMBOL
GetButtonId = c_iSELECT_PORT
CASE IDC_SELECT_PRINTER_SYMBOL
GetButtonId = c_iSELECT_PRINTER
CASE IDC_RUN_FILE_MANAGER_SYMBOL
GetButtonId = c_iRUN_FILE_MANAGER
CASE IDC_README_SYMBOL
GetButtonId = c_iREADME
CASE IDC_OVERVIEW_SYMBOL
GetButtonId = c_iOVERVIEW
CASE IDC_REBOOT_SYMBOL
GetButtonId = c_iREBOOT
CASE IDC_RESUME_SYMBOL
GetButtonId = c_iRESUME
CASE IDC_BACK_SYMBOL
GetButtonId = c_iBACK
CASE IDC_CONTINUE_SYMBOL
GetButtonId = c_iCONTINUE
CASE IDC_EXIT_SYMBOL
GetButtonId = c_iEXIT
CASE IDOK_SYMBOL
GetButtonId = c_iOK
CASE IDCANCEL_SYMBOL
GetButtonId = c_iCANCEL
CASE IDYES_SYMBOL
GetButtonId = c_iYES
CASE IDNO_SYMBOL
GetButtonId = c_iNO
CASE ELSE
GetButtonId = c_iINVALID
END SELECT
END FUNCTION