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