home *** CD-ROM | disk | FTP | other *** search
/ Odyssee des Zoombinis / ZOOMBINI.bin / pc / setup.deu / bbinstal.mst < prev    next >
Text File  |  1995-07-10  |  31KB  |  1,102 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$ = "Installationsprogramm fⁿr "+GetIniKeyString(cfgFile$, "product", "ProductName")
  172. ''        prodName$ = "Installer for "+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$ = "Nicht spezifiziertes Produkt"
  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("Das Windows-Laufwerk ('"+WINDRIVE$+"') ist kein gⁿltiges Laufwerk.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  251. ''        i% = DoMsgBox("Windows drive ('"+WINDRIVE$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  252.         GOTO QUIT
  253.     END IF
  254. '$ENDIF ''DEBUG
  255.  
  256.  
  257. WELCOME:
  258.     SetSymbolValue "CENTERWINDOW", "BOTH"
  259.     SetSymbolValue "OFFSETVERTPERC", "-10"
  260.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  261.     IF sz$ = "CONTINUE" THEN
  262.           UIPop 1
  263.     ELSE
  264.         GOSUB ASKQUIT
  265.         GOTO WELCOME
  266.     END IF
  267.  
  268. WAVESELECT:
  269.     IF waveNeeded% = 0 THEN
  270.         GOTO WAVESELECTEND
  271.     END IF
  272.  
  273.     waveCount% = GetDriverCount("wave")
  274.     IF waveCount% > 0 THEN
  275.         GOTO WAVESELECTEND
  276.     END IF
  277.  
  278.     sz$ = UIStartDlg(CUIDLL$,NOWAVEWARN,"FInfoDlgProc",APPHELP,HELPPROC$)
  279.     IF sz$ = "CONTINUE" THEN
  280.         UIPop 1
  281.         AddListItem "IncompleteInstall", "In Ihrem System sind keine Wave-Treiber installiert."
  282. ''        AddListItem "IncompleteInstall", "Your system has no wave drivers installed."
  283.         GOTO WAVESELECTEND
  284.     ELSE
  285.         GOSUB ASKQUIT
  286.         GOTO WAVESELECT
  287.     END IF
  288. WAVESELECTEND:
  289.  
  290.  
  291. MIDISELECT:
  292.     IF midiNeeded% = 0 THEN
  293.         GOTO MIDISELECTEND
  294.     END IF
  295.  
  296.     midiCount% = GetDriverCount("midi")
  297.     IF midiCount% > 0 THEN
  298.         IF cmdLine$ <> "" THEN
  299.             cmdLine$ = cmdLine$+";"
  300.             cmdLine$ = cmdLine$+midiCmdLine$
  301.         ELSE
  302.           cmdLine$ = midiCmdLine$
  303.         END IF
  304.         GOTO MIDISELECTEND
  305.     END IF
  306.  
  307.     sz$ = UIStartDlg(CUIDLL$,NOMIDIWARN,"FInfoDlgProc",APPHELP,HELPPROC$)
  308.     IF sz$ = "CONTINUE" THEN
  309.         UIPop 1
  310. ''        AddListItem "IncompleteInstall", "Your system has no MIDI drivers installed."
  311.         AddListItem "IncompleteInstall", "In Ihrem System sind keine MIDI-Treiber installiert."
  312. ''        cmdLine$ = ""
  313.         GOTO MIDISELECTEND
  314.     ELSE
  315.         GOSUB ASKQUIT
  316.         GOTO MIDISELECT
  317.     END IF
  318. MIDISELECTEND:
  319.  
  320.  
  321. QTWSELECT:
  322.     IF qtwNeeded% = 0 THEN
  323.         GOTO QTWSELECTEND
  324.     ENDIF
  325.  
  326.     verString$ = GetVersionOfFile(GetWindowsSysDir+"QTIM.DLL")
  327.     IF verString$ < qtwVersion$ THEN
  328.         IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  329.         ELSE
  330.             qtwCmdLine95$ = GetIniKeyString(cfgFile$,"quicktime","qtw95CmdLine")
  331.             IF qtwCmdLine$ <> "" THEN
  332.              qtwCmdLine$ = qtwCmdLine$+";"+qtwCmdLine95$
  333.             END IF
  334.         END IF
  335.     ELSE
  336.         qtwCmdLine$ = ""
  337.         GOTO QTWSELECTEND
  338.     END IF
  339.  
  340.     IF cmdLine$ <> "" THEN
  341.         cmdLine$ = cmdLine$+";"
  342.         cmdLine$ = cmdLine$+qtwCmdLine$
  343.     ELSE
  344.         cmdLine$ = qtwCmdLine$
  345.     END IF
  346. QTWSELECTEND:
  347.  
  348.  
  349. CUSTINST:
  350.     result% = SetDriveStatus(1)
  351.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  352.  
  353.     IF sz$ = "CONTINUE" THEN
  354.         ''Install only if it will fit.
  355.         IF ExcessNeeded& > 0 THEN
  356.             GOSUB TOOBIG
  357.             GOTO CUSTINST
  358.         END IF
  359.         UIPop 1
  360.     ELSEIF sz$ = "PATH" THEN
  361.         GOTO GETPATH
  362.     ELSEIF sz$ = "REACTIVATE" THEN
  363.         GOTO CUSTINST
  364.     ELSEIF sz$ = "EXIT" THEN
  365.         GOSUB ASKQUIT
  366.         GOTO CUSTINST
  367.     ELSEIF sz$ = "BACK" THEN
  368.         UIPop 1
  369.         GOTO WELCOME
  370.     ELSE
  371.         GOSUB ASKQUIT
  372.         GOTO CUSTINST
  373.     END IF
  374.     result% = SetDriveStatus(0)
  375.     IF result% = 1 THEN
  376.         GOTO CUSTINST
  377.     END IF
  378.  
  379.  
  380.     IF fontsToInstall% = 0 THEN
  381.         GOTO GETWINIBKUPEND
  382.     END IF
  383. GETWINIBKUP:
  384.     SetSymbolValue "EditTextIn", winIniBkpFile$
  385.     SetSymbolValue "EditFocus", "END"
  386. GETWINIBKUPL1:
  387.     sz$ = UIStartDlg(CUIDLL$, WININIBACKUP, "FEditDlgProc", APPHELP, HELPPROC$)
  388.     winIniBkpFile$ = GetWindowsDir()+GetSymbolValue("EditTextOut")
  389.  
  390.     IF sz$ = "CONTINUE" THEN
  391.         UIPop 1
  392.     ELSEIF sz$ = "REACTIVATE" THEN
  393.         GOTO GETWINIBKUPL1
  394.     ELSEIF sz$ = "BACK" THEN
  395.         UIPop 1
  396.         GOTO CUSTINST
  397.     ELSE
  398.         GOSUB ASKQUIT
  399.         GOTO GETWINIBKUP
  400.     END IF
  401.  
  402.     CopyFile GetWindowsDir()+"WIN.INI", winIniBkpFile$, cmoOverwrite, 0
  403. GETWINIBKUPEND:
  404.  
  405.  
  406.     ''BEGIN INSTALLATION PROCESS
  407.     listLen% = GetListLength("NEWDIRLIST")
  408.     SetSymbolValue "BASE0$",destDir$
  409.     FOR i% = 1 TO listLen% STEP 1
  410.         theDir$ = InstantString(GetListItem("NEWDIRLIST",i%))
  411.         IF theDir$ <> "" THEN
  412.             CreateDir theDir$, cmoVital
  413.             ReplaceListItem "DIRLIST",i%,theDir$
  414.         END IF
  415.     NEXT
  416.     RemoveSymbol "BASE0$"
  417.  
  418.     IF logFile$ <> "" THEN
  419.         IF build$ = "" THEN
  420.             logFile$ = MakePath(destDir$, "LOGFILE.OUT")
  421.         END IF
  422.         OpenLogFile logFile$, 0
  423. ''        WriteToLogFile "  Destination directory: '" + destDir$ + "'"
  424.         WriteToLogFile "  Zielverzeichnis: '" + destDir$ + "'"
  425.      END IF
  426.  
  427.     ''INSTALL FILES
  428.     filesInstalled% = 1
  429.     CopyFilesInCopyList
  430.     ClearCopyList
  431.  
  432.  
  433.     IF build$ = "" THEN
  434.         IF cfgFile$ <> "" THEN
  435.             ''COPY INSTALLER CONFIG FILE TO DEST DIR, AND UPDATE WITH RUNTIME INFO
  436.             SPLITPATH szInf$,bDrive$,bDir$,bFile$,bExt$
  437.             destCfgFile$ = MakePath(destDir$,bFile$+".CFG")
  438.             CopyFile cfgFile$, destCfgFile$, cmoOverwrite, 0
  439.  
  440.           ''[directories] section contains directory listings with no trailing \
  441.             IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  442.                 tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  443.             ELSE
  444.                 tempString$ = sourceDir$
  445.             END IF
  446.             CreateIniKeyValue destCfgFile$,"directories","InstallFromDir",tempString$, cmoOverwrite
  447.             IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  448.                 tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  449.             ELSE
  450.                 tempString$ = destDir$
  451.             END IF
  452.             CreateIniKeyValue destCfgFile$,"directories","InstallToDir",tempString$, cmoOverwrite
  453.  
  454.         ''[install] section contains directory listings with a trailing \
  455.             IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  456.                 tempString$ = sourceDir$
  457.             ELSE
  458.                 tempString$ = sourceDir$+"\"
  459.             END IF
  460.             CreateIniKeyValue destCfgFile$,"install","InstallFromDir",tempString$, cmoOverwrite
  461.  
  462.             IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  463.                 tempString$ = destDir$
  464.             ELSE
  465.                 tempString$ = destDir$+"\"
  466.             END IF
  467.             CreateIniKeyValue destCfgFile$,"install","InstallToDir",tempString$, cmoOverwrite
  468.  
  469.             CreateIniKeyValue destCfgFile$, "install","InstallFromDrive", MID$(sourceDir$,1,1), cmoOverwrite
  470.             CreateIniKeyValue destCfgFile$, "install","InstallToDrive", MID$(destDir$,1,1), cmoOverwrite
  471.         ELSE
  472.             destCfgFile$ = ""
  473.         END IF
  474.     ELSEIF destCfgFile$ <> "" THEN
  475.         CreateIniKeyValue destCfgFile$,"directories","MediaBuildDir",destDir$,cmoOverwrite
  476.     END IF
  477.  
  478.     ''INSTALL FONTS - IF NECESSARY
  479.     IF fontsToInstall% = 0 THEN
  480.         GOTO FONTINSTALLEND
  481.     END IF
  482. FONTINSTALL:
  483.     fontInstallError% = InstallFonts(destDir$,destCfgFile$,winIniBkpFile$)
  484.     IF fontInstallError% > 0 THEN
  485.         sz$ = UIStartDlg(CUIDLL$, FONTERROR, "FQuitDlgProc", 0, "")
  486.         IF sz$ = "EXIT" THEN
  487.             UIPopAll
  488.             ERROR STFQUIT
  489.         ELSEIF sz$ = "REACTIVATE" THEN
  490.             GOTO FONTINSTALL
  491.         ELSE
  492.             UIPop 1
  493.         END IF
  494.         AddListItem "IncompleteInstall", "Die Schriftarten fⁿr dieses Produkt sind nicht korrekt installiert."
  495. ''        AddListItem "IncompleteInstall", "Fonts are not installed correctly for this product."
  496.     END IF
  497.     fontsInstalled% = 1
  498. FONTINSTALLEND:
  499.  
  500.  
  501.     ''INSTALL PROGRAM GROUP AND PROGRAM GROUP ITEMS
  502.      IF build$ = "" THEN
  503.         progGroup$ = GetIniKeyString(destCfgFile$,"proggroup","groupname")
  504.         CreateProgmanGroup progGroup$,"",cmoVital
  505.         IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  506.             anerror% = PGInstall(destCfgFile$,1,1)
  507.         ELSE
  508.             anerror% = PGInstall(destCfgFile$,1,6)
  509.         END IF
  510.     END IF
  511.  
  512.     IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  513.         varTable$ = "INSTALLFROMDIR|"+MID$(sourceDir$,1,LEN(sourceDir$)-1)
  514.     ELSE
  515.         varTable$ = "INSTALLFROMDIR|"+sourceDir$
  516.     END IF
  517.     IF destDir$ <> "" THEN
  518.         IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  519.             varTable$ = varTable$+"|INSTALLTODIR|"+MID$(destDir$,1,LEN(destDir$)-1)
  520.         ELSE
  521.             varTable$ = varTable$+"|INSTALLTODIR|"+destDir$
  522.         END IF
  523.     END IF
  524.  
  525.     result% = CreateRegEntries(cfgFile$,MakePath(destDir$,"install.log"),varTable$,"|")
  526.     ''DoRegistrations
  527.  
  528.     IF logFile$ <> "" THEN
  529.         CloseLogFile
  530.     END IF
  531.  
  532.  
  533. QUIT:
  534.     ON ERROR GOTO ERRQUIT
  535.  
  536.     IF ERR = 0 THEN
  537.         GOTO GOODQUIT
  538.     ELSE
  539.         GOTO BADQUIT
  540.     ENDIF
  541.  
  542. GOODQUIT:
  543.     IF GetListLength("IncompleteInstall") THEN
  544.         SetSymbolValue "ListItemsIn", ""
  545.         FOR i% = 1 TO GetListLength("IncompleteInstall") STEP 1
  546.             AddListItem "ListItemsIn", GetListItem("IncompleteInstall",i%)
  547.         NEXT
  548. INCOMPLETEQUITL1:
  549.         sz$ = UIStartDlg(CUIDLL$,EXITINCOMPLETE,"FList0DlgProc",0,"")
  550.         IF sz$ = "REACTIVATE" THEN
  551.             GOTO INCOMPLETEQUITL1
  552.         END IF
  553.         UIPop 1
  554.         GOTO ENDINSTALL
  555.     ELSEIF cmdLine$ = "" THEN
  556. GOODQUITL0:
  557.         sucComID$ = LTRIM$(STR$(SUCCESSCOMMENT))
  558.         AddListItem "VarStringID", sucComID$
  559.         IF sucCom$ = "" THEN
  560. ''            sucCom$ = "Have Fun!"
  561.             sucCom$ = "Viel Spa▀!"
  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$ = "Drⁿcken Sie OK, um fortzufahren"
  622. ''        chainTxt$ = "Press OK to continue"
  623.     ELSE
  624. ''        chainTxt$ = "Please refer to the documentation for instructions on how to do this."
  625.         chainTxt$ = "Lesen Sie in der Dokumentation die entsprechenden Anweisungen."
  626.     END IF
  627.  
  628.     SetSymbolValue chainID$,chainTxt$
  629.  
  630.     sz$ = UIStartDlg(CUIDLL$,dlg%,"FList0DlgProc",0,"")
  631.     IF sz$ = "REACTIVATE" THEN
  632.         GOTO GOODQUITL1
  633.     END IF
  634.     UIPop 1
  635. ENDINSTALL:
  636.     END
  637.  
  638. BADQUIT:
  639.     IF ERR = STFQUIT THEN
  640.         dlg% = EXITQUIT
  641.     ELSE
  642.         dlg% = EXITFAILURE
  643.     END IF
  644.     DeinstFiles
  645. BADQUITL1:
  646.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  647.     IF sz$ = "REACTIVATE" THEN
  648.         GOTO BADQUITL1
  649.     END IF
  650.     UIPop 1
  651.     END
  652.  
  653. ERRQUIT:
  654.     DeinstFiles
  655.     i% = DoMsgBox("Die Setup-Quellen sind beschΣdigt. Rufen Sie die Nummer 555-1212 an!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  656. ''    i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  657.     END
  658.  
  659.  
  660. TOOBIG:
  661.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  662.     IF sz$ = "REACTIVATE" THEN
  663.         GOTO TOOBIG
  664.     END IF
  665.     UIPop 1
  666.     RETURN
  667.  
  668.  
  669.  
  670. BADPATH:
  671.      sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  672.     IF sz$ = "REACTIVATE" THEN
  673.         GOTO BADPATH
  674.     END IF
  675.     UIPop 1
  676.     RETURN
  677.  
  678.  
  679.  
  680. ASKQUIT:
  681.     SetSymbolValue "OFFSETVERTPERC", "-20"
  682.     SetSymbolValue "OFFSETHORZPERC", "10"
  683.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  684.     RemoveSymbol "OFFSETHORZPERC"
  685.     SetSymbolValue "OFFSETVERTPERC", "-10"
  686.  
  687.     IF sz$ = "EXIT" THEN
  688.         UIPopAll
  689.         ERROR STFQUIT
  690.     ELSEIF sz$ = "REACTIVATE" THEN
  691.         GOTO ASKQUIT
  692.     ELSE
  693.         UIPop 1
  694.     END IF
  695.     RETURN
  696.  
  697.  
  698. GETPATH:
  699.     SetSymbolValue "EditTextIn", destDir$
  700.     SetSymbolValue "EditFocus", "END"
  701. GETPATHL1:
  702.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  703.  
  704.     IF sz$ = "CONTINUE" THEN
  705.         olddest$ = destDir$
  706.         destDir$ = GetSymbolValue("EditTextOut")
  707.  
  708.         ''Validate new path.
  709.         IF IsDirWritable(destDir$) = 0 THEN
  710.             GOSUB BADPATH
  711.             GOTO GETPATHL1
  712.         END IF
  713.         UIPop 1
  714.  
  715.         ''Truncate display if too long.
  716.         IF LEN(destDir$) > 23 THEN
  717.             ReplaceListItem "DriveStatusText", 7, MID$(destDir$, 1, 23)+"..."
  718.         ELSE
  719.             ReplaceListItem "DriveStatusText", 7, destDir$
  720.         END IF
  721.  
  722.         olddest$ = ""
  723.  
  724.         result% = SetDriveStatus(1)
  725.         GOTO CUSTINST
  726.     ELSEIF sz$ = "REACTIVATE" THEN
  727.         GOTO GETPATHL1
  728.     ELSEIF sz$ = "EXIT" THEN
  729.         GOSUB ASKQUIT
  730.         GOTO GETPATHL1
  731.      ELSEIF sz$ = "BACK" THEN
  732.         UIPop 1
  733.         GOTO CUSTINST
  734.     ELSE
  735.         UIPop 1
  736.         GOTO CUSTINST
  737.     END IF
  738.  
  739.  
  740.  
  741. '**
  742. '** Purpose:
  743. '**     Appends a file name to the end of a directory path,
  744. '**     inserting a backslash character as needed.
  745. '** Arguments:
  746. '**     szDir$  - full directory path (with optional ending "\")
  747. '**     szFile$ - filename to append to directory
  748. '** Returns:
  749. '**     Resulting fully qualified path name.
  750. '*************************************************************************
  751. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  752.     IF szDir$ = "" THEN
  753.         MakePath = szFile$
  754.     ELSEIF szFile$ = "" THEN
  755.         MakePath = szDir$
  756.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  757.         MakePath = szDir$ + szFile$
  758.     ELSE
  759.         MakePath = szDir$ + "\" + szFile$
  760.     END IF
  761. END FUNCTION
  762.  
  763.  
  764. FUNCTION InstantString (varStr$) STATIC AS STRING
  765.  
  766.     newStr$ = ""
  767.  
  768.     strLen% = LEN(varStr$)
  769.     IF strLen = 0 THEN
  770.         GOTO INSTANTSTRINGEXIT
  771.     END IF
  772.  
  773.     strHead% = 1
  774.     WHILE (strHead% > 0)
  775.         dollarPos1% = INSTR(strHead%,varStr$,"$")
  776.         IF dollarPos1% > 0 THEN
  777.             newStr$ = newStr$+MID$(varStr$,strHead%,dollarPos1%-strHead%)
  778.             dollarPos2% = INSTR(dollarPos1% + 1,varStr$,"$")
  779.             IF dollarPos2% > 0 THEN
  780.                 var$ = MID$(varStr$,dollarPos1% + 1,dollarPos2% - dollarPos1%)
  781.                 strHead% = dollarPos2%+1
  782.                 IF strHead% > LEN(varStr$) THEN
  783.                     strHead% = 0
  784.                 END IF
  785.             ELSE
  786.                 var$ = MID$(varStr$,dollarPos1% + 1)
  787.                 strHead% = 0
  788.             END IF
  789.  
  790.             newStr$ = newStr$+GetSymbolValue(UCASE$(var$))
  791.         ELSE
  792.             newStr$ = newStr$+MID$(varStr$,strHead%)
  793.             strHead% = 0
  794.         END IF
  795.     WEND
  796.  
  797. INSTANTSTRINGEXIT:
  798.     InstantString = newStr$
  799.  
  800. END FUNCTION
  801.  
  802.  
  803. FUNCTION AddDirToCopyList(theFile$,dir$,srcDir$,dstDir$,silent%) STATIC AS INTEGER
  804.  
  805.     result% = 0
  806.  
  807.     IF srcDir$ = "" THEN
  808.         GOTO ADDDIRTOCOPYLISTEXIT
  809.     END IF
  810.  
  811.     IF dstDir$ = "" THEN
  812.         GOTO ADDDIRTOCOPYLISTEXIT
  813.     END IF
  814.  
  815.     baseSym$ = MID$(dir$,2,6)
  816. subStrStart% = INSTR(srcDir$,"\SETUP")
  817. IF subStrStart% <> 0 THEN
  818.     srcDir$ = MID$(srcDir$,1,subStrStart%)
  819. END IF
  820.     SetSymbolValue baseSym$,srcDir$
  821.     newSrcDir$ = InstantString(dir$)
  822.     SetSymbolValue baseSym$,dstDir$
  823.     newDstDir$ = InstantString(dir$)
  824.  
  825.     IF dir$ = "$BASE0$" THEN
  826. ''    IF MID$(dir$,1,1) = "$" AND LEN(dir$) = 7 THEN
  827.         RemoveSymbol "DIRLIST"
  828.         RemoveSymbol "NEWDIRLIST"
  829.     END IF
  830.  
  831.     IF DoesDirExist(newDstDir$) = 0 THEN
  832.         AddListItem "DIRLIST",""
  833.         AddListItem "NEWDIRLIST",dir$
  834.     ELSE
  835.         AddListItem "DIRLIST",dir$
  836.         AddListItem "NEWDIRLIST",""
  837.     END IF
  838.  
  839.     IF DoesIniSectionExist(theFile$,dir$) = 1 THEN
  840.         IF silent% = 0 THEN
  841.             i% = 0
  842.             key$ = "f"+RTRIM$(LTRIM$(STR$(i%)))
  843.             curFile$ = GetIniKeyString(theFile$,dir$,""""+key$+"""")
  844.             curFile$ = GetNthFieldFromIniString(curFile$,2)
  845.             halt% = 0
  846.  
  847.             SetSymbolValue "CENTERWINDOW", "BOTH"
  848.  
  849.             WHILE curFile$ <> "" AND halt% = 0
  850.                 fileExists% = DoesFileExist(newDstDir$+"\"+curFile$,femExists)
  851.                 IF fileExists% = 1 AND replaceAll% = 0 THEN
  852.                     SetSymbolValue filePathID$,newDstDir$+"\"+curFile$
  853.                     sz$ = UIStartDlg(CUIDLL$, DUPFILE, "FInfoDlgProc", 0, "")
  854.                     IF sz$ = "CONTINUE" THEN ''this translates to "replace"
  855.                         AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  856.                     ELSEIF sz$ = "EXIT" THEN ''this translates to "replace ALL"
  857.                         AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  858.                         replaceAll% = 1
  859.                     ELSEIF sz$ = "CANCEL" THEN ''this translates to "stop"
  860.                         halt% = 1
  861.                         result% = 1
  862.                         UIPop 1
  863.                         GOTO ADDDIRTOCOPYLISTEXIT
  864.                     END IF
  865.                     UIPop 1
  866.                 ELSE
  867.                     AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  868.                 END IF
  869.  
  870.                 i% = i% + 1
  871.                 key$ = "f"+RTRIM$(LTRIM$(STR$(i%)))
  872.                 curFile$ = GetIniKeyString(theFile$,dir$,""""+key$+"""")
  873.                 curFile$ = GetNthFieldFromIniString(curFile$,2)
  874.             WEND
  875.         ELSE
  876.             AddSectionFilesToCopyList dir$,newSrcDir$,newDstDir$
  877.         END IF
  878.     END IF
  879.  
  880.     IF DoesIniSectionExist(theFile$,dir$+"\") = 1 THEN
  881.         subDirStr$ = GetIniKeyString(theFile$,dir$+"\","""subdirs""")
  882.         i% = 1
  883.         subDir$ = GetNthFieldFromIniString(subDirStr$,i%)
  884.         WHILE subDir$ <> ""
  885.             subDir$ = dir$+"\"+subDir$
  886.             result% = AddDirToCopyList(theFile$,subDir$,srcDir$,dstDir$,silent%)
  887.             IF result% = 1 THEN
  888.                 GOTO ADDDIRTOCOPYLISTEXIT
  889.             END IF
  890.             i% = i% + 1
  891.             subDir$ = GetNthFieldFromIniString(subDirStr$,i%)
  892.         WEND
  893.     END IF
  894.  
  895. ADDDIRTOCOPYLISTEXIT:
  896.     AddDirToCopyList = result%
  897. END FUNCTION
  898.  
  899.  
  900. FUNCTION SetDriveStatus(silent%) STATIC AS INTEGER
  901.  
  902. ''Drive Status Text fields:
  903. ''    1:    installation drive
  904. ''    2:    install drive space required
  905. ''    3:    install drive space available
  906. ''    4:    Windows drive
  907. ''    5:    Windows drive space required
  908. ''    6:    Windows drive space available
  909. ''    7:    Installation path
  910.  
  911.     result% = 0
  912.  
  913.     ''CALCULATE COSTS
  914.     ClearCopyList
  915.     replaceAll% = 0
  916.     result% = AddDirToCopyList (szInf$,"$BASE0$",sourceDir$,destDir$,silent%)
  917.     IF result% = 1 THEN
  918.         ClearCopyList
  919.         GOTO SETDRIVESTATUSEXIT
  920.     END IF
  921.  
  922.     ''ADD FILES DESTINED FOR THE WINDOWS DIRECTORY
  923.     ''SPECIAL NOTE: THIS CRAPPY MSSETUP CAN'T DEAL WITH THE PATH WINDOWS\SYSTEM,
  924.     ''SO FILES DESTINED FOR THE WINDOWS\SYSTEM DIRECTORY SHOULD BE INCLUDED HERE
  925.     IF wingNeeded% = 1 THEN
  926.         IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  927.             AddSectionFilesToCopyList "$WINDOWS$",sourceDir$,GetWindowsDir()
  928.         END IF
  929.     END IF
  930.  
  931.     i% = 0
  932.     tmpSrcDirStr$ = srcDirStr$
  933.     WHILE tmpSrcDirStr$ <> ""
  934.         temp% = INSTR(tmpSrcDirStr$,",")
  935.         IF temp% > 0 THEN
  936.             curSrcDir$ = MID$(tmpSrcDirStr$,1,temp%-1)
  937.             tmpSrcDirStr$ = MID$(tmpSrcDirStr$,temp%+1)
  938.         ELSE
  939.             curSrcDir$ = MID$(tmpSrcDirStr$,1)
  940.             tmpSrcDirStr$ = ""
  941.         END IF
  942.         i% = i% + 1
  943.         baseStr$ = "$BASE"+RTRIM$(LTRIM$(STR$(i%)))+"$"
  944.         result% = AddDirToCopyList (szInf$,baseStr$,curSrcDir$,destDir$,silent%)
  945.         IF result% = 1 THEN
  946.             ClearCopyList
  947.             GOTO SETDRIVESTATUSEXIT
  948.         END IF
  949.     WEND
  950.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  951. ''    ReplaceListItem "ExtraCosts", ndrive%, "10240"
  952.     ReplaceListItem "ExtraCosts", ndrive%, RTRIM$(LTRIM$(STR$(GetNetPGSize(cfgFile$))))
  953.  
  954.     ExcessNeeded& = GetCopyListCost("ExtraCosts", "AppNeeds", "")
  955.  
  956.     drive$ = MID$(destDir$, 1, 1)
  957.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  958.  
  959.     cost& = VAL(GetListItem("AppNeeds", ndrive%))
  960.     IF cost& < 0 THEN
  961.         cost& = 0
  962.     END IF
  963.     free& = GetFreeSpaceForDrive(drive$)
  964.     IF free& < 0 THEN
  965.         free& = 0
  966.     END IF
  967.  
  968.     ReplaceListItem "DriveStatusText", 1, drive$ + ":"
  969.     ReplaceListItem "DriveStatusText", 2, STR$(cost& / 1024) + " K"
  970.     ReplaceListItem "DriveStatusText", 3, STR$(free& / 1024) + " K"
  971.  
  972.     IF drive$ <> WINDRIVE$ THEN
  973.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  974.         cost& = VAL(GetListItem("AppNeeds", ndrive%))
  975.         IF cost& < 0 THEN
  976.             cost& = 0
  977.         END IF
  978.     ELSE
  979.         cost& = 0
  980.     END IF
  981.     IF cost& <> 0 THEN
  982.         free& = GetFreeSpaceForDrive(WINDRIVE$)
  983.         ReplaceListItem "DriveStatusText", 4, WINDRIVE$ + ":"
  984.         ReplaceListItem "DriveStatusText", 5, STR$(cost& / 1024) + " K"
  985.         ReplaceListItem "DriveStatusText", 6, STR$(free& / 1024) + " K"
  986.     ELSE
  987.         ReplaceListItem "DriveStatusText", 4, ""
  988.         ReplaceListItem "DriveStatusText", 5, ""
  989.         ReplaceListItem "DriveStatusText", 6, ""
  990.     END IF
  991.  
  992. SETDRIVESTATUSEXIT:
  993.     SetDriveStatus = result%
  994. END FUNCTION
  995.  
  996.  
  997. SUB DeinstFiles STATIC
  998.  
  999.     listLen% = GetListLength("DIRLIST")
  1000.     IF listLen% = 0 THEN
  1001.         GOTO DEINSTFILESEXIT
  1002.     END IF
  1003.  
  1004.      clearDirList% = 1
  1005.     clearNewDirList% = 1
  1006.     SetSymbolValue "BASE0$",destDir$
  1007.     FOR i% = listLen% TO 1 STEP -1
  1008.         theDir$ = GetListItem("DIRLIST",i%)
  1009.         IF theDir$ <> "" THEN
  1010.             theNewDir$ = GetListItem("NEWDIRLIST",i%)
  1011.             IF theNewDir$ <> "" THEN
  1012.                 result% = DeleteDirectory(theDir$,1)
  1013.                 IF result% = 1 THEN
  1014.                     clearNewDirList% = 0
  1015.                 ELSE
  1016.                     ReplaceListItem "DIRLIST",i%,""
  1017.                 END IF
  1018.             ELSE
  1019.                 clearDirList% = 0
  1020.                 IF filesInstalled% = 1 THEN
  1021.                     junk% = DeinstallFiles(InstantString(theDir$),szInf$,theDir$,0)
  1022.                 END IF
  1023.             END IF
  1024.         END IF
  1025.     NEXT
  1026.     RemoveSymbol "BASE0$"
  1027.     IF clearNewDirList% = 1 THEN
  1028.         RemoveSymbol "NEWDIRLIST"
  1029.         IF clearDirList% = 1 THEN
  1030.             RemoveSymbol "DIRLIST"
  1031.         END IF
  1032.     END IF
  1033.  
  1034.     filesInstalled% = 0
  1035.  
  1036. DEINSTFILESEXIT:
  1037. END SUB
  1038.  
  1039.  
  1040. FUNCTION ParseCommand (commFlag$) STATIC AS STRING
  1041.  
  1042.     ParseCommand = ""
  1043.  
  1044.     a% = INSTR(COMMAND$,"/"+commFlag$)
  1045.     IF a% = 0 THEN
  1046.         GOTO PARSECOMMANDEXIT
  1047.     END IF
  1048.  
  1049.     b% = INSTR(a%+1,COMMAND$,"/")
  1050.     IF b% > 0 THEN
  1051.         temp$ = MID$(COMMAND$,a%,b%-a%)
  1052.         C$ = MID$(COMMAND$,b%)
  1053.     ELSE
  1054.         temp$ = MID$(COMMAND$,a%)
  1055.         C$ = ""
  1056.     END IF
  1057.     IF a% > 1 THEN
  1058.         D$ = MID$(COMMAND$,1,a%-1)
  1059.     ELSE
  1060.         D$ = ""
  1061.     END IF
  1062.     COMMAND$ = D$+C$
  1063.     ParseCommand = RTRIM$(LTRIM$(MID$(temp$,3)))
  1064.  
  1065. PARSECOMMANDEXIT:
  1066. END FUNCTION
  1067.  
  1068.  
  1069. SUB DoRegistrations STATIC
  1070.  
  1071.     MakeListFromSectionKeys "REGLIST","REGEDIT"
  1072.     listLen% = GetListLength("REGLIST")
  1073.     IF listLen% = 0 THEN
  1074.         GOTO DOREGISTRATIONSEXIT
  1075.     END IF
  1076.  
  1077.     FOR i%=1 TO listLen% STEP 1
  1078.         key$ = GetListItem("REGLIST",i%)
  1079.         keyValue$ = GetIniKeyString(szInf$,"REGEDIT",""""+key$+"""")
  1080.  
  1081.         IF INSTR(LEN(sourceDir$),destDir$,"\") > 0 THEN
  1082.             tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  1083.         ELSE
  1084.             tempString$ = destDir$
  1085.         END IF
  1086.         SetSymbolValue "INSTALLTODIR$",tempString$
  1087.         IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  1088.             tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  1089.         ELSE
  1090.             tempString$ = sourceDir$
  1091.         END IF
  1092.         SetSymbolValue "INSTALLFROMDIR$",tempString$
  1093.         SetSymbolValue "WINDOWS$",MID$(GetWindowsDir(),1,LEN(GetWindowsDir())-1)
  1094.         SetSymbolValue "WINSYS$",MID$(GetWindowsSysDir(),1,LEN(GetWindowsSysDir())-1)
  1095.  
  1096.         CreateRegKey key$
  1097.         CreateRegKeyValue key$,InstantString(keyValue$)
  1098.     NEXT
  1099.  
  1100. DOREGISTRATIONSEXIT:
  1101. END SUB
  1102.