home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
My First Incredible Amazing Dictionary
/
Win_DorlingKindersley_MyFirstIncredibleAmazingDictionary.iso
/
dksetup
/
dksetup.mst
< prev
next >
Wrap
Text File
|
1994-08-15
|
27KB
|
946 lines
'**************************************************************************
'* Stowaway Setup
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'' '$INCLUDE 'msshared.inc'
'' OPTION EXPLICIT
DECLARE FUNCTION FIsVGA LIB "mscuistf.dll" AS INTEGER
DECLARE FUNCTION FIs256Colour LIB "mscuistf.dll" AS INTEGER
''Dialog ID's
CONST WELCOME = 100
CONST CUSTOMHELP = 106
CONST SPEED = 111
CONST BILLBOARD = 113
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST APPHELP = 900
CONST DONENEWSYSSOFT = 1100
CONST MAILMAN = 1500
CONST DONENOSYSSOFT = 1800
CONST NEWSYSTEMSOFTWARE = 2300
CONST NEWADPCM = 2600
CONST WARNNOSYSSOFT = 3100
CONST PROGMANGRP = 3742
CONST CUSTOM = 6200
CONST NOSPACE = 6300
CONST BADPATH = 6400
CONST NEED31 = 6401
CONST NOMOUSE = 6402
CONST BADVGA = 6403
CONST NOT256 = 6404
CONST POORMACHINE = 6405
CONST AWFULMACHINE = 6406
CONST PATHHELP = 6407
CONST WHIZZHELP = 6408
CONST URKADPCM = 6409
CONST ADPCMHELP = 6410
''Bitmap ID
CONST LOGO = 1
GLOBAL CURSOR% '' Old mouse cursor state
GLOBAL DEST$ '' Default destination directory.
GLOBAL ProdSrc$, dirCode$, dirSetup$
GLOBAL SysSrc$
GLOBAL SRCDIR$ '' Source Drive
GLOBAL FussyUser$ '' "1" for express installation, "2" for custom.
GLOBAL MINIMAL$ '' "ON" for minimal installation, "OFF" for normal
GLOBAL PROGMAN$ '' "ON" for invoke program manager, "OFF" otherwise
GLOBAL CUSTCHECK$ '' the state of all Custom dialogue check boxes
GLOBAL PROGGRP$ '' Name of Program Manager Group
GLOBAL PRODNAME$ '' Product Name
GLOBAL COMPNAME$ '' Company Name
GLOBAL WINSYSDIR$ '' Windows System Driver
GLOBAL DESTDRIVE$ '' Destination drive
GLOBAL WINDRIVE$ '' Windows drive (system directory)
GLOBAL WinDir$ '' Windows directory
GLOBAL DD% '' Integer DESTDRIVE$
GLOBAL WD% '' Integer WINDRIVE$
GLOBAL SizeReq& '' Total installation size?
GLOBAL NEWSYSADPCM$
GLOBAL CrapLng%
GLOBAL Junk&
GLOBAL CUIDLL$
GLOBAL HELPPROC$
GLOBAL SZINF$
GLOBAL OPTCUR$
GLOBAL I%
GLOBAL SZ$, Key$, SrcDrive$, SrcPengeDir$
GLOBAL VerNew$
GLOBAL VerOld$
GLOBAL ADPCMCOPY%, ADPCMINIUPDATED%
GLOBAL dlg%
GLOBAL INI$
GLOBAL INSTRINI$
GLOBAL Count%, RebootMsg%, uLen%
GLOBAL OLDNTH&, NEWNTH&
GLOBAL OldYear%, NewYear%, OldMonth%, NewMonth%, OldDay%, NewDay%
GLOBAL ExeFile$, PengeFile$, IniFile$, Section$, Moi$
DECLARE SUB Install
DECLARE FUNCTION IsVersionLater (VersionOld$, VersionNew$) AS INTEGER
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION IsDateLater (DateOld$, DateNew$) AS INTEGER
'******************************************************************
'** Declare the funcitons in USER.EXE we need to register a
'** unique message identifier and needed to post that message
'** to the NSETUP.EXE program. See the Windows api documentation
'** for additional information on these functions.
'******************************************************************
DECLARE FUNCTION PostMessage LIB "user" (hwnd%, msg%, wparam%, lparam&) AS INTEGER
DECLARE FUNCTION RegisterWindowMessage LIB "user" (szRebootMessage$) AS INTEGER
INIT:
Cursor% = ShowWaitCursor ()
dirCode$ = "DKCODE"
dirSetup$ = "DKSETUP"
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
PRODNAME$ = "My First Incredible, Amazing Dictionary"
COMPNAME$ = "DK Multimedia"
ExeFile$ = "mfd.exe"
PengeFile$ = "mfd.png"
IniFile$ = "mfd.ini"
Section$ = "MFD"
Moi$ = ProdName$ + " Setup"
WinSysDir$ = GetWindowsSysDir ()
WinDir$ = GetWindowsDir ()
WINDRIVE$ = MID$ (GetWindowsSysDir (), 1, 1)
INSTRINI$ = MakePath(GetWindowsDir(),IniFile$)
SrcDir$ = GetSymbolValue ("STF_SRCDIR")
uLen% = Len (SrcDir$) - Len (dirSetup$)
ProdSrc$ = Mid$ (SrcDir$, 1, uLen% - 1) + dirCode$
SysSrc$ = SrcDir$
SetAbout PRODNAME$, "⌐ 1994 " + COMPNAME$
CrapLng% = SetBeepingMode (1)
SetBitmap CUIDLL$, LOGO
SetTitle PRODNAME$ + " Setup"
CrapLng% = SetDecompMode (1)
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
END IF
ReadInfFile szInf$
OPTCUR$ = "1"
DEST$ = "C:\DKMM\MFD"
MINIMAL$ = "OFF"
PROGMAN$ = "ON"
'***************************************************************
'** Here we go registering the message so we can communicate
'** with NSETUP.EXE.
'***************************************************************
RebootMsg% = RegisterWindowMessage ("NSetup")
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
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
'$ENDIF ''DEBUG
WELCOME:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
Cursor% = ShowWaitCursor ()
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
TEST31:
IF GetWindowsMajorVersion () > 3 THEN
GOTO TESTVGA
END IF
IF GetWindowsMajorVersion () < 3 THEN
GOTO GORDONBENNETT
END IF
IF GetWindowsMinorVersion () >= 10 THEN
GOTO TESTVGA
END IF
GORDONBENNETT:
RestoreCursor (Cursor%)
sz$ = UIStartDlg (CUIDLL$, NEED31, "FInfoDlgProc", AWFULMACHINE, HELPPROC$)
Cursor% = ShowWaitCursor ()
UIPopAll
ERROR STFQUIT
TESTVGA:
IF GetScreenHeight () >= 480 AND GetScreenWidth () >= 640 THEN
GOTO TESTMOUSE
ELSE
RestoreCursor (Cursor%)
sz$ = UIStartDlg (CUIDLL$, BADVGA, "FInfoDlgProc", AWFULMACHINE, HELPPROC$)
Cursor% = ShowWaitCursor ()
IF sz$ = "CONTINUE" THEN
UIPop(1)
GOTO TESTMOUSE
ELSEIF sz$ = "REACTIVATE" THEN
GOTO TESTVGA
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO TESTMOUSE
END IF
END IF
TESTMOUSE:
IF HasMouseInstalled() > 0 THEN
GOTO TESTCOLOUR
ELSE
RestoreCursor (Cursor%)
sz$ = UIStartDlg (CUIDLL$, NOMOUSE, "FInfoDlgProc", AWFULMACHINE, HELPPROC$)
Cursor% = ShowWaitCursor ()
IF sz$ = "CONTINUE" THEN
UIPop(1)
GOTO TESTCOLOUR
ELSEIF sz$ = "REACTIVATE" THEN
GOTO TESTMOUSE
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO TESTCOLOUR
END IF
END IF
TESTCOLOUR:
IF FIs256Colour() > 0 THEN
GOTO WHIZZO
ELSE
RestoreCursor (Cursor%)
sz$ = UIStartDlg (CUIDLL$, NOT256, "FInfoDlgProc", POORMACHINE, HELPPROC$)
Cursor% = ShowWaitCursor ()
IF sz$ = "CONTINUE" THEN
UIPop(1)
GOTO WHIZZO
ELSEIF sz$ = "REACTIVATE" THEN
GOTO TESTCOLOUR
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO WHIZZO
END IF
END IF
WHIZZO:
SetSymbolValue "RadioDefault", FussyUser$
WHIZZ1:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, SPEED, "FRadioDlgProc", WHIZZHELP, HELPPROC$)
Cursor% = ShowWaitCursor ()
FussyUser$ = GetSymbolValue("ButtonChecked")
IF sz$ = "CONTINUE" THEN
UIPop(1)
GOTO FUSSPOT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WHIZZ1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO FUSSPOT
END IF
'' At this point, determine which device drivers need to be loaded.
FUSSPOT:
IF FussyUser$ = "1" THEN
AddSectionFilesToCopyList Section$, ProdSrc$, Dest$
GOTO TESTDRIVERS
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
VerOld$ = Dest$
SetSymbolValue "EditFocus", "ALL"
GETPATH1:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", PATHHELP, HELPPROC$)
Cursor% = ShowWaitCursor ()
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF MID$ (DEST$, 2, 1) <> ":" THEN
IF MID$ (DEST$, 1, 1) <> "\" THEN
DEST$ = WINDRIVE$ + ":\" + DEST$
ELSE
DEST$ = WINDRIVE$ + ":" + DEST$
END IF
ELSEIF IsDriveValid (MID$ (DEST$, 1, 1)) = 0 THEN
Dest$ = VerOld$
UIPop 1
GOSUB BADPATH
GOTO GETPATH
END IF
IF IsDirWritable(DEST$) = 0 THEN
Dest$ = VerOld$
UIPop 1
GOSUB BADPATH
GOTO GETPATH
END IF
IF DoesDirExist( DEST$ ) = 0 THEN
i% = DoMsgBox( "The specified directory does not exist. Do you want to create the directory?", "Install Location", 8228)
IF i% = 7 THEN
GOTO GETPATH1
END IF
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATH1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WHIZZO
ELSE
GOSUB ASKQUIT
GOTO DOCUSTOM
END IF
DOCUSTOM:
SrcDir$ = GetSymbolValue ("STF_SRCDIR")
SetSymbolValue "CheckItemsState", ""
AddListItem "CheckItemsState", MINIMAL$
AddListItem "CheckItemsState", PROGMAN$
'' ** "DriveStatusText" - list of seven strings to initialize drive status
'' ** text items (IDC_TEXT1-7) in the following sequence:
'' ** dst_drive, dst_space_need, dst_space_free,
'' ** win_drive, win_space_need, win_space_free,
'' ** dst_path
'' ** If any of the "win_" items is an empty string, its label
'' ** text will be made non-visible.
DESTDRIVE$ = MID$ (DEST$, 1, 1)
DD% = ASC (DESTDRIVE$) - ASC ("A") + 1
WD% = ASC (WINDRIVE$) - ASC ("A") + 1
CUSTOM1:
ClearCopyList
IF MINIMAL$ = "OFF" THEN
AddSectionFilesToCopyList Section$, ProdSrc$, Dest$
END IF
SetSymbolValue "ExtraSpace", ""
SetSymbolValue "Needed", ""
SetSymbolValue "Cost", ""
SetSymbolValue "DriveStatusText", ""
for i% = 1 to wd% - 1
AddListItem "ExtraSpace", ""
next i%
AddListItem "ExtraSpace", "2048"
Junk& = GetCopyListCost ("ExtraSpace", "Needed", "Cost")
AddListItem "DriveStatusText", DESTDRIVE$
AddListItem "DriveStatusText", GetListItem ("Needed", DD%)
AddListItem "DriveStatusText", STR$ (GetFreeSpaceForDrive (DESTDRIVE$))
if dd% = wd% then
AddListItem "DriveStatusText", ""
AddListItem "DriveStatusText", ""
AddListItem "DriveStatusText", ""
else
AddListItem "DriveStatusText", WINDRIVE$
AddListItem "DriveStatusText", GetListItem ("Needed", WD%)
AddListItem "DriveStatusText", STR$ (GetFreeSpaceForDrive (WINDRIVE$))
end if
AddListItem "DriveStatusText", DEST$
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, CUSTOM, "FCustInstDlgProc", CUSTOMHELP, HELPPROC$)
Cursor% = ShowWaitCursor ()
MINIMAL$ = GetListItem ("CheckItemsState", 1)
PROGMAN$ = GetListItem ("CheckItemsState", 2)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO CUSTOM1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETPATH
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
ClearCopyList
IF MINIMAL$ = "OFF" THEN
AddSectionFilesToCopyList Section$, ProdSrc$, Dest$
END IF
RemoveSymbol "Needed"
RemoveSymbol "Cost"
RemoveSymbol "ExtraSpace"
TESTDRIVERS:
AddToBillboardList CUIDLL$, MAILMAN, "MailmanDlgProc", 2500
SetCopyGaugePosition -1, 140
ADPCMINIUPDATED% = 0
'Change WIN.INI and SYSTEM.INI for ACM driver and ADPCM compresser
Key$ = GetIniKeyString (WinDir$ + "system.ini", "drivers", "WaveMapper")
IF Key$ = "" THEN
ADPCMCOPY% = 1
GOTO SIDTHETHIRD
END IF
IF Key$ <> "msacm.drv" AND Key$ <> "" THEN
ADPCMINI1:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, URKADPCM, "FInfoDlgProc", ADPCMHELP, HELPPROC$)
Cursor% = ShowWaitCursor ()
IF sz$ = "REACTIVATE" THEN
GOTO ADPCMINI1
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO ADPCMINI1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WHIZZO
ELSEIF SZ$ = "CANCEL" THEN
UIPop(1)
GOTO SIDTHEFIFTH
END IF
UIPop 1
ADPCMCOPY% = 1
GOTO SIDTHETHIRD
ENDIF
Key$ = GetIniKeyString (WinDir$ + "system.ini", "MSACM", "Install")
IF Key$ <> "msadpcm.acm" AND Key$ <> "" THEN
ADPCMINI2:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, URKADPCM, "FInfoDlgProc", ADPCMHELP, HELPPROC$)
Cursor% = ShowWaitCursor ()
IF sz$ = "REACTIVATE" THEN
GOTO ADPCMINI2
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO ADPCMINI2
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WHIZZO
ELSEIF sz$ = "CANCEL" THEN
UIPOP 1
GOTO SIDTHEFIFTH
ENDIF
UIPop 1
ADPCMCOPY% = 1
GOTO SIDTHETHIRD
ENDIF
ADPCMCOPY:
ADPCMCOPY% = 0
'Find out if msacm driver is installed
IF DoesFileExist ((MakePath (WinSysDir$, "msacm.drv")), femExists) = 1 THEN
'Is the version installed the latest version?
VerNew$ = GetVersionOfFile (MakePath (ProdSrc$, "msacm.drv"))
VerOld$ = GetVersionOfFile (MakePath (WinSysDir$, "msacm.drv"))
ADPCMCOPY% = IsVersionLater (VerOld$, VerNew$)
ELSE
ADPCMCOPY% = 1
END IF
'We only need to look at the msadpcm.acm file if we have not already
'installed our version of ADPCM
IF ADPCMCOPY% = 0 THEN
'Find out if msadpcm.acm is installed
IF DoesFileExist ((MakePath (WinSysDir$, "msadpcm.acm")), femExists) = 1 THEN
'Is the version installed the latest version?
VerNew$ = GetVersionOfFile (MakePath (ProdSrc$, "msadpcm.acm"))
VerOld$ = GetVersionOfFile (MakePath (WinSysDir$, "msadpcm.acm"))
ADPCMCOPY% = IsVersionLater (VerOld$, VerNew$)
ELSE
ADPCMCOPY% = 1
END IF
END IF
SIDTHETHIRD:
IF ADPCMCOPY% = 1 THEN
ADPCM1:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, NEWSYSTEMSOFTWARE, "FInfoDlgProc", NEWADPCM, HELPPROC$)
Cursor% = ShowWaitCursor ()
IF sz$ = "CONTINUE" THEN
UIPop(1)
AddSpecialFileToCopyList "ACM Drivers", "MSACM", ProdSrc$, MakePath (WinSysDir$, "msacm.drv")
AddSpecialFileToCopyList "ACM Drivers", "MSADPCM", ProdSrc$, MakePath (WinSysDir$, "msadpcm.acm")
CreateIniKeyValue WinDir$ + "system.ini", "drivers", "WaveMapper", "msacm.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "MSACM", "Install", "msadpcm.acm", cmoOverwrite
CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv","MS Audio Compression Manager", cmoOverwrite
CreateIniKeyValue WinDir$ + "control.ini", "Userinstallable.drivers", "WaveMapper", "msacm.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "control.ini", "related.desc", "WaveMapper", "", cmoOverwrite
ADPCMINIUPDATED% = 1
GOTO SIDTHEFOURTH
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO ADPCM1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ADPCM1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WHIZZO
ELSE
GOSUB ASKQUIT
END IF
NOSYSSOFT:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, WARNNOSYSSOFT, "FInfoDlgProc", 0, "")
Cursor% = ShowWaitCursor ()
IF sz$ = "CONTINUE" THEN
UIPop(1)
GOTO SIDTHEFOURTH
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO NOSYSSOFT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO NOSYSSOFT
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO ADPCM1
ELSE
GOSUB ASKQUIT
END IF
SIDTHEFOURTH:
UIPop 1
SIDTHEFIFTH:
END IF
DESTDRIVE$ = MID$ (DEST$, 1, 1)
DD% = ASC (DESTDRIVE$) - ASC ("A") + 1
WD% = ASC (WINDRIVE$) - ASC ("A") + 1
SetSymbolValue "ExtraSpace", ""
SetSymbolValue "Needed", ""
SetSymbolValue "Cost", ""
SetSymbolValue "DriveStatusText", ""
for i% = 1 to wd% - 1
AddListItem "ExtraSpace", ""
next i%
AddListItem "ExtraSpace", "2048"
Junk& = GetCopyListCost ("ExtraSpace", "Cost", "Needed")
if Junk& > 0 THEN
if wd% <> dd% then
Junk& = Val (GetListItem ("Needed", wd%))
if Junk& > 0 then
Junk& = Junk& / 1024 + 1
if Junk& > 2048 then
sz$ = "Setup needs an additional " + str$(Junk&/1024 + 1) + " Mbytes of disk space on drive "
else
sz$ = "Setup needs an additional " + str$(Junk&) + " Kbytes of disk space on drive "
end if
sz$ = sz$ + WINDRIVE$ + ", your Windows drive, to install the "
sz$ = sz$ + "system files needed by " + PRODNAME$ + ". Setup will now exit. You should delete some "
sz$ = sz$ + "unnecessary files on drive " + WINDRIVE$ + " before you run " + Moi$ + " again."
i% = DoMsgBox(sz$, Moi$, MB_OK + MB_ICONHAND)
END
end if
end if
Junk& = Val (GetListItem ("Needed", dd%)) / 1024 + 1
if Junk& > 2048 then
sz$ = "Setup needs an additional " + str$ (Junk&/1024+1) + " Mbytes of disk space on drive "
else
sz$ = "Setup needs an additional " + str$ (Junk&) + " Kbytes of disk space on drive "
end if
sz$ = sz$ + DESTDRIVE$ + " to install " + PRODNAME$ + ". You should select an alternative disk drive, or delete "
sz$ = sz$ + "some unnecessary files on drive " + DESTDRIVE$
sz$ = sz$ + " (which you can do using File Manager or a similar product)."
i% = DoMsgBox (sz$, Moi$, MB_OK + MB_ICONHAND)
goto GETPATH
end if
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
GOTO QUITL1
ELSE
dlg% = EXITFAILURE
GOTO QUITL1
END IF
QUITL3:
IF ADPCMINIUPDATED% = 1 THEN
dlg% = DONENEWSYSSOFT
ELSE
dlg% = DONENOSYSSOFT
END IF
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
Cursor% = ShowWaitCursor ()
IF sz$ = "REACTIVATE" THEN
GOTO QUITL3
ELSEIF sz$ = "CONTINUE" THEN
IF MINIMAL$ = "OFF" THEN
RUN "NOTEPAD.EXE" + " " + MakePath(DEST$,"README.TXT"), NOWAIT
ELSE
RUN "NOTEPAD.EXE" + " " + MakePath(SRCDIR$,"..\" + dirCode$ + "\README.TXT"), NOWAIT
END IF
GOTO QUITL3
ELSEIF sz$ = "BACK" THEN
SetRestartDir DEST$
i% = PostMessage (65535, RebootMsg%, 0, 0)
ELSEIF sz$ = "EXIT" THEN
IF ADPCMINIUPDATED% = 1 THEN
i% = DoMsgBox( "The new system configuration will not be loaded until Windows is restarted.", Moi$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
END IF
END IF
UIPop 1
STOP
END
QUITL1:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
Cursor% = ShowWaitCursor ()
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
STOP
END
ERRQUIT:
i% = DoMsgBox("The setup sources were corrupted. You may be able to correct the problem by using SCANDISK to fix your hard disk.", Moi$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
Cursor% = ShowWaitCursor ()
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
RestoreCursor (Cursor%)
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
Cursor% = ShowWaitCursor ()
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
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
OpenLogFile MakePath(DEST$, "SETUP.LOG"), 0
WriteToLogFile ""
WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
WriteToLogFile " User chose option: '" + OPTCUR$ + "'"
WriteToLogFile ""
WriteToLogFile "May have had to create the directory: " + DEST$
WriteToLogFile ""
CopyFilesInCopyList
SrcDrive$ = MID$(SrcDir$, 1, 1)
uLen% = LEN (SrcDir$) - Len (dirSetup$) - 1
SrcPengeDir$ = MID$(SrcDir$, 1, uLen%-1)
if DoesIniSectionExist (INSTRINI$, "Directory") = 1 then
RemoveIniSection INSTRINI$, "Directory", cmoNone
end if
CreateIniKeyValue INSTRINI$, "Directory", "Data", SrcPengeDir$, cmoOverwrite
IF PROGMAN$ = "ON" THEN
PROGGRP$ = COMPNAME$
WriteToLogFile ""
WriteToLogFile "Updating Program Manager."
WriteToLogFile ""
CreateProgmanGroup PROGGRP$, "", cmoNone
ShowProgmanGroup PROGGRP$, 1, cmoNone
sz$ = "My First Dictionary Read Me"
IF MINIMAL$ = "ON" THEN
szInf$ = MakePath (SrcDir$,"..\" + dirCode$ + "\" + ExeFile$ + " ")+MakePath(SrcDir$,"..\" + dirCode$ + "\" + PengeFile$)
CreateProgmanItem PROGGRP$, "My First Incredible Amazing Dictionary", szInf$, szInf$, cmoOverwrite
CreateProgmanItem PROGGRP$, sz$, "notepad.exe "+MakePath(SrcDir$,"..\" + dirCode$ + "\readme.txt"), "", cmoOverwrite
ELSE
szInf$ = MakePath(DEST$,ExeFile$ + " ")+MakePath(DEST$,PengeFile$)
CreateProgmanItem PROGGRP$, "My First Incredible Amazing Dictionary", szInf$, szInf$, cmoOverwrite
CreateProgmanItem PROGGRP$, sz$, "notepad.exe "+MakePath(DEST$,"readme.txt"), "", cmoOverwrite
END IF
END IF
WriteToLogFile ""
WriteToLogFile "Installation complete"
WriteToLogFile ""
CloseLogFile
Kill MakePath(DEST$, "SETUP.LOG")
END SUB
FUNCTION IsVersionLater (VersionOld$, VersionNew$) STATIC AS INTEGER
IsVersionLater = 0
FOR Count% = 1 TO 4
OldNth& = GetVersionNthField (VersionOld$, Count%)
NewNth& = GetVersionNthField (VersionNew$, Count%)
IF OldNth& > NewNth& THEN
EXIT FOR
END IF
IF NewNth& > OldNth& THEN
IsVersionLater = 1
EXIT FOR
END IF
NEXT Count%
END FUNCTION
'*************************************************************************
'**
'** IsDateLater
'** --------
'** Purpose:
'** Compares two file dates
'** Arguments:
'** DateOld$ in YYYY-MM-DD-HH-MM-SS format
'** DateNew$ in YYYY-MM-DD-HH-MM-SS format
'** Returns:
'** 1 if new date is later, 0 if new date is older or the same
'*************************************************************************
FUNCTION IsDateLater (DateOld$, DateNew$) STATIC AS INTEGER
'First compare year
OldYear% = GetYearFromDate (DateOld$)
NewYear% = GetYearFromDate (DateNew$)
IF NewYear% < OldYear% THEN
IsDateLater = 0
ELSEIF NewYear% = OldYear% THEN
'If year is the same, compare month
OldMonth% = GetMonthFromDate (DateOld$)
NewMonth% = GetMonthFromDate (DateNew$)
IF NewMonth% < OldMonth% THEN
IsDateLater = 0
ELSEIF NewMonth% = OldMonth% THEN
'If month is the same, compare day
OldDay% = GetDayFromDate (DateOld$)
NewDay% = GetDayFromDate (DateNew$)
IF NewDay% <= OldDay% THEN
IsDateLater = 0
ELSE
IsDateLater = 1
END IF
ELSE
IsDateLater = 1
END IF
ELSE
IsDateLater = 1
ENDIF
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$ = "" 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