home *** CD-ROM | disk | FTP | other *** search
/ Chip: Windows 95 / WIN95_CD.ISO / sharewar / internet / amadeus / amadeus2.mst < prev    next >
Encoding:
Text File  |  1995-05-10  |  33.2 KB  |  1,090 lines

  1. '**************************************************************************
  2. '*                  MS Test script for Win32s setup program
  3. '**************************************************************************
  4.  
  5. ''$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7.  
  8. '$INCLUDE 'setupapi.inc'
  9. '$INCLUDE 'msdetect.inc'
  10.  
  11. ''Dialog ID's
  12. CONST WELCOME                  = 100
  13. CONST AMADEUSWELCOME           = 150    
  14. CONST ASKQUIT                  = 200
  15. CONST DESTPATH                 = 300
  16. CONST EXITFAILURE              = 400
  17. CONST EXITQUIT                 = 600
  18. CONST EXITSUCCESS              = 700
  19. CONST OPTIONS                  = 800
  20. CONST SERVEROPTION             = 850
  21. CONST BADPATH                  = 6400
  22.  
  23. CONST HELPWELCOME              = 1000
  24. CONST VERPATH                  = 1100
  25. CONST EXITFAILNOTWIN31         = 1200
  26. CONST EXITFAILNOTENH           = 1300
  27. CONST EXITFAILNOTPAGING        = 1325
  28. CONST EXITFAILNOTINTEL         = 1350
  29. CONST AMADEUSINST              = 1400
  30. CONST FREECELLINSTNOWIN32S     = 1450
  31. CONST FREECELLPATH             = 1500
  32. ''CONST HELPFREECELL             = 1600
  33.  
  34. CONST APPHELP      = 1000
  35. CONST CUSTINST     = 6200
  36.  
  37. ''Bitmap ID
  38. CONST LOGO = 1
  39.  
  40. GLOBAL bInstallDVA%
  41.  
  42. GLOBAL DESTSYS$      ''Windows\System directory.
  43. GLOBAL DEST32S$      ''Windows\System\Win32s directory
  44. GLOBAL DESTWING$     ''Windows\System directory for WinG.
  45.  
  46. ''File Types
  47. CONST APPFILES              = 1
  48. CONST OPT_EWAN_FILES        = 2
  49. CONST OPT_FTP_FILES         = 3
  50. CONST OPT_PS_FILES          = 4
  51. CONST OPT_SCENE_FILES       = 5
  52. CONST OPT_LOCAL_FILES       = 6
  53. CONST OPT_PS_ALONE_FILES    = 7
  54. CONST OPT_HMCARD_FILES      = 8
  55.  
  56. GLOBAL DEST$     ''Destination directory
  57. GLOBAL WINDRIVE$    ''Windows drive letter.
  58. GLOBAL OPT_EWAN$      ''Option Selection for Ewan-Files
  59. GLOBAL OPT_FTP$      ''Option Selection for FTP-Files
  60. GLOBAL OPT_PS$      ''Option Selection for PS-Viewer-Files
  61. GLOBAL OPT_SCENE$
  62. GLOBAL OPT_LOCAL$
  63. GLOBAL OPT_PS_ALONE$
  64. GLOBAL OPT_HMCARD$
  65.  
  66.  
  67. ''CustInst list symbol names
  68. CONST MAX_CUST_OPTIONS = 5
  69.  
  70. GLOBAL APPNEEDS$    ''Option list costs per drive
  71. GLOBAL OPT_EWAN_NEEDS$
  72. GLOBAL OPT_FTP_NEEDS$
  73. GLOBAL OPT_PS_NEEDS$
  74. GLOBAL OPT_SCENE_NEEDS$
  75. GLOBAL OPT_LOCAL_NEEDS$
  76. GLOBAL OPT_PS_ALONE_NEEDS$
  77. GLOBAL OPT_HMCARD_NEEDS$
  78.  
  79. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  80. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  81.  
  82. ''Dialog list symbol names
  83. GLOBAL CHECKSTATES$
  84. GLOBAL STATUSTEXT$
  85. GLOBAL DRIVETEXT$
  86.  
  87. ''Installation mode
  88. GLOBAL INSTALLMODE%
  89. CONST MIN_INSTALL = 1
  90. CONST CUST_INSTALL = 2
  91. CONST MAX_INSTALL = 3
  92. CONST SERV_INSTALL = 4
  93.  
  94. DECLARE SUB Install
  95. DECLARE SUB UpdateSystemIni
  96. DECLARE SUB RebootSystem
  97. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  98. DECLARE FUNCTION GetRealWindowsSysDir AS STRING
  99. DECLARE SUB UpdateWinG32 (szOrig$) 
  100.  
  101. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  102. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  103. DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  104. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  105. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  106. DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$) 
  107.  
  108. DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER
  109. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  110. DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER
  111. DECLARE FUNCTION ShareEnabled LIB "INIUPD.DLL" AS INTEGER
  112. DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
  113. DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
  114.    
  115. DECLARE SUB AddOptFilesToCopyList (ftype%)
  116. DECLARE SUB RecalcOptFiles (ftype%)
  117. DECLARE SUB RecalcPath
  118. DECLARE SUB SetDriveStatus
  119.  
  120. INIT:
  121.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  122.     HELPPROC$ = "FHelpDlgProc"      ''Help dialog procedure
  123.     szOldVer$ ="1.00.000     "      ''Reserve space in string for version
  124.     bInstallDVA% = 0
  125.     WIN32ENABLED% = 0
  126.     SERVERINSTALL% = 0              ''1 ... install on a server
  127.     GLOBAL AlwaysCopy%
  128.     AlwaysCopy% = 0
  129.     ON ERROR GOTO ERRNORMAL
  130.  
  131.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  132.  
  133.     SetBitmap CUIDLL$, LOGO
  134.     SetTitle "Amadeus Setup Program"
  135.  
  136.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  137.     IF szInf$ = "" THEN
  138.        szInf$ = GetSymbolValue("STF_CWDDIR") + "setup.inf"
  139.     END IF
  140.     ReadInfFile szInf$
  141.  
  142.     DESTSYS$ = GetWindowsSysDir()
  143.     DEST32S$ = DESTSYS + "WIN32S\"
  144.  
  145.     IF OnWindowsNT() THEN
  146.     DESTSYS$ = MID$(DESTSYS$, 1, LEN(DESTSYS$) - 1)
  147.     DESTSYS$ = DESTSYS$+ "32\"
  148.     END IF      
  149.  
  150.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  151.     IF IsDriveValid(WinDrive$) = 0 THEN
  152.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  153.         GOTO QUIT
  154.     END IF
  155.  
  156.     DEST$ = WINDRIVE$ + ":\AMADEUS"
  157.     ''CustInst list symbols
  158.     CHECKSTATES$ = "CheckItemsState"
  159.     STATUSTEXT$  = "StatusItemsText"
  160.     DRIVETEXT$   = "DriveStatusText"
  161.     
  162.     ' all choices to on
  163.     FOR i% = 1 TO 8 STEP 1
  164.         AddListItem CHECKSTATES$, "ON"
  165.     NEXT i%
  166.  
  167.     ' clear all text for choice
  168.     FOR i% = 1 TO 8 STEP 1
  169.         AddListItem STATUSTEXT$, ""
  170.     NEXT i%
  171.     
  172.     FOR i% = 1 TO 7 STEP 1
  173.         AddListItem DRIVETEXT$, ""
  174.     NEXT i%
  175.     ReplaceListItem DRIVETEXT$, 7, DEST$
  176.  
  177.     ''Disk cost list symbols
  178.     APPNEEDS$           = "AppNeeds"
  179.     OPT_EWAN_NEEDS$     = "Opt_Ewan_Needs"
  180.     OPT_FTP_NEEDS$      = "Opt_Ftp_Needs"
  181.     OPT_PS_NEEDS$       = "Opt_Ps_Needs"
  182.     OPT_SCENE_NEEDS     = "Opt_Scene_Needs"
  183.     OPT_LOCAL_NEEDS$    = "Opt_Local_Needs"
  184.     OPT_PS_ALONE_NEEDS$ = "Opt_Ps_Alone_Needs"
  185.     OPT_HMCARD_NEEDS$   = "Opt_HmCard_Needs"
  186.  
  187.     EXTRACOSTS$ = "ExtraCosts"
  188.     BIGLIST$    = "BigList"
  189.     FOR i% = 1 TO 8 STEP 1
  190.         AddListItem BIGLIST$, ""
  191.     NEXT i%
  192.     FOR i% = 1 TO 26 STEP 1
  193.         AddListItem EXTRACOSTS$, "0"
  194.     NEXT i%
  195.  
  196.      ''File Option Variables
  197.     OPT_EWAN$       = "1"
  198.     OPT_FTP$        = "1"
  199.     OPT_PS$         = "1"
  200.     OPT_SCENE$      = "1"
  201.     OPT_LOCAL$      = "1"
  202.     OPT_PS_ALONE$   = "1"
  203.     OPT_HMCARD$     = "1"
  204.  
  205. '    RecalcPath
  206. '    SetDriveStatus
  207.  
  208. '$IFDEF DEBUG
  209.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  210. '$ENDIF ''DEBUG
  211.  
  212. WELCOME:
  213.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", HELPWELCOME, HELPPROC$)
  214.     IF sz$ = "CONTINUE" THEN
  215.     UIPop 1
  216.     ELSE
  217.     GOSUB ASKQUIT
  218.     GOTO WELCOME
  219.     END IF
  220.  
  221. CHOOSEINSTALLMODE:
  222.     sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", 0, "")
  223.     selectopt$ = GetSymbolValue("ButtonChecked")
  224.  
  225.     IF sz$ = "CONTINUE" THEN
  226.         UIPop 1
  227.     ELSE
  228.         GOSUB ASKQUIT
  229.         GOTO CHOOSEINSTALLMODE
  230.     END IF
  231.  
  232.     IF selectopt$ = "1" THEN
  233.         INSTALLMODE% = MIN_INSTALL
  234.  
  235.     ELSEIF selectopt$ = "2" THEN 
  236.         INSTALLMODE% = CUST_INSTALL
  237.  
  238.     ELSEIF selectopt$ = "3" THEN 
  239.         INSTALLMODE% = MAX_INSTALL
  240.  
  241.     ELSEIF selectopt$ = "4" THEN
  242.         INSTALLMODE% = SERV_INSTALL
  243.         SERVERINSTALL% = 1
  244.         GOTO GETMINPATH
  245.     END IF
  246.  
  247.     ' only TRUE for SETUP2
  248.     WIN32ENABLED% = 1  
  249.  
  250.     IF WIN32ENABLED% = 1 THEN
  251.         GOTO AMADEUS
  252.     END IF
  253.  
  254. CHECK:
  255.     IF GetWindowsMajorVersion < 3 THEN
  256.     ExitCode% = EXITFAILNOTWIN31
  257.     GOTO QUIT
  258.     END IF
  259.     IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 10 THEN
  260.     ExitCode% = EXITFAILNOTWIN31
  261.     GOTO QUIT
  262.     END IF
  263.     '' Check that we are not runnig on Chicago, including pre-released
  264.     '' Chicago versions.
  265.     IF GetWindowsMajorVersion * 100 + GetWindowsMinorVersion > 350 THEN
  266.         ExitCode% = EXITSUCCESS
  267.         WIN32ENABLED% = 1
  268.         GOTO AMADEUS
  269.     END IF
  270.     IF GetWindowsMode < 2  THEN
  271.     IF OnWindowsNT() THEN
  272.        ExitCode% = EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
  273.     ELSE
  274.        ExitCode% = EXITFAILNOTENH   '' Standard Mode Windows
  275.     END IF
  276.     GOTO QUIT
  277.     END IF
  278.     IF OnWindowsNT() THEN
  279.     ExitCode% = EXITSUCCESS
  280.     WIN32ENABLED% = 1
  281.     GOTO AMADEUS
  282.     END IF
  283.     ExitCode% = EXITSUCCESS
  284.  
  285.     '' Get version of Win32s to be installed from version info in file
  286.     szNewVer$ = GetVersionOfFile( GetSymbolValue("STF_SRCDIR") + "WIN32S16.DLL" )
  287.  
  288.     '' Check if Win32s is partially installed
  289.     sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "Win32s", "Setup")
  290.     '' If WIN32S.INI specifies Setup=0, then force complete Win32s file overwrite
  291.     IF sz$ = "0" THEN
  292.     AlwaysCopy% = 1
  293.     GOTO GETWIN32SPATH
  294.     END IF
  295.     '' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
  296.     IF sz$ <> "1" THEN
  297.     GOTO GETWIN32SPATH
  298.     END IF
  299.  
  300.     '' If Win32s is already installed, get running version number
  301.     i% = DoesFileExist( DESTSYS$ + "W32SYS.DLL", femExists )
  302.     IF i% = 1 THEN
  303.     i% = IsWin32sLoaded( szOldVer$ )
  304.     END IF
  305.  
  306.     IF i% = 0 THEN
  307.     GOTO GETWIN32SPATH
  308.     END IF
  309.     IF szNewVer$ > szOldVer$ THEN
  310.     GOTO GETWIN32SPATH
  311.     END IF
  312.     WIN32ENABLED% = 1
  313.     GOTO AMADEUS
  314.  
  315.  
  316.  
  317.  
  318.  
  319. GETWIN32SPATH:
  320.     IF PagingEnabled() = 0 THEN
  321.     i% = DoMsgBox("Use the Control Panel 386 Enhanced icon and configure Windows using the Virtual Memory option.", "Win32s requires Virtual Memory", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  322.     ExitCode% = EXITFAILURE '' Enhanced mode but not paging
  323.     GOTO QUIT
  324.     END IF
  325.  
  326.     IF ShareEnabled() = 0 THEN
  327.     i% = DoMsgBox( "File-sharing must be enabled. Run SHARE.EXE before starting Windows or add SHARE.EXE to your AUTOEXEC.BAT file.", "Win32s Setup: SHARE.EXE is not loaded", MB_TASKMODAL+MB_ICONEXCLAMATION+MB_OK)
  328.     END IF
  329.  
  330.  
  331.     SetSymbolValue "EditTextIn", DESTSYS$
  332.     SetSymbolValue "EditFocus", "END"
  333.  
  334. GETPATHL1:
  335.     sz$ = UIStartDlg(CUIDLL$, VERPATH, "FDispDlgProc", HELPWELCOME, HELPPROC$)
  336.  
  337.     IF sz$ = "CONTINUE" THEN
  338.     IF IsDirWritable(DESTSYS$) = 0 THEN
  339.         GOSUB BADPATH
  340.         GOTO GETPATHL1
  341.     END IF
  342.     UIPop 1
  343.     ELSEIF sz$ = "REACTIVATE" THEN
  344.     GOTO GETPATHL1
  345.     ELSEIF sz$ = "BACK" THEN
  346.     UIPop 1
  347.     GOTO WELCOME
  348.     ELSE
  349.     GOSUB ASKQUIT
  350.     GOTO GETPATHL1
  351.     END IF
  352.  
  353. COPYFILES:
  354.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
  355.  
  356.     '' Indicate Win32s install failure until all files known to be copied.
  357.     ExitCode% = EXITFAILURE
  358.     ERR = 0
  359.     CreateDir DEST32S$, cmoNone
  360.     Install
  361.     UpdateSystemIni
  362.     '' Terminate if unhandled fatal error
  363.     IF ERR <> 0 THEN
  364.     GOTO QUIT
  365.     END IF
  366.  
  367.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "1", cmoOverwrite
  368.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Version", szNewVer$, cmoOverwrite
  369.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Nls", "AnsiCP", "1252", cmoOverwrite
  370.  
  371.     '' Indicate Win32s correctly copied and installed.
  372.     ExitCode% = EXITSUCCESS
  373.  
  374.     sz$ = UIStartDlg(CUIDLL$, AMADEUSINST, "FInfoDlgProc",0, "")
  375.     IF sz$ = "CONTINUE" THEN
  376.     UIPop 1
  377.     ELSE
  378.     GOTO QUIT
  379.     END IF
  380.  
  381. AMADEUS:
  382.     IF INSTALLMODE% = MIN_INSTALL THEN
  383.         ReplaceListItem CHECKSTATES$, OPT_EWAN_FILES, "OFF"
  384.         ReplaceListItem CHECKSTATES$, OPT_FTP_FILES, "OFF"
  385.         ReplaceListItem CHECKSTATES$, OPT_PS_FILES, "OFF"
  386.         ReplaceListItem CHECKSTATES$, OPT_SCENE_FILES, "OFF"
  387.         ReplaceListItem CHECKSTATES$, OPT_LOCAL_FILES, "OFF"
  388.         ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "OFF"
  389.         ReplaceListItem CHECKSTATES$, OPT_HMCARD_FILES, "OFF"
  390.  
  391.         GOTO GETMINPATH
  392.  
  393.     ELSEIF INSTALLMODE% = CUST_INSTALL THEN 
  394.         ReplaceListItem CHECKSTATES$, OPT_LOCAL_FILES, "OFF"
  395.         ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "OFF"
  396.         ReplaceListItem CHECKSTATES$, OPT_HMCARD_FILES, "OFF"
  397.         
  398.         RecalcPath
  399.         SetDriveStatus
  400.         
  401.         GOTO CUSTINST
  402.  
  403.     ELSEIF INSTALLMODE% = MAX_INSTALL THEN 
  404.         ReplaceListItem CHECKSTATES$, OPT_EWAN_FILES, "ON"
  405.         ReplaceListItem CHECKSTATES$, OPT_FTP_FILES, "ON"
  406.         ReplaceListItem CHECKSTATES$, OPT_PS_FILES, "ON"
  407.         ReplaceListItem CHECKSTATES$, OPT_SCENE_FILES, "ON"
  408.         ReplaceListItem CHECKSTATES$, OPT_LOCAL_FILES, "ON"
  409.         ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "ON"
  410.         ReplaceListItem CHECKSTATES$, OPT_HMCARD_FILES, "ON"
  411.         GOTO GETMINPATH
  412.  
  413.     ELSEIF INSTALLMODE% = SERV_INSTALL THEN
  414.         ReplaceListItem CHECKSTATES$, OPT_EWAN_FILES, "ON"
  415.         ReplaceListItem CHECKSTATES$, OPT_FTP_FILES, "ON"
  416.         ReplaceListItem CHECKSTATES$, OPT_PS_FILES, "ON"
  417.         ReplaceListItem CHECKSTATES$, OPT_SCENE_FILES, "ON"
  418.         ReplaceListItem CHECKSTATES$, OPT_LOCAL_FILES, "ON"
  419.         ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "ON"
  420.         ReplaceListItem CHECKSTATES$, OPT_HMCARD_FILES, "ON"
  421.         GOTO GETMINPATH
  422.     END IF
  423.  
  424. CUSTINST:
  425.  
  426.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  427.  
  428.     RecalcOptFiles APPFILES
  429.     SetDriveStatus
  430.  
  431.     IF sz$ = "CONTINUE" THEN
  432.         ''Install only if it will fit.
  433.         FOR i% = 1 TO 1 STEP 1
  434.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  435.                 GOSUB TOOBIG
  436.                 GOTO CUSTINST
  437.             END IF
  438.         NEXT i%
  439.         UIPop 1
  440.         GOTO INSTALLAMADEUS
  441.     ELSEIF sz$ = "PATH" THEN
  442.         GOTO GETAMADEUSPATH
  443.     ELSEIF sz$ = "CHK1" THEN
  444.         RecalcOptFiles APPFILES
  445.         SetDriveStatus
  446.         GOTO CUSTINST
  447.     ELSEIF sz$ = "CHK2" THEN
  448.         RecalcOptFiles OPT_EWAN_FILES
  449.         SetDriveStatus
  450.         GOTO CUSTINST
  451.     ELSEIF sz$ = "CHK3" THEN
  452.         RecalcOptFiles OPT_FTP_FILES
  453.         SetDriveStatus
  454.         GOTO CUSTINST
  455.     ELSEIF sz$ = "CHK4" THEN
  456.         IF GetListItem(CHECKSTATES$, OPT_PS_FILES) = "OFF" THEN
  457.             ReplaceListItem CHECKSTATES$, OPT_PS_ALONE_FILES, "OFF"
  458.         END IF
  459.         RecalcOptFiles OPT_PS_FILES
  460.         RecalcOptFiles OPT_PS_ALONE_FILES
  461.         SetDriveStatus
  462.         GOTO CUSTINST
  463.     ELSEIF sz$ = "CHK5" THEN
  464.         RecalcOptFiles OPT_SCENE_FILES
  465.         SetDriveStatus
  466.         GOTO CUSTINST
  467.     ELSEIF sz$ = "CHK6" THEN
  468.         RecalcOptFiles OPT_LOCAL_FILES
  469.         SetDriveStatus
  470.         GOTO CUSTINST
  471.     ELSEIF sz$ = "CHK7" THEN
  472.         IF GetListItem(CHECKSTATES$, OPT_PS_ALONE_FILES) = "ON" THEN
  473.             ReplaceListItem CHECKSTATES$, OPT_PS_FILES, "ON"
  474.         END IF
  475.         RecalcOptFiles OPT_PS_FILES
  476.         RecalcOptFiles OPT_PS_ALONE_FILES
  477.         SetDriveStatus
  478.         GOTO CUSTINST
  479.     ELSEIF sz$ = "CHK8" THEN
  480.         RecalcOptFiles OPT_HMCARD_FILES
  481.         SetDriveStatus
  482.         GOTO CUSTINST
  483.     ELSEIF sz$ = "REACTIVATE" THEN
  484.         RecalcPath
  485.         SetDriveStatus
  486.         GOTO CUSTINST
  487.     ELSEIF sz$ = "BACK" THEN    
  488.         UIPop 1
  489.         GOTO CHOOSEINSTALLMODE
  490.     ELSE
  491.         GOSUB ASKQUIT
  492.         GOTO CUSTINST
  493.     END IF
  494.  
  495. INSTALLSERVER:
  496.     ExitCode% = EXITFAILURE
  497.     ERR = 0
  498.  
  499.     ClearCopyList
  500.     AddSectionFilesToCopyList "ServerWin32s", SrcDir$, DEST$
  501.     AddOptFilesToCopyList APPFILES
  502.     AddOptFilesToCopyList OPT_EWAN_FILES
  503.     AddOptFilesToCopyList OPT_FTP_FILES
  504.     AddOptFilesToCopyList OPT_PS_FILES
  505.     AddOptFilesToCopyList OPT_SCENE_FILES
  506.     AddOptFilesToCopyList OPT_LOCAL_FILES
  507.     AddOptFilesToCopyList OPT_PS_ALONE_FILES
  508.     AddOptFilesToCopyList OPT_HMCARD_FILES
  509.     
  510.     AddSectionFilesToCopyList "ServerFiles", SrcDir$, DEST$
  511.  
  512.     CreateDir DEST$, cmoNone
  513.     IF GetListItem(CHECKSTATES$, OPT_PS_FILES) = "ON" THEN
  514.         CreateDir DEST$ + "\gs", cmoNone
  515.     END IF
  516.  
  517.     CopyFilesInCopyList
  518.  
  519.     IF ERR = 0 THEN
  520.         RenameFile DEST$ + "\server.lst", "setup.lst"
  521.     END IF
  522.     
  523.     IF ERR = 0 THEN
  524.         i% = DoMsgBox("Amadeus was successfully installed.", "Amadeus Setup", MB_OK+MB_TASKMODAL)
  525.         END
  526.     END IF
  527.  
  528.     GOTO QUIT
  529.  
  530.  
  531. INSTALLAMADEUS:
  532.     ExitCode% = EXITFAILURE
  533.     ERR = 0
  534.  
  535.     ClearCopyList
  536.     AddOptFilesToCopyList APPFILES
  537.     AddOptFilesToCopyList OPT_EWAN_FILES
  538.     AddOptFilesToCopyList OPT_FTP_FILES
  539.     AddOptFilesToCopyList OPT_PS_FILES
  540.     AddOptFilesToCopyList OPT_SCENE_FILES
  541.     AddOptFilesToCopyList OPT_LOCAL_FILES
  542.     AddOptFilesToCopyList OPT_PS_ALONE_FILES
  543.     AddOptFilesToCopyList OPT_HMCARD_FILES
  544.  
  545.     CreateDir DEST$, cmoNone
  546.     IF GetListItem(CHECKSTATES$, OPT_PS_FILES) = "ON" THEN
  547.         CreateDir DEST$ + "\gs", cmoNone
  548.     END IF 
  549.  
  550.     ' ######## WinG #########
  551.  
  552.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  553.     DESTWING$ = GetWindowsSysDir
  554.     
  555.     AddSectionFilesToCopyList "runtime", SrcDir$, DESTWING$
  556.     
  557.     '
  558.     ' only use DVA on Windows 3.x
  559.     '
  560.     IF OnWin3x() = 1 THEN
  561.         AddSectionFilesToCopyList "dva", SrcDir$, DESTWING$
  562.         IF VflatdPresent() = 0 THEN
  563.             CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite
  564.             bInstallDVA% = 1
  565.         END IF
  566.     END IF
  567.     
  568.     DESTWING$ = GetRealWindowsSysDir
  569.     
  570.     AddSectionFilesToCopyList "wing32", SrcDir$, DESTWING$
  571.         Dest1$ = MakePath(DEST$,"wing32.dll")
  572.         Dest2$ = MakePath(DEST$,"wing32.xxx")
  573.     RenameFilePlease Dest1$,Dest2$
  574.     
  575.     ' ######## WinG #########
  576.  
  577.     CopyFilesInCopyList
  578.  
  579.     IF ERR <> 0 THEN
  580.     GOTO QUIT
  581.     END IF
  582.  
  583.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  584.         CopyFile DEST$ + "\ctl3d32.dll",  DESTSYS$ + "ctl3d32.dll", cmoOverwrite, 0
  585.         RemoveFile DEST$ + "\ctl3d32.dll", cmoNone
  586.  
  587.         RemoveIniSection "WIN.INI", "Amadeus", cmoNone
  588.         CreateIniKeyValue "WIN.INI", "Amadeus", "Dir", DEST$, cmoNone
  589.  
  590.         CreateProgmanGroup "Amadeus", "Amadeus", cmoNone
  591.         CreateProgmanItem "Amadeus", "Amadeus", MakePath(DEST$,"amadeus.exe"), "", cmoOverwrite
  592.  
  593.         CreateIniKeyValue DEST$ + "\Amadeus.ini", "TextViewer", "StyleDirectory", DEST$, cmoOverwrite
  594.     END IF
  595.  
  596.     IF GetListItem(CHECKSTATES$, OPT_EWAN_FILES) = "ON" THEN
  597.         CopyFile DEST$ + "\ctl3dv2.dll",  DESTSYS$ + "ctl3dv2.dll", cmoOverwrite, 0
  598.         RemoveFile DEST$ + "\ctl3dv2.dll", cmoNone
  599.  
  600.         CopyFile DEST$ + "\bwcc.dll",  DESTSYS$ + "bwcc.dll", cmoOverwrite, 0
  601.         RemoveFile DEST$ + "\bwcc.dll", cmoNone
  602.  
  603.         CreateIniKeyValue GetWindowsDir() + "Ewan.ini", "Terminal", "Emulation", "VT100.DLL" , cmoNone
  604.     END IF  
  605.  
  606.     ' create icon for Scene viewer
  607.     IF GetListItem(CHECKSTATES$, OPT_SCENE_FILES) = "ON" THEN
  608.         CreateProgmanGroup "Amadeus", "Amadeus", cmoNone
  609.         CreateProgmanItem "Amadeus", "Scene Viewer", MakePath(DEST$,"scene.exe"), "", cmoOverwrite
  610.     END IF
  611.  
  612.     ' create icon for Stand alone PS viewer
  613.     IF GetListItem(CHECKSTATES$, OPT_PS_ALONE_FILES) = "ON" THEN
  614.         CreateProgmanGroup "Amadeus", "Amadeus", cmoNone
  615.         CreateProgmanItem "Amadeus", "Postscript Viewer", MakePath(DEST$,"psview.exe"), "", cmoOverwrite
  616.     END IF
  617.  
  618.     ' create icon for Local Amadeus
  619.     IF GetListItem(CHECKSTATES$, OPT_LOCAL_FILES) = "ON" THEN
  620.         CreateProgmanGroup "Amadeus", "Amadeus", cmoNone
  621.         CreateProgmanItem "Amadeus", "Local Amadeus", MakePath(DEST$,"locamad.exe"), "", cmoOverwrite
  622.     END IF
  623.  
  624.     UpdateWinG32 GetRealWindowsSysDir()
  625.  
  626.     IF ERR = 0 THEN
  627.         if bInstallDVA% = 1 then
  628.             i% = DoMsgBox("Amadeus was successfully installed. To complete the installation Windows has to be restarted !", "Amadeus Setup", MB_OK+MB_TASKMODAL)
  629.             rc% = RestartWindows
  630.         end if
  631.         i% = DoMsgBox("Amadeus was successfully installed.", "Amadeus Setup", MB_OK+MB_TASKMODAL)
  632.         END
  633.     END IF
  634.     ERR = 0
  635.  
  636. QUIT:
  637.     '' Install error handler for final message box routines
  638.     ON ERROR GOTO ERRQUIT
  639.     IF ERR = 0 THEN
  640.     dlg% = ExitCode%
  641.     ELSEIF ERR = STFQUIT THEN
  642.     dlg% = EXITQUIT
  643.     ExitCode% = EXITQUIT
  644.     ELSE
  645.     dlg% = EXITFAILURE
  646.     ExitCode% = EXITQUIT
  647.     END IF
  648.  
  649. QUITL1:
  650.     IF WIN32ENABLED% = 1 THEN
  651.     UIPop 1
  652.     END
  653.     END IF
  654.  
  655.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  656.     IF sz$ = "REACTIVATE" THEN
  657.     GOTO QUITL1
  658.     END IF
  659.     UIPop 1
  660.  
  661.     ' ######## WinG #########
  662.     if bInstallDVA% = 1 then
  663.         rc% = RestartWindows
  664.     end if
  665.     ' ######## WinG #########
  666.  
  667.     IF ExitCode% = EXITSUCCESS THEN
  668.         RebootSystem
  669.         CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
  670.         i% = DoMsgBox("Win32s is not properly configured and Win32s Setup must be run again.", "Unable to Restart Windows", MB_ICONEXCLAMATION+MB_OK+MB_TASKMODAL)
  671.     END IF
  672.  
  673.     END
  674.  
  675. '' Fatal error handler for error message routine
  676. ERRQUIT:
  677.     i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  678.     END
  679.  
  680. '' Bypass run-time errors. Let final dialog box display fatal error message.
  681. ERRNORMAL:
  682.     '' Check if user cancelled setup
  683.     IF ERR = STFQUIT THEN
  684.     GOTO QUIT
  685.     END IF
  686.     RESUME NEXT
  687.  
  688. GETMINPATH:
  689.     SetSymbolValue "EditTextIn", DEST$
  690.     SetSymbolValue "EditFocus", "END"
  691.  
  692. GETMINPATHL1:
  693.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  694.  
  695.     IF sz$ = "CONTINUE" THEN
  696.         DEST$ = GetSymbolValue("EditTextOut")
  697.         IF IsDirWritable(DEST$) = 0 THEN
  698.             GOSUB BADPATH
  699.             GOTO GETMINPATHL1
  700.         END IF
  701.         UIPop 1
  702.  
  703.     ELSEIF sz$ = "BACK" THEN
  704.         UIPop 1
  705.         GOTO CHOOSEINSTALLMODE
  706.  
  707.     ELSEIF sz$ = "REACTIVATE" THEN
  708.         GOTO GETMINPATHL1
  709.  
  710.     ELSE
  711.         GOSUB ASKQUIT
  712.         GOTO GETMINPATHL1
  713.     END IF
  714.  
  715.     IF INSTALLMODE% = SERV_INSTALL THEN
  716.         GOTO INSTALLSERVER
  717.     ELSE
  718.         GOTO INSTALLAMADEUS
  719.     END IF
  720.  
  721. GETAMADEUSPATH:
  722.     SetSymbolValue "EditTextIn", DEST$
  723.     SetSymbolValue "EditFocus", "END"
  724. GETAMADEUSPATHL1:
  725.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  726.  
  727.     IF sz$ = "CONTINUE" THEN
  728.         olddest$ = DEST$
  729.         DEST$ = GetSymbolValue("EditTextOut")
  730.  
  731.         ''Validate new path.
  732.         IF IsDirWritable(DEST$) = 0 THEN
  733.             GOSUB BADPATH
  734.             GOTO GETAMADEUSPATHL1
  735.         END IF
  736.         UIPop 1
  737.  
  738.         ''Truncate display if too long.
  739.         IF LEN(DEST$) > 23 THEN
  740.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  741.         ELSE
  742.             ReplaceListItem DRIVETEXT$, 7, DEST$
  743.         END IF
  744.  
  745.         ''Recalc if path changed.
  746.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  747.             RecalcPath
  748.             SetDriveStatus
  749.         END IF
  750.  
  751.         olddest$ = ""
  752.         GOTO CUSTINST
  753.     ELSEIF sz$ = "REACTIVATE" THEN
  754.         RecalcPath
  755.         SetDriveStatus
  756.         GOTO GETAMADEUSPATHL1
  757.     ELSEIF sz$ = "EXIT" THEN
  758.         GOSUB ASKQUIT
  759.         GOTO GETAMADEUSPATHL1
  760.     ELSE
  761.         UIPop 1
  762.         GOTO CUSTINST
  763.     END IF
  764.  
  765. TOOBIG:
  766.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  767.     IF sz$ = "REACTIVATE" THEN
  768.         RecalcPath
  769.         SetDriveStatus
  770.         GOTO TOOBIG
  771.     END IF
  772.     UIPop 1
  773.     RETURN
  774.  
  775. BADPATH:
  776.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  777.     IF sz$ = "REACTIVATE" THEN
  778.     GOTO BADPATH
  779.     END IF
  780.     UIPop 1
  781.     RETURN
  782.  
  783.   ASKQUIT:
  784.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  785.  
  786.     IF sz$ = "EXIT" THEN
  787.     UIPopAll
  788.     ERROR STFQUIT
  789.     ELSEIF sz$ = "REACTIVATE" THEN
  790.     GOTO ASKQUIT
  791.     ELSE
  792.     UIPop 1
  793.     END IF
  794.     RETURN
  795.  
  796.  
  797.  
  798. '**
  799. '** Purpose:
  800. '**     Builds the copy list and performs all installation operations.
  801. '** Arguments:
  802. '**     none.
  803. '** Returns:
  804. '**     none.
  805. '*************************************************************************
  806. SUB Install STATIC
  807.  
  808.     ClearCopyList
  809.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  810.  
  811.     '' Check if overwrite required.
  812.     '' Use file layout sections that specify OLDER file version/time check
  813.     AddSectionFilesToCopyList "WindowsSystem", SrcDir$, DESTSYS$
  814.     AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\"
  815.  
  816.     '' Add obsolete files to be removed
  817.     AddSectionFilesToCopyList "Win32sSystemObsoleteFiles", SrcDir$, DESTSYS$ + "WIN32S\"
  818.  
  819.     SetRestartDir GetWindowsDir()
  820.  
  821.     CopyFilesInCopyList
  822.  
  823. END SUB
  824.  
  825. SUB UpdateSystemIni STATIC
  826.  
  827.     VxDPath$ = DEST32S$ + "W32S.386"
  828.     SystemIniPath$ = GetWindowsDir()
  829.  
  830.     t% = MakeSystemIni(SystemIniPath$, VxdPath$)
  831.  
  832. END SUB
  833.  
  834. SUB RebootSystem STATIC
  835.  
  836. '   Check if any files were locked during install.  If the RestartList
  837. '   is not empty, ExitExecRestart() will restart Windows, cleanup setup
  838. '   files, and copy over locked files before Windows restarts.
  839.     i% = RestartListEmpty()
  840.     IF i% = 0 THEN
  841. '      ExitExecRestart() only returns if applications refuse to be shutdown.
  842. '      Win32s is installed but will not operate until Windows is restarted
  843. '      and the Win32s VxD is loaded.
  844.        i% = ExitExecRestart()
  845.      ELSE
  846. '      If the RestartList list is empty, it is necessary to restart windows
  847. '      directly.  The MSSETUP program creates _MSRSTRT.EXE and _MSSETUP.BAT
  848. '      in the restart directory.  This program should be exec'd to handle
  849. '      proper MSSETUP cleanup (temp files) and restart Windows.
  850.        i% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
  851.      END IF
  852.  
  853. END SUB
  854.  
  855.  
  856. '**
  857. '** Purpose:
  858. '**     Appends a file name to the end of a directory path,
  859. '**     inserting a backslash character as needed.
  860. '** Arguments:
  861. '**     szDir$  - full directory path (with optional ending "\")
  862. '**     szFile$ - filename to append to directory
  863. '** Returns:
  864. '**     Resulting fully qualified path name.
  865. '*************************************************************************
  866. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  867.     IF szDir$ = "" THEN
  868.     MakePath = szFile$
  869.     ELSEIF szFile$ = "" THEN
  870.     MakePath = szDir$
  871.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  872.     MakePath = szDir$ + szFile$
  873.     ELSE
  874.     MakePath = szDir$ + "\" + szFile$
  875.     END IF
  876. END FUNCTION
  877.  
  878. '**
  879. '** Purpose:
  880. '**     Adds the specified option files to the copy list.
  881. '** Arguments:
  882. '**     ftype%  - type of files to add, one of the following:
  883. '**             APPFILES
  884. '** Returns:
  885. '**     none.
  886. '*************************************************************************
  887. SUB AddOptFilesToCopyList (ftype%) STATIC
  888.  
  889.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  890.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  891.         IF ftype% = APPFILES THEN
  892.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  893.         ELSEIF ftype% = OPT_EWAN_FILES THEN
  894.             AddSectionFilesToCopyList "Opt_Ewan_Files", SrcDir$, DEST$
  895.         ELSEIF ftype% = OPT_FTP_FILES THEN
  896.             AddSectionFilesToCopyList "Opt_Ftp_Files", SrcDir$, DEST$
  897.         ELSEIF ftype% = OPT_PS_FILES THEN
  898.             AddSectionFilesToCopyList "Opt_Ps_Files", SrcDir$, DEST$ + "\gs"
  899.         ELSEIF ftype% = OPT_SCENE_FILES THEN
  900.             AddSectionFilesToCopyList "Opt_Scene_Files", SrcDir$, DEST$
  901.         ELSEIF ftype% = OPT_LOCAL_FILES THEN
  902.             AddSectionFilesToCopyList "Opt_Local_Files", SrcDir$, DEST$
  903.         ELSEIF ftype% = OPT_PS_AlONE_FILES THEN
  904.             AddSectionFilesToCopyList "Opt_Ps_Alone_Files", SrcDir$, DEST$
  905.         ELSEIF ftype% = OPT_HMCARD_FILES THEN
  906.             AddSectionFilesToCopyList "Opt_HmCard_Files", SrcDir$, DEST$
  907.         END IF
  908.         SrcDir$ = ""
  909.     END IF
  910. END SUB
  911.  
  912. '**
  913. '** Purpose:
  914. '**     Recalculates disk space for the given option files and sets
  915. '**     the status info symbol "StatusItemsText".
  916. '** Arguments:
  917. '**     ftype% - type of files to add, one of the following:
  918. '**             APPFILES
  919. '** Returns:
  920. '**     none.
  921. '*************************************************************************
  922. SUB RecalcOptFiles (ftype%) STATIC
  923.     CursorSave% = ShowWaitCursor()
  924.     ClearCopyList
  925.     AddOptFilesToCopyList ftype%
  926.  
  927.     fExtra% = 0
  928.     IF ftype% = APPFILES THEN
  929.         ListSym$ = APPNEEDS$
  930.         IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  931.             ''Add extra cost to Windows drive for ini/progman, etc.
  932.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  933.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  934.             fExtra% = 1
  935.         END IF
  936.     ELSEIF ftype% = OPT_EWAN_FILES THEN
  937.         ListSym$ = OPT_EWAN_NEEDS$
  938.     ELSEIF ftype% = OPT_FTP_FILES THEN
  939.         ListSym$ = OPT_FTP_NEEDS$
  940.     ELSEIF ftype% = OPT_PS_FILES THEN
  941.         ListSym$ = OPT_PS_NEEDS$
  942.     ELSEIF ftype% = OPT_SCENE_FILES THEN
  943.         ListSym$ = OPT_SCENE_NEEDS$
  944.     ELSEIF ftype% = OPT_LOCAL_FILES THEN
  945.         ListSym$ = OPT_LOCAL_NEEDS$
  946.     ELSEIF ftype% = OPT_PS_ALONE_FILES THEN
  947.         ListSym$ = OPT_PS_ALONE_NEEDS$
  948.     ELSEIF ftype% = OPT_HMCARD_FILES THEN
  949.         ListSym$ = OPT_HMCARD_NEEDS$
  950.     END IF
  951.  
  952.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  953.  
  954.     cost& = 0
  955.     FOR i% = 1 TO 26 STEP 1
  956.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  957.     NEXT i%
  958.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  959.  
  960.     IF StillNeed& > 0 THEN
  961.         ReplaceListItem BIGLIST$, ftype%, "YES"
  962.     ELSE
  963.         ReplaceListItem BIGLIST$, ftype%, ""
  964.     END IF
  965.  
  966.     IF fExtra% THEN
  967.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  968.     END IF
  969.     RestoreCursor CursorSave%
  970.     ListSym$ = ""
  971. END SUB
  972.  
  973. '**
  974. '** Purpose:
  975. '**     Recalculates disk space and sets option status info according
  976. '**     to the current destination path.
  977. '** Arguments:
  978. '**     none.
  979. '** Returns:
  980. '**     none.
  981. '*************************************************************************
  982. SUB RecalcPath STATIC
  983.  
  984.     CursorSave% = ShowWaitCursor()
  985.  
  986.     RecalcOptFiles APPFILES
  987.     RecalcOptFiles OPT_EWAN_FILES
  988.     RecalcOptFiles OPT_FTP_FILES
  989.     RecalcOptFiles OPT_PS_FILES
  990.     RecalcOptFiles OPT_SCENE_FILES
  991.     RecalcOptFiles OPT_LOCAL_FILES
  992.     RecalcOptFiles OPT_PS_ALONE_FILES
  993.     RecalcOptFiles OPT_HMCARD_FILES
  994.  
  995.     RestoreCursor CursorSave%
  996. END SUB
  997.  
  998.  
  999. '**
  1000. '** Purpose:
  1001. '**     Sets drive status info according to latest disk space calcs.
  1002. '** Arguments:
  1003. '**     none.
  1004. '** Returns:
  1005. '**     none.
  1006. '*************************************************************************
  1007. SUB SetDriveStatus STATIC
  1008.  
  1009.     drive$ = MID$(DEST$, 1, 1)
  1010.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  1011.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) 
  1012.     cost& = cost& + VAL(GetListItem(OPT_EWAN_NEEDS$, ndrive%)) 
  1013.     cost& = cost& + VAL(GetListItem(OPT_FTP_NEEDS$, ndrive%)) 
  1014.     cost& = cost& + VAL(GetListItem(OPT_PS_NEEDS$, ndrive%)) 
  1015.     cost& = cost& + VAL(GetListItem(OPT_SCENE_NEEDS$, ndrive%)) 
  1016.     cost& = cost& + VAL(GetListItem(OPT_LOCAL_NEEDS$, ndrive%)) 
  1017.     cost& = cost& + VAL(GetListItem(OPT_PS_ALONE_NEEDS$, ndrive%)) 
  1018.     cost& = cost& + VAL(GetListItem(OPT_HMCARD_NEEDS$, ndrive%)) 
  1019.     free& = GetFreeSpaceForDrive(drive$)
  1020.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  1021.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  1022.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  1023.  
  1024.     IF drive$ = WINDRIVE$ THEN
  1025.         ReplaceListItem DRIVETEXT$, 4, ""
  1026.         ReplaceListItem DRIVETEXT$, 5, ""
  1027.         ReplaceListItem DRIVETEXT$, 6, ""
  1028.     ELSE
  1029.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  1030.         cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) 
  1031.         cost& = cost& + VAL(GetListItem(OPT_EWAN_NEEDS$, ndrive%))
  1032.         cost& = cost& + VAL(GetListItem(OPT_FTP_NEEDS$, ndrive%))
  1033.         cost& = cost& + VAL(GetListItem(OPT_PS_NEEDS$, ndrive%))
  1034.         cost& = cost& + VAL(GetListItem(OPT_SCENE_NEEDS$, ndrive%))
  1035.         cost& = cost& + VAL(GetListItem(OPT_LOCAL_NEEDS$, ndrive%)) 
  1036.         cost& = cost& + VAL(GetListItem(OPT_PS_ALONE_NEEDS$, ndrive%)) 
  1037.         cost& = cost& + VAL(GetListItem(OPT_HMCARD_NEEDS$, ndrive%)) 
  1038.         IF cost& = 0 THEN
  1039.             ReplaceListItem DRIVETEXT$, 4, ""
  1040.             ReplaceListItem DRIVETEXT$, 5, ""
  1041.             ReplaceListItem DRIVETEXT$, 6, ""
  1042.         ELSE
  1043.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  1044.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  1045.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  1046.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  1047.         END IF
  1048.     END IF
  1049. END SUB
  1050.  
  1051. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  1052.     szBuf$ = string$(260, 32)
  1053.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  1054.     IF cbBuf% = 0 THEN
  1055.         ERROR STFERR
  1056.     ELSE
  1057.         IF cbBuf% > 259 THEN
  1058.             res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  1059.             ERROR STFERR
  1060.         END IF
  1061.         szBuf$ = RTRIM$(szBuf$)
  1062.         IF MID$(szBuf$, 1, 1) = "\" THEN
  1063.             szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  1064.         ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  1065.             szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  1066.         END IF
  1067.         IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  1068.             szBuf$ = szBuf$ + "\"
  1069.         END IF
  1070.         GetRealWindowsSysDir = szBuf$
  1071.     END IF
  1072.  
  1073.     szBuf$ = ""
  1074. END FUNCTION
  1075.  
  1076. SUB UpdateWinG32 (szOrig$) STATIC 
  1077.     '
  1078.     ' Here we check the version ourselves of wing32.dll, since 
  1079.     ' we can't get version checking for Win32 apps from Win16
  1080.     '
  1081.     FileNew$ = MakePath(szOrig$, "wing32.dll")
  1082.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  1083.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  1084.     RemoveFile FileOrig$, cmoForce
  1085.     ELSE
  1086.         RemoveFile FileNew$, cmoForce       ' get rid of new file
  1087.     RenameFilePlease FileOrig$,FileNew$ ' put back old file
  1088.     END IF
  1089. END SUB
  1090.