home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 38 / PCF_CD38.bin / setup16 / bbinstal.mst < prev    next >
Text File  |  1996-07-07  |  31KB  |  1,118 lines

  1. '**************************************************************************
  2. '*                Generic install script for Broderbund Products
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. ''parse command line for custom commands here
  8. GLOBAL build$
  9. GLOBAL destCfgFile$
  10. GLOBAL srcDirStr$
  11. GLOBAL canChain$
  12. GLOBAL chainWindow%
  13. DECLARE FUNCTION ParseCommand (commFlag$) AS STRING
  14.  
  15. build$ = ParseCommand("B")
  16. destCfgFile$ = build$
  17.  
  18. canChain$ = ParseCommand("X")
  19. temp$ = ParseCommand("P")
  20. IF temp$ <> "" THEN
  21.     chainWindow% = VAL(temp$)
  22. ELSE
  23.     chainWindow% = 0
  24. END IF
  25.  
  26. '$INCLUDE 'setupapi.inc'
  27. '$INCLUDE 'msdetect.inc'
  28. '$INCLUDE 'msregdb.inc'
  29.  
  30. ''Dialog ID's
  31. CONST WELCOME       = 100
  32. CONST NOMIDIWARN    = 101
  33. CONST NOWAVEWARN    = 102
  34. CONST DUPFILE        = 103
  35. CONST ASKQUIT       = 200
  36. CONST FONTERROR        = 201
  37. CONST DESTPATH      = 300
  38. CONST WININIBACKUP    = 301
  39. CONST EXITFAILURE   = 400
  40. CONST EXITQUIT      = 600
  41. CONST EXITSUCCESS   = 700
  42. CONST EXITSUCCESS1  = 701
  43. CONST EXITSUCCESS2  = 702
  44. CONST APPHELP       = 900
  45. CONST MIDILIST        = 1901
  46. CONST EXITINCOMPLETE    = 1902
  47. CONST CUSTINST     = 6200
  48. CONST TOOBIG       = 6300
  49. CONST BADPATH       = 6400
  50.  
  51. ''    Dialog Variable String IDs
  52. CONST    PRODUCTNAME    =    701
  53. CONST    CUSTSUPPNUM    =    702
  54. CONST    SUCCESSCOMMENT = 703
  55. CONST SUCCESSCOMMENT1 = 750
  56. CONST SUCCESSCOMMENT2 = 751
  57. CONST    FILEPATH    = 704
  58. CONST    CHAINTEXT    = 705
  59.  
  60. ''Bitmap ID
  61. CONST LOGO = 1
  62.  
  63. CONST BROADKEY = 30706
  64.  
  65. GLOBAL WINDRIVE$    ''Windows drive letter.
  66. GLOBAL sourceDir$    ''Install from directory.
  67. GLOBAL destDir$     ''Default destination directory.
  68. GLOBAL cfgFile$        ''Config file containing custom info for installer
  69. GLOBAL filesInstalled%    ''0 = no files installed, 1 = files installed
  70. GLOBAL waveNeeded%    ''0 = wave device not required by product, 1 = wave device is required by product
  71. GLOBAL waveCount%    '' # of wave devices installed on system
  72. GLOBAL midiNeeded%    ''0 = MIDI device not required by product, 1 = MIDI device is required by product
  73. GLOBAL midiCount%    '' # of MIDI devices installed on system
  74. GLOBAL qtwNeeded% '' QuickTime for Windows required
  75. GLOBAL qtwVersion$ '' QuickTime for Windows version that is required
  76. GLOBAL fontsToInstall%    ''0 = no fonts need be installed, 1 = fonts need to be installed
  77. GLOBAL fontsInstalled%    ''0 = not installed, 1 = installed (partial or otherwise)
  78. GLOBAL fontInstallError%    ''0 = no error
  79. GLOBAL wingNeeded% ''0 = WinG not required, 1 = WinG required
  80. GLOBAL winIniBkpFile$    ''Backup name for WIN.INI file
  81. GLOBAL szInf$
  82. GLOBAL prodName$
  83. GLOBAL CUIDLL$
  84. GLOBAL filePathID$
  85. GLOBAL replaceAll%
  86. GLOBAL ExcessNeeded&    ''if > 0, indicates space unavailable for install
  87. GLOBAL sucCom$
  88. GLOBAL qtwSucComm$
  89. GLOBAL cmdLine$
  90. GLOBAL midiCmdLine$
  91. GLOBAL qtwCmdLine$
  92.  
  93. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  94. DECLARE FUNCTION InstantString (varStr$) AS STRING
  95. DECLARE SUB DeinstFiles
  96. DECLARE FUNCTION AddDirToCopyList (theFile$,dir$,srcDir$,dstDir$,silent%) AS INTEGER
  97. DECLARE FUNCTION SetDriveStatus (silent%) AS INTEGER
  98. DECLARE SUB DoRegistrations
  99. DECLARE FUNCTION CreateRegEntries LIB "brodreg.dll" (srcCfgFile$,dstCfgFile$,varTable$,demarChar$) AS INTEGER
  100. DECLARE FUNCTION InstallFonts LIB "brodfont.dll" (installDir$, configFile$, winBackup$) AS INTEGER
  101. DECLARE FUNCTION DeinstallFonts LIB "brodfont.dll" (configFile$, winBackup$) AS INTEGER
  102. DECLARE FUNCTION SetParentWindow LIB "brodutil.dll" (parentWindow%) AS INTEGER
  103. DECLARE FUNCTION DeleteDirectory LIB "brodutil.dll" (directory$,silent%) AS INTEGER
  104. DECLARE FUNCTION DeinstallFiles LIB "brodutil.dll" (directory$,config$,section$,remove%) AS INTEGER
  105. DECLARE FUNCTION NotifyChain LIB "brodutil.dll" (chainWindow%,wParam%,theMess$) AS INTEGER
  106. DECLARE FUNCTION PGInstall LIB "brodpgi.dll" (theFile$,silent%,showGroup%) AS INTEGER
  107. DECLARE FUNCTION PGUninstall LIB "brodpgi.dll" (theFile$,prejudice%) AS INTEGER
  108. DECLARE FUNCTION GetNetPGSize LIB "brodpgi.dll" (theFile$) AS INTEGER
  109. DECLARE FUNCTION SelectMidiDevice LIB "brodmidi.dll" (cmdLine$) AS INTEGER
  110. DECLARE FUNCTION GetDriverCount LIB "brodmidi.dll" (driverType$) AS INTEGER
  111.  
  112. ''DECLARE FUNCTION GetClusterSize LIB "brodfile.dll" (driveLetter$) AS LONG
  113.  
  114. INIT:
  115.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  116.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  117.  
  118.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  119.     IF szInf$ = "" THEN
  120.         szInf$ = GetSymbolValue("STF_CWDDIR") + "BBINSTAL.INF"
  121.     ELSE
  122.         SPLITPATH szInf$,bDrive$,bDir$,bFile$,bExt$
  123.         IF bDrive$ = "" THEN
  124.             szInf$ = GetSymbolValue("STF_CWDDIR")+szInf$
  125.         END IF
  126.     END IF
  127.     ReadInfFile szInf$
  128.  
  129.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  130.     sourceDir$ = GetSymbolValue("STF_SRCDIR")
  131.     IF LEN(sourceDir$) > 3 THEN
  132.         sourceDir$ = Mid$(sourceDir$,1,LEN(sourceDir$)-1)
  133.     END IF
  134.  
  135.  
  136. ''GET CONFIG FILE INFO
  137.     SPLITPATH szInf$,bDrive$,bDir$,bFile$,bExt$
  138.     cfgFile$ = MakePath(sourceDir$,bFile$+".BDF")
  139.     IF DoesFileExist(cfgFile$,femExists) = 1 THEN
  140.         destDir$ = WINDRIVE$+":\"+GetIniKeyString(cfgFile$,"directories","TargetDir")
  141.         prodName$ = GetIniKeyString(cfgFile$, "product", "ProductName")
  142.         waveNeeded% = VAL(GetIniKeyString(cfgFile$,"general","wavedevice"))
  143.         midiNeeded% = VAL(GetIniKeyString(cfgFile$,"general","mididevice"))
  144.         qtwNeeded% = VAL(GetIniKeyString(cfgFile$,"quicktime","qtwRequired"))
  145.         qtwVersion$ = GetIniKeyString(cfgFile$,"quicktime","qtwVersion")
  146.         fontsToInstall% = VAL(GetIniKeyString(cfgFile$,"general","fontinstall"))
  147.       wingNeeded% = VAL(GetIniKeyString(cfgFile$,"general","wing"))
  148.         sucCom$ = GetIniKeyString(cfgFile$,"general","successcomment")
  149.         ''cmdLine$ = GetIniKeyString(cfgFile$,"general","chaincommand")
  150.         midiCmdLine$ = GetIniKeyString(cfgFile$,"general","chaincommand") ''temporary solution
  151.         qtwCmdLine$ = GetIniKeyString(cfgFile$,"quicktime","qtwCmdLine")
  152.         qtwSucComm$ = GetIniKeyString(cfgFile$,"quicktime","qtwsuccomm")
  153.     ELSEIF build$ <> "" THEN
  154.         cfgFile$ = destCfgFile$
  155.         destDir$ = GetIniKeyString(cfgFile$,"directories","MediaBuildDir")
  156.         IF destDir$ = "" THEN
  157.             destDir$ = WINDRIVE$+":\BRODINST"
  158.         END IF
  159.         prodName$ = "Installer for "+GetIniKeyString(cfgFile$, "product", "ProductName")
  160.         waveNeeded% = 0
  161.         midiNeeded% = 0
  162.         qtwNeeded% = 0
  163.         qtwVersion$ = ""
  164.         fontsToInstall% = 0
  165.       wingNeeded% = 0
  166.         sucCom$ = ""
  167.         cmdLine$ = ""
  168.         midiCmdLine$ = ""
  169.         qtwCmdLine$ = ""
  170.       qtwSucComm$ = ""
  171.     ELSE
  172.         cfgFile$ = ""
  173.         destDir$ = WINDRIVE$+":\BRODINST"
  174.         prodName$ = "Unspecified Product"
  175.         waveNeeded% = 0
  176.         midiNeeded% = 0
  177.         qtwNeeded% = 0
  178.         qtwVersion$ = ""
  179.         fontsToInstall% = 0
  180.         wingNeeded% = 0
  181.         sucCom$ = ""
  182.         cmdLine$ = ""
  183.         midiCmdLine$ = ""
  184.         qtwCmdLine$ = ""
  185.       qtwSucComm$ = ""
  186.     END IF
  187.  
  188.     filesInstalled% = 0
  189.     waveCount% = 0
  190.     midiCount% = 0
  191.     fontsInstalled% = 0
  192.     fontInstallError% = 0
  193.     winIniBkpFile$ = "WIN.BAK"
  194.     skip% = 0
  195.  
  196.     prodNameID$ = LTRIM$(STR$(PRODUCTNAME))
  197.     AddListItem "VarStringID", prodNameID$
  198.     SetSymbolValue prodNameID$,prodName$
  199.  
  200.     filePathID$ = LTRIM$(STR$(FILEPATH))
  201.     AddListItem "VarStringID", filePathID$
  202.  
  203.     something% = SetParentWindow(HwndFrame())
  204.  
  205.     SetBitmap CUIDLL$, LOGO
  206.     SetTitle GetSymbolValue(prodNameID$)
  207.     ExcessNeeded& = 0
  208.  
  209.     ''CustInst list symbols
  210.     FOR i% = 1 TO 7 STEP 1
  211.         AddListItem "DriveStatusText", ""
  212.     NEXT i%
  213.     IF destDir$ <> "" THEN
  214.         ReplaceListItem "DriveStatusText", 7, destDir$
  215.     END IF
  216.  
  217.     ''Disk cost list symbols
  218.     FOR i% = 1 TO 26 STEP 1
  219.         AddListItem "ExtraCosts", "0"
  220.      NEXT i%
  221.  
  222.     IF build$ <> "" THEN
  223.         srcDirStr$ = GetIniKeyString(cfgFile$, "build", "sourcedir")
  224.     ELSE
  225.         srcDirStr$ = GetIniKeyString(cfgFile$,"directories","sourcedir")
  226.     END IF
  227.  
  228. '$IFDEF DEBUG
  229.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  230.     IF IsDriveValid(WINDRIVE$) = 0 THEN
  231.         i% = DoMsgBox("Windows drive ('"+WINDRIVE$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  232.         GOTO QUIT
  233.     END IF
  234. '$ENDIF ''DEBUG
  235.  
  236. WELCOME:
  237.     SetSymbolValue "CENTERWINDOW", "BOTH"
  238.     SetSymbolValue "OFFSETVERTPERC", "-10"
  239.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  240.     IF sz$ = "CONTINUE" THEN
  241.           UIPop 1
  242.     ELSE
  243.         GOSUB ASKQUIT
  244.         GOTO WELCOME
  245.     END IF
  246.  
  247. WAVESELECT:
  248.     IF waveNeeded% = 0 THEN
  249.         GOTO WAVESELECTEND
  250.     END IF
  251.  
  252.     waveCount% = GetDriverCount("wave")
  253.     IF waveCount% > 0 THEN
  254.         GOTO WAVESELECTEND
  255.     END IF
  256.  
  257.     sz$ = UIStartDlg(CUIDLL$,NOWAVEWARN,"FInfoDlgProc",APPHELP,HELPPROC$)
  258.     IF sz$ = "CONTINUE" THEN
  259.         UIPop 1
  260.         AddListItem "IncompleteInstall", "Your system has no wave drivers installed."
  261.         GOTO WAVESELECTEND
  262.     ELSE
  263.         GOSUB ASKQUIT
  264.         GOTO WAVESELECT
  265.     END IF
  266. WAVESELECTEND:
  267.  
  268.  
  269. MIDISELECT:
  270.     IF midiNeeded% = 0 THEN
  271.         GOTO MIDISELECTEND
  272.     END IF
  273.  
  274.     midiCount% = GetDriverCount("midi")
  275.     IF midiCount% > 0 THEN
  276.         IF cmdLine$ <> "" THEN
  277.             cmdLine$ = cmdLine$+";"
  278.             cmdLine$ = cmdLine$+midiCmdLine$
  279.         ELSE
  280.           cmdLine$ = midiCmdLine$
  281.         END IF
  282.         GOTO MIDISELECTEND
  283.     END IF
  284.  
  285.     sz$ = UIStartDlg(CUIDLL$,NOMIDIWARN,"FInfoDlgProc",APPHELP,HELPPROC$)
  286.     IF sz$ = "CONTINUE" THEN
  287.         UIPop 1
  288.         AddListItem "IncompleteInstall", "Your system has no MIDI drivers installed."
  289. ''        cmdLine$ = ""
  290.         GOTO MIDISELECTEND
  291.     ELSE
  292.         GOSUB ASKQUIT
  293.         GOTO MIDISELECT
  294.     END IF
  295. MIDISELECTEND:
  296.  
  297.  
  298. QTWSELECT:
  299.     IF qtwNeeded% = 0 THEN
  300.         GOTO QTWSELECTEND
  301.     ENDIF
  302.  
  303.     verString$ = GetVersionOfFile(GetWindowsSysDir+"QTIM.DLL")
  304.     IF verString$ < qtwVersion$ THEN
  305.         IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  306.         ELSE
  307.             qtwCmdLine95$ = GetIniKeyString(cfgFile$,"quicktime","qtw95CmdLine")
  308.             IF qtwCmdLine$ <> "" THEN
  309.              qtwCmdLine$ = qtwCmdLine$+";"+qtwCmdLine95$
  310.             END IF
  311.         END IF
  312.     ELSE
  313.         qtwCmdLine$ = ""
  314.         GOTO QTWSELECTEND
  315.     END IF
  316.  
  317.     IF cmdLine$ <> "" THEN
  318.         cmdLine$ = cmdLine$+";"
  319.         cmdLine$ = cmdLine$+qtwCmdLine$
  320.     ELSE
  321.         cmdLine$ = qtwCmdLine$
  322.     END IF
  323. QTWSELECTEND:
  324.  
  325.  
  326. CUSTINST:
  327. prevCur% = ShowWaitCursor()
  328.     result% = SetDriveStatus(1)
  329. RestoreCursor prevCur%
  330.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  331.  
  332.     IF sz$ = "CONTINUE" THEN
  333.         ''Install only if it will fit.
  334.         IF ExcessNeeded& > 0 THEN
  335.             GOSUB TOOBIG
  336.             GOTO CUSTINST
  337.         END IF
  338.         UIPop 1
  339.     ELSEIF sz$ = "PATH" THEN
  340.         GOTO GETPATH
  341.     ELSEIF sz$ = "REACTIVATE" THEN
  342.         GOTO CUSTINST
  343.     ELSEIF sz$ = "EXIT" THEN
  344.         GOSUB ASKQUIT
  345.         GOTO CUSTINST
  346.     ELSEIF sz$ = "BACK" THEN
  347.         UIPop 1
  348.         GOTO WELCOME
  349.     ELSE
  350.         GOSUB ASKQUIT
  351.         GOTO CUSTINST
  352.     END IF
  353.     result% = SetDriveStatus(0)
  354.     IF result% = 1 THEN
  355.         GOTO CUSTINST
  356.     END IF
  357.  
  358.  
  359.     IF fontsToInstall% = 0 THEN
  360.         GOTO GETWINIBKUPEND
  361.     END IF
  362. GETWINIBKUP:
  363.     SetSymbolValue "EditTextIn", winIniBkpFile$
  364.     SetSymbolValue "EditFocus", "END"
  365. GETWINIBKUPL1:
  366.     sz$ = UIStartDlg(CUIDLL$, WININIBACKUP, "FEditDlgProc", APPHELP, HELPPROC$)
  367.     winIniBkpFile$ = GetWindowsDir()+GetSymbolValue("EditTextOut")
  368.  
  369.     IF sz$ = "CONTINUE" THEN
  370.         UIPop 1
  371.     ELSEIF sz$ = "REACTIVATE" THEN
  372.         GOTO GETWINIBKUPL1
  373.     ELSEIF sz$ = "BACK" THEN
  374.         UIPop 1
  375.         GOTO CUSTINST
  376.     ELSE
  377.         GOSUB ASKQUIT
  378.         GOTO GETWINIBKUP
  379.     END IF
  380.  
  381.     CopyFile GetWindowsDir()+"WIN.INI", winIniBkpFile$, cmoOverwrite, 0
  382. GETWINIBKUPEND:
  383.  
  384.  
  385.     ''BEGIN INSTALLATION PROCESS
  386.     listLen% = GetListLength("NEWDIRLIST")
  387.     SetSymbolValue "BASE0$",destDir$
  388.     FOR i% = 1 TO listLen% STEP 1
  389.         theDir$ = InstantString(GetListItem("NEWDIRLIST",i%))
  390.         IF theDir$ <> "" THEN
  391.             CreateDir theDir$, cmoVital
  392.             ReplaceListItem "DIRLIST",i%,theDir$
  393.         END IF
  394.     NEXT
  395.     RemoveSymbol "BASE0$"
  396.  
  397.     ''INSTALL FILES
  398.     filesInstalled% = 1
  399.     CopyFilesInCopyList
  400.     ClearCopyList
  401.  
  402.  
  403.     IF build$ = "" THEN
  404.         IF cfgFile$ <> "" THEN
  405.             ''COPY INSTALLER CONFIG FILE TO DEST DIR, AND UPDATE WITH RUNTIME INFO
  406.             SPLITPATH szInf$,bDrive$,bDir$,bFile$,bExt$
  407.             destCfgFile$ = MakePath(destDir$,bFile$+".CFG")
  408.             CopyFile cfgFile$, destCfgFile$, cmoOverwrite, 0
  409.  
  410.           ''[directories] section contains directory listings with no trailing \
  411.             IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  412.                 tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  413.             ELSE
  414.                 tempString$ = sourceDir$
  415.             END IF
  416.             CreateIniKeyValue destCfgFile$,"directories","InstallFromDir",tempString$, cmoOverwrite
  417.             IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  418.                 tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  419.             ELSE
  420.                 tempString$ = destDir$
  421.             END IF
  422.             CreateIniKeyValue destCfgFile$,"directories","InstallToDir",tempString$, cmoOverwrite
  423.  
  424.         ''[install] section contains directory listings with a trailing \
  425.             IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  426.                 tempString$ = sourceDir$
  427.             ELSE
  428.                 tempString$ = sourceDir$+"\"
  429.             END IF
  430.             CreateIniKeyValue destCfgFile$,"install","InstallFromDir",tempString$, cmoOverwrite
  431.  
  432.             IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  433.                 tempString$ = destDir$
  434.             ELSE
  435.                 tempString$ = destDir$+"\"
  436.             END IF
  437.             CreateIniKeyValue destCfgFile$,"install","InstallToDir",tempString$, cmoOverwrite
  438.  
  439.             CreateIniKeyValue destCfgFile$, "install","InstallFromDrive", MID$(sourceDir$,1,1), cmoOverwrite
  440.             CreateIniKeyValue destCfgFile$, "install","InstallToDrive", MID$(destDir$,1,1), cmoOverwrite
  441.         ELSE
  442.             destCfgFile$ = ""
  443.         END IF
  444.     ELSEIF destCfgFile$ <> "" THEN
  445.         CreateIniKeyValue destCfgFile$,"directories","MediaBuildDir",destDir$,cmoOverwrite
  446.     END IF
  447.  
  448.     ''INSTALL FONTS - IF NECESSARY
  449.     IF fontsToInstall% = 0 THEN
  450.         GOTO FONTINSTALLEND
  451.     END IF
  452. FONTINSTALL:
  453.     fontInstallError% = InstallFonts(destDir$,destCfgFile$,winIniBkpFile$)
  454.     IF fontInstallError% > 0 THEN
  455.         sz$ = UIStartDlg(CUIDLL$, FONTERROR, "FQuitDlgProc", 0, "")
  456.         IF sz$ = "EXIT" THEN
  457.             UIPopAll
  458.             ERROR STFQUIT
  459.         ELSEIF sz$ = "REACTIVATE" THEN
  460.             GOTO FONTINSTALL
  461.         ELSE
  462.             UIPop 1
  463.         END IF
  464.         AddListItem "IncompleteInstall", "Fonts are not installed correctly for this product."
  465.     END IF
  466.     fontsInstalled% = 1
  467. FONTINSTALLEND:
  468.  
  469.  
  470.     ''INSTALL PROGRAM GROUP AND PROGRAM GROUP ITEMS
  471.      IF build$ = "" THEN
  472.         progGroup$ = GetIniKeyString(destCfgFile$,"proggroup","groupname")
  473.         CreateProgmanGroup progGroup$,"",cmoVital
  474.  
  475.  
  476. IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  477.     tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  478. ELSE
  479.     tempString$ = destDir$
  480. END IF
  481. SetSymbolValue "INSTALLTODIR$",tempString$
  482. IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  483.     tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  484. ELSE
  485.     tempString$ = sourceDir$
  486. END IF
  487. SetSymbolValue "INSTALLFROMDIR$",tempString$
  488.  
  489. prevCur% = ShowWaitCursor()
  490. i% = 0
  491. key$ = "pgi1"
  492. pgiItem$ = GetIniKeyString(destCfgFile$,key$,"pgicaption")
  493. WHILE (pgiItem$ <> "")
  494.     pgiCmd$ = GetIniKeyString(destCfgFile$,key$,"pgicmd")
  495. pgiCmd$ = InstantString(pgiCmd$)
  496.     pgiIcon$ = GetIniKeyString(destCfgFile$,key$,"pgiicon")
  497. pgiIcon$ = InstantString(pgiIcon$)
  498.     CreateProgmanItem progGroup$,pgiItem$,pgiCmd$,pgiIcon$,cmoOverwrite
  499.     i% = i% + 1
  500.     key$ = "pgi"+RTRIM$(LTRIM$(STR$(i%)))
  501.     pgiItem$ = GetIniKeyString(destCfgFile$,key$,"pgicaption")
  502. WEND
  503.  
  504. ''RestoreCursor prevCur%
  505.  
  506. ShowProgmanGroup progGroup$,1,cmoNone
  507. ''        IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  508. ''            anerror% = PGInstall(destCfgFile$,1,1)
  509. ''ShowProgmanGroup progGroup$,1,cmoNone
  510. ''        ELSE
  511. ''            anerror% = PGInstall(destCfgFile$,1,6)
  512. ''        END IF
  513.  
  514. RestoreCursor prevCur%
  515.     END IF
  516.  
  517.     IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  518.         varTable$ = "INSTALLFROMDIR|"+MID$(sourceDir$,1,LEN(sourceDir$)-1)
  519.     ELSE
  520.         varTable$ = "INSTALLFROMDIR|"+sourceDir$
  521.     END IF
  522.     IF destDir$ <> "" THEN
  523.         IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  524.             varTable$ = varTable$+"|INSTALLTODIR|"+MID$(destDir$,1,LEN(destDir$)-1)
  525.         ELSE
  526.             varTable$ = varTable$+"|INSTALLTODIR|"+destDir$
  527.         END IF
  528.     END IF
  529.  
  530.     result% = CreateRegEntries(cfgFile$,"",varTable$,"|")
  531.     ''DoRegistrations
  532.  
  533.  
  534. QUIT:
  535.     ON ERROR GOTO ERRQUIT
  536.  
  537.     IF ERR = 0 THEN
  538.         GOTO GOODQUIT
  539.     ELSE
  540.         GOTO BADQUIT
  541.     ENDIF
  542.  
  543. GOODQUIT:
  544.     IF GetListLength("IncompleteInstall") THEN
  545.         SetSymbolValue "ListItemsIn", ""
  546.         FOR i% = 1 TO GetListLength("IncompleteInstall") STEP 1
  547.             AddListItem "ListItemsIn", GetListItem("IncompleteInstall",i%)
  548.         NEXT
  549. INCOMPLETEQUITL1:
  550.         sz$ = UIStartDlg(CUIDLL$,EXITINCOMPLETE,"FList0DlgProc",0,"")
  551.         IF sz$ = "REACTIVATE" THEN
  552.             GOTO INCOMPLETEQUITL1
  553.         END IF
  554.         UIPop 1
  555.         GOTO ENDINSTALL
  556.     ELSEIF cmdLine$ = "" THEN
  557. GOODQUITL0:
  558.         sucComID$ = LTRIM$(STR$(SUCCESSCOMMENT))
  559.         AddListItem "VarStringID", sucComID$
  560.         IF sucCom$ = "" THEN
  561.             sucCom$ = "Have Fun!"
  562.         END IF
  563.         SetSymbolValue sucComID$,sucCom$
  564.  
  565.         sz$ = UIStartDlg(CUIDLL$,EXITSUCCESS,"FList0DlgProc",0,"")
  566.         IF sz$ = "REACTIVATE" THEN
  567.             GOTO GOODQUITL0
  568.         END IF
  569.         UIPop 1
  570.         GOTO ENDINSTALL
  571.     ELSEIF midiCmdLine$ <> "" THEN
  572.         sucCom1$ = sucCom$
  573.         dlg% = EXITSUCCESS1
  574.         IF qtwCmdLine$ <> "" THEN
  575.             sucCom2$ = qtwSucComm$
  576.             dlg% = EXITSUCCESS2
  577.             GOTO TWOCHAIN
  578.         ELSE
  579.             GOTO ONECHAIN
  580.         END IF
  581.     ELSEIF qtwCmdLine$ <> "" THEN
  582.         sucCom1$ = qtwSucComm$
  583.       dlg% = EXITSUCCESS1
  584.         GOTO ONECHAIN
  585.     ELSE
  586.        GOTO GOODQUITL0
  587.     END IF
  588.  
  589. TWOCHAIN:
  590.     sucComID2$ = LTRIM$(STR$(SUCCESSCOMMENT2))
  591.     AddListItem "VarStringID", sucComID2$
  592.     SetSymbolValue sucComID2$,sucCom2$
  593. ONECHAIN:
  594.     sucComID1$ = LTRIM$(STR$(SUCCESSCOMMENT1))
  595.     AddListItem "VarStringID", sucComID1$
  596.     SetSymbolValue sucComID1$,sucCom1$
  597.  
  598.     chainID$ = LTRIM$(STR$(CHAINTEXT))
  599.     AddListItem "VarStringID", chainID$
  600.  
  601. GOODQUITL1:
  602.     IF canChain$ = "Y" THEN
  603.     ''SET VARIABLES FOR COMMAND LINE
  604.     ''SET COMMAND LINE
  605.     ''SEND COMMAND LINE TO PARENT EXECUTABLE
  606.         IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  607.             tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  608.         ELSE
  609.             tempString$ = destDir$
  610.         END IF
  611.         SetSymbolValue "INSTALLTODIR$",tempString$
  612.         IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  613.             tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  614.         ELSE
  615.             tempString$ = sourceDir$
  616.         END IF
  617.         SetSymbolValue "INSTALLFROMDIR$",tempString$
  618.         SetSymbolValue "WINDOWS$",MID$(GetWindowsDir(),1,LEN(GetWindowsDir())-1)
  619.         SetSymbolValue "WINSYS$",MID$(GetWindowsSysDir(),1,LEN(GetWindowsSysDir())-1)
  620.         anerror% = NotifyChain(chainWindow%,0,InstantString(cmdLine$))
  621.         chainTxt$ = "Press OK to continue"
  622.     ELSE
  623.         chainTxt$ = "Please refer to the documentation for instructions on how to do this."
  624.     END IF
  625.  
  626.     SetSymbolValue chainID$,chainTxt$
  627.  
  628.     sz$ = UIStartDlg(CUIDLL$,dlg%,"FList0DlgProc",0,"")
  629.     IF sz$ = "REACTIVATE" THEN
  630.         GOTO GOODQUITL1
  631.     END IF
  632.     UIPop 1
  633. ENDINSTALL:
  634.     END
  635.  
  636. BADQUIT:
  637.     IF ERR = STFQUIT THEN
  638.         dlg% = EXITQUIT
  639.     ELSE
  640.         dlg% = EXITFAILURE
  641.     END IF
  642.     DeinstFiles
  643. BADQUITL1:
  644.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  645.     IF sz$ = "REACTIVATE" THEN
  646.         GOTO BADQUITL1
  647.     END IF
  648.     UIPop 1
  649.     END
  650.  
  651. ERRQUIT:
  652.     DeinstFiles
  653.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  654.     END
  655.  
  656.  
  657. TOOBIG:
  658.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  659.     IF sz$ = "REACTIVATE" THEN
  660.         GOTO TOOBIG
  661.     END IF
  662.     UIPop 1
  663.     RETURN
  664.  
  665.  
  666.  
  667. BADPATH:
  668.      sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  669.     IF sz$ = "REACTIVATE" THEN
  670.         GOTO BADPATH
  671.     END IF
  672.     UIPop 1
  673.     RETURN
  674.  
  675.  
  676.  
  677. ASKQUIT:
  678.     SetSymbolValue "OFFSETVERTPERC", "-20"
  679.     SetSymbolValue "OFFSETHORZPERC", "10"
  680.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  681.     RemoveSymbol "OFFSETHORZPERC"
  682.     SetSymbolValue "OFFSETVERTPERC", "-10"
  683.  
  684.     IF sz$ = "EXIT" THEN
  685.         UIPopAll
  686.         ERROR STFQUIT
  687.     ELSEIF sz$ = "REACTIVATE" THEN
  688.         GOTO ASKQUIT
  689.     ELSE
  690.         UIPop 1
  691.     END IF
  692.     RETURN
  693.  
  694.  
  695. GETPATH:
  696.     SetSymbolValue "EditTextIn", destDir$
  697.     SetSymbolValue "EditFocus", "END"
  698. GETPATHL1:
  699.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  700.  
  701.     IF sz$ = "CONTINUE" THEN
  702.         olddest$ = destDir$
  703.         destDir$ = GetSymbolValue("EditTextOut")
  704.  
  705.         ''Validate new path.
  706.         IF IsDirWritable(destDir$) = 0 THEN
  707.             GOSUB BADPATH
  708.             GOTO GETPATHL1
  709.         END IF
  710.         UIPop 1
  711.  
  712.         ''Truncate display if too long.
  713.         IF LEN(destDir$) > 23 THEN
  714.             ReplaceListItem "DriveStatusText", 7, MID$(destDir$, 1, 23)+"..."
  715.         ELSE
  716.             ReplaceListItem "DriveStatusText", 7, destDir$
  717.         END IF
  718.  
  719.         olddest$ = ""
  720.  
  721.         result% = SetDriveStatus(1)
  722.         GOTO CUSTINST
  723.     ELSEIF sz$ = "REACTIVATE" THEN
  724.         GOTO GETPATHL1
  725.     ELSEIF sz$ = "EXIT" THEN
  726.         GOSUB ASKQUIT
  727.         GOTO GETPATHL1
  728.      ELSEIF sz$ = "BACK" THEN
  729.         UIPop 1
  730.         GOTO CUSTINST
  731.     ELSE
  732.         UIPop 1
  733.         GOTO CUSTINST
  734.     END IF
  735.  
  736.  
  737.  
  738. '**
  739. '** Purpose:
  740. '**     Appends a file name to the end of a directory path,
  741. '**     inserting a backslash character as needed.
  742. '** Arguments:
  743. '**     szDir$  - full directory path (with optional ending "\")
  744. '**     szFile$ - filename to append to directory
  745. '** Returns:
  746. '**     Resulting fully qualified path name.
  747. '*************************************************************************
  748. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  749.     IF szDir$ = "" THEN
  750.         MakePath = szFile$
  751.     ELSEIF szFile$ = "" THEN
  752.         MakePath = szDir$
  753.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  754.         MakePath = szDir$ + szFile$
  755.     ELSE
  756.         MakePath = szDir$ + "\" + szFile$
  757.     END IF
  758. END FUNCTION
  759.  
  760.  
  761. FUNCTION InstantString (varStr$) STATIC AS STRING
  762.  
  763.     newStr$ = ""
  764.  
  765.     strLen% = LEN(varStr$)
  766.     IF strLen = 0 THEN
  767.         GOTO INSTANTSTRINGEXIT
  768.     END IF
  769.  
  770.     strHead% = 1
  771.     WHILE (strHead% > 0)
  772.         dollarPos1% = INSTR(strHead%,varStr$,"$")
  773.         IF dollarPos1% > 0 THEN
  774.             newStr$ = newStr$+MID$(varStr$,strHead%,dollarPos1%-strHead%)
  775.             dollarPos2% = INSTR(dollarPos1% + 1,varStr$,"$")
  776.             IF dollarPos2% > 0 THEN
  777.                 var$ = MID$(varStr$,dollarPos1% + 1,dollarPos2% - dollarPos1%)
  778.                 strHead% = dollarPos2%+1
  779.                 IF strHead% > LEN(varStr$) THEN
  780.                     strHead% = 0
  781.                 END IF
  782.             ELSE
  783.                 var$ = MID$(varStr$,dollarPos1% + 1)
  784.                 strHead% = 0
  785.             END IF
  786.  
  787.             newStr$ = newStr$+GetSymbolValue(UCASE$(var$))
  788.         ELSE
  789.             newStr$ = newStr$+MID$(varStr$,strHead%)
  790.             strHead% = 0
  791.         END IF
  792.     WEND
  793.  
  794. INSTANTSTRINGEXIT:
  795.     InstantString = newStr$
  796.  
  797. END FUNCTION
  798.  
  799.  
  800. FUNCTION AddDirToCopyList(theFile$,dir$,srcDir$,dstDir$,silent%) STATIC AS INTEGER
  801.  
  802.     result% = 0
  803.  
  804.     IF srcDir$ = "" THEN
  805.         GOTO ADDDIRTOCOPYLISTEXIT
  806.     END IF
  807.  
  808.     IF dstDir$ = "" THEN
  809.         GOTO ADDDIRTOCOPYLISTEXIT
  810.     END IF
  811.  
  812.     baseSym$ = MID$(dir$,2,6)
  813.     SetSymbolValue baseSym$,srcDir$
  814.     newSrcDir$ = InstantString(dir$)
  815.     SetSymbolValue baseSym$,dstDir$
  816.     newDstDir$ = InstantString(dir$)
  817.  
  818.     IF dir$ = "$BASE0$" THEN
  819. ''    IF MID$(dir$,1,1) = "$" AND LEN(dir$) = 7 THEN
  820.         RemoveSymbol "DIRLIST"
  821.         RemoveSymbol "NEWDIRLIST"
  822.     END IF
  823.  
  824.     IF DoesDirExist(newDstDir$) = 0 THEN
  825.         AddListItem "DIRLIST",""
  826.         AddListItem "NEWDIRLIST",dir$
  827.     ELSE
  828.         AddListItem "DIRLIST",dir$
  829.         AddListItem "NEWDIRLIST",""
  830.     END IF
  831.  
  832.     IF DoesIniSectionExist(theFile$,dir$) = 1 THEN
  833.         IF silent% = 0 THEN
  834.             i% = 0
  835.             key$ = "f"+RTRIM$(LTRIM$(STR$(i%)))
  836.             curFile$ = GetIniKeyString(theFile$,dir$,""""+key$+"""")
  837.             curFile$ = GetNthFieldFromIniString(curFile$,2)
  838.             halt% = 0
  839.  
  840.             SetSymbolValue "CENTERWINDOW", "BOTH"
  841.  
  842.             WHILE curFile$ <> "" AND halt% = 0
  843.                 fileExists% = DoesFileExist(MakePath(newDstDir$,curFile$),femExists)
  844. ''                fileExists% = DoesFileExist(newDstDir$+"\"+curFile$,femExists)
  845.                 IF fileExists% = 1 AND replaceAll% = 0 THEN
  846.                     SetSymbolValue filePathID$,newDstDir$+"\"+curFile$
  847.                     sz$ = UIStartDlg(CUIDLL$, DUPFILE, "FInfoDlgProc", 0, "")
  848.                     IF sz$ = "CONTINUE" THEN ''this translates to "replace"
  849.                         AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  850.                     ELSEIF sz$ = "EXIT" THEN ''this translates to "replace ALL"
  851.                         AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  852.                         replaceAll% = 1
  853.                     ELSEIF sz$ = "CANCEL" THEN ''this translates to "stop"
  854.                         halt% = 1
  855.                         result% = 1
  856.                         UIPop 1
  857.                         GOTO ADDDIRTOCOPYLISTEXIT
  858.                     END IF
  859.                     UIPop 1
  860.                 ELSE
  861.                     AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  862.                 END IF
  863.  
  864.                 i% = i% + 1
  865.                 key$ = "f"+RTRIM$(LTRIM$(STR$(i%)))
  866.                 curFile$ = GetIniKeyString(theFile$,dir$,""""+key$+"""")
  867.                 curFile$ = GetNthFieldFromIniString(curFile$,2)
  868.             WEND
  869.         ELSE
  870.             AddSectionFilesToCopyList dir$,newSrcDir$,newDstDir$
  871.         END IF
  872.     END IF
  873.  
  874.     IF DoesIniSectionExist(theFile$,dir$+"\") = 1 THEN
  875.         subDirStr$ = GetIniKeyString(theFile$,dir$+"\","""subdirs""")
  876.         i% = 1
  877.         subDir$ = GetNthFieldFromIniString(subDirStr$,i%)
  878.         WHILE subDir$ <> ""
  879.             subDir$ = dir$+"\"+subDir$
  880.             result% = AddDirToCopyList(theFile$,subDir$,srcDir$,dstDir$,silent%)
  881.             IF result% = 1 THEN
  882.                 GOTO ADDDIRTOCOPYLISTEXIT
  883.             END IF
  884.             i% = i% + 1
  885.             subDir$ = GetNthFieldFromIniString(subDirStr$,i%)
  886.         WEND
  887.     END IF
  888.  
  889. ADDDIRTOCOPYLISTEXIT:
  890.     AddDirToCopyList = result%
  891. END FUNCTION
  892.  
  893.  
  894. FUNCTION SetDriveStatus(silent%) STATIC AS INTEGER
  895.  
  896. ''Drive Status Text fields:
  897. ''    1:    installation drive
  898. ''    2:    install drive space required
  899. ''    3:    install drive space available
  900. ''    4:    Windows drive
  901. ''    5:    Windows drive space required
  902. ''    6:    Windows drive space available
  903. ''    7:    Installation path
  904.  
  905.     result% = 0
  906.  
  907.     ''CALCULATE COSTS
  908.     ClearCopyList
  909.     replaceAll% = 0
  910.     result% = AddDirToCopyList (szInf$,"$BASE0$",sourceDir$,destDir$,silent%)
  911.     IF result% = 1 THEN
  912.         ClearCopyList
  913.         GOTO SETDRIVESTATUSEXIT
  914.     END IF
  915.  
  916.     ''ADD FILES DESTINED FOR THE WINDOWS DIRECTORY
  917.     ''SPECIAL NOTE: THIS CRAPPY MSSETUP CAN'T DEAL WITH THE PATH WINDOWS\SYSTEM,
  918.     ''SO FILES DESTINED FOR THE WINDOWS\SYSTEM DIRECTORY SHOULD BE INCLUDED HERE
  919.     IF wingNeeded% = 1 THEN
  920.         IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  921.             AddSectionFilesToCopyList "$WINDOWS$",sourceDir$,GetWindowsDir()
  922.         END IF
  923.     END IF
  924.  
  925.     i% = 0
  926.     tmpSrcDirStr$ = srcDirStr$
  927.     WHILE tmpSrcDirStr$ <> ""
  928.         temp% = INSTR(tmpSrcDirStr$,",")
  929.         IF temp% > 0 THEN
  930.             curSrcDir$ = MID$(tmpSrcDirStr$,1,temp%-1)
  931.             tmpSrcDirStr$ = MID$(tmpSrcDirStr$,temp%+1)
  932.         ELSE
  933.             curSrcDir$ = MID$(tmpSrcDirStr$,1)
  934.             tmpSrcDirStr$ = ""
  935.         END IF
  936.         i% = i% + 1
  937.         baseStr$ = "$BASE"+RTRIM$(LTRIM$(STR$(i%)))+"$"
  938.         result% = AddDirToCopyList (szInf$,baseStr$,curSrcDir$,destDir$,silent%)
  939.         IF result% = 1 THEN
  940.             ClearCopyList
  941.             GOTO SETDRIVESTATUSEXIT
  942.         END IF
  943.     WEND
  944.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  945. ''    ReplaceListItem "ExtraCosts", ndrive%, "10240"
  946.     ReplaceListItem "ExtraCosts", ndrive%, RTRIM$(LTRIM$(STR$(GetNetPGSize(cfgFile$))))
  947.  
  948.     ExcessNeeded& = GetCopyListCost("ExtraCosts", "AppNeeds", "")
  949.  
  950.     drive$ = MID$(destDir$, 1, 1)
  951.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  952.  
  953.     cost& = VAL(GetListItem("AppNeeds", ndrive%))
  954.     IF cost& < 0 THEN
  955.         cost& = 0
  956.     END IF
  957.     free& = GetFreeSpaceForDrive(drive$)
  958.     IF free& < 0 THEN
  959.         free& = 0
  960.     END IF
  961.  
  962.     ''take care of errors caused by block size rounding
  963.     ''e.g., the "free" value may be lower than reported - force these situations
  964.     ''into an "excess needed" situation, which is safer
  965.     IF free& <> 0 THEN
  966. ''        IF (free& - cost&) < GetClusterSize(drive$) THEN
  967. ''            free& = cost&
  968. ''        END IF
  969.         IF free& = cost& THEN
  970.             free& = free& - 1
  971.             ExcessNeeded& = 1
  972.         END IF
  973.     END IF
  974.  
  975.     ReplaceListItem "DriveStatusText", 1, drive$ + ":"
  976.     ReplaceListItem "DriveStatusText", 2, STR$(cost& / 1024) + " K"
  977.     ReplaceListItem "DriveStatusText", 3, STR$(free& / 1024) + " K"
  978.  
  979.     IF drive$ <> WINDRIVE$ THEN
  980.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  981.         cost& = VAL(GetListItem("AppNeeds", ndrive%))
  982.         IF cost& < 0 THEN
  983.             cost& = 0
  984.         END IF
  985.     ELSE
  986.         cost& = 0
  987.     END IF
  988.     IF cost& <> 0 THEN
  989.         free& = GetFreeSpaceForDrive(WINDRIVE$)
  990.  
  991.         ''take care of errors caused by block size rounding
  992.         ''e.g., the "free" value may be lower than reported - force these situations
  993.         ''into an "excess needed" situation, which is safer
  994.         IF free& = cost& THEN
  995.             free& = free& - 1
  996.             ExcessNeeded& = 1
  997.         END IF
  998.  
  999.         ReplaceListItem "DriveStatusText", 4, WINDRIVE$ + ":"
  1000.         ReplaceListItem "DriveStatusText", 5, STR$(cost& / 1024) + " K"
  1001.         ReplaceListItem "DriveStatusText", 6, STR$(free& / 1024) + " K"
  1002.     ELSE
  1003.         ReplaceListItem "DriveStatusText", 4, ""
  1004.         ReplaceListItem "DriveStatusText", 5, ""
  1005.         ReplaceListItem "DriveStatusText", 6, ""
  1006.     END IF
  1007.  
  1008. SETDRIVESTATUSEXIT:
  1009.     SetDriveStatus = result%
  1010. END FUNCTION
  1011.  
  1012.  
  1013. SUB DeinstFiles STATIC
  1014.  
  1015.     listLen% = GetListLength("DIRLIST")
  1016.     IF listLen% = 0 THEN
  1017.         GOTO DEINSTFILESEXIT
  1018.     END IF
  1019.  
  1020.      clearDirList% = 1
  1021.     clearNewDirList% = 1
  1022.     SetSymbolValue "BASE0$",destDir$
  1023.     FOR i% = listLen% TO 1 STEP -1
  1024.         theDir$ = GetListItem("DIRLIST",i%)
  1025.         IF theDir$ <> "" THEN
  1026.             theNewDir$ = GetListItem("NEWDIRLIST",i%)
  1027.             IF theNewDir$ <> "" THEN
  1028.                 result% = DeleteDirectory(theDir$,1)
  1029.                 IF result% = 1 THEN
  1030.                     clearNewDirList% = 0
  1031.                 ELSE
  1032.                     ReplaceListItem "DIRLIST",i%,""
  1033.                 END IF
  1034.             ELSE
  1035.                 clearDirList% = 0
  1036.                 IF filesInstalled% = 1 THEN
  1037.                     junk% = DeinstallFiles(InstantString(theDir$),szInf$,theDir$,0)
  1038.                 END IF
  1039.             END IF
  1040.         END IF
  1041.     NEXT
  1042.     RemoveSymbol "BASE0$"
  1043.     IF clearNewDirList% = 1 THEN
  1044.         RemoveSymbol "NEWDIRLIST"
  1045.         IF clearDirList% = 1 THEN
  1046.             RemoveSymbol "DIRLIST"
  1047.         END IF
  1048.     END IF
  1049.  
  1050.     filesInstalled% = 0
  1051.  
  1052. DEINSTFILESEXIT:
  1053. END SUB
  1054.  
  1055.  
  1056. FUNCTION ParseCommand (commFlag$) STATIC AS STRING
  1057.  
  1058.     ParseCommand = ""
  1059.  
  1060.     a% = INSTR(COMMAND$,"/"+commFlag$)
  1061.     IF a% = 0 THEN
  1062.         GOTO PARSECOMMANDEXIT
  1063.     END IF
  1064.  
  1065.     b% = INSTR(a%+1,COMMAND$,"/")
  1066.     IF b% > 0 THEN
  1067.         temp$ = MID$(COMMAND$,a%,b%-a%)
  1068.         C$ = MID$(COMMAND$,b%)
  1069.     ELSE
  1070.         temp$ = MID$(COMMAND$,a%)
  1071.         C$ = ""
  1072.     END IF
  1073.     IF a% > 1 THEN
  1074.         D$ = MID$(COMMAND$,1,a%-1)
  1075.     ELSE
  1076.         D$ = ""
  1077.     END IF
  1078.     COMMAND$ = D$+C$
  1079.     ParseCommand = RTRIM$(LTRIM$(MID$(temp$,3)))
  1080.  
  1081. PARSECOMMANDEXIT:
  1082. END FUNCTION
  1083.  
  1084.  
  1085. SUB DoRegistrations STATIC
  1086.  
  1087.     MakeListFromSectionKeys "REGLIST","REGEDIT"
  1088.     listLen% = GetListLength("REGLIST")
  1089.     IF listLen% = 0 THEN
  1090.         GOTO DOREGISTRATIONSEXIT
  1091.     END IF
  1092.  
  1093.     FOR i%=1 TO listLen% STEP 1
  1094.         key$ = GetListItem("REGLIST",i%)
  1095.         keyValue$ = GetIniKeyString(szInf$,"REGEDIT",""""+key$+"""")
  1096.  
  1097.         IF INSTR(LEN(sourceDir$),destDir$,"\") > 0 THEN
  1098.             tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  1099.         ELSE
  1100.             tempString$ = destDir$
  1101.         END IF
  1102.         SetSymbolValue "INSTALLTODIR$",tempString$
  1103.         IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  1104.             tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  1105.         ELSE
  1106.             tempString$ = sourceDir$
  1107.         END IF
  1108.         SetSymbolValue "INSTALLFROMDIR$",tempString$
  1109.         SetSymbolValue "WINDOWS$",MID$(GetWindowsDir(),1,LEN(GetWindowsDir())-1)
  1110.         SetSymbolValue "WINSYS$",MID$(GetWindowsSysDir(),1,LEN(GetWindowsSysDir())-1)
  1111.  
  1112.         CreateRegKey key$
  1113.         CreateRegKeyValue key$,InstantString(keyValue$)
  1114.     NEXT
  1115.  
  1116. DOREGISTRATIONSEXIT:
  1117. END SUB
  1118.