home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1998 January (DVD)
/
VPR980100.ISO
/
OLS
/
WIN16
/
CG_ST
/
CG_ST01.LZH
/
CGSTN.MS_
/
CGSTN.MS
Wrap
Text File
|
1994-12-23
|
11KB
|
363 lines
'******************************************************************************
'* Setup Script for CG-Station
'* Copyright (C) 1994 Noriyuki Seko
'* Created in 12/21/1994
'******************************************************************************
''$DEFINE DEBUG
'*-----------------------------------------------------------------------------
'* Include Files
'*-----------------------------------------------------------------------------
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'*-----------------------------------------------------------------------------
'* Constant Declarations
'*-----------------------------------------------------------------------------
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST TOOBIG = 6300
CONST BADPATH = 6400
CONST BADLICENCE = 7100
CONST CDBADFILE = 7200
CONST CDCONFIRMINFO = 7300
CONST CDGETNAMEORG = 7500
CONST CDBADNAME = 7700
CONST CDBADORG = 7800
CONST LOGO = 1
'*-----------------------------------------------------------------------------
'* Procedure Declarations
'*-----------------------------------------------------------------------------
DECLARE FUNCTION CheckRegistoration LIB "install.dll" AS INTEGER
DECLARE FUNCTION StampRegistoration LIB "install.dll" (szFile$, szName$, szOrg$) AS INTEGER
DECLARE FUNCTION MakeModuleAvailable LIB "install.dll" (szFile1$, szFile2$) AS INTEGER
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
Declare Function ShowWindow Lib "User" (hWnd%, nCmdShow%) As Integer
'*-----------------------------------------------------------------------------
'* Installation Script
'*-----------------------------------------------------------------------------
INIT:
i% = ShowWindow(HwndFrame(), 3)
CuiDll$ = "mscuistf.dll"
LicDll$ = "install.dll"
SrcPath$ = GetSymbolValue("STF_SRCDIR")
CwdPath$ = GetSymbolValue("STF_CWDDIR")
CgsInfFile$ = "CGSTN.INF"
SetupLog$ = "CGSTN.LOG"
'** Define the bitmap to use in the main window's background and
'** set dialog title
SetBitmap CuiDll$, LOGO
SetTitle "CG-Station Setup"
'** Check Windows version (must be version 3.10 or later)
i% = GetWindowsMajorVersion * 100 + GetWindowsMinorVersion
if i% < 310 then
i% = DoMsgBox("CG-Stationを使用するにはバージョン3.1以降のWindowsが必要です。", "セットアップエラー", MB_ICONHAND)
end
end if
'** Read disk layout .INF file
szInf$ = GetSymbolValue("STF_SRCINFPATH")
if szInf$ = "" then
szInf$ = CwdPath$ + CgsInfFile$
end if
ReadInfFile szInf$
'** Set default CG-Station directory
DstPath$ = MID$(GetWindowsDir, 1, 2) + "\CGSTN\"
'** Calculate total free size needed
SpaceNeeded& = 0
for j% = 1 to 4
TempList$ = "ModuleNameList"
if j% = 1 then
b$ = "ModelStudio"
elseif j% = 2 then
b$ = "RenderStudio"
elseif j% = 3 then
b$ = "Samples"
else
b$ = "Documents"
end if
MakeListFromSectionKeys TempList$, b$
for i% = 1 to GetListLength(TempList$)
a$ = GetListItem(TempList$, i%)
SpaceNeeded& = SpaceNeeded& + GetSectionKeySize(b$, a$)
next i%
RemoveSymbol TempList$
next j%
'$IFDEF DEBUG
i% = DoMsgBox("Size needed = "+str$(SpaceNeeded&), "debug", MB_ICONHAND)
'$ENDIF
i% = ShowWindow(HwndFrame(), 3)
'**----------------------------------------------------------------------------
'** This is the initial dialog box that the user sees, "Welcome".
'** shows the welcome dialog box and wait for the user decision.
WELCOME:
sz$ = UIStartDlg(CuiDll$, WELCOME, "FInfoDlgProc", 0, "")
if sz$ = "CONTINUE" then
UIPop 1
else
gosub ASKQUIT
goto WELCOME
end if
'**----------------------------------------------------------------------------
'** Check whether the source floppy is registered already or not. If it has
'** been already registered, pass the dialog box to enter the personal info.
CHECKREGISTRATION:
flag% = CheckRegistoration()
if flag% = 1 then 'Registered
'$IFDEF DEBUG
i% = DoMsgBox("This disk is registered already", "Setup", MB_ICONHAND)
'$ENDIF
goto GETPATH
elseif flag% = 2 then 'Invalid
'$IFDEF DEBUG
i% = DoMsgBox("This disk is invalid", "Setup", MB_ICONHAND)
'$ENDIF
goto BADLICENCE
end if
'$IFDEF DEBUG
i% = DoMsgBox("This disk is not registerd yet", "Setup", MB_ICONHAND)
'$ENDIF
'**----------------------------------------------------------------------------
'** This is the dialog box to enter the user specific personal information.
'** Both name and organization name (company name) are required.
REGISTRATION:
sz$ = UIStartDlg(CuiDll$, CDGETNAMEORG, "FNameOrgDlgProc", 0, "")
RegName$ = GetSymbolValue("NameOut")
RegOrg$ = GetSymbolValue("OrgOut")
if sz$ = "CONTINUE" then
if RegName$ = "" then
gosub BADCNAME
goto REGISTRATION
elseif RegOrg$ = "" then
gosub BADCORG
goto REGISTRATION
else
UIPop 1
end if
elseif sz$ = "BACK" then
UIPop 1
goto WELCOME
else
gosub ASKQUIT
goto REGISTRATION
end if
'**----------------------------------------------------------------------------
'** This is the dialog box to confirm the user name and organization name
'** entered by user.
CONFIRMATION:
AddListItem "ConfirmTextIn", RegName$
AddListItem "ConfirmTextIn", RegOrg$
sz$ = UIStartDlg(CuiDll$, CDCONFIRMINFO, "FConfirmDlgProc", 0, "")
if sz$ = "CONTINUE" then
UIPop 1
elseif sz$ = "BACK" then
UIPop 1
goto REGISTRATION
else
gosub ASKQUIT
goto CONFIRMATION
end if
'**----------------------------------------------------------------------------
'** Register entered user name and organization name to the floppy disk.
'** To do this, the floppy disk must be writable.
DOREGISTRATION:
if IsDirWritable(SrcPath$) = 0 then
sz$ = UIStartDlg(CuiDll$, CDBADFILE, "FInfoDlgProc", 0, "")
if sz$ = "CONTINUE" then
UIPop 1
goto DOREGISTRATION
else
gosub ASKQUIT
goto DOREGISTRATION
end if
end if
if StampRegistoration(SrcPath$ + LicDll$, RegName$, RegOrg$) = 0 then
UIPop 1
goto BADLICENCE
end if
'**----------------------------------------------------------------------------
'** This is the dialog box to require the specific destination
'** directory name to user.
GETPATH:
SetSymbolValue "EditTextIn", DstPath$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CuiDll$, DESTPATH, "FEditDlgProc", 0, "")
DstPath$ = GetSymbolValue("EditTextOut")
if sz$ = "CONTINUE" then
if IsDirWritable(DstPath$) = 0 then
gosub BADPATH
goto GETPATHL1
end if
if GetFreeSpaceForDrive(MID$(DstPath$, 1, 2)) < SizeNeeded& then
gosub NOTENOUGH
goto GETPATHL1
end if
UIPop 1
elseif sz$ = "REACTIVATE" then
goto GETPATHL1
elseif sz$ = "BACK" then
UIPop 1
goto WELCOME
else
gosub ASKQUIT
goto GETPATH
end if
'**----------------------------------------------------------------------------
'** Actual installation procedure.
INSTALLATION:
'** Create destination directory to install.
CreateDir DstPath$, cmoNone
'** Open log file and write the name of destination directory to it.
OpenLogFile MakePath(DstPath$, SetupLog$), 0
WriteToLogFile "指定されたインストール先ディレクトリ :" + DstPath$
'** Copy all the files needed from floppy disk to HD.
AddSectionFilesToCopyList "ModelStudio", SrcPath$, DstPath$
AddSectionFilesToCopyList "RenderStudio", SrcPath$, DstPath$
AddSectionFilesToCopyList "Documents", SrcPath$, DstPath$
AddSectionFilesToCopyList "Samples", SrcPath$, MakePath(DstPath$, "SAMPLES\")
CopyFilesInCopyList
'** Create new program group and entry all the icons to it.
CreateProgmanGroup "CG-Station", "", cmoNone
ShowProgmanGroup "CG-Station", 1, cmoNone
CreateProgmanItem "CG-Station", "Model Studio", MakePath(DstPath$, "MODEL.EXE"), "", cmoOverwrite
CreateProgmanItem "CG-Station", "Render Studio", MakePath(DstPath$, "RENDER.EXE"), "", cmoOverwrite
CreateProgmanItem "CG-Station", "readme", "write.exe " + MakePath(DstPath$, "readme.wri"), "", cmoOverwrite
'** Close log file.
CloseLogFile
'**----------------------------------------------------------------------------
'** Make the program modules available
REALIZEMODULE:
if MakeModuleAvailable(SrcPath$ + LicDll$, MakePath(DstPath$, "MODEL.EXE")) = 0 then
'$IFDEF DEBUG
i% = DoMsgBox("can't realize MODEL.EXE", "Setup", MB_ICONHAND)
'$ENDIF
goto BADLICENCE
end if
if MakeModuleAvailable(SrcPath$ + LicDll$, MakePath(DstPath$, "RENDER.EXE")) = 0 then
'$IFDEF DEBUG
i% = DoMsgBox("can't realize RENDER.EXE", "Setup", MB_ICONHAND)
'$ENDIF
goto BADLICENCE
end if
'**----------------------------------------------------------------------------
'** Done !
QUIT:
on ERROR goto ERRQUIT
if ERR = 0 then
dlg% = EXITSUCCESS
elseif ERR = STFQUIT then
dlg% = EXITQUIT
else
dlg% = EXITFAILURE
end if
QUITL1:
if UIStartDlg(CuiDll$, dlg%, "FInfo0DlgProc", 0, "") = "REACTIVATE" then
goto QUITL1
end if
UIPop 1
end
'*-----------------------------------------------------------------------------
'* Error Message
'*-----------------------------------------------------------------------------
'** When the installer was corrupted.
ERRQUIT:
i% = DoMsgBox ("セットアッププログラムが破損しています!", "セットアップエラー゙", MB_OK + MB_TASKMODAL + MB_ICONHAND)
end
'** When the bad path name was specified:
BADPATH:
if UIStartDlg (CuiDll$, BADPATH, "FInfo0DlgProc", 0, "") = "REACTIVATE" then
goto BADPATH
end if
UIPop 1
return
'** When the bad user name was specified.
BADCNAME:
if UIStartDlg (CuiDll$, CDBADNAME, "FInfo0DlgProc", 0, "") = "REACTIVATE" then
goto BADCNAME
end if
UIPop 1
return
'** When the bad organization name was specified.
BADCORG:
if UIStartDlg (CuiDll$, CDBADORG, "FInfo0DlgProc", 0, "") = "REACTIVATE" then
goto BADCNAME
end if
UIPop 1
return
'** When specified drive has not enough space to install.
NOTENOUGH:
if UIStartDlg (CuiDll$, TOOBIG, "FInfo0DlgProc", 0, "") = "REACTIVATE" then
goto NOTENOUGH
end if
UIPop 1
return
'** Confirm if it's OK to quit.
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
'** When the licence info was corrupted.
BADLICENCE:
if UIStartDlg (CuiDll$, BADLICENCE, "FInfo0DlgProc", 0, "") = "REACTIVATE" then
UIPopAll
ERROR STFQUIT
end if
end
'*-----------------------------------------------------------------------------
'* Utilities
'*-----------------------------------------------------------------------------
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