home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today - The Disc! 2 / CD-ROM_Today_-_The_Disc_2_June-July_1994.iso / wfsound / wfsound.ms_ / wfsound.bin
Text File  |  1993-11-02  |  17KB  |  679 lines

  1. '**************************************************************************
  2. '*                     Wired for Sound Install Script
  3. '*     version 1.1   by Aaron Wallace  (c) 1993 Aristosoft, Inc
  4. '**************************************************************************
  5.  
  6. '' Define DEBUG for script debugging
  7.  
  8. '$DEFINE DEBUG
  9.  
  10. '$INCLUDE 'setupapi.inc'
  11. '$INCLUDE 'msdetect.inc'
  12.  
  13. ''Dialog ID's
  14. CONST WELCOME      = 100
  15. CONST ASKQUIT      = 200
  16. CONST DESTPATH     = 300
  17. CONST EXITFAILURE  = 400
  18. CONST EXITQUIT     = 600
  19. CONST EXITSUCCESS  = 700
  20. CONST WHICHINST    = 800
  21. CONST APPHELP      = 900
  22. CONST WHICHINSTHLP = 910
  23. CONST SETOWNER       = 1000
  24. CONST TESTSOUND    = 1100
  25. CONST INSTALLDRV   = 1200
  26. CONST SOUNDPLAYED  = 1300
  27. CONST WAITDLG       = 1400
  28. CONST EXITREBOOT   = 1500
  29. CONST BBD1       = 5000
  30. CONST BBD2       = 5010
  31. CONST BBD3       = 5020
  32. CONST BBD4       = 5030
  33. CONST BBD5       = 5040
  34. CONST BBD6       = 5050
  35. CONST SOUNDSDLG    = 5200
  36. CONST TAPPSDLG     = 5300
  37. CONST VOICESDLG    = 5400
  38. CONST CUSTINST     = 6200
  39. CONST TOOBIG       = 6300
  40. CONST BADPATH      = 6400
  41.  
  42. '' For message boxes
  43. CONST MB_YESNO=4
  44. CONST IDNO=7
  45. CONST IDYES=6
  46.  
  47. ''Bitmap ID
  48. CONST LOGO         = 1
  49.  
  50. ''File Types
  51. CONST BASEFILES     = 1
  52. CONST TAPPFILES     = 2
  53. CONST SOUNDFILES    = 3
  54. CONST VOICEFILES    = 4
  55. CONST MAX_TYPES     = 4
  56.  
  57. ''Install directories, etc.
  58. GLOBAL DEST$        ''Default destination directory.
  59. GLOBAL WINDRIVE$    ''Windows drive letter.
  60. GLOBAL CUIDLL$        ''CUI DLL
  61. GLOBAL WINDIR$        ''Windows directory
  62. GLOBAL SYSDIR$        ''System directory
  63. GLOBAL WININI$        ''"win.ini"
  64. GLOBAL SYSINI$        ''GetWindowsDir() + "system.ini"
  65.  
  66. '' User info
  67. GLOBAL OWNER$        '' Product registered owner
  68. GLOBAL WORKPLACE$   '' Company or such
  69.  
  70. ''Install item lists
  71. GLOBAL BASE$        ''List of base files
  72. GLOBAL TAPPS$       ''List of all talking apps
  73. GLOBAL SOUNDS$      ''List of all sounds.
  74. GLOBAL VOICES$      ''List of available voices
  75.  
  76. GLOBAL BASEINST$    ''List of base files to install
  77. GLOBAL TAPPSINST$   ''List of Talking Apps to install
  78. GLOBAL SOUNDSINST$  ''List of sounds to install
  79. GLOBAL VOICESINST$  ''List of voices to install
  80.  
  81. ''Custom Install list symbol names
  82. GLOBAL BASENEEDS$   ''Option list costs per drive
  83. GLOBAL TAPPNEEDS$
  84. GLOBAL SOUNDNEEDS$
  85. GLOBAL VOICENEEDS$
  86. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  87.  
  88. ''Custom Install dialog list symbol names
  89. GLOBAL CHECKSTATES$ ''List of check box values
  90. GLOBAL STATUSTEXT$  ''List of values to initialize status items
  91. GLOBAL DRIVETEXT$   ''Drive space info, etc.
  92.  
  93. '' Install DSOUND
  94. GLOBAL INSTDSOUND%
  95.  
  96. '' Customize product
  97. GLOBAL CUSTOMIZE%
  98.  
  99. '' Test sound hardware
  100. GLOBAL DOTEST%
  101.  
  102. GLOBAL WFSFOUND%
  103. GLOBAL CUSTINSTALL%
  104.  
  105. '' Which type of install to perform, by default
  106. GLOBAL DEFINSTOPT$
  107.  
  108. ''Progman titles
  109. GLOBAL WFSAPP$        ''Name of WFS app
  110.  
  111. ''Win.ini [Aristosoft] install code
  112. GLOBAL INSTDIR$
  113.  
  114. ''Space requirements
  115. GLOBAL FITS%        '' > 0 if everything fits
  116.  
  117. DECLARE SUB RecalcOptFiles (ftype%)
  118. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  119. DECLARE FUNCTION GetWindowsVersionCorrectly& ()
  120. DECLARE FUNCTION MakeVer& (x as integer, y as integer)
  121. DECLARE FUNCTION StringInList (s$, y$) AS INTEGER
  122.  
  123. DECLARE FUNCTION sndPlaySound LIB "MMSYSTEM.DLL" (f$, fl%) AS INTEGER
  124. DECLARE FUNCTION GetModuleHandle LIB "KERNEL" (f$) AS INTEGER
  125.  
  126. DECLARE SUB Ctl3dRegister LIB "WFSUI.DLL" (f%)
  127. DECLARE SUB Ctl3dAutoSubclass LIB "WFSUI.DLL" (f%)
  128. DECLARE SUB Ctl3dUnregister LIB "WFSUI.DLL" (f%)
  129.  
  130. DECLARE SUB RemoveSectionFiles (dest$, sect$)
  131. DECLARE SUB RemDirectory (d$)
  132. DECLARE FUNCTION HasSoundDriver() AS INTEGER
  133. DECLARE SUB SendProgmanCommand LIB "CUI.DLL" (s$)
  134.  
  135. '' These are defined in wfs.inc (product-specific)
  136. DECLARE SUB SetProductTitles
  137. DECLARE FUNCTION InfFile() AS STRING
  138. DECLARE FUNCTION MakeInstDir(D$) AS STRING
  139. DECLARE SUB AddInfSectionNames (BASE$, TAPPS$, SOUNDS$, VOICES$, BASEINST$, TAPPSINST$, SOUNDSINST$, VOICESINST$)
  140. DECLARE SUB RecalcPath
  141. DECLARE SUB AddOptFilesToCopyList (ftype%)
  142. DECLARE SUB SetDriveStatus
  143. DECLARE SUB AddOptFiles
  144. DECLARE SUB ConfigureApps
  145. DECLARE SUB AddBillboards
  146. DECLARE SUB DoUninstall
  147.  
  148.  
  149. '' This is where it all begins!
  150.  
  151. INIT:
  152.  
  153.     CUIDLL$ = "cui.dll"
  154.     DEFINSTOPT$ = "1"
  155.     INSTDSOUND% = 0
  156.     CUSTOMIZE% = -1
  157.     DOTEST% = -1
  158.  
  159.     SetProductTitles
  160.  
  161.     HELPPROC$ = "FHelpDlgProc"        ''Help dialog procedure
  162.  
  163.     SetBitmap CUIDLL$, LOGO
  164.  
  165.  
  166. '' We don't do Windows 3.0...
  167.  
  168.     If GetWindowsVersionCorrectly() < MakeVer(3, 10) Then
  169.     i% = DoMsgBox("This product requires Windows version 3.10 or greater", WFSAPP$, MB_OK)
  170.     GOTO DONEFINIFIN
  171.     End If
  172.  
  173. '' We don't want these DLLs to be loaded quite yet...
  174. LookAround:
  175.     IF GetModuleHandle("SNDAPI") OR GetModuleHandle("WFSABOUT") THEN
  176.     i% = DoMsgBox("Please quit all other Aristosoft products before continuing with Setup.", WFSAPP$, MB_RETRYCANCEL)
  177.     IF i% = IDRETRY THEN
  178.         GOTO LookAround
  179.     ELSEIF i% = IDCANCEL THEN
  180.         GOTO DONEFINIFIN
  181.     END IF
  182.     END IF
  183.  
  184.     HCUI% = GetModuleHandle("CUI")
  185.     Ctl3dRegister(HCUI%)
  186.     Ctl3dAutoSubclass(HCUI%)
  187.  
  188. ''Find location of INF file and create a default dest. dir
  189.  
  190.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  191.     IF szInf$ = "" THEN
  192.     szInf$ = GetSymbolValue("STF_CWDDIR") + InfFile()
  193.     END IF
  194.  
  195.     '' Load the INF file
  196.     ReadInfFile szInf$
  197.  
  198.     '' Construct default strings
  199.     WINDIR$ = GetWindowsDir()
  200.     SYSDIR$ = GetWindowsSysDir()
  201.     WININI$ = "win.ini"
  202.     SYSINI$ = MakePath(WINDIR$, "system.ini")
  203.  
  204.     '' Construct the default install path
  205.     WINDRIVE$ = MID$(WINDIR$, 1, 1)
  206.     DEST$ = MakeInstDir(WINDRIVE$)
  207.  
  208.     '' Setup install symbols
  209.     BASE$ = "Base Files"
  210.     TAPPS$ = "Talking Apps"
  211.     SOUNDS$ = "Sounds"
  212.     VOICES$ = "Voices"
  213.     BASEINST$ = "Base Files Inst"
  214.     TAPPSINST$ = "Talking Apps Inst"
  215.     SOUNDSINST$ = "Sounds Inst"
  216.     VOICESINST$ = "Voices Inst"
  217.  
  218.     SetSymbolValue BASE$, ""
  219.     SetSymbolValue TAPPS$, ""
  220.     SetSymbolValue SOUNDS$, ""
  221.     SetSymbolValue VOICES$, ""
  222.  
  223.     ''Set up symbols for the initial install dialog
  224.     RADIODEFAULT$ = "Radio Default"
  225.  
  226.     ''Set up symbols for the custom install dialog
  227.     CHECKSTATES$ = "CheckItemsState"
  228.     STATUSTEXT$  = "StatusItemsText"
  229.     DRIVETEXT$   = "DriveStatusText"
  230.     FOR i% = 1 TO 4 STEP 1
  231.     AddListItem CHECKSTATES$, "ON"
  232.     NEXT i%
  233.     FOR i% = 1 TO 4 STEP 1
  234.     AddListItem STATUSTEXT$, ""
  235.     NEXT i%
  236.     FOR i% = 1 TO 7 STEP 1
  237.     AddListItem DRIVETEXT$, ""
  238.     NEXT i%
  239.     ReplaceListItem DRIVETEXT$, 7, DEST$
  240.  
  241.     ''Disk cost list symbols
  242.     BASENEEDS$   = "BaseNeeds"
  243.     TAPPNEEDS$   = "TAppNeeds"
  244.     SOUNDNEEDS$  = "SoundNeeds"
  245.     VOICENEEDS$  = "VoiceNeeds"
  246.     EXTRACOSTS$  = "ExtraCosts"
  247.     FOR i% = 1 TO 26 STEP 1
  248.     AddListItem EXTRACOSTS$, "0"
  249.     NEXT i%
  250.  
  251.     ''Configure lists of installable files
  252.     AddInfSectionNames BASE$, TAPPS$, SOUNDS$, VOICES$, BASEINST$, TAPPSINST$, SOUNDSINST$, VOICESINST$
  253.  
  254. '$IFDEF DEBUG
  255.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  256. '$ENDIF ''DEBUG
  257.  
  258.  
  259. '' Display Welcome dialog
  260. WELCOME:
  261.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  262.     
  263.     IF sz$ = "EXIT" THEN
  264.     GOSUB ASKQUIT
  265.     GOTO WELCOME
  266.     ELSEIF sz$ = "CONTINUE" THEN
  267.     UIPop 1
  268.     GOTO WHICHINST
  269.     END IF
  270.     GOTO WELCOME
  271.  
  272.  
  273. '' See if users want an easy install, custom install, or no install...
  274. WHICHINST:
  275.     SetSymbolValue "RadioDefault", DEFINSTOPT$
  276.     sz$ = UIStartDlg(CUIDLL$, WHICHINST, "FRadioDlgProc", WHICHINSTHLP, HELPPROC$)
  277.     
  278.     ''sz$ is the button the user pressed; RADIODEFAULT$ is the option selected
  279.  
  280.     IF sz$ = "EXIT" THEN
  281.     GOSUB ASKQUIT
  282.     GOTO WHICHINST
  283.     ELSEIF sz$ = "CONTINUE" THEN
  284.     sz$ = GetSymbolValue("ButtonChecked")
  285.     IF sz$ = "1" THEN
  286.         UIPop 1
  287.         CUSTINSTALL% = 0
  288.         GOTO CUSTOMIZE
  289.     ELSEIF sz$ = "3" THEN
  290.         DoUninstall
  291.         GOTO WHICHINST
  292.     END IF
  293.     END IF
  294.     GOTO WHICHINST
  295.  
  296.  
  297. '' Customize the copy of the product
  298. CUSTOMIZE:
  299.     IF NOT CUSTOMIZE% THEN
  300.     GOTO SOUNDTEST
  301.     END IF
  302.  
  303.     sz$ = UIStartDlg(CUIDLL$, SETOWNER, "FNameOrgDlgProc", WHICHINSTHLP, HELPPROC$)
  304.  
  305.     IF sz$ = "EXIT" THEN
  306.     GOSUB ASKQUIT
  307.     GOTO CUSTOMIZE
  308.     ELSEIF sz$ = "CONTINUE" THEN
  309.     OWNER$ = GetSymbolValue("NameOut")
  310.     WORKPLACE$ = GetSymbolValue("OrgOut")
  311.     UIPop 1
  312.     GOTO SOUNDTEST
  313.     ELSEIF sz$ = "BACK" THEN
  314.     UIPop 1
  315.     GOTO WHICHINST
  316.     END IF
  317.     GOTO CUSTOMIZE
  318.  
  319.  
  320. '' Test the sound system
  321. SOUNDTEST:
  322.     IF NOT DOTEST% THEN
  323.     GOTO DOINST
  324.     END IF
  325.  
  326.     sz$ = UIStartDlg(CUIDLL$, TESTSOUND, "FInfoDlgProc", WHICHINSTHLP, HELPPROC$)
  327.  
  328.     IF sz$ = "EXIT" THEN
  329.     GOSUB ASKQUIT
  330.     GOTO SOUNDTEST
  331.     ELSEIF sz$ = "CONTINUE" THEN
  332.     UIPop 1
  333.     IF HasSoundDriver() THEN
  334.         GOTO DOINST
  335.     ELSE
  336.         GOTO INSTDSOUND
  337.     END IF
  338.     ELSEIF sz$ = "BACK" THEN
  339.     UIPop 1
  340.     GOTO CUSTOMIZE
  341.     ELSEIF sz$ = "TEST" THEN
  342.     w$ = "TEST.WAV"
  343.     res% = sndPlaySound(w$, 2)
  344.     UIPop 1
  345.     GOTO DIDPLAY
  346.     END IF
  347.     GOTO SOUNDTEST
  348.  
  349.  
  350. '' Did the sound play?
  351. DIDPLAY:
  352.     sz$ = UIStartDlg(CUIDLL$, SOUNDPLAYED, "FInfoDlgProc", WHICHINSTHLP, HELPPROC$)
  353.  
  354.     IF sz$ = "EXIT" THEN
  355.     GOSUB ASKQUIT
  356.     GOTO DIDPLAY
  357.     ELSEIF sz$ = "YES" THEN
  358.     UIPop 1
  359.     GOTO DOINST
  360.     ELSEIF sz$ = "NO" THEN
  361.     UIPop 1
  362.     GOTO INSTDSOUND
  363.     ELSEIF sz$ = "BACK" THEN
  364.     UIPop 1
  365.     GOTO SOUNDTEST
  366.     END IF
  367.     GOTO DIDPLAY
  368.  
  369.  
  370. '' Install DSOUND
  371. INSTDSOUND:
  372.     sz$ = UIStartDlg(CUIDLL$, INSTALLDRV, "FInfoDlgProc", WHICHINSTHLP, HELPPROC$)
  373.  
  374.     IF sz$ = "EXIT" THEN
  375.     GOSUB ASKQUIT
  376.     GOTO INSTDSOUND
  377.     ELSEIF sz$ = "INSTALL" THEN
  378.     UIPop 1
  379.     INSTDSOUND% = -1
  380.     GOTO DOINST
  381.     ELSEIF sz$ = "CONTINUE" THEN
  382.     UIPop 1
  383.     GOTO DOINST
  384.     ELSEIF sz$ = "BACK" THEN
  385.     UIPop 1
  386.     GOTO DIDPLAY
  387.     END IF
  388.     GOTO INSTDSOUND
  389.  
  390.  
  391. '' Do the appropriate type of install
  392. DOINST:
  393.  
  394. ''Perform a default installation (of all files and options)
  395. DEFINST:
  396.     RecalcPath
  397.     SetDriveStatus
  398.  
  399. GETDEFINSTPATH:
  400.     GOSUB GETPATH
  401.  
  402.     IF sz$ = "CONTINUE" THEN
  403.     ''Install only if it will fit.
  404.     IF FITS% > 0 THEN
  405.         GOSUB TOOBIG
  406.         GOTO GETDEFINSTPATH
  407.     END IF
  408.     UIPop 1
  409.     GOTO INSTALL
  410.     ELSEIF sz$ = "BACK" THEN
  411.     GOTO WHICHINST
  412.     END IF
  413.     GOTO GETDEFINSTPATH
  414.  
  415.  
  416. INSTALL:
  417.     SetRestartDir DEST$
  418.     ClearCopyList
  419.  
  420.     AddOptFiles
  421.  
  422.     AddBillboards
  423.  
  424.     CreateDir DEST$, cmoNone
  425.  
  426.     UIPopAll
  427.  
  428.     ''Do the copyn'
  429.     SetCopyGaugePosition 10, 135
  430.     CopyFilesInCopyList
  431.  
  432.     ''Back up SYSTEM.INI and WIN.INI
  433.     CopyFile MakePath(WINDIR$, WININI$), MakePath(WINDIR$, "WIN.BAK"), cmoOverwrite, 0
  434.     CopyFile SYSINI$, MakePath(WINDIR$, "SYSTEM.BAK"), cmoOverwrite, 0
  435.  
  436.     '' Configure the installed applications
  437.     ConfigureApps
  438.  
  439.     ''See if we need to restart Windows to finish installing system files which may be in use
  440.     IF RestartListEmpty() = 0 THEN
  441.     i% = DoMsgBox("Certain system files that Setup needs to install are currently in use." + "  Please close all other applications and press OK.  Setup will exit Windows, install these files, and restart Windows.", WFSAPP$ + " Setup", MB_OK)
  442.     i% = ExitExecRestart()
  443.     END IF
  444.  
  445. QUIT:
  446.     ON ERROR GOTO ERRQUIT
  447.  
  448.     IF ERR = 0 THEN
  449.     dlg% = EXITREBOOT
  450.     ELSEIF ERR = STFQUIT THEN
  451.     dlg% = EXITQUIT
  452.     ELSE
  453.  
  454. '$IFNDEF DEBUG
  455.     RESUME NEXT
  456. '$ELSE
  457.     dlg% = EXITFAILURE
  458. '$ENDIF
  459.  
  460.     END IF
  461. QUITL1:
  462.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  463.     IF sz$ = "REACTIVATE" THEN
  464.     GOTO QUITL1
  465.     END IF
  466.     UIPop 1
  467.  
  468. DONEFINIFIN:
  469.     Ctl3dUnregister(HCUI%)
  470.     END
  471.  
  472. ERRQUIT:
  473.     i% = DoMsgBox("Setup sources were corrupted, call Aristosoft at (510) 426-5355!", "Setup Error", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  474.     Ctl3dUnregister(HCUI%)
  475.     END
  476.  
  477.  
  478.  
  479. GETPATH:
  480.     SetSymbolValue "EditTextIn", DEST$
  481.     SetSymbolValue "EditFocus", "END"
  482. GETPATHL1:
  483.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  484.  
  485.     IF sz$ = "CONTINUE" THEN
  486.     olddest$ = DEST$
  487.     DEST$ = GetSymbolValue("EditTextOut")
  488.  
  489.     ''Validate new path.
  490.     IF IsDirWritable(DEST$) = 0 THEN
  491.         GOSUB BADPATH
  492.         GOTO GETPATHL1
  493.     END IF
  494.     UIPop 1
  495.  
  496.     ''Truncate display if too long.
  497.     IF LEN(DEST$) > 23 THEN
  498.         ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  499.     ELSE
  500.         ReplaceListItem DRIVETEXT$, 7, DEST$
  501.     END IF
  502.  
  503.     ''Recalc if path changed.
  504.     ''IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  505.         RecalcPath
  506.         SetDriveStatus
  507.     ''END IF
  508.  
  509.     olddest$ = ""
  510.     RETURN
  511.     ELSEIF sz$ = "EXIT" THEN
  512.     GOSUB ASKQUIT
  513.     GOTO GETPATHL1
  514.     ELSEIF sz$ = "BACK" THEN
  515.     UIPop 1
  516.     RETURN
  517.     END IF
  518.     GOTO GETPATHL1
  519.  
  520.  
  521. TOOBIG:
  522.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  523.     UIPop 1
  524.     RETURN
  525.  
  526.  
  527.  
  528. BADPATH:
  529.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  530.     UIPop 1
  531.     RETURN
  532.  
  533.  
  534. ASKQUIT:
  535.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  536.  
  537.     IF sz$ = "EXIT" THEN
  538.     UIPopAll
  539.     ERROR STFQUIT
  540.     ELSEIF sz$ = "REACTIVATE" THEN
  541.     GOTO ASKQUIT
  542.     ELSE
  543.     UIPop 1
  544.     END IF
  545.     RETURN
  546.  
  547.  
  548. ''Recalculate space based on install options...
  549. SUB RecalcOptFiles (ftype%) STATIC
  550.  
  551.     CursorSave% = ShowWaitCursor()
  552.  
  553.     sz$ = UIStartDlg(CUIDLL$, WAITDLG, "FModelessDlgProc", APPHELP, HELPPROC$)
  554.  
  555.     ClearCopyList
  556.  
  557.     AddOptFilesToCopyList ftype%
  558.  
  559.     fExtra% = 0
  560.     IF ftype% = BASEFILES THEN
  561.     ListSym$ = BASENEEDS$
  562.     IF GetListItem(CHECKSTATES$, BASEFILES) = "ON" THEN
  563.         ''Add extra cost to Windows drive for ini/progman, etc.
  564.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  565.         ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  566.         fExtra% = 1
  567.     END IF
  568.     ELSEIF ftype% = TAPPFILES THEN
  569.     ListSym$ = TAPPNEEDS$
  570.     ELSEIF ftype% = SOUNDFILES THEN
  571.     ListSym$ = SOUNDNEEDS$
  572.     ELSEIF ftype% = VOICEFILES THEN
  573.     ListSym$ = VOICENEEDS$
  574.     END IF
  575.  
  576.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  577.  
  578.     cost& = 0
  579.     FOR i% = 1 TO 26 STEP 1
  580.     cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  581.     NEXT i%
  582.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  583.  
  584.     IF fExtra% THEN
  585.     ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  586.     END IF
  587.  
  588.     UIPop 1
  589.  
  590.     RestoreCursor CursorSave%
  591.  
  592.     ListSym$ = ""
  593. END SUB
  594.  
  595.  
  596. ''Make path from dir and szFile; add \  as needed
  597. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  598.     IF szDir$ = "" THEN
  599.     MakePath = szFile$
  600.     ELSEIF szFile$ = "" THEN
  601.     MakePath = szDir$
  602.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  603.     MakePath = szDir$ + szFile$
  604.     ELSE
  605.     MakePath = szDir$ + "\" + szFile$
  606.     END IF
  607. END FUNCTION
  608.  
  609.  
  610. '' Return true if the given string is in the symbol's list
  611. FUNCTION StringInList (s$, y$) STATIC AS INTEGER
  612.     l% = GetListLength(y$)
  613.     FOR i% = 1 TO l
  614.     IF s$ = GetListItem(y$, i%) THEN
  615.         StringInList = -1
  616.         GOTO DONE
  617.     END IF
  618.     NEXT i%
  619.     StringInList = 0
  620. DONE:
  621. END FUNCTION
  622.  
  623.  
  624. ''Get Windows version in a useful way
  625. FUNCTION GetWindowsVersionCorrectly& () STATIC
  626.     GetWindowsVersionCorrectly = GetWindowsMajorVersion() * 256 + GetWindowsMinorVersion()
  627. END FUNCTION
  628.  
  629.  
  630. '' Turn x, y into a major.minor version long
  631. FUNCTION MakeVer& (x as integer, y as integer) STATIC
  632.     MakeVer = x * 256 + y
  633. END FUNCTION
  634.  
  635.  
  636. '' Remove all files in the given .INF section
  637. SUB RemoveSectionFiles (dest$, sect$) STATIC
  638.     foo$ = "foo"
  639.     MakeListFromSectionFilename foo$, sect$
  640.     l% = GetListLength(foo$)
  641.     FOR i% = 1 TO l% STEP 1
  642.     RemoveFile MakePath(dest$, GetListItem(foo$, i%)), cmoForce
  643.     NEXT i%
  644.     foo$ = ""
  645. END SUB
  646.  
  647.  
  648. '' Remove directory and all files in it, if it exists
  649. SUB RemDirectory(d$) STATIC
  650.     IF Exists(MakePath(d$, "NUL")) THEN
  651.     Kill MakePath(d$, "*.*")
  652.     RmDir d$
  653.     END IF
  654. END SUB
  655.  
  656.  
  657. '' Return True (-1) if the user has a sound driver in the [drivers]
  658. ''  section of win.ini.
  659. FUNCTION HasSoundDriver() STATIC AS INTEGER
  660.     r% = 0
  661.     IF GetIniKeyString(SYSINI$, "drivers", "wave") <> "" THEN
  662.     r% = -1
  663.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave1") <> "" THEN
  664.     r% = -1
  665.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave2") <> "" THEN
  666.     r% = -1
  667.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave3") <> "" THEN
  668.     r% = -1
  669.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave4") <> "" THEN
  670.     r% = -1
  671.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave5") <> "" THEN
  672.     r% = -1
  673.     END IF
  674.     HasSoundDriver = r%
  675. END FUNCTION
  676.  
  677. '' Include product-specific function definitions
  678. '$INCLUDE 'specific.inc'
  679.