home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-10 | 43.8 KB | 1,290 lines |
- '$DEFINE DEBUG
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- CONST TITLE = "La Hora y Lugar en la Casa de Trudy"
- CONST INSERTCD = "La Hora y Lugar en la Casa de Trudy "
- CONST INIFILE = "Edmark.INI"
- CONST PROGRAMTITLE = "La Hora y Lugar en la Casa de Trudy"
- CONST READMETITLE = "Registration Information"
- CONST HELPTITLE = "La Hora y Lugar en la Casa de Trudy Help"
- CONST SECTION = "TRUDY"
- CONST TRUDYDIR = "TRUDY\"
- CONST EDUTILDIR = "\EDUTIL\"
- CONST WING = "WING\"
- CONST HELPPATH = "~:\TRUDY\TRUDY3.hlp"
- CONST READMEPATH = "~:\edinst\win10k.wri"
- CONST DEARPARENTSPATH = "~:\TRUDY\dearpar\dearpar.exe"
- CONST DEARPARENTSICON = "dearpar.ico"
- CONST READMEICON = "win10k.ico"
- CONST DEMOPATH = "DEMO\DEMO.EXE"
- CONST DEMOICON = "DEMO\DEMO.ico"
- CONST DEMOTITLE = "Demo"
- CONST HELPICON = "TRUDY3.ico"
- CONST EXEICON = "TRUDY.ico"
- CONST EXENAME = "TRUDY.exe"
-
- ''DIALOG ID's
- CONST WELCOME = 100
- CONST ASKQUIT = 200
- CONST DESTPATH = 300
- CONST EXITFAILURE = 400
- CONST EXITQUIT = 600
- CONST EXITSUCCESS = 700
- CONST VERIFYWINPATH = 2400
- CONST ERROR_UNEXPECTED = 2200
- CONST EXITSUCCESSRESTART = 2300
- CONST NOVIRTUALMEM = 2600
- CONST ASKRESTART = 2700
- CONST RESTART = 2800
- CONST README = 2900
- CONST NOSHAREENABLED = 3000
- CONST NEEDREBOOT = 3100
- CONST CUSTINST = 6200
-
- ''OTHER CONSTANTS
- CONST LOGO = 1
- CONST EXIT_FAIL_NOT31 = 1500 '' AT LEAST WINDOWS 3.1
- CONST EXIT_FAIL_NOTINTEL = 1600 '' NOT INTEL
- CONST EXIT_FAIL_NOTENHANCED = 1700 '' NOT ENHANCED MODE
- CONST MB_YESNO = 4
- CONST MB_ICONINFORMATION = 64
- CONST IDYES = 6
- CONST IDNO = 7
- CONST MB_OKCANCEL = 1
- CONST IDOK = 1
-
- GLOBAL DESTWIN$ ''Windows dir
- GLOBAL DESTWINSYS$ ''Windows\System dir
- GLOBAL DESTDIR$ ''Diner directory
- GLOBAL SrcDrive$
- GLOBAL DestEdUtilDir$
- GLOBAL bInstallDVA%
- GLOBAL DEARPARENTS$
- GLOBAL READMESTR$
- GLOBAL HELP$
- GLOBAL DPICON$
- GLOBAL RMICON$
- GLOBAL HICON$
- GLOBAL SHAREMISSING%
-
- ''WIN32S Stuff
- CONST TF_FORCEDRIVE = 128
- GLOBAL DEST32S$ ''Windows\System\Win32s directory
- GLOBAL OLE_PROTECT% ''Indicates whether ole2 dlls were protected from being
- '' copied.
- GLOBAL OLE_OLEBOOT%
- GLOBAL VERNUM$ '' Win32s Version Number (i.e., for v1.25 VERNUM$="125"
-
- GLOBAL szOldVer$
- GLOBAL WIN32ENABLED%
- GLOBAL OLEONLY%
- GLOBAL OLE2_16%
- GLOBAL OLE2AUTO_16%
- GLOBAL OLE16RUNAPP%
- GLOBAL OLEINCLUDED%
- GLOBAL OLE2_32%
- GLOBAL szOleNewVer$
- GLOBAL szOleOldVer$
- GLOBAL szOle16OldVer$
- GLOBAL szOle16NewVer$
- ''End Win32s stuff
-
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
- DECLARE SUB UpdateWinG32 (szOrig$)
-
- DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
- DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
- DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
- DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
- DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$)
- DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
- DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER
- DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
- DECLARE FUNCTION StartWaitCursor LIB "MSCUISTF.DLL" AS INTEGER
- DECLARE FUNCTION StopWaitCursor LIB "MSCUISTF.DLL" AS INTEGER
-
- ''Win32s function declarations
- DECLARE FUNCTION AddWin32sToFakeCopyList AS INTEGER
- DECLARE FUNCTION CopyWin32sFiles AS INTEGER
- DECLARE SUB InstallWin32s(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%)
- DECLARE SUB RecoverFromCopy(szFileName$)
- DECLARE SUB UpdateSystemIni
- DECLARE FUNCTION RebootSystem(ONLY_IF_RESTART_NOT_EMPTY%) AS INTEGER
- DECLARE FUNCTION MakeSystemIni LIB "INIUPD2.DLL" (arg1$, arg2$) AS INTEGER
- DECLARE FUNCTION ShareEnabled LIB "INIUPD2.DLL" AS INTEGER
- DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD2.DLL" (arg1$) AS INTEGER
- DECLARE FUNCTION IsRunningApp LIB "INIUPD2.DLL" AS INTEGER
- DECLARE FUNCTION SetCuiFlags LIB "MSCUISTF.DLL" (arg1%, arg2%) AS INTEGER
- DECLARE FUNCTION GetModuleHandle LIB "KRNL386.EXE" (arg1$) AS INTEGER
- DECLARE FUNCTION LoadLibrary LIB "KRNL386.EXE" (arg1$) AS INTEGER
- DECLARE SUB FreeLibrary LIB "KRNL386.EXE" (arg1%)
- DECLARE FUNCTION SetErrorMode LIB "KRNL386.EXE" (arg1%) AS INTEGER
- DECLARE FUNCTION GetTempFileName LIB "KRNL386.EXE" (drive%, prefix$, u%, filename$) AS INTEGER
- DECLARE SUB WriteLine LIB "INIUPD2.DLL" (filename$, text$)
- DECLARE FUNCTION GetTempFileAt(szDir$, szPrefix$) as string
- ''End Win32s declarations
-
- INIT:
- CUIDLL$ = "MSCUISTF.DLL"
- bInstallDVA% = 0
- ExitCode% = 0
- ON ERROR GOTO ERRORTRAP
-
- SHAREMISSING% = 0
-
- SrcDir$ = GetSymbolValue ("STF_SRCDIR")
- DESTWIN$ = GetWindowsDir()
- SrcDrive$ = MID$ (SrcDir$, 1,3)
- DESTDIR$ = MID$ (DESTWIN$, 1,3)
- DESTDIR$ = DESTDIR + "EDMARK"
- DestEdUtilDir$=DESTDIR$+EDUTILDIR
-
- SetBitmap CUIDLL$, LOGO
- SetTitle PROGRAMTITLE
- DestEdUtilDir$=DESTDIR$+EDUTILDIR
- DESTDIR$=DESTDIR$+"\"+TRUDYDIR
-
- szInf$ = GetSymbolValue ("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = GetSymbolValue ("STF_CWDDIR") + "setup.inf"
- ENDIF
- ReadInfFile szInf$
- CHECK:
- '' Check to make sure we're running at least Win 3.1
- IF GetWindowsMajorVersion < 3 THEN
- ExitCode% = EXIT_FAIL_NOT31
- GOTO WELCOME
- ENDIF
- IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 1 THEN
- ExitCode% = EXIT_FAIL_NOT31
- GOTO WELCOME
- ENDIF
- '' Check to see that we're running in enhanced mode or on an INTEL-Based NT machine
- '' GetWindowsMode < 2 means not INTEL if running NT, or not ENHANCED if running Windows
- IF GetWindowsMode < 2 THEN
- IF OnWindowsNT() THEN
- ExitCode% = EXIT_FAIL_NOTINTEL
- ELSE
- ExitCode% = EXIT_FAIL_NOTENHANCED
- ENDIF
- GOTO WELCOME
- ENDIF
- VIRTUALMEM:
- '' Check to make sure windows is set up for virtual memory
- IF PagingEnabled() = 0 THEN
- sz$ = UIStartDlg (CUIDLL$, NOVIRTUALMEM, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO VIRTUALMEM
- ENDIF
- UIPop 1
- GOTO WELCOME
- ENDIF
- WELCOME:
- sz$ = UIStartDlg (CUIDLL$, WELCOME, "FInfoDlgProc", 0, "")
-
- IF sz$ <> "CONTINUE" THEN
- GOSUB ASKQUIT
- GOTO WELCOME
- ENDIF
-
- UIPop 1 '' destroy dialog on top of stack
-
- IF ExitCode% <> 0 THEN
- GOTO EXITFAIL
- ENDIF
- VERIFYWINPATH:
- '' Verify that setup has found the correct \windows directory
- SetSymbolValue "EditTextIn", DESTWIN$
- SetSymbolValue "EditFocus", "END"
- sz$ = UIStartDlg (CUIDLL$, VERIFYWINPATH, "FEditDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO VERIFYWINPATH
- ELSEIF SZ$ = "EXIT" THEN
- GOSUB ASKQUIT
- GOTO VERIFYWINPATH
- ENDIF
- sz$ = GetSymbolValue ("EditTextOut")
- IF sz$ <> DESTWIN$ THEN
-
- '' make sure user ended path with a '\'
- '' if not, help 'em out
- DESTWIN$ = sz$
- DESTWIN$ = LTRIM$(RTRIM$ (DESTWIN$))
- IF INSTR (LEN (DESTWIN$) - 1, DESTWIN$, "\") = 0 THEN
- DESTWIN$ = DESTWIN$ + "\"
- ENDIF
- '' make sure path has a drive letter and drive letter is valid
- sz$ = MID$ (DESTWIN$, 2, 1)
- IF sz$ <> ":" THEN
- i% = DoMsgBox ("Aseg·rese que la ruta es vßlida.", TITLE, MB_ICONHAND + MB_OK)
- GOTO VERIFYWINPATH
- ENDIF
- sz$ = MID$ (DESTWIN$, 1, 1)
- IF IsDriveValid (sz$) = 0 THEN
- i% = DoMsgBox ("Aseg·rese que la ruta es vßlida.", TITLE, MB_ICONHAND + MB_OK)
- GOTO VERIFYWINPATH
- ENDIF
- '' make sure path is valid (i.e. it exists)
- IF DoesDirExist (DESTWIN$) = 0 THEN
- i% = DoMsgBox (" Ruta de acceso no vßlida!", TITLE, MB_ICONHAND + MB_OK)
- GOTO VERIFYWINPATH
- ENDIF
- ENDIF
-
- UIPop 1
-
- DESTWINSYS$ = DESTWIN$
- IF INSTR (LEN (DESTWINSYS$) - 1, DESTWINSYS$, "\") = 0 THEN
- DESTWINSYS$ = DESTWINSYS$ + "\"
- ENDIF
- DESTWINSYS$ = DESTWINSYS$ + "SYSTEM\"
- INITCOPYLISTFORESTIMATE:
- '' add possible files to copy list so we can get the copy list cost for the next dialog
- '' (so we know how much space the files will take up)
- '' after the next dialog, we'll rebuild an actual copy list
- '' (we can't do it accurately yet since we don't know where the path will be)
- '' NOTE: THIS CANNOT BE A FINAL COPY LIST AS SOME VITAL COMMANDS DON'T APPEAR -
- '' SEE FINAL COPY LIST SECTION BELOW
-
- i% = StartWaitCursor()
- ClearCopyList
-
- AddSectionFilesToCopyList SECTION, SrcDrive$+TRUDYDIR, DESTDIR$
- AddSectionFilesToCopyList "EDUTIL", SrcDir$, DestEdUtilDir$
-
- ''see if WAVEMIX.INI file already exists
- '' if not, copy a pre-built one
- IF DoesFileExist (DESTWIN$ + "WAVEMIX.INI", femExists) = 0 THEN
- AddSectionFilesToCopyList "WaveMixIni", SrcDir$, DESTWIN$
- ENDIF
-
- '' ******** WING SECTION STARTS HERE
- AddSectionFilesToCopyList "WinG", SrcDir$+WING, DESTWINSYS$
-
- '
- ' only use DVA on Windows 3.x
- '
- IF OnWin3x() = 1 THEN
- AddSectionFilesToCopyList "dva", SrcDir$ + WING, DESTWINSYS$
- END IF
-
- AddSectionFilesToCopyList "wing32", SrcDir$, DESTWINSYS$
-
- '' Add VfW files here
- AddSectionFilesToCopyList "VfW Runtime", SrcDir$, DESTWINSYS$
- AddSectionFilesToCopyList "AVICodecs", SrcDir$, DESTWINSYS$
- AddSectionFilesToCopyList "ACM Drivers", SrcDir$, DESTWINSYS$
- AddSectionFilesToCopyList "Indeo-ini", SrcDir$, DESTWIN$
- '' AddSectionFilesToCopyList "OLE2", SrcDir$, DESTWINSYS$
- AddSectionFilesToCopyList "MPlayer", SrcDir$, DESTWIN$
- i% = AddWin32sToFakeCopyList()
- IF i% <> EXITSUCCESS THEN
- IF i% = EXITFAILURE THEN
- GOTO FAILURE
- ELSE
- GOTO EXITFAIL
- END IF
- END IF
- sizereq& = GetCopyListCost ("", "NeededSpace", "ExtraNeeded")
-
- i% = StopWaitCursor()
- CUSTOMINIT:
- '' SET UP DRIVE AND DIRECTORY SYMBOL VALUES HERE
- SetSymbolValue "DriveStatusText", ""
- sz$ = MID$ (DESTDIR$, 1, 2)
- AddListItem "DriveStatusText", sz$
- sz$ = GetListItem ("NeededSpace", ASC(LCASE$ (DESTDIR$)) - ASC("a") + 1)
- AddListItem "DriveStatusText", sz$
- DinerSpaceAvail& = GetFreeSpaceForDrive (MID$ (DESTDIR$, 1, 1))
- AddListItem "DriveStatusText", STR$ (DinerSpaceAvail&)
- AddListItem "DriveStatusText", ""
- AddListItem "DriveStatusText", ""
- AddListItem "DriveStatusText", ""
- AddListItem "DriveStatusText", DESTDIR$
- CUSTOM:
- '' Get drive and directory to install product to
- sz$ = UIStartDlg (CUIDLL$, CUSTINST, "FCustInstDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO CUSTOM
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO VERIFYWINPATH
- ELSEIF sz$ = "EXIT" THEN
- GOSUB ASKQUIT
- GOTO CUSTOM
- ELSEIF sz$ = "PATH" THEN
- TEMPDINER$ = DESTDIR$
- GETDINERPATH:
- '' Let user choose own path for Diner
- SetSymbolValue "EditTextIn", TEMPDINER$
- SetSymbolValue "EditFocus", "ALL"
- sz$ = UIStartDlg (CUIDLL$, DESTPATH, "FEditDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO GETDINERPATH
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO CUSTOM
- ELSEIF sz$ = "EXIT" THEN
- GOSUB ASKQUIT
- GOTO GETDINERPATH
- ENDIF
- sz$ = GetSymbolValue ("EditTextOut")
- '' make sure user ended path with a '\'
- '' if not, help 'em out
- TEMPDINER$ = LTRIM$ (RTRIM$ (sz$))
- IF INSTR (LEN (TEMPDINER$) - 1, TEMPDINER$, "\") = 0 THEN
- TEMPDINER$ = TEMPDINER$ + "\"
- ENDIF
- '' make sure path has a drive letter and drive letter is valid
- sz$ = MID$ (TEMPDINER$, 2, 1)
- IF sz$ <> ":" THEN
- i% = DoMsgBox ("Aseg·rese que la ruta es vßlida.", TITLE, MB_ICONHAND + MB_OK)
- GOTO GETDINERPATH
- ENDIF
- sz$ = MID$ (TEMPDINER$, 1, 1)
- IF IsDriveValid (sz$) = 0 THEN
- i% = DoMsgBox ("Aseg·rese que la ruta es vßlida.", TITLE, MB_ICONHAND + MB_OK)
- GOTO GETDINERPATH
- ENDIF
- '' make sure path is valid
- IF IsDirWritable (TEMPDINER$) = 0 THEN
- i% = DoMsgBox ("Ruta de acceso no vßlida.", TITLE, MB_ICONHAND + MB_OK)
- GOTO GETDINERPATH
- ENDIF
- UIPop 1
- DESTDIR$ = TEMPDINER$
- GOTO INITCOPYLISTFORESTIMATE
- ENDIF
-
- UIPop 1
- CHECKSPACE:
- amt$ = GetListItem ("ExtraNeeded", ASC(LCASE$ (DESTDIR$)) - ASC("a") + 1)
- amt$ = MID$ (amt$, 1, 1)
- IF amt$ <> "-" THEN
- i% = DoMsgBox ("No hay suficiente espacio en la unidad.", TITLE, MB_ICONHAND + MB_OK)
- GOTO CUSTOM
- ENDIF
-
- amt$ = GetListItem ("ExtraNeeded", ASC(LCASE$ (DESTWIN$)) - ASC("a") + 1)
- amt$ = MID$ (amt$, 1, 1)
- IF amt$ <> "-" THEN
- i% = DoMsgBox ("No hay suficiente espacio en la unidad de Windows.", TITLE, MB_ICONHAND + MB_OK)
- GOTO SEEYA
- ENDIF
- INITREALCOPYLIST:
- '' add files to copy list
- ClearCopyList
-
- RESTARTDIR$ = DESTWIN$
- SetRestartDir RESTARTDIR$
-
- i% = CopyWin32sFiles()
- IF i%=EXITERROR THEN
- GOTO ERR_UNEXPECTED
- END IF
- IF i%<>EXITSUCCESS THEN
- GOTO FAILURE
- END IF
- ClearCopyList
-
- AddSectionFilesToCopyList SECTION, SrcDrive$+TRUDYDIR, DESTDIR$
- AddSectionFilesToCopyList "EDUTIL", SrcDir$, DestEdUtilDir$
-
- '' see if DINER.INI file already exists
- '' if not, copy a base INI file
- '' IF DoesFileExist (DESTWIN$ + INIFILE, femExists) = 0 THEN
- '' AddSectionFilesToCopyList "INI", SrcDir$, DESTWIN$
- '' ENDIF
-
- '' see if WAVEMIX.INI file already exists
- '' if not, copy a pre-built one
- IF DoesFileExist (DESTWIN$ + "WAVEMIX.INI", femExists) = 0 THEN
- AddSectionFilesToCopyList "WaveMixIni", SrcDir$, DESTWIN$
- ENDIF
-
- '' ******** WING SECTION STARTS HERE
- AddSectionFilesToCopyList "WinG", SrcDir$, DESTWINSYS$
-
- '
- ' only use DVA on Windows 3.x
- '
- IF OnWin3x() = 1 THEN
- AddSectionFilesToCopyList "dva", SrcDir$, DESTWINSYS$
- IF VflatdPresent() = 0 THEN
- bInstallDVA% = 1
- END IF
- END IF
-
- AddSectionFilesToCopyList "wing32", SrcDir$, DESTWINSYS$
- Dest1$ = MakePath(DESTWINSYS$,"wing32.dll")
- Dest2$ = MakePath(DESTWINSYS$,"wing32.xxx")
- RenameFilePlease Dest1$,Dest2$
-
- '' Add VfW files here
- AddSectionFilesToCopyList "VfW Runtime", SrcDir$, DESTWINSYS$
- AddSectionFilesToCopyList "AVICodecs", SrcDir$, DESTWINSYS$
- AddSectionFilesToCopyList "ACM Drivers", SrcDir$, DESTWINSYS$
- AddSectionFilesToCopyList "Indeo-ini", SrcDir$, DESTWIN$
- '' AddSectionFilesToCopyList "OLE2", SrcDir$, DESTWINSYS$
- AddSectionFilesToCopyList "MPlayer", SrcDir$, DESTWIN$
- COPYFILES:
- SrcDir$ = GetSymbolValue ("STF_SRCDIR")
- CreateDir DESTDIR$, cmoVital
- '' CreateDir DESTDIR$ + "TRUDY\", cmoVital
- ERR = 0
- IF SHAREMISSING% = 1 THEN
- i% = DoMsgBox (TITLE + " recomienda que se a±ada el archivo SHARE.EXE al AUTOEXEC.BAT.", TITLE, MB_ICONHAND + MB_OK)
- END IF
- '' copy the files
- CopyFilesInCopyList
-
- '' update wing32
- UpdateWinG32 DESTWINSYS$
-
- '' if we needed to install DVA, create an INI key value
- IF bInstallDVA% = 1 THEN
- CreateSysIniKeyValue DESTWIN$ + "system.ini", "386Enh", "device", MakePath(DESTWINSYS$, "dva.386"), cmoOverwrite
- ENDIF
-
- '' update VfW stuff
- CreateIniKeyValue DESTWIN$ + INIFILE, TITLE, "Resource Path", SrcDrive$, cmoOverwrite
- CreateIniKeyValue DESTWIN$ + INIFILE, TITLE, "ExePath", DESTDIR$ + EXENAME, cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "VIDC.IV31", "ir32.dll", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
- I% = DoesIniKeyExist (DESTWIN$ + "system.ini", "Drivers", "VIDC.RT21")
- IF I% = 0 THEN
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "VIDC.RT21", "indeov.drv", cmoOverwrite
- END IF
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "VIDC.YVU9", "indeov.drv", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
- CreateIniKeyValue DESTWIN$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
-
- '' check for copy errors
- IF ERR <> 0 THEN
- GOTO ERR_UNEXPECTED
- ENDIF
-
- '' more VfW stuff
- Run ("regedit.exe /s " + MakePath(DESTWIN$, "mplayer.reg"))
- '' Run ("regedit.exe /s " + MakePath(DESTWINSYS$, "OLE2.reg"))
- '' Run ("regedit.exe /s " + MakePath(DESTWINSYS$, "cleanup.reg"))
- EICON$ = DESTDIR$+EXEICON
- '' add program manager group and item icon
- CreateProgmanGroup "Edmark", "", cmoNone
-
-
- '' Delete the items first since setup seems to have a bug so it won't overwrite if you specify an icon
- Run("delitem.exe " + TITLE)
- CreateProgmanItem "Edmark", TITLE, DESTDIR$ + EXENAME, EICON$, cmoOverwrite
-
-
- '' CreateProgramItem "Edmark", DEARPARENTS,
- ShowProgmanGroup "Edmark", 1, cmoNone
-
- Run ("profdisp.exe")
- READMEDLG:
- sz$ = UIStartDlg (CUIDLL$, README, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO READMEDLG
- ENDIF
- UIPop 1
- SUCCESS:
- '' HERE WE ALMOST CERTAINLY NEED TO RESTART WINDOWS (and possibly reboot the machine)
- '' BECAUSE OF THE WIN32S STUFF
- '' IF IT WAS ALREADY INSTALLED AND WE DIDN'T INSTALL ANY DVA STUFF, THEN WE DON'T
- '' NEED TO REBOOT
- '' indicate success to the user and restart windows if necessary
- sz$ = UIStartDlg (CUIDLL$, EXITSUCCESS, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO SUCCESS
- ENDIF
- UIPop 1
- DOIT:
- ''make sure we run share if necessary before we start windows up after
- ''we exit out
-
- FOR_APP% = (WIN32ENABLED% and not bInstallDVA)
- FOR_W32S% = (OLEONLY% and not OLE_OLEBOOT% and not bInstallDVA)
- IF RebootSystem(FOR_APP% or FOR_W32S%) = 0 THEN
- dummy% = DoMsgBox ("Salga de MS-DOS y haga clic en OK.", TITLE, MB_OK + MB_ICONHAND)
- goto DOIT
- END IF
- GOTO SEEYA
-
- ASKQUIT:
- sz$ = UIStartDlg (CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
-
- IF sz$ = "EXIT" THEN
- UIPop 1
- GOTO QUIT
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO ASKQUIT
- ELSE
- UIPop 1 '' remove quit dialog and go back to previous dialog
- ENDIF
- RETURN
- QUIT:
- sz$= UIStartDlg (CUIDLL$, EXITQUIT, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO QUIT
- ENDIF
- UIPopALL
- GOTO SEEYA
- ERR_UNEXPECTED:
- sz$ = UIStartDlg (CUIDLL$, ERROR_UNEXPECTED, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO ERR_UNEXPECTED
- ENDIF
- UIPop 1
- GOTO FAILURE
- EXITFAIL:
- sz$ = UIStartDlg (CUIDLL$, ExitCode%, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO EXITFAIL
- ENDIF
- UIPop 1
- GOTO FAILURE
- FAILURE:
- sz$ = UIStartDlg (CUIDLL$, EXITFAILURE, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO FAILURE
- ENDIF
- UIPopAll
- GOTO SEEYA
- ERRORTRAP:
- IF ERR = STFQUIT THEN
- GOTO QUIT
- ENDIF
-
- RESUME NEXT
-
- SEEYA:
- UIPopAll
- IF (OLE_PROTECT% = 1) THEN
-
- '' Free all previously loaded libraries
- FreeLibrary GetModuleHandle("compobj")
- FreeLibrary GetModuleHandle("ole2")
- FreeLibrary GetModuleHandle("ole2prox")
- FreeLibrary GetModuleHandle("ole2conv")
- FreeLibrary GetModuleHandle("storage")
- FreeLibrary GetModuleHandle("ole2nls")
- FreeLibrary GetModuleHandle("ole2disp")
- FreeLibrary GetModuleHandle("typelib")
- END IF
-
- END
-
-
-
- '' FROM HERE ON ARE FUNCTIONS IN THE ORIGINAL WING.MST FILE THAT THE WING SETUP USES
-
- '**
- '** 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
-
- SUB UpdateWinG32 (szOrig$) STATIC
- '
- ' Here we check the version ourselves of wing32.dll, since
- ' we can't get version checking for Win32 apps from Win16
- '
- FileNew$ = MakePath(szOrig$, "wing32.dll")
- FileOrig$ = MakePath(szOrig$, "wing32.xxx")
- IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
- RemoveFile FileOrig$, cmoForce
- ELSE
- RemoveFile FileNew$, cmoForce ' get rid of new file
- RenameFilePlease FileOrig$,FileNew$ ' put back old file
- END IF
- END SUB
-
-
- ''********************************************************************************
- '' WIN32S install code starts here
- ''********************************************************************************
- FUNCTION CopyWin32sFiles STATIC AS INTEGER
- ''This first part is the same as the first part of AddWin32sFilesToFakeCopyList
- ''since it initializes thousands of vars and I didn't want to pass them all in
- szOldVer$ ="1.00.000 " '' Reserve space in string for version
- '' WIN32ENABLED% = 0
- '' OLEONLY% = 0
- '' OLE2_16% = 0
- '' OLE2AUTO_16% = 0
- '' OLE16RUNAPP% = 0
- '' OLE_PROTECT% = 0
- '' OLE_OLEBOOT% = 0
-
-
- WIN32SVER$ = MID$(GetSectionKeyVersion("WindowsSystem", "win32s16"), 1, 4)
- VERNUM$ = MID$(WIN32SVER$, 1, 1) + MID$(WIN32SVER$, 3 , 2)
-
- DESTWIN$ = GetWindowsDir()
- DEST32S$ = DESTWINSYS + "WIN32S\"
-
- IF OnWindowsNT() THEN
- ExitCode% = EXITSUCCESS
- GOTO ENDCOPY
- ENDIF
-
- ''Don't think we need this
- '''$IFDEF DEBUG
- '' i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
- '' WinDrive$ = MID$(GetWindowsDir, 1, 1)
- '' IF IsDriveValid(WinDrive$) = 0 THEN
- '' i% = DoMsgBox("La unidad de Windows no es correcta.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
- '' GOTO QUIT
- '' END IF
- '''$ENDIF ''DEBUG
-
- '' Get version of Win32s to be installed from version info in INF file
- szNewVer$ = GetSectionKeyVersion("WindowsSystem", "win32s16")
-
- '' See if OLE is included.
-
- '' OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "WIN32S\" + "OLE2THK.DL_", femExists )
-
- '' IF OLEINCLUDED% = 1 THEN
- '' See whether one of the OLE 16 bit components is loaded.
- '' IF GetModulehandle("compobj") <> 0 THEN
- '' OLE16RUNAPP% = 1
- '' GOTO GetOleVersion
- '' END IF
- '' IF GetModuleHandle("ole2") <> 0 THEN
- '' OLE16RUNAPP% = 1
- '' GOTO GetOleVersion
- '' END IF
- '' IF GetModuleHandle("ole2prox") <> 0 THEN
- '' OLE16RUNAPP% = 1
- '' GOTO GetOleVersion
- '' END IF
- '' IF GetModuleHandle("ole2conv") <> 0 THEN
- '' OLE16RUNAPP% = 1
- '' GOTO GetOleVersion
- '' END IF
- '' IF GetModuleHandle("storage") <> 0 THEN
- '' OLE16RUNAPP% = 1
- '' GOTO GetOleVersion
- '' END IF
- '' IF GetModuleHandle("ole2nls") <> 0 THEN
- '' OLE16RUNAPP% = 1
- '' GOTO GetOleVersion
- '' END IF
- '' IF GetModuleHandle("ole2disp") <> 0 THEN
- '' OLE16RUNAPP% = 1
- '' GOTO GetOleVersion
- '' END IF
- '' IF GetModuleHandle("typelib") <> 0 THEN
- '' OLE16RUNAPP% = 1
- '' GOTO GetOleVersion
- '' END IF
- ''
- ''GetOleVersion:
- '' szOleNewVer$ = GetSectionKeyVersion("OleWindowsSystemWin32s", "ole2thk")
- ''
- '' '' Get version of currently installed OLE32 from version info of
- '' '' ole2thk file
- '' szOleOldVer$ = GetVersionOfFile( DESTWINSYS$ + "WIN32S\OLE2THK.DLL" )
- ''
- '' szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "COMPOBJ.DLL" )
- '' szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "compobj")
- '' IF (szOle16NewVer$ > szOle16OldVer$) THEN
- '' OLE2_16% = 1
- '' END IF
- ''
- '' szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2.DLL" )
- '' szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2")
- '' IF (szOle16NewVer$ > szOle16OldVer$) THEN
- '' OLE2_16% = 1
- '' END IF
- ''
- '' szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2PROX.DLL" )
- '' szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2prox")
- '' IF (szOle16NewVer$ > szOle16OldVer$) THEN
- '' OLE2_16% = 1
- '' END IF
- ''
- '' szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "STORAGE.DLL" )
- '' szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "storage")
- '' IF (szOle16NewVer$ > szOle16OldVer$) THEN
- '' OLE2_16% = 1
- '' END IF
- ''
- '' szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2CONV.DLL" )
- '' szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2conv")
- '' IF (szOle16NewVer$ > szOle16OldVer$) THEN
- '' OLE2_16% = 1
- '' END IF
- ''
- '' szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2NLS.DLL" )
- '' szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2nls")
- '' IF (szOle16NewVer$ > szOle16OldVer$) THEN
- '' OLE2AUTO_16% = 1
- '' END IF
-
- '' szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2DISP.DLL" )
- '' szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2disp")
- '' IF (szOle16NewVer$ > szOle16OldVer$) THEN
- '' OLE2AUTO_16% = 1
- '' END IF
-
- '' szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "TYPELIB.DLL" )
- '' szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "typelib")
- '' IF (szOle16NewVer$ > szOle16OldVer$) THEN
- '' OLE2AUTO_16% = 1
- '' END IF
-
- '' END IF
-
- '' OLE2_32% = OLEINCLUDED%
-
- '' Check if Win32s is partially installed'
- sz$ = GetIniKeyString (DESTWINSYS$ + "WIN32S.INI", "Win32s", "Setup")
- '' If WIN32S.INI specifies Win32s Setup=0, then force complete Win32s file overwrite
- IF sz$ = "0" THEN
- GOTO STARTWIN32SCOPY
- END IF
- '' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
- IF sz$ <> "1" THEN
- GOTO STARTWIN32SCOPY
- END IF
-
- '' If Win32s is already installed, get running version number
- i% = DoesFileExist( DESTWINSYS$ + "W32SYS.DLL", femExists )
- IF i% = 1 THEN
- i% = IsWin32sLoaded( szOldVer$ )
- ENDIF
-
- IF ERR <> 0 THEN
- GOTO ERRNORMAL
- END IF
-
- IF i% = 0 THEN
- GOTO STARTWIN32SCOPY
- END IF
-
- IF szNewVer$ > szOldVer$ THEN
- GOTO STARTWIN32SCOPY
- END IF
-
- IF OLEINCLUDED% = 1 THEN
-
- OLE2_32% = 0
-
- IF (szNewVer$ = szOldVer$) OR (szNewVer$ < szOldVer$) THEN
- '' Compare OLE32 version and versions of each of OLE16 libraries.
- sz$ = GetIniKeyString (DESTWINSYS$ + "WIN32S.INI", "OLE", "Setup")
- '' If WIN32S.INI specifies OLE2 Setup=0, then force OLE2 file overwrite
- IF ((sz$ <> "1") OR (szOleNewVer$ > szOleOldVer$)) THEN
- OLEONLY% = 1
- OLE2_32% = 1
- GOTO STARTWIN32SCOPY
- END IF
-
- IF OLE2_16% OR OLE2AUTO_16 THEN
- OLEONLY% = 1
- GOTO STARTWIN32SCOPY
- END IF
-
- END IF
-
- END IF
-
- WIN32ENABLED% = 1
-
- STARTWIN32SCOPY:
- IF WIN32ENABLED% = 1 THEN
- ExitCode% = EXITSUCCESS
- GOTO ENDCOPY
- END IF
- IF OLEONLY% = 0 THEN
- CreateIniKeyValue DESTWINSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
- END IF
- IF OLE2_32% = 1 THEN
- CreateIniKeyValue DESTWINSYS$ + "WIN32S.INI", "OLE", "Setup", "0", cmoOverwrite
- END IF
-
- IF ERR <> 0 THEN
- GOTO ERRNORMAL
- END IF
-
- '' Indicate Win32s install failure until all files known to be copied.
- ExitCode% = EXITFAILURE
- ERR = 0
- CreateDir DEST32S$, cmoNone
- InstallWin32S OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%
- UpdateSystemIni
- '' Terminate if unhandled fatal error
- IF ERR <> 0 THEN
- ExitCode% = EXITERROR
- GOTO ENDCOPY
- END IF
-
- IF OLEONLY% = 0 THEN
- CreateIniKeyValue DESTWINSYS$ + "WIN32S.INI", "Win32s", "Setup", "1", cmoOverwrite
- CreateIniKeyValue DESTWINSYS$ + "WIN32S.INI", "Win32s", "Version", szNewVer$, cmoOverwrite
- CreateIniKeyValue DESTWINSYS$ + "WIN32S.INI", "Nls", "AnsiCP", "1252", cmoOverwrite
- END IF
- IF OLE2_32% = 1 THEN
- CreateIniKeyValue DESTWINSYS$ + "WIN32S.INI", "OLE", "Setup", "1", cmoOverwrite
- CreateIniKeyValue DESTWINSYS$ + "WIN32S.INI", "OLE", "Version", szOleNewVer, cmoOverwrite
- END IF
-
- '' Indicate Win32s correctly copied and installed.
- ExitCode% = EXITSUCCESS
- GOTO ENDCOPY
- ERRNORMAL:
- ExitCode% = EXITFAILURE
- ENDCOPY:
- CopyWin32sFiles = ExitCode%
- END FUNCTION
-
-
- FUNCTION AddWin32sToFakeCopyList STATIC AS INTEGER
- szOldVer$ ="1.00.000 " '' Reserve space in string for version
- WIN32ENABLED% = 0
- OLEONLY% = 0
- OLE2_16% = 0
- OLE2AUTO_16% = 0
- OLE16RUNAPP% = 0
- OLE_PROTECT% = 0
- OLE_OLEBOOT% = 0
-
- ERR = 0
- WIN32SVER$ = MID$(GetSectionKeyVersion("WindowsSystem", "win32s16"), 1, 4)
- VERNUM$ = MID$(WIN32SVER$, 1, 1) + MID$(WIN32SVER$, 3 , 2)
-
- DESTWIN$ = GetWindowsDir()
- DEST32S$ = DESTWINSYS + "WIN32S\"
- ''Don't think we need this
- '''$IFDEF DEBUG
- '' i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
- '' WinDrive$ = MID$(GetWindowsDir, 1, 1)
- '' IF IsDriveValid(WinDrive$) = 0 THEN
- '' i% = DoMsgBox("La unidad de Windows no es correcta.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
- '' GOTO QUIT
- '' END IF
- '''$ENDIF ''DEBUG
- CHECKWIN32S:
- ''standard checks were done in main INIT
- IF OnWindowsNT() THEN
- ExitCode% = EXITSUCCESS
- GOTO ENDFAKE
- ENDIF
-
- IF IsRunningApp() <> 0 THEN
- i% = DoMsgBox("Salga de los otros programas y haga clic en OK.", TITLE, MB_ICONHAND + MB_OKCANCEL)
- IF i% = IDOK THEN
- GOTO CHECKWIN32S
- ELSE
- GOTO ERRNORMAL
- END IF
- END IF
-
- IF SHAREMISSING% = 0 and ShareEnabled() = 0 THEN
- SHAREMISSING% = 1
- END IF
- '' Get version of Win32s to be installed from version info in INF file
- szNewVer$ = GetSectionKeyVersion("WindowsSystem", "win32s16")
-
- '' See if OLE is included.
- ''I don't think any of this OLE stuff will ever happen since we're not shipping
- '' OLE2THK.DLL, just the win32s stuff
- OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "WIN32S\" + "OLE2THK.DL_", femExists )
-
- IF OLEINCLUDED% = 1 THEN
- '' See whether one of the OLE 16 bit components is loaded.
- IF GetModulehandle("compobj") <> 0 THEN
- OLE16RUNAPP% = 1
- GOTO GetOleVersion
- END IF
- IF GetModuleHandle("ole2") <> 0 THEN
- OLE16RUNAPP% = 1
- GOTO GetOleVersion
- END IF
- IF GetModuleHandle("ole2prox") <> 0 THEN
- OLE16RUNAPP% = 1
- GOTO GetOleVersion
- END IF
- IF GetModuleHandle("ole2conv") <> 0 THEN
- OLE16RUNAPP% = 1
- GOTO GetOleVersion
- END IF
- IF GetModuleHandle("storage") <> 0 THEN
- OLE16RUNAPP% = 1
- GOTO GetOleVersion
- END IF
- IF GetModuleHandle("ole2nls") <> 0 THEN
- OLE16RUNAPP% = 1
- GOTO GetOleVersion
- END IF
- IF GetModuleHandle("ole2disp") <> 0 THEN
- OLE16RUNAPP% = 1
- GOTO GetOleVersion
- END IF
- IF GetModuleHandle("typelib") <> 0 THEN
- OLE16RUNAPP% = 1
- GOTO GetOleVersion
- END IF
-
- GetOleVersion:
- szOleNewVer$ = GetSectionKeyVersion("OleWindowsSystemWin32s", "ole2thk")
-
- '' Get version of currently installed OLE32 from version info of
- '' ole2thk file
- szOleOldVer$ = GetVersionOfFile( DESTWINSYS$ + "WIN32S\OLE2THK.DLL" )
-
- szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "COMPOBJ.DLL" )
- szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "compobj")
- IF (szOle16NewVer$ > szOle16OldVer$) THEN
- OLE2_16% = 1
- END IF
-
- szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2.DLL" )
- szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2")
- IF (szOle16NewVer$ > szOle16OldVer$) THEN
- OLE2_16% = 1
- END IF
-
- szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2PROX.DLL" )
- szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2prox")
- IF (szOle16NewVer$ > szOle16OldVer$) THEN
- OLE2_16% = 1
- END IF
-
- szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "STORAGE.DLL" )
- szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "storage")
- IF (szOle16NewVer$ > szOle16OldVer$) THEN
- OLE2_16% = 1
- END IF
-
- szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2CONV.DLL" )
- szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2conv")
- IF (szOle16NewVer$ > szOle16OldVer$) THEN
- OLE2_16% = 1
- END IF
-
- szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2NLS.DLL" )
- szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2nls")
- IF (szOle16NewVer$ > szOle16OldVer$) THEN
- OLE2AUTO_16% = 1
- END IF
-
- szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "OLE2DISP.DLL" )
- szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2disp")
- IF (szOle16NewVer$ > szOle16OldVer$) THEN
- OLE2AUTO_16% = 1
- END IF
-
- szOle16OldVer$ = GetVersionOfFile( DESTWINSYS$ + "TYPELIB.DLL" )
- szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "typelib")
- IF (szOle16NewVer$ > szOle16OldVer$) THEN
- OLE2AUTO_16% = 1
- END IF
-
- END IF
- ''End of OLE stuff that I think will never happen. SD
- OLE2_32% = OLEINCLUDED%
-
- '' Check if Win32s is partially installed
- sz$ = GetIniKeyString (DESTWINSYS$ + "WIN32S.INI", "Win32s", "Setup")
- '' If WIN32S.INI specifies Win32s Setup=0, then force complete Win32s file overwrite
- IF sz$ = "0" THEN
- GOTO ADDFILES
- END IF
- '' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
- IF sz$ <> "1" THEN
- GOTO ADDFILES
- END IF
-
- '' If Win32s is already installed, get running version number
- i% = DoesFileExist( DESTWINSYS$ + "W32SYS.DLL", femExists )
- IF i% = 1 THEN
- i% = IsWin32sLoaded( szOldVer$ )
- ENDIF
-
- IF i% = 0 THEN
- GOTO ADDFILES
- END IF
-
- IF szNewVer$ > szOldVer$ THEN
- GOTO ADDFILES
- END IF
-
- IF OLEINCLUDED% = 1 THEN
-
- OLE2_32% = 0
-
- IF (szNewVer$ = szOldVer$) OR (szNewVer$ < szOldVer$) THEN
- '' Compare OLE32 version and versions of each of OLE16 libraries.
- sz$ = GetIniKeyString (DESTWINSYS$ + "WIN32S.INI", "OLE", "Setup")
- '' If WIN32S.INI specifies OLE2 Setup=0, then force OLE2 file overwrite
- IF ((sz$ <> "1") OR (szOleNewVer$ > szOleOldVer$)) THEN
- OLEONLY% = 1
- OLE2_32% = 1
- GOTO ADDFILES
- END IF
-
- IF OLE2_16% OR OLE2AUTO_16 THEN
- OLEONLY% = 1
- GOTO ADDFILES
- END IF
-
- END IF
-
- END IF
-
- WIN32ENABLED% = 1
- ExitCode% = EXITSUCCESS
- GOTO ENDFAKE
- ADDFILES:
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
-
- '' Use file layout sections that specify OLDER file version/time check
- IF OLEONLY% = 0 THEN
- AddSectionFilesToCopyList "WindowsSystem", SrcDir$ + "WIN32S\", DESTWINSYS$
- AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$ + "WIN32S\", DESTWINSYS$ + "WIN32S\"
- '' Add obsolete files to be removed
- AddSectionFilesToCopyList "Win32sSystemObsoleteFiles", SrcDir$ + "WIN32S", DESTWINSYS$ + "WIN32S\"
- END IF
-
- OLE_PROTECT% = 0
- OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "WIN32S\" + "OLE2THK.DL_", femExists )
- ''This OLE stuff should never happen. SD
- if OLEINCLUDED% = 1 THEN
- IF (OLE2_16% = 1) OR (OLE2AUTO_16% = 1) THEN
- AddSectionFilesToCopyList "OleWindowsSystem", SrcDir$ + "WIN32S\", DESTWINSYS$
- END IF
- IF OLE2_32% = 1 THEN
- AddSectionFilesToCopyList "OleWindowsSystemWin32s", SrcDir$ + "WIN32S\", DESTWINSYS$ + "WIN32S\"
- END IF
- IF (OLE2_16% = 1) OR (OLE2_32% = 1) OR (OLE2AUTO_16% = 1) THEN
- AddSectionFilesToCopyList "Ole2RegWindowsSystem", SrcDir$ + "WIN32S\", DESTWINSYS$
- END IF
- IF (OLE2AUTO_16% = 1) THEN
- AddSectionFilesToCopyList "StdoleWindowsSystem", SrcDir$ + "WIN32S\", DESTWINSYS$
- END IF
- END IF
- IF ERR <> 0 THEN
- GOTO ERRNORMAL
- END IF
- ExitCode% = EXITSUCCESS
- GOTO ENDFAKE
- ERRNORMAL:
- ExitCode% = EXITFAILURE
- ENDFAKE:
- AddWin32sToFakeCopyList = ExitCode%
- END FUNCTION
-
-
- '**
- '** Purpose:
- '** Builds the copy list and performs all installation operations.
- '** Arguments:
- '** none.
- '** Returns:
- '** none.
- '*************************************************************************
- SUB InstallWin32s(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%) STATIC
-
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
-
- '' Use file layout sections that specify OLDER file version/time check
- IF OLEONLY% = 0 THEN
- AddSectionFilesToCopyList "WindowsSystem", SrcDir$ + "WIN32S\", DESTWINSYS$
- AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$ + "WIN32S\", DESTWINSYS$ + "WIN32S\"
- '' Add obsolete files to be removed
- AddSectionFilesToCopyList "Win32sSystemObsoleteFiles", SrcDir$ + "WIN32S\", DESTWINSYS$ + "WIN32S\"
- END IF
-
- OLE_PROTECT% = 0
- OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "WIN32S\" + "OLE2THK.DL_", femExists )
-
- if OLEINCLUDED% = 1 THEN
- IF (OLE2_16% = 1) OR (OLE2AUTO_16% = 1) THEN
- IF OLE16RUNAPP% = 1 THEN
- '' Force all OLE2 DLLS to be copied during reboot.
- i% = SetErrorMode(-32768)
- i% = LoadLibrary(DESTWINSYS$ + "compobj.dll")
- i% = LoadLibrary(DESTWINSYS$ + "ole2.dll")
- i% = LoadLibrary(DESTWINSYS$ + "ole2prox.dll")
- i% = LoadLibrary(DESTWINSYS$ + "ole2conv.dll")
- i% = LoadLibrary(DESTWINSYS$ + "storage.dll")
- i% = LoadLibrary(DESTWINSYS$ + "ole2nls.dll")
- i% = LoadLibrary(DESTWINSYS$ + "ole2disp.dll")
- i% = LoadLibrary(DESTWINSYS$ + "typelib.dll")
- OLE_PROTECT% = 1
- END IF
- AddSectionFilesToCopyList "OleWindowsSystem", SrcDir$ + "WIN32S\", DESTWINSYS$
- END IF
- IF OLE2_32% = 1 THEN
- AddSectionFilesToCopyList "OleWindowsSystemWin32s", SrcDir$ + "WIN32S\", DESTWINSYS$ + "WIN32S\"
- END IF
- IF (OLE2_16% = 1) OR (OLE2_32% = 1) OR (OLE2AUTO_16% = 1) THEN
- AddSectionFilesToCopyList "Ole2RegWindowsSystem", SrcDir$ + "WIN32S\", DESTWINSYS$
- END IF
- IF (OLE2AUTO_16% = 1) THEN
- AddSectionFilesToCopyList "StdoleWindowsSystem", SrcDir$ + "WIN32S\", DESTWINSYS$
- IF (OLE16RUNAPP and DoesFileExist(DESTWINSYS$ + "WIN32S\" + "stdole.tlb", femExists) ) THEN
- ' copy stdole.tlb -> tempfile1
- stdole1$ = DESTWINSYS$ + GetTempFileAt(DESTWINSYS$, "STD")
- CopyFile DESTWINSYS$+"STDOLE.TLB", stdole1$, cmoOverwrit, 0
- OLE_OLEBOOT% = 1
- ENDIF
- END IF
- END IF
-
- CopyFilesInCopyList
-
- IF (OLEINCLUDED% = 1) THEN
- RecoverFromCopy DESTWINSYS$ + "compobj.dll"
- RecoverFromCopy DESTWINSYS$ + "ole2.dll"
- RecoverFromCopy DESTWINSYS$ + "ole2prox.dll"
- RecoverFromCopy DESTWINSYS$ + "ole2conv.dll"
- RecoverFromCopy DESTWINSYS$ + "storage.dll"
- RecoverFromCopy DESTWINSYS$ + "ole2nls.dll"
- RecoverFromCopy DESTWINSYS$ + "ole2disp.dll"
- RecoverFromCopy DESTWINSYS$ + "typelib.dll"
- END IF
-
- IF (OLE_PROTECT% = 1) THEN
- '' Free all previously loaded libraries
- FreeLibrary GetModuleHandle("compobj")
- FreeLibrary GetModuleHandle("ole2")
- FreeLibrary GetModuleHandle("ole2prox")
- FreeLibrary GetModuleHandle("ole2conv")
- FreeLibrary GetModuleHandle("storage")
- FreeLibrary GetModuleHandle("ole2nls")
- FreeLibrary GetModuleHandle("ole2disp")
- FreeLibrary GetModuleHandle("typelib")
- OLE_PROTECT% = 0
- END IF
-
- IF (OLE_OLEBOOT% = 1) THEN
- 'rename new stdole.tlb -> tempfile2
- stdole2$ = GetTempFileAt(DESTWINSYS$, "STD")
- RemoveFile DESTWINSYS$+stdole2$, cmoForce
- RenameFile DESTWINSYS$+"STDOLE.TLB" , stdole2$
- 'rename tempfile1 -> stdole.tlb
- RenameFile stdole1$, "STDOLE.TLB"
- 'write to _mssetup.bat: rename tempfile2 to stdole.tlb
- WriteLine DESTWIN$+"_MSSETUP.BAT", ""
- WriteLine DESTWIN$+"_MSSETUP.BAT", "DEL "+DESTWINSYS$+"STDOLE.TLB"
- WriteLine DESTWIN$+"_MSSETUP.BAT", "REN "+DESTWINSYS$+stdole2$+" STDOLE.TLB"
- ENDIF
-
- IF OLEINCLUDED% AND (OLE2_16% OR OLE2_32% OR OLE2AUTO_16%) THEN
- IF OLE16RUNAPP% THEN
- reg1$ = DESTWIN$ + GetTempFileAt(DESTWIN$, "REG")
- CopyFile DESTWIN$+"REG.DAT", reg1$, cmoOverwrit, 0
- ENDIF
-
- RUN "regedit /s " + DESTWINSYS$ + "ole2.reg"
-
- IF OLE16RUNAPP% THEN
- reg2$ = GetTempFileAt(DESTWIN$, "REG")
- RemoveFile DESTWIN$ + reg2$, cmoForce
- RenameFile DESTWIN$ + "REG.DAT" , reg2$
- 'rename tempfile1 -> reg.dat
- RenameFile reg1$, "REG.DAT"
- 'write to _mssetup.bat: rename tempfile2 to reg.dat
- WriteLine DESTWIN$+"_MSSETUP.BAT", ""
- WriteLine DESTWIN$+"_MSSETUP.BAT", "DEL "+DESTWIN$+"REG.DAT"
- WriteLine DESTWIN$+"_MSSETUP.BAT", "REN "+DESTWIN$ + reg2$+" REG.DAT"
- OLE_OLEBOOT% = 1
- ENDIF
- END IF
- END SUB
-
- SUB UpdateSystemIni STATIC
- VxDPath$ = DEST32S$ + "W32S.386"
- SystemIniPath$ = GetWindowsDir()
-
- t% = MakeSystemIni(SystemIniPath$, VxdPath$)
- END SUB
-
- FUNCTION RebootSystem(ONLY_IF_RESTART_NOT_EMPTY%) STATIC AS INTEGER
- ' Check if any files were locked during install. If the RestartList
- ' is not empty, ExitExecRestart() will restart Windows, cleanup setup
- ' files, and copy over locked files before Windows restarts.
- i% = RestartListEmpty()
- CUIDLL$ = "MSCUISTF.DLL"
- IF ((i% = 0) or (not (ONLY_IF_RESTART_NOT_EMPTY% = 1))) THEN
- RESTART:
- sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO RESTART
- END IF
- END IF
-
- IF i% = 0 THEN
- ' ExitExecRestart() only returns if applications refuse to be shutdown.
- ' Win32s is installed but will not operate until Windows is restarted
- ' and the Win32s VxD is loaded.
- i% = ExitExecRestart()
- RebootSystem = 0
- ELSE
- ' If the RestartList list is empty, it is necessary to restart windows
- ' directly. The MSSETUP program creates _MSRSTRT.EXE and _MSSETUP.BAT
- ' in the restart directory. This program should be exec'd to handle
- ' proper MSSETUP cleanup (temp files) and restart Windows.
- IF (ONLY_IF_RESTART_NOT_EMPTY% = 1) THEN
- RebootSystem = 1
- ELSE
- i% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
- RebootSystem = 0
- END IF
- ENDIF
- ENDREBOOTSYSTEM:
- END FUNCTION
-
-
-
- FUNCTION GetTempFileAt(szDir$, szPrefix$) STATIC AS STRING
- szCurDir$ = CURDIR$
- CHDIR szDir$ + "."
- szTempFile$ = STRING$(144, "E")
- i% = GetTempFileName(TF_FORCEDRIVE, szPrefix$,0, szTempFile$)
- CHDIR szCurDir$
- GetTempFileAt = MID$(szTempFile$,3)
- END FUNCTION
-
- SUB RecoverFromCopy(szFileName$) STATIC
- IF DoesFileExist(szFileName$, femExist) = 0 THEN
- szBackFile$ = MID$(szFileName$, 1, LEN(szFileName$)-3) + VERNUM$
- IF DoesfileExist(szBackFile$, femExist) = 0 THEN
- i% = DoMsgBox("ERROR: Could not find backup file "+szBackfile$, "Setup Error", MB_ICONEXLAMATION + MB_OK)
- ELSE
- CopyFile szBackFile$, szFileName$, cmoTimeStamp, 0
- END IF
- END IF
- END SUB
-