home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / netutils / inetcon1.arj / COREWSDS.MS_ / COREWSDS.MS
Text File  |  1994-06-06  |  17KB  |  550 lines

  1. '**************************************************************************
  2. '    Core Winsock Development Systems Setup Script
  3. '    Copyright Core Systems, 1994
  4. '    Author: Linh Vuong
  5. '**************************************************************************
  6.  
  7. '$DEFINE DEBUG  ''Define for script development/debugging
  8.  
  9. '$INCLUDE 'setupapi.inc'
  10. '$INCLUDE 'msdetect.inc'
  11.  
  12. '$INCLUDE 'coreins.inc'
  13.  
  14. CONST SW_SHOWNORMAL = 1
  15. DECLARE FUNCTION WinExec LIB "KERNEL.EXE" (cmd$, show%) AS INTEGER
  16.  
  17. ''Dialog ID's
  18. CONST ASKQUIT      = 200
  19. CONST DESTPATH     = 300
  20. CONST EXITFAILURE  = 400
  21. CONST EXITQUIT     = 600
  22. CONST EXITSUCCESS  = 700
  23. CONST EXITSUCCESS1 = 750
  24. CONST OPTIONS      = 800
  25. CONST APPHELP      = 900
  26. CONST CUSTINST     = 6201
  27. CONST TOOBIG       = 6300
  28. CONST BADPATH      = 6400
  29.  
  30. ''Bitmap ID
  31. CONST LOGO         = 1
  32.  
  33. ''File Types
  34. CONST OPTFILES1    = 1
  35. CONST OPTFILES2    = 2
  36. ''CONST OPTFILES3    = 3
  37. ''CONST OPTFILES4    = 4
  38. CONST NUMOPTIONS   = 2
  39.  
  40. GLOBAL OLDCOREDIR$
  41. GLOBAL DEST$        ''Default destination directory.
  42. GLOBAL WINDRIVE$    ''Windows drive letter.
  43. GLOBAL OPT1OPT$     ''Option selection from OptFiles1 option dialog.
  44. GLOBAL OPT2OPT$     ''Option selection from OptFiles2 option dialog.
  45. ''GLOBAL OPT3OPT$     ''Option selection from OptFiles3 option dialog.
  46. ''GLOBAL OPT4OPT$     ''Option selection from OptFiles4 option dialog.
  47.  
  48. ''CustInst list symbol names
  49. GLOBAL OPT1NEEDS$    ''Option list costs per drive
  50. GLOBAL OPT2NEEDS$
  51. ''GLOBAL OPT3NEEDS$
  52. ''GLOBAL OPT4NEEDS$
  53. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  54. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  55.  
  56. ''Dialog list symbol names
  57. GLOBAL CHECKSTATES$
  58. GLOBAL STATUSTEXT$
  59. GLOBAL DRIVETEXT$
  60.  
  61. GLOBAL FrameWindow%
  62.  
  63. COREWSDS$ = "corewsds"
  64. VXDWSA$ = "\vxdwsa.386"
  65. ALLDRIVES$ = "AllLocalHardDrives"
  66.  
  67. DECLARE SUB AddOptFilesToCopyList (ftype%)
  68. DECLARE SUB RecalcOptFiles (ftype%)
  69. DECLARE SUB RecalcPath
  70. DECLARE SUB SetDriveStatus
  71. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  72.  
  73. INIT:
  74.     FrameWindow% = HwndFrame ()
  75.     SetSymbolValue "FrameWindow", STR$ (FrameWindow%)
  76.     ExpandWin(FrameWindow%)
  77.  
  78.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  79.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  80.  
  81.     SetBitmap CUIDLL$, LOGO
  82.     SetTitle "Core Winsock Development System Setup"
  83.  
  84.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  85.     IF szInf$ = "" THEN
  86.         szInf$ = GetSymbolValue("STF_CWDDIR") + COREWSDS$ + ".INF"
  87.     END IF
  88.     ReadInfFile szInf$
  89.  
  90.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  91.     OLDCOREDIR$ = FindFileUsingFileOpen("wsacore.exe")
  92. ''    GetLocalHardDrivesList ALLDRIVES$
  93. ''    n% = GetListLength(ALLDRIVES$)
  94. ''    FOR i% = 1 TO n% STEP 1
  95. ''        d$ = GetListItem(ALLDRIVES$,i%)
  96. ''        IF d$ <> "" THEN
  97. ''            IF IsDriveLocalHard(d$) = 1 THEN
  98. ''                OLDCOREDIR$ = FindFileInTree("wsacore.exe",d$ + ":\")
  99. ''                IF OLDCOREDIR$ <> "" THEN
  100. ''                    GOTO FOUNDOLDCORE
  101. ''                END IF
  102. ''            END IF
  103. ''        END IF
  104. ''    NEXT i%
  105. ''FOUNDOLDCORE:
  106.     IF OLDCOREDIR$ = "" THEN
  107.         DEST$ = WINDRIVE$ + ":\" + COREWSDS$
  108.     ELSE
  109.         DEST$ = MID$(OLDCOREDIR$, 1, LEN(OLDCOREDIR$) - LEN("\wsacore.exe"))
  110.     END IF
  111.  
  112.     ''CustInst list symbols
  113.     CHECKSTATES$ = "CheckItemsState"
  114.     STATUSTEXT$  = "StatusItemsText"
  115.     DRIVETEXT$   = "DriveStatusText"
  116.     FOR i% = 1 TO NUMOPTIONS STEP 1
  117.         AddListItem CHECKSTATES$, "ON"
  118.     NEXT i%
  119.     FOR i% = 1 TO NUMOPTIONS STEP 1
  120.         AddListItem STATUSTEXT$, ""
  121.     NEXT i%
  122.     FOR i% = 1 TO 7 STEP 1
  123.         AddListItem DRIVETEXT$, ""
  124.     NEXT i%
  125.     ReplaceListItem DRIVETEXT$, 7, DEST$
  126.  
  127.     ''Disk cost list symbols
  128.     OPT1NEEDS$  = "Opt1Needs"
  129.     OPT2NEEDS$  = "Opt2Needs"
  130.     ''OPT3NEEDS$  = "Opt3Needs"
  131.     ''OPT4NEEDS$  = "Opt4Needs"
  132.     EXTRACOSTS$ = "ExtraCosts"
  133.     BIGLIST$    = "BigList"
  134.     FOR i% = 1 TO NUMOPTIONS STEP 1
  135.         AddListItem BIGLIST$, ""
  136.     NEXT i%
  137.     FOR i% = 1 TO 26 STEP 1
  138.         AddListItem EXTRACOSTS$, "0"
  139.     NEXT i%
  140.  
  141.     ''File Option Variables
  142.     OPT1OPT$ = "1"
  143.     OPT2OPT$ = "2"
  144.     ''OPT3OPT$ = "3"
  145.     ''OPT4OPT$ = "4"
  146.  
  147.     RecalcPath
  148.     SetDriveStatus
  149.  
  150. '$IFDEF DEBUG
  151.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  152. '$ENDIF ''DEBUG
  153.  
  154. CUSTINST:
  155.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  156.  
  157.     IF sz$ = "CONTINUE" THEN
  158.         ''Install only if it will fit.
  159.         FOR i% = 1 TO NUMOPTIONS STEP 1
  160.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  161.                 GOSUB TOOBIG
  162.                 GOTO CUSTINST
  163.             END IF
  164.         NEXT i%
  165.         UIPop 1
  166.         GOTO INSTALL
  167.     ELSEIF sz$ = "PATH" THEN
  168.         GOTO GETPATH
  169.     ELSEIF sz$ = "CHK1" THEN
  170.         RecalcOptFiles OPTFILES1
  171.         SetDriveStatus
  172.         GOTO CUSTINST
  173.     ELSEIF sz$ = "CHK2" THEN
  174.         RecalcOptFiles OPTFILES2
  175.         SetDriveStatus
  176.         GOTO CUSTINST
  177. ''    ELSEIF sz$ = "CHK3" THEN
  178. ''        RecalcOptFiles OPTFILES3
  179. ''        SetDriveStatus
  180. ''        GOTO CUSTINST
  181. ''    ELSEIF sz$ = "CHK4" THEN
  182. ''        RecalcOptFiles OPTFILES4
  183. ''        SetDriveStatus
  184. ''        GOTO CUSTINST
  185.     ELSEIF sz$ = "BTN1" THEN
  186.         GOTO OPTFILES1
  187.     ELSEIF sz$ = "BTN2" THEN
  188.         GOTO OPTFILES2
  189. ''    ELSEIF sz$ = "BTN3" THEN
  190. ''        GOTO OPTFILES3
  191. ''    ELSEIF sz$ = "BTN4" THEN
  192. ''        GOTO OPTFILES4
  193.     ELSEIF sz$ = "REACTIVATE" THEN
  194.         RecalcPath
  195.         SetDriveStatus
  196.         GOTO CUSTINST
  197.     ELSE
  198.         GOSUB ASKQUIT
  199.         GOTO CUSTINST
  200.     END IF
  201.  
  202. INSTALL:
  203.     ClearCopyList
  204.     AddOptFilesToCopyList OPTFILES1
  205.     AddOptFilesToCopyList OPTFILES2
  206. ''    AddOptFilesToCopyList OPTFILES3
  207. ''    AddOptFilesToCopyList OPTFILES4
  208.     CreateDir DEST$, cmoNone
  209.     CopyFilesInCopyList
  210.  
  211.     IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  212.     i% = ProbeVxd()
  213.     IF i% = 0 THEN
  214.            vxd$ = DEST$ + VXDWSA$
  215.        ini$ = MakePath(GetWindowsDir, "SYSTEM.INI")
  216.        CreateSysIniKeyValue ini$, "386Enh", "Device", vxd$, cmoVital
  217.            ini$ = ""
  218.     END IF
  219.         CreateProgmanGroup "Core Winsock SDK", "", cmoNone
  220.         ShowProgmanGroup  "Core Winsock SDK", 1, cmoNone
  221.         CreateProgmanItem "Core Winsock SDK", "Winsock API", "winhelp.exe "+MakePath(DEST$,"winsock.hlp"), "", cmoOverwrite
  222.         CreateProgmanItem "Core Winsock SDK", "Problem Report", MakePath(DEST$,"problem.wri"), "", cmoOverwrite
  223.         CreateProgmanItem "Core Winsock SDK", "Read Me", MakePath(DEST$,"relnotes.wri"), "", cmoOverwrite
  224.         CreateProgmanItem "Core Winsock SDK", "core.ini", MakePath(DEST$,"core.ini"), "", cmoOverwrite
  225.     END IF
  226.  
  227.     IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
  228.         ShowProgmanGroup  "Core Winsock SDK", 1, cmoNone
  229.         CreateProgmanItem "Core Winsock SDK", "wsacore", MakePath(DEST$,"wsacore.exe"), "", cmoOverwrite
  230.         CreateProgmanItem "Core Winsock SDK", "wsaspy", MakePath(DEST$,"wsaspy.exe"), "", cmoOverwrite
  231.         CreateProgmanItem "Core Winsock SDK", "wsaconf", MakePath(DEST$,"wsaconf.exe"), "", cmoOverwrite
  232.         CreateProgmanItem "Core Winsock SDK", "wping", MakePath(DEST$,"wping.exe"), "", cmoOverwrite
  233.         CreateProgmanItem "Core Winsock SDK", "wfinger", MakePath(DEST$,"wfinger.exe"), "", cmoOverwrite
  234.     END IF
  235.  
  236. QUIT:
  237.     ON ERROR GOTO ERRQUIT
  238.  
  239.     IF ERR = 0 THEN
  240.         dlg% = EXITSUCCESS1
  241.     ELSEIF ERR = STFQUIT THEN
  242.         dlg% = EXITQUIT
  243.     ELSE
  244.         dlg% = EXITFAILURE
  245.     END IF
  246. QUITL1:
  247.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  248.     IF sz$ = "REACTIVATE" THEN
  249.         GOTO QUITL1
  250.     END IF
  251.     IF (dlg% = EXITSUCCESS1) AND (sz$ = "CONTINUE") THEN
  252.         i% = WinExecAndWait(0, "write.exe " + MakePath(DEST$,"relnotes.wri"), SW_SHOWNORMAL)
  253.         ''i% = WinExecAndWait(FrameWindow%, "write.exe " + MakePath(DEST$,"relnotes.wri"), SW_SHOWNORMAL)
  254.         ''i% = WinExec("write.exe " + MakePath(DEST$,"relnotes.wri"), SW_SHOWNORMAL)
  255.     END IF
  256.     i% = DoMsgBox("Would you like to configure Core Winsock now ?", "Core Winsock Setup", MB_YESNO+MB_TASKMODAL+MB_ICONINFORMATION)
  257.     IF (i% = IDYES) THEN
  258.         i% = WinExecAndWait(0, MakePath(DEST$,"wsaconf.exe"), SW_SHOWNORMAL)
  259.         ''i% = WinExecAndWait(FrameWindow%, MakePath(DEST$,"wsaconf.exe"), SW_SHOWNORMAL)
  260.         ''i% = WinExec(MakePath(DEST$,"wsaconf.exe"), SW_SHOWNORMAL)
  261.     END IF
  262.     UIPop 1
  263.  
  264.     END
  265.  
  266. ERRQUIT:
  267.     i% = DoMsgBox("Setup sources were corrupted, contact Core Systems Product Support !", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  268.     END
  269.  
  270. GETPATH:
  271.     SetSymbolValue "EditTextIn", DEST$
  272.     SetSymbolValue "EditFocus", "END"
  273. GETPATHL1:
  274.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  275.  
  276.     IF sz$ = "CONTINUE" THEN
  277.         olddest$ = DEST$
  278.         DEST$ = GetSymbolValue("EditTextOut")
  279.  
  280.         ''Validate new path.
  281.         IF IsDirWritable(DEST$) = 0 THEN
  282.             GOSUB BADPATH
  283.             GOTO GETPATHL1
  284.         END IF
  285.         UIPop 1
  286.  
  287.         ''Truncate display if too long.
  288.         IF LEN(DEST$) > 23 THEN
  289.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  290.         ELSE
  291.             ReplaceListItem DRIVETEXT$, 7, DEST$
  292.         END IF
  293.  
  294.         ''Recalc if path changed.
  295.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  296.             RecalcPath
  297.             SetDriveStatus
  298.         END IF
  299.  
  300.         olddest$ = ""
  301.         GOTO CUSTINST
  302.     ELSEIF sz$ = "REACTIVATE" THEN
  303.         RecalcPath
  304.         SetDriveStatus
  305.         GOTO GETPATHL1
  306.     ELSEIF sz$ = "EXIT" THEN
  307.         GOSUB ASKQUIT
  308.         GOTO GETPATHL1
  309.     ELSE
  310.         UIPop 1
  311.         GOTO CUSTINST
  312.     END IF
  313.  
  314.  
  315. OPTFILES1:
  316.     newopt$ = GetListItem(CHECKSTATES$, OPTFILES1)
  317.     IF newopt$ = "ON" THEN
  318.             RecalcPath
  319.         RecalcOptFiles OPTFILES1
  320.         SetDriveStatus
  321.     END IF
  322.     newopt$ = ""
  323.     GOTO CUSTINST
  324.  
  325. OPTFILES2:
  326.     newopt$ = GetListItem(CHECKSTATES$, OPTFILES2)
  327.     IF newopt$ = "ON" THEN
  328.             RecalcPath
  329.         RecalcOptFiles OPTFILES2
  330.         SetDriveStatus
  331.     END IF
  332.     newopt$ = ""
  333.     GOTO CUSTINST
  334.  
  335. ''OPTFILES3:
  336. ''    newopt$ = GetListItem(CHECKSTATES$, OPTFILES3)
  337. ''    IF newopt$ = "ON" THEN
  338. ''           RecalcPath
  339. ''        RecalcOptFiles OPTFILES3
  340. ''        SetDriveStatus
  341. ''    END IF
  342. ''    newopt$ = ""
  343. ''    GOTO CUSTINST
  344.  
  345. ''OPTFILES4:
  346. ''    newopt$ = GetListItem(CHECKSTATES$, OPTFILES4)
  347. ''    IF newopt$ = "ON" THEN
  348. ''            RecalcPath
  349. ''        RecalcOptFiles OPTFILES4
  350. ''        SetDriveStatus
  351. ''    END IF
  352. ''    newopt$ = ""
  353. ''    GOTO CUSTINST
  354.  
  355. TOOBIG:
  356.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  357.     IF sz$ = "REACTIVATE" THEN
  358.         RecalcPath
  359.         SetDriveStatus
  360.         GOTO TOOBIG
  361.     END IF
  362.     UIPop 1
  363.     RETURN
  364.  
  365. BADPATH:
  366.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  367.     IF sz$ = "REACTIVATE" THEN
  368.         RecalcPath
  369.         SetDriveStatus
  370.         GOTO BADPATH
  371.     END IF
  372.     UIPop 1
  373.     RETURN
  374.  
  375. ASKQUIT:
  376.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  377.  
  378.     IF sz$ = "EXIT" THEN
  379.         UIPopAll
  380.         ERROR STFQUIT
  381.     ELSEIF sz$ = "REACTIVATE" THEN
  382.         GOTO ASKQUIT
  383.     ELSE
  384.         UIPop 1
  385.     END IF
  386.     RETURN
  387.  
  388.  
  389.  
  390. '**
  391. '** Purpose:
  392. '**     Adds the specified option files to the copy list.
  393. '** Arguments:
  394. '**     ftype%  - type of files to add, one of the following:
  395. '**             OPTFILES1, OPTFILES2, OPTFILES3, OPTFILES4
  396. '** Returns:
  397. '**     none.
  398. '*************************************************************************
  399. SUB AddOptFilesToCopyList (ftype%) STATIC
  400.  
  401.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  402.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  403.         IF ftype% = OPTFILES1 THEN
  404.             AddSectionKeyFileToCopyList "Optfiles1", OPT1OPT$, SrcDir$, DEST$
  405.         ELSEIF ftype% = OPTFILES2 THEN
  406.             AddSectionKeyFileToCopyList "Optfiles2", OPT2OPT$, SrcDir$, DEST$
  407. ''        ELSEIF ftype% = OPTFILES3 THEN
  408. ''            AddSectionKeyFileToCopyList "Optfiles3", OPT3OPT$, SrcDir$, DEST$
  409. ''        ELSEIF ftype% = OPTFILES4 THEN
  410. ''            AddSectionKeyFileToCopyList "Optfiles4", OPT4OPT$, SrcDir$, DEST$
  411.         END IF
  412.         SrcDir$ = ""
  413.     END IF
  414. END SUB
  415.  
  416.  
  417. '**
  418. '** Purpose:
  419. '**     Recalculates disk space for the given option files and sets
  420. '**     the status info symbol "StatusItemsText".
  421. '** Arguments:
  422. '**     ftype% - type of files to add, one of the following:
  423. '**             OPTFILES1, OPTFILES2, OPTFILES3, OPTFILES4
  424. '** Returns:
  425. '**     none.
  426. '*************************************************************************
  427. SUB RecalcOptFiles (ftype%) STATIC
  428.     CursorSave% = ShowWaitCursor()
  429.     ClearCopyList
  430.     AddOptFilesToCopyList ftype%
  431.  
  432.     fExtra% = 0
  433.     IF ftype% = OPTFILES1 THEN
  434.         ListSym$ = OPT1NEEDS$
  435.     ELSEIF ftype% = OPTFILES2 THEN
  436.         ListSym$ = OPT2NEEDS$
  437. ''    ELSEIF ftype% = OPTFILES3 THEN
  438. ''        ListSym$ = OPT3NEEDS$
  439. ''    ELSEIF ftype% = OPTFILES4 THEN
  440. ''        ListSym$ = OPT4NEEDS$
  441.     END IF
  442.  
  443.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  444.  
  445.     cost& = 0
  446.     FOR i% = 1 TO 26 STEP 1
  447.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  448.     NEXT i%
  449.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  450.  
  451.     IF StillNeed& > 0 THEN
  452.         ReplaceListItem BIGLIST$, ftype%, "YES"
  453.     ELSE
  454.         ReplaceListItem BIGLIST$, ftype%, ""
  455.     END IF
  456.  
  457.     IF fExtra% THEN
  458.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  459.     END IF
  460.     RestoreCursor CursorSave%
  461.     ListSym$ = ""
  462. END SUB
  463.  
  464.  
  465. '**
  466. '** Purpose:
  467. '**     Recalculates disk space and sets option status info according
  468. '**     to the current destination path.
  469. '** Arguments:
  470. '**     none.
  471. '** Returns:
  472. '**     none.
  473. '*************************************************************************
  474. SUB RecalcPath STATIC
  475.  
  476.     CursorSave% = ShowWaitCursor()
  477.  
  478.     RecalcOptFiles OPTFILES1
  479.     RecalcOptFiles OPTFILES2
  480. ''    RecalcOptFiles OPTFILES3
  481. ''    RecalcOptFiles OPTFILES4
  482.  
  483.     RestoreCursor CursorSave%
  484. END SUB
  485.  
  486.  
  487. '**
  488. '** Purpose:
  489. '**     Sets drive status info according to latest disk space calcs.
  490. '** Arguments:
  491. '**     none.
  492. '** Returns:
  493. '**     none.
  494. '*************************************************************************
  495. SUB SetDriveStatus STATIC
  496.  
  497.     drive$ = MID$(DEST$, 1, 1)
  498.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  499. ''    cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%)) + VAL(GetListItem(OPT4NEEDS$, ndrive%))
  500.     cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  501.     free& = GetFreeSpaceForDrive(drive$)
  502.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  503.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  504.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  505.  
  506.     IF drive$ = WINDRIVE$ THEN
  507.         ReplaceListItem DRIVETEXT$, 4, ""
  508.         ReplaceListItem DRIVETEXT$, 5, ""
  509.         ReplaceListItem DRIVETEXT$, 6, ""
  510.     ELSE
  511.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  512. ''        cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%)) + VAL(GetListItem(OPT4NEEDS$, ndrive%))
  513.         cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  514.         IF cost& = 0 THEN
  515.             ReplaceListItem DRIVETEXT$, 4, ""
  516.             ReplaceListItem DRIVETEXT$, 5, ""
  517.             ReplaceListItem DRIVETEXT$, 6, ""
  518.         ELSE
  519.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  520.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  521.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  522.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  523.         END IF
  524.     END IF
  525. END SUB
  526.  
  527.  
  528. '**
  529. '** Purpose:
  530. '**     Appends a file name to the end of a directory path,
  531. '**     inserting a backslash character as needed.
  532. '** Arguments:
  533. '**     szDir$  - full directory path (with optional ending "\")
  534. '**     szFile$ - filename to append to directory
  535. '** Returns:
  536. '**     Resulting fully qualified path name.
  537. '*************************************************************************
  538. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  539.     IF szDir$ = "" THEN
  540.         MakePath = szFile$
  541.     ELSEIF szFile$ = "" THEN
  542.         MakePath = szDir$
  543.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  544.         MakePath = szDir$ + szFile$
  545.     ELSE
  546.         MakePath = szDir$ + "\" + szFile$
  547.     END IF
  548. END FUNCTION
  549.  
  550.