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