home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / INTERNET / TCPIP / INETCON2 / COREWSDS.MS_ / COREWSDS.MS
Encoding:
Text File  |  1995-01-04  |  17.5 KB  |  559 lines

  1. '**************************************************************************
  2. '    Core Winsock Internet-Connect 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 Internet-Connect (TM) 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 Internet-Connect", "", cmoNone
  220.         ShowProgmanGroup  "Core Internet-Connect", 1, cmoNone
  221.         CreateProgmanItem "Core Internet-Connect", "Winsock API", "winhelp.exe "+MakePath(DEST$,"winsock.hlp"), "", cmoOverwrite
  222.         CreateProgmanItem "Core Internet-Connect", "Problem Report", MakePath(DEST$,"problem.wri"), "", cmoOverwrite
  223.         CreateProgmanItem "Core Internet-Connect", "Read Me", MakePath(DEST$,"relnotes.wri"), "", cmoOverwrite
  224.         CreateProgmanItem "Core Internet-Connect", "core.ini", MakePath(DEST$,"core.ini"), "", cmoOverwrite
  225.         CreateProgmanItem "Core Internet-Connect", "Order Form", MakePath(DEST$,"order.txt"), "", cmoOverwrite
  226.     END IF
  227.  
  228.     IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
  229.         ShowProgmanGroup  "Core Internet-Connect", 1, cmoNone
  230.         CreateProgmanItem "Core Internet-Connect", "Winsock Monitor", MakePath(DEST$,"wsacore.exe"), "", cmoOverwrite
  231.         CreateProgmanItem "Core Internet-Connect", "Winsock API Tracer", MakePath(DEST$,"wsaspy.exe"), "", cmoOverwrite
  232.         CreateProgmanItem "Core Internet-Connect", "Winsock SLIP/PPP", MakePath(DEST$,"wsaslip.exe"), "", cmoOverwrite
  233.         CreateProgmanItem "Core Internet-Connect", "NetConfig", MakePath(DEST$,"wsaconf.exe"), "", cmoOverwrite
  234.         CreateProgmanItem "Core Internet-Connect", "wping", MakePath(DEST$,"wping.exe"), "", cmoOverwrite
  235.         CreateProgmanItem "Core Internet-Connect", "wfinger", MakePath(DEST$,"wfinger.exe"), "", cmoOverwrite
  236.         CreateProgmanItem "Core Internet-Connect", "Winsock Dialer", MakePath(DEST$,"wsadial.exe"), "", cmoOverwrite
  237.         CreateProgmanItem "Core Internet-Connect", "Terminal Emulator", MakePath(DEST$,"wsatty.exe"), "", cmoOverwrite
  238.         CreateProgmanItem "Core Internet-Connect", "FTP", MakePath(DEST$,"cftp.exe"), "", cmoOverwrite
  239.         CreateProgmanItem "Core Internet-Connect", "PPP Server Admin", MakePath(DEST$,"pppadmin.exe"), "", cmoOverwrite
  240.         CreateProgmanItem "Core Internet-Connect", "DHCP Client", MakePath(DEST$,"wsadhcpc.exe"), "", cmoOverwrite
  241.         CreateProgmanItem "Core Internet-Connect", "Online Order", MakePath(DEST$,"order.exe"), "", cmoOverwrite
  242.     END IF
  243.  
  244. QUIT:
  245.     ON ERROR GOTO ERRQUIT
  246.  
  247.     IF ERR = 0 THEN
  248.         dlg% = EXITSUCCESS1
  249.     ELSEIF ERR = STFQUIT THEN
  250.         dlg% = EXITQUIT
  251.     ELSE
  252.         dlg% = EXITFAILURE
  253.     END IF
  254. QUITL1:
  255.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  256.     IF sz$ = "REACTIVATE" THEN
  257.         GOTO QUITL1
  258.     END IF
  259.     i% = InitCore(MakePath(DEST$,"core.ini"))
  260.     IF (dlg% = EXITSUCCESS1) AND (sz$ = "CONTINUE") THEN
  261.         i% = WinExecAndWait(0, "write.exe " + MakePath(DEST$,"relnotes.wri"), SW_SHOWNORMAL)
  262.         ''i% = WinExecAndWait(FrameWindow%, "write.exe " + MakePath(DEST$,"relnotes.wri"), SW_SHOWNORMAL)
  263.         ''i% = WinExec("write.exe " + MakePath(DEST$,"relnotes.wri"), SW_SHOWNORMAL)
  264.     END IF
  265.     i% = DoMsgBox("Would you like to configure Core Internet-Connect now ?", "Core Internet-Connect Setup", MB_YESNO+MB_TASKMODAL+MB_ICONINFORMATION)
  266.     IF (i% = IDYES) THEN
  267.         i% = WinExecAndWait(0, MakePath(DEST$,"wsaconf.exe"), SW_SHOWNORMAL)
  268.         ''i% = WinExecAndWait(FrameWindow%, MakePath(DEST$,"wsaconf.exe"), SW_SHOWNORMAL)
  269.         ''i% = WinExec(MakePath(DEST$,"wsaconf.exe"), SW_SHOWNORMAL)
  270.     END IF
  271.     UIPop 1
  272.  
  273.     END
  274.  
  275. ERRQUIT:
  276.     i% = DoMsgBox("Setup sources were corrupted, contact Core Systems Product Support !", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  277.     END
  278.  
  279. GETPATH:
  280.     SetSymbolValue "EditTextIn", DEST$
  281.     SetSymbolValue "EditFocus", "END"
  282. GETPATHL1:
  283.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  284.  
  285.     IF sz$ = "CONTINUE" THEN
  286.         olddest$ = DEST$
  287.         DEST$ = GetSymbolValue("EditTextOut")
  288.  
  289.         ''Validate new path.
  290.         IF IsDirWritable(DEST$) = 0 THEN
  291.             GOSUB BADPATH
  292.             GOTO GETPATHL1
  293.         END IF
  294.         UIPop 1
  295.  
  296.         ''Truncate display if too long.
  297.         IF LEN(DEST$) > 23 THEN
  298.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  299.         ELSE
  300.             ReplaceListItem DRIVETEXT$, 7, DEST$
  301.         END IF
  302.  
  303.         ''Recalc if path changed.
  304.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  305.             RecalcPath
  306.             SetDriveStatus
  307.         END IF
  308.  
  309.         olddest$ = ""
  310.         GOTO CUSTINST
  311.     ELSEIF sz$ = "REACTIVATE" THEN
  312.         RecalcPath
  313.         SetDriveStatus
  314.         GOTO GETPATHL1
  315.     ELSEIF sz$ = "EXIT" THEN
  316.         GOSUB ASKQUIT
  317.         GOTO GETPATHL1
  318.     ELSE
  319.         UIPop 1
  320.         GOTO CUSTINST
  321.     END IF
  322.  
  323.  
  324. OPTFILES1:
  325.     newopt$ = GetListItem(CHECKSTATES$, OPTFILES1)
  326.     IF newopt$ = "ON" THEN
  327.             RecalcPath
  328.         RecalcOptFiles OPTFILES1
  329.         SetDriveStatus
  330.     END IF
  331.     newopt$ = ""
  332.     GOTO CUSTINST
  333.  
  334. OPTFILES2:
  335.     newopt$ = GetListItem(CHECKSTATES$, OPTFILES2)
  336.     IF newopt$ = "ON" THEN
  337.             RecalcPath
  338.         RecalcOptFiles OPTFILES2
  339.         SetDriveStatus
  340.     END IF
  341.     newopt$ = ""
  342.     GOTO CUSTINST
  343.  
  344. ''OPTFILES3:
  345. ''    newopt$ = GetListItem(CHECKSTATES$, OPTFILES3)
  346. ''    IF newopt$ = "ON" THEN
  347. ''           RecalcPath
  348. ''        RecalcOptFiles OPTFILES3
  349. ''        SetDriveStatus
  350. ''    END IF
  351. ''    newopt$ = ""
  352. ''    GOTO CUSTINST
  353.  
  354. ''OPTFILES4:
  355. ''    newopt$ = GetListItem(CHECKSTATES$, OPTFILES4)
  356. ''    IF newopt$ = "ON" THEN
  357. ''            RecalcPath
  358. ''        RecalcOptFiles OPTFILES4
  359. ''        SetDriveStatus
  360. ''    END IF
  361. ''    newopt$ = ""
  362. ''    GOTO CUSTINST
  363.  
  364. TOOBIG:
  365.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  366.     IF sz$ = "REACTIVATE" THEN
  367.         RecalcPath
  368.         SetDriveStatus
  369.         GOTO TOOBIG
  370.     END IF
  371.     UIPop 1
  372.     RETURN
  373.  
  374. BADPATH:
  375.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  376.     IF sz$ = "REACTIVATE" THEN
  377.         RecalcPath
  378.         SetDriveStatus
  379.         GOTO BADPATH
  380.     END IF
  381.     UIPop 1
  382.     RETURN
  383.  
  384. ASKQUIT:
  385.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  386.  
  387.     IF sz$ = "EXIT" THEN
  388.         UIPopAll
  389.         ERROR STFQUIT
  390.     ELSEIF sz$ = "REACTIVATE" THEN
  391.         GOTO ASKQUIT
  392.     ELSE
  393.         UIPop 1
  394.     END IF
  395.     RETURN
  396.  
  397.  
  398.  
  399. '**
  400. '** Purpose:
  401. '**     Adds the specified option files to the copy list.
  402. '** Arguments:
  403. '**     ftype%  - type of files to add, one of the following:
  404. '**             OPTFILES1, OPTFILES2, OPTFILES3, OPTFILES4
  405. '** Returns:
  406. '**     none.
  407. '*************************************************************************
  408. SUB AddOptFilesToCopyList (ftype%) STATIC
  409.  
  410.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  411.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  412.         IF ftype% = OPTFILES1 THEN
  413.             AddSectionKeyFileToCopyList "Optfiles1", OPT1OPT$, SrcDir$, DEST$
  414.         ELSEIF ftype% = OPTFILES2 THEN
  415.             AddSectionKeyFileToCopyList "Optfiles2", OPT2OPT$, SrcDir$, DEST$
  416. ''        ELSEIF ftype% = OPTFILES3 THEN
  417. ''            AddSectionKeyFileToCopyList "Optfiles3", OPT3OPT$, SrcDir$, DEST$
  418. ''        ELSEIF ftype% = OPTFILES4 THEN
  419. ''            AddSectionKeyFileToCopyList "Optfiles4", OPT4OPT$, SrcDir$, DEST$
  420.         END IF
  421.         SrcDir$ = ""
  422.     END IF
  423. END SUB
  424.  
  425.  
  426. '**
  427. '** Purpose:
  428. '**     Recalculates disk space for the given option files and sets
  429. '**     the status info symbol "StatusItemsText".
  430. '** Arguments:
  431. '**     ftype% - type of files to add, one of the following:
  432. '**             OPTFILES1, OPTFILES2, OPTFILES3, OPTFILES4
  433. '** Returns:
  434. '**     none.
  435. '*************************************************************************
  436. SUB RecalcOptFiles (ftype%) STATIC
  437.     CursorSave% = ShowWaitCursor()
  438.     ClearCopyList
  439.     AddOptFilesToCopyList ftype%
  440.  
  441.     fExtra% = 0
  442.     IF ftype% = OPTFILES1 THEN
  443.         ListSym$ = OPT1NEEDS$
  444.     ELSEIF ftype% = OPTFILES2 THEN
  445.         ListSym$ = OPT2NEEDS$
  446. ''    ELSEIF ftype% = OPTFILES3 THEN
  447. ''        ListSym$ = OPT3NEEDS$
  448. ''    ELSEIF ftype% = OPTFILES4 THEN
  449. ''        ListSym$ = OPT4NEEDS$
  450.     END IF
  451.  
  452.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  453.  
  454.     cost& = 0
  455.     FOR i% = 1 TO 26 STEP 1
  456.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  457.     NEXT i%
  458.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  459.  
  460.     IF StillNeed& > 0 THEN
  461.         ReplaceListItem BIGLIST$, ftype%, "YES"
  462.     ELSE
  463.         ReplaceListItem BIGLIST$, ftype%, ""
  464.     END IF
  465.  
  466.     IF fExtra% THEN
  467.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  468.     END IF
  469.     RestoreCursor CursorSave%
  470.     ListSym$ = ""
  471. END SUB
  472.  
  473.  
  474. '**
  475. '** Purpose:
  476. '**     Recalculates disk space and sets option status info according
  477. '**     to the current destination path.
  478. '** Arguments:
  479. '**     none.
  480. '** Returns:
  481. '**     none.
  482. '*************************************************************************
  483. SUB RecalcPath STATIC
  484.  
  485.     CursorSave% = ShowWaitCursor()
  486.  
  487.     RecalcOptFiles OPTFILES1
  488.     RecalcOptFiles OPTFILES2
  489. ''    RecalcOptFiles OPTFILES3
  490. ''    RecalcOptFiles OPTFILES4
  491.  
  492.     RestoreCursor CursorSave%
  493. END SUB
  494.  
  495.  
  496. '**
  497. '** Purpose:
  498. '**     Sets drive status info according to latest disk space calcs.
  499. '** Arguments:
  500. '**     none.
  501. '** Returns:
  502. '**     none.
  503. '*************************************************************************
  504. SUB SetDriveStatus STATIC
  505.  
  506.     drive$ = MID$(DEST$, 1, 1)
  507.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  508. ''    cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%)) + VAL(GetListItem(OPT4NEEDS$, ndrive%))
  509.     cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  510.     free& = GetFreeSpaceForDrive(drive$)
  511.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  512.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  513.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  514.  
  515.     IF drive$ = WINDRIVE$ THEN
  516.         ReplaceListItem DRIVETEXT$, 4, ""
  517.         ReplaceListItem DRIVETEXT$, 5, ""
  518.         ReplaceListItem DRIVETEXT$, 6, ""
  519.     ELSE
  520.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  521. ''        cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%)) + VAL(GetListItem(OPT4NEEDS$, ndrive%))
  522.         cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  523.         IF cost& = 0 THEN
  524.             ReplaceListItem DRIVETEXT$, 4, ""
  525.             ReplaceListItem DRIVETEXT$, 5, ""
  526.             ReplaceListItem DRIVETEXT$, 6, ""
  527.         ELSE
  528.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  529.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  530.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  531.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  532.         END IF
  533.     END IF
  534. END SUB
  535.  
  536.  
  537. '**
  538. '** Purpose:
  539. '**     Appends a file name to the end of a directory path,
  540. '**     inserting a backslash character as needed.
  541. '** Arguments:
  542. '**     szDir$  - full directory path (with optional ending "\")
  543. '**     szFile$ - filename to append to directory
  544. '** Returns:
  545. '**     Resulting fully qualified path name.
  546. '*************************************************************************
  547. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  548.     IF szDir$ = "" THEN
  549.         MakePath = szFile$
  550.     ELSEIF szFile$ = "" THEN
  551.         MakePath = szDir$
  552.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  553.         MakePath = szDir$ + szFile$
  554.     ELSE
  555.         MakePath = szDir$ + "\" + szFile$
  556.     END IF
  557. END FUNCTION
  558.  
  559.