home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today (UK) 9 / cdromtoday9-coverdisc.bin / memphis / setup.mst < prev    next >
Text File  |  1994-09-16  |  15KB  |  536 lines

  1. '**************************************************************************
  2. '*                       Memphis Math Installation and Setup
  3. '**************************************************************************
  4.  
  5. '$INCLUDE 'setupapi.inc'
  6. '$INCLUDE 'msdetect.inc'
  7.  
  8. ''Dialog ID's
  9. CONST ASKQUIT      = 200
  10. CONST DESTPATH     = 300
  11. CONST EXITFAILURE  = 400
  12. CONST EXITQUIT     = 600
  13. CONST EXITSUCCESS  = 700
  14. CONST OPTIONS      = 800
  15. CONST APPHELP      = 900
  16. CONST CUSTINST     = 6200
  17. CONST TOOBIG       = 6300
  18. CONST BADPATH      = 6400
  19.  
  20. ''Windows API include stuff
  21. CONST SW_SHOWMAXIMIZED = 3
  22.  
  23. DECLARE FUNCTION ShowWindow  LIB "user.exe" (hWnd%, iShow%) AS INTEGER
  24.  
  25. ''Bitmap ID
  26. CONST LOGO         = 1
  27.  
  28. ''File Types
  29. CONST MINIMAL      = 1
  30. CONST STANDARD     = 2
  31. CONST FULL         = 3
  32.  
  33. GLOBAL DEST$        ''Destination directory.
  34. GLOBAL RESDIR$            ''Resource files subdirectory.
  35. GLOBAL APPDIR$            ''Application files subdirectory
  36. GLOBAL DATADIR$            ''Data files subdirectory
  37. GLOBAL CTL3DDIR$        ''CTL3D source subdirectory
  38. GLOBAL SOURCE$            ''Source directory.
  39. GLOBAL PMGROUP$            ''Program manager group title
  40. GLOBAL WINDRIVE$    ''Windows drive letter.
  41. GLOBAL OPT1OPT$     ''Option selection from OptFiles1 option dialog.
  42. GLOBAL OPT2OPT$     ''Option selection from OptFiles2 option dialog.
  43.  
  44. ''CustInst list symbol names
  45. GLOBAL APPNEEDS$    ''Option list costs per drive
  46. GLOBAL RESNEEDS$
  47. GLOBAL REQNEEDS$
  48. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  49. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  50.  
  51. ''Dialog list symbol names
  52. GLOBAL CHECKSTATES$
  53. GLOBAL STATUSTEXT$
  54. GLOBAL DRIVETEXT$
  55.  
  56.  
  57. DECLARE SUB AddFilesToCopyList (ftype%)
  58. DECLARE SUB RecalcOptFiles (ftype%)
  59. DECLARE SUB RecalcPath
  60. DECLARE SUB SetDriveStatus
  61. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  62.  
  63. INIT:
  64.  
  65.         ''Maximize window
  66.         i1% = ShowWindow (HwndFrame (), SW_SHOWMAXIMIZED)
  67.  
  68.         ''initialize global variables
  69.         WINDRIVE$ = MID$ (GetWindowsDir, 1, 1)
  70.         SOURCE$ = GetSymbolValue ("STF_SRCDIR")
  71.         DEST$ = "C:\MEMPHIS"                                            ''default destination directory
  72.         RESDIR$ = "RESOURCE"                                            ''Resource files subdirectory.
  73.         APPDIR$ = ""                                                            ''Application files subdirectory
  74.         CTL3DDIR$ = "CTL3D"                                                ''CTL3D source subdirectory
  75.         DATADIR$ = "DATA"                                                    ''Data files subdirectory
  76.         PMGROUP$ = "WordPerfect Main Street"
  77.         CUIDLL$ = "mscuistf.dll"                           ''custom user interface dll
  78.         HELPPROC$ = "FHelpDlgProc"                      ''Help dialog procedure
  79.  
  80.         SetBitmap CUIDLL$, LOGO
  81.         SetTitle "Memphis Math Treasure of the Tombs Installation"
  82.  
  83.         szInf$ = GetSymbolValue("STF_SRCINFPATH")
  84.         IF szInf$ = "" THEN
  85.                 szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  86.         END IF
  87.         ReadInfFile szInf$
  88.  
  89.  
  90.         ''determine version requirements
  91.         MajorVer% = GetWindowsMajorVersion()
  92.         MinorVer% = GetWindowsMinorVersion()
  93.         IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
  94.             i% = DoMsgBox ("Microsoft Windows version 3.10 or greater is required for this software.  Please upgrade your version of Windows.", "Memphis Math Install", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  95.             END
  96.         END IF
  97.  
  98.         ''CustInst list symbols
  99.         CHECKSTATES$ = "CheckItemsState"
  100.         STATUSTEXT$  = "StatusItemsText"
  101.         DRIVETEXT$   = "DriveStatusText"
  102.  
  103.         AddListItem CHECKSTATES$, "ON"
  104.         AddListItem CHECKSTATES$, "OFF"
  105.         AddListItem CHECKSTATES$, "OFF"
  106.  
  107.         FOR i% = 1 TO 3 STEP 1
  108.                 AddListItem STATUSTEXT$, ""
  109.         NEXT i%
  110.         FOR i% = 1 TO 7 STEP 1
  111.                 AddListItem DRIVETEXT$, ""
  112.         NEXT i%
  113.         ReplaceListItem DRIVETEXT$, 7, DEST$
  114.  
  115.         ''Disk cost list symbols
  116.         APPNEEDS$   = "AppNeeds"
  117.         RESNEEDS$   = "ResourceNeeds"
  118.         REQNEEDS$   = "RequiredNeeds"
  119.         EXTRACOSTS$ = "ExtraCosts"
  120.         BIGLIST$    = "BigList"
  121.         FOR i% = 1 TO 3 STEP 1
  122.                 AddListItem BIGLIST$, ""
  123.         NEXT i%
  124.         FOR i% = 1 TO 26 STEP 1
  125.                 AddListItem EXTRACOSTS$, "0"
  126.         NEXT i%
  127.  
  128.         ''File Option Variables
  129.         OPT1OPT$ = "1"
  130.         OPT2OPT$ = "1"
  131.  
  132.         RecalcPath
  133.         SetDriveStatus
  134.  
  135. '$IFDEF DEBUG
  136.         i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  137. '$ENDIF ''DEBUG
  138.  
  139.  
  140.  
  141. CUSTINST:
  142.         sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  143.  
  144.         IF sz$ = "CONTINUE" THEN
  145.                 ''Install only if it will fit.
  146.                 FOR i% = 1 TO 3 STEP 1
  147.                         IF GetListItem(BIGLIST$, i%) <> "" THEN
  148.                                 GOSUB TOOBIG
  149.                                 GOTO CUSTINST
  150.                         END IF
  151.                 NEXT i%
  152.                 UIPop 1
  153.                 GOTO INSTALL
  154.         ELSEIF sz$ = "PATH" THEN
  155.                 GOTO GETPATH
  156.         ELSEIF sz$ = "CHK1" THEN
  157.                 RecalcPath
  158.                 RecalcOptFiles MINIMAL
  159.                 SetDriveStatus
  160.                 GOTO CUSTINST
  161.         ELSEIF sz$ = "CHK2" THEN
  162.                 RecalcPath
  163.                 RecalcOptFiles STANDARD
  164.                 SetDriveStatus
  165.                 GOTO CUSTINST
  166.         ELSEIF sz$ = "CHK3" THEN
  167.                 RecalcPath
  168.                 RecalcOptFiles FULL
  169.                 SetDriveStatus
  170.                 GOTO CUSTINST
  171.         ELSEIF sz$ = "REACTIVATE" THEN
  172.                 RecalcPath
  173.                 SetDriveStatus
  174.                 GOTO CUSTINST
  175.         ELSE
  176.                 GOSUB ASKQUIT
  177.                 GOTO CUSTINST
  178.         END IF
  179.  
  180.  
  181.  
  182. INSTALL:
  183.         ''Create directory structure
  184.         CreateDir DEST$, cmoNone            ''root
  185.  
  186.         SubDir$ = MakePath (DEST$, APPDIR$)
  187.         CreateDir SubDir$, cmoNone        ''application
  188.  
  189.         SubDir$ = MakePath (DEST$, RESDIR$)
  190.         CreateDir SubDir$, cmoNone        ''resource
  191.  
  192.         SubDir$ = MakePath (DEST$, DATADIR$)
  193.         CreateDir SubDir$, cmoNone        ''data
  194.  
  195.         SubDir$ = ""
  196.  
  197.         ClearCopyList
  198.  
  199.  
  200.         IF GetListItem(CHECKSTATES$, MINIMAL) = "ON" THEN
  201.             AddFilesToCopyList MINIMAL
  202.         END IF
  203.         IF GetListItem(CHECKSTATES$, STANDARD) = "ON" THEN
  204.             AddFilesToCopyList MINIMAL
  205.             AddFilesToCopyList STANDARD
  206.         END IF
  207.         IF GetListItem(CHECKSTATES$, FULL) = "ON" THEN
  208.             AddFilesToCopyList MINIMAL
  209.             AddFilesToCopyList STANDARD
  210.             AddFilesToCopyList FULL
  211.         END IF
  212.  
  213.         ''Add system files
  214.         AddSectionFilesToCopyList "SystemFiles", SOURCE$, GetWindowsSysDir
  215.  
  216.         ''Copy files
  217.         CopyFilesInCopyList
  218.  
  219.         ''System profile settings
  220.         CreateSysIniKeyValue MakePath (GetWindowsDir, "SYSTEM.INI"), "386Enh", "UniqueDOSPSP", "TRUE" , cmoOverwrite
  221.         IF GetWindowsMajorVersion () = 3 THEN
  222.             CreateSysIniKeyValue MakePath (GetWindowsDir, "SYSTEM.INI"), "386Enh", "device", "VSHARE.386" , cmoNone
  223.         ENDIF
  224.  
  225.         ''Update profile settings
  226.         profile$ = MakePath (GetWindowsDir, "MEMPHIS.INI")
  227.  
  228.         ''Btrieve settings
  229.         SubDir$ = MakePath (DEST$, "DATA\BTRIEVE.TRN")
  230.         btrv$ = "/m:64 /p:4096" + " /t:" + SubDir$
  231.         SubDir$ = ""
  232.         CreateIniKeyValue "WIN.INI", "Btrieve", "Options", btrv$, cmoOverwrite
  233.         btrv$ = ""
  234.  
  235.         ''Config settings
  236.         CreateIniKeyValue profile$, "Config", "Cache", "TRUE" , cmoOverwrite
  237.  
  238.         ''source and local cache settings
  239.         CreateIniKeyValue profile$, "Paths", "Local", DEST$ , cmoOverwrite
  240.         IF GetListItem(CHECKSTATES$, FULL) = "ON" THEN
  241.             CreateIniKeyValue profile$, "Paths", "Source", DEST$ , cmoOverwrite
  242.         ELSE
  243.             CreateIniKeyValue profile$, "Paths", "Source", SOURCE$ , cmoOverwrite
  244.         ENDIF
  245.         profile$ = ""
  246.  
  247.         ''create the program manager group and add the application
  248.         CreateProgmanGroup PMGROUP$, "", cmoNone
  249.         ShowProgmanGroup PMGROUP$, 1, cmoNone
  250.         IF GetListItem (CHECKSTATES$, MINIMAL) = "ON" THEN
  251.             AppPath$ = MakePath (SOURCE$, "MEMPHIS.EXE")
  252.         ELSE
  253.             AppPath$ = MakePath (DEST$, "MEMPHIS.EXE")
  254.         ENDIF
  255.         IcoPath$ = MakePath (DEST$, "MEMPHIS.ICO")
  256.         CreateProgmanItem PMGROUP$, "Memphis Math", AppPath$, IcoPath$, cmoOverwrite
  257.         AppPath$ = ""
  258.         IcoPath$ = ""
  259.  
  260.  
  261. QUIT:
  262.         ON ERROR GOTO ERRQUIT
  263.  
  264.         IF ERR = 0 THEN
  265.                 dlg% = EXITSUCCESS
  266.         ELSEIF ERR = STFQUIT THEN
  267.                 dlg% = EXITQUIT
  268.         ELSE
  269.                 dlg% = EXITFAILURE
  270.         END IF
  271. QUITL1:
  272.         sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  273.         IF sz$ = "REACTIVATE" THEN
  274.                 GOTO QUITL1
  275.         END IF
  276.         UIPop 1
  277.  
  278.         END
  279.  
  280. ERRQUIT:
  281.         i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  282.         END
  283.  
  284.  
  285.  
  286. GETPATH:
  287.         SetSymbolValue "EditTextIn", DEST$
  288.         SetSymbolValue "EditFocus", "END"
  289. GETPATHL1:
  290.         sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  291.  
  292.         IF sz$ = "CONTINUE" THEN
  293.                 olddest$ = DEST$
  294.                 DEST$ = GetSymbolValue("EditTextOut")
  295.  
  296.                 ''Validate new path.
  297.                 IF IsDirWritable(DEST$) = 0 THEN
  298.