home *** CD-ROM | disk | FTP | other *** search
/ Secrets of Stargate / STARGATE.iso / mac / INSTALL / STARGATE.MST < prev    next >
Text File  |  1994-10-07  |  24KB  |  833 lines

  1. '*******************************************************************
  2. '*
  3. '*    DESCRIPTION: Compton's STARGATE Installation Script
  4. '*
  5. '*    AUTHOR:       Hal Grogan et al
  6. '*
  7. '*    HISTORY:     Last Edit 09/06/94
  8. '*
  9. '*******************************************************************
  10. '**************************************************************************
  11. '*        STARGATE & Quicktime for Windows
  12. '**************************************************************************
  13. '$DEFINE DEBUG  ''Define for script development/debugging
  14. '$INCLUDE 'setupapi.inc'
  15. '$INCLUDE 'msdetect.inc'
  16.  
  17. ''Dialog ID's
  18. CONST WELCOME                 =    100
  19.  
  20. CONST ASKQUITSETUP            =    200
  21. CONST ASKQUITNOTHING          =    201
  22. CONST ASKQUITQTW              =    202
  23.  
  24. CONST ASKEXISTSQTWDIR         =    300
  25. CONST ASKEXISTSQTWPROD        =    301
  26. CONST ASKEXISTSOLDQTWPROD     =    302
  27.  
  28. CONST DESTPATHQTW             =    400
  29.  
  30. CONST EXITFAILURE             =    500
  31. CONST EXITQUIT                =    600
  32.  
  33. CONST EXITSUCCESSFFS          =    700
  34. CONST EXITSUCCESSQTW          =    701
  35. CONST EXITSUCCESSQTWREBOOT    =    702
  36.  
  37. CONST PRODHELP                =    900
  38. CONST MODELESS                =   5000
  39. CONST CUSTINST                =   6200
  40. CONST TOOBIG                  =   6300
  41. CONST BADPATH                 =   6400
  42. CONST MINREQUIRED                            =      6500
  43.  
  44. ''Bitmap IDs
  45. CONST IDC_BM0       = 600
  46.  
  47. CONST PRODUCT = 1
  48. CONST FILEVER = 0
  49.  
  50.  
  51. ''File Types
  52. CONST GROUP    = 1
  53. CONST QTW     = 2
  54.  
  55. '' actual amount plus 10%
  56. CONST GROUPCOST = 10240
  57. CONST QTWCOST  = 2329118
  58.  
  59. GLOBAL CUIDLL$
  60.  
  61. GLOBAL WinDir$
  62. GLOBAL WinSysDir$
  63.  
  64. GLOBAL DEST$        '' Default destination directory.
  65. GLOBAL WINDRIVE$    '' Windows drive letter.
  66.  
  67. GLOBAL cost&
  68. GLOBAL cost1&
  69. GLOBAL free&
  70. GLOBAL free1&
  71.  
  72. GLOBAL CursorSave%
  73.  
  74. ''Dialog list symbol names
  75. GLOBAL CHECKSTATES$
  76. GLOBAL STATUSTEXT$
  77. GLOBAL DRIVETEXT$
  78. GLOBAL REQUIREDTEXT$
  79. GLOBAL HDLIST$
  80.  
  81. '' defined functions
  82. DECLARE SUB AddOptFilesToCopyList
  83. DECLARE SUB RecalcOptFiles (ftype%)
  84. DECLARE SUB RecalcPath
  85. DECLARE SUB SetDriveStatus
  86. DECLARE FUNCTION MakePath(szDir$, szFile$) AS STRING
  87. Declare FUNCTION MakeDirPath (szDir$) AS STRING
  88. DECLARE FUNCTION RemoveSlash(szDir$) AS STRING
  89. Declare Function CheckFileForDateAndVersion(szFile$, szDate$, szVersion$) As String
  90. Declare Sub AskExit(nDialog%)
  91. Declare Sub AskQuit(nDialog%)
  92. Declare Sub GetPath
  93. Declare Sub InstallQTWFiles
  94. Declare Sub ModifyIniForQTW
  95. Declare Sub InstallGroup
  96. Declare Sub BadDirPath
  97. Declare Sub NotEnoughRoom
  98. Declare Sub WelcomeToSetup
  99. Declare Sub MinimumRequired
  100. Declare Sub ModifyAutoexec
  101. Declare Sub CustomInstall
  102.  
  103. Declare Function GetProcessor() As Integer
  104. Declare Function MeetsMinRequired() As Integer
  105.  
  106. '' external procedures
  107. Declare Function MaximizeWindow LIB "mscuistf.dll" (hwnd%) As Integer
  108. Declare Function DoMemManInfo LIB "mscuistf.dll" (item%) As Integer
  109. Declare Function SetTo256Min LIB "mscuistf.dll" () As Integer
  110. Declare Function GetVerInfo LIB "mscuistf.dll" (szPath$, szVer$, Product%) As Integer
  111.  
  112. DECLARE FUNCTION GetModuleHandle LIB "kernel" (szModName$) AS INTEGER
  113. DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
  114. DECLARE FUNCTION ExitWindowsExec  LIB "User" (Exec$, Param$) AS INTEGER
  115. Declare Function sndPlaySound Lib "MMSystem" (lpsound As Any, flag As Integer) As Integer
  116. Declare Function waveOutGetNumDevs Lib "MMSystem" () As Integer
  117. Declare Function GetDC Lib "User" (hWnd%) As Integer
  118. Declare Function GetDeskTopWindow Lib "User" () As Integer
  119. Declare Function GetDeviceCaps Lib "GDI" (hDC%, nIndex%) As Integer
  120. DECLARE FUNCTION GetPrivateProfileString LIB "Kernel" (lpApplicationName As String, lpKeyName As String, lpDefault As String, lpReturnedString As String, nSize As Integer, lpFileName As String) As Integer
  121. Declare Function GlobalCompact Lib "kernel" (flag&) As Long
  122. Declare Function GetFreeSpace Lib "kernel" (flag%) As Long
  123. Declare Function GetFreeSystemResources Lib "User" (fuSysResource As Integer) As Integer
  124. Declare Function ReleaseDC Lib "User" (hWnd As Integer, hDC As Integer) As Integer
  125.  
  126. Const SM_MOUSEPRESENT = 19
  127.  
  128. INIT:
  129.     
  130.   CUIDLL$ = "mscuistf.dll"            '' custom user interface dll
  131.   HELPPROC$ = "FHelpDlgProc"          '' Help dialog procedure
  132.  
  133.   hwnd% = HwndFrame()
  134.   i% = MaximizeWindow(hwnd%)          '' maximize the main window
  135.  
  136.   SetBitmap CUIDLL$, IDC_BM0 '' comptons logo
  137.   SetTitle "STARGATE"
  138.  
  139.   szTmp$ = GetSymbolValue("STF_SRCINFPATH")
  140.   szInf$ = GetSymbolValue("STF_SRCINFPATH")
  141.   IF szInf$ = "" THEN
  142.     szInf$ = GetSymbolValue("STF_CWDDIR") + "STARGATE" + ".INF"
  143.   END IF                    
  144.   ReadInfFile szInf$
  145.  
  146.   WinDir$     = GetWindowsDir()
  147.   WinSysDir$  = GetWindowsSysDir()
  148.   WINDRIVE$ = MID$(WinDir$, 1, 1)
  149.  
  150.   '' see if the product is running
  151.   IF GetModuleHandle("STARGATE") > 0 THEN
  152.     i% = DoMsgBox("Product is currently running."+chr$(13)+"Please exit the program and rerun Setup.","Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  153.         END
  154.   END IF
  155.  
  156.   ''CustInst list symbols
  157.   CHECKSTATES$ = "CheckItemsState"
  158.   STATUSTEXT$  = "StatusItemsText"
  159.   DRIVETEXT$   = "DriveStatusText"
  160.     REQUIREDTEXT$ = "MinRequiredText"
  161.     HDLIST$       = "HdList"
  162.  
  163.   FOR i% = 1 TO 2 STEP 1
  164.       AddListItem CHECKSTATES$, "ON"
  165.   NEXT i%
  166.  
  167.   '' for each inf section the required K
  168.   FOR i% = 1 TO 2 STEP 1
  169.     AddListItem STATUSTEXT$, ""
  170.   NEXT i%
  171.  
  172.   '' for the display in custinst
  173.   FOR i% = 1 TO 7 STEP 1
  174.     AddListItem DRIVETEXT$, ""
  175.   NEXT i%
  176.  
  177.   '' for the display of minimum requirements
  178.   FOR i% = 1 TO 7 STEP 1
  179.     AddListItem REQUIREDTEXT$, ""
  180.   NEXT i%
  181.  
  182.   '' means the message box will allow error to be ignored if file size does not match with inf file
  183.   i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  184.  
  185.     WelcomeToSetup
  186.  
  187. ''    If MeetsMinRequired() = 0 Then
  188. ''        MinimumRequired
  189. ''    End If
  190.  
  191.   CursorSave% = ShowWaitCursor()
  192.     DEST$ = CheckFileForDateAndVersion("PLAYER.EXE", "1994-01-11", "1.1.1.0")
  193.     If DEST$ = "" Then
  194.       '' set windows drive and windows directory as default for QTW
  195.       DEST$ = RemoveSlash(WinDir$)
  196.     End If
  197.  
  198.  
  199.  
  200. ''    CustomInstall
  201.  
  202.     InstallQTWFiles
  203.     
  204.     ModifyIniForQTW
  205.  
  206.     InstallGroup
  207.     
  208. ''  IF GetListItem(CHECKSTATES$, GROUP) = "ON" THEN
  209. ''        sz$ = UIStartDlg(CUIDLL$, EXITSUCCESSFFS, "FQuitDlgProc", 0, "")
  210. ''    ElseIf GetListItem(CHECKSTATES$, QTW) = "ON" THEN
  211. ''        sz$ = UIStartDlg(CUIDLL$, EXITSUCCESSQTW, "FQuitDlgProc", 0, "")
  212. ''    End If
  213.  
  214. ''  IF GetListItem(CHECKSTATES$, QTW) = "ON" THEN
  215. ''        UIPop 1
  216. ''    ELSE
  217.         '' if VFW not installed  then no need to see about restarting
  218. ''        UIPopAll
  219. ''        END
  220. ''  END IF
  221.  
  222. QUIT:
  223.     ON ERROR GOTO ERRQUIT
  224.     IF ERR = 0 THEN
  225.         dlg% = EXITSUCCESSFFS
  226.     ELSEIF ERR = STFQUIT THEN
  227.         dlg% = EXITQUIT
  228.     ELSE
  229.         dlg% = EXITFAILURE
  230.     END IF
  231. QUITL1:
  232.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  233.     IF sz$ = "REACTIVATE" THEN
  234.         GOTO QUITL1
  235.     END IF
  236.     UIPop 1
  237.     END
  238.  
  239. ERRQUIT:
  240.     i% = DoMsgBox("Call Compton's NewMedia Technical Support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  241.     END
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248. '**
  249. '** Purpose:
  250. '**     Adds the specified option files (sections of inf file) to the copy list.
  251. '** Arguments:
  252. '**     ftype%  - constant representing section such as  GROUP, QTW
  253. '** Caveats:
  254. '**     This SUB has been hand tweaked to get the job done and is not generic
  255. '**     for that reason.
  256. '** Returns:
  257. '**     none.
  258. '*************************************************************************
  259. SUB AddOptFilesToCopyList STATIC
  260.  
  261.   SrcDir$ = GetSymbolValue("STF_SRCDIR")
  262.  
  263.   AddSectionFilesToCopyList "QTW Files", MakePath(SrcDir$,"install\"), DEST$
  264.  
  265.   AddSectionFilesToCopyList "QTW Ini", MakePath(SrcDir$,"install\"), WinDir$
  266.  
  267.   AddSectionFilesToCopyList "QTW Driver", MakePath(SrcDir$,"install\"), WinSysDir$
  268.  
  269.   AddSectionFilesToCopyList "QTW Exe", MakePath(SrcDir$,"install\"), DEST$
  270.     
  271.     
  272. END SUB
  273.  
  274.  
  275. '**
  276. '** Purpose:
  277. '**     Appends a file name to the end of a directory path,
  278. '**     inserting a backslash character as needed.
  279. '** Arguments:
  280. '**     szDir$  - full directory path (with optional ending "\")
  281. '**     szFile$ - filename to append to directory
  282. '** Returns:
  283. '**     Resulting fully qualified path name.
  284. '*************************************************************************
  285. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  286.     IF szDir$ = "" THEN
  287.         MakePath = szFile$
  288.     ELSEIF szFile$ = "" THEN
  289.         MakePath = szDir$
  290.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  291.         MakePath = szDir$ + szFile$
  292.     ELSE
  293.         MakePath = szDir$ + "\" + szFile$
  294.     END IF
  295. END FUNCTION
  296.  
  297.  
  298. '**
  299. '** Purpose:
  300. '**     Removes a file name at the end of a directory path,
  301. '** Arguments:
  302. '**     szDir$  - full directory path including filespec
  303. '** Returns:
  304. '**     Resulting directory path name
  305. '*************************************************************************
  306. FUNCTION MakeDirPath (szDir$) STATIC AS STRING
  307.     
  308.     szTmp$ = RemoveSlash(szDir$)
  309.     
  310.   For j% = Len(szTmp$) to 1 Step -1
  311.         If MID$(szTmp$, j%, 1) = "\" Then
  312.       szTmp$ = Mid$(szTmp$, 1, j% - 1)
  313.             Exit For
  314.         End If
  315.     Next J%
  316.     MakeDirPath = szTmp$                
  317. END FUNCTION
  318.  
  319.  
  320. FUNCTION RemoveSlash (szDir$) STATIC AS STRING
  321.   IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  322.     szTmp$ = MID$(szDir$, 1, LEN(szDir$) - 1)
  323.     RemoveSlash = szTmp$
  324.     Else
  325.         RemoveSlash = szDir$
  326.   END IF
  327. END FUNCTION
  328.  
  329.  
  330. '**
  331. '** Purpose:
  332. '**     Recalculates disk space for the given option files and sets
  333. '**     the status info symbol "StatusItemsText".
  334. '** Arguments:
  335. '**     ftype% - type of files to add, one of the following:
  336. '**             GROUP, QTW
  337. '** Returns:
  338. '**     none.
  339. '*************************************************************************
  340. SUB RecalcOptFiles (ftype%) STATIC
  341.  
  342.     CursorSave% = ShowWaitCursor()
  343.  
  344.         nowcost& = 0
  345.     IF ftype% = GROUP THEN
  346.           IF GetListItem(CHECKSTATES$, GROUP) = "ON" THEN
  347.                 nowcost& = GROUPCOST
  348.             END IF
  349.     ELSEIF ftype% = QTW THEN
  350.           IF GetListItem(CHECKSTATES$, QTW) = "ON" THEN
  351.                 nowcost& = QTWCOST
  352.             END IF
  353.     END IF
  354.  
  355.     ReplaceListItem STATUSTEXT$, ftype%, STR$(nowcost& / 1024) + " K"
  356.  
  357.     RestoreCursor CursorSave%
  358. END SUB
  359.  
  360.  
  361. '**
  362. '** Purpose:
  363. '**     Recalculates disk space and sets option status info according
  364. '**     to the current destination path.
  365. '** Arguments:
  366. '**     none.
  367. '** Returns:
  368. '**     none.
  369. '*************************************************************************
  370. SUB RecalcPath STATIC
  371.  
  372.     CursorSave% = ShowWaitCursor()
  373.  
  374.     RecalcOptFiles GROUP
  375.     RecalcOptFiles QTW
  376.  
  377.     RestoreCursor CursorSave%
  378. END SUB
  379.  
  380.  
  381. '**
  382. '** Purpose:
  383. '**     Sets drive status info according to latest disk space calcs.
  384. '** Arguments:
  385. '**     none.
  386. '** Returns:
  387. '**     none.
  388. '*************************************************************************
  389. SUB SetDriveStatus STATIC
  390.  
  391.   drive$ = MID$(DEST$, 1, 1)
  392.   ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  393.  
  394.     cost& = 0
  395.   IF GetListItem(CHECKSTATES$, GROUP) = "ON" THEN
  396.     cost& = GROUPCOST
  397.     END IF
  398.  
  399.   IF drive$ = WINDRIVE$ THEN
  400.     IF GetListItem(CHECKSTATES$, QTW) = "ON" THEN
  401.     cost& = cost& + QTWCOST
  402.         END IF
  403.     END IF
  404.  
  405.     '' do install to drive which may or may not be windows drive
  406.   free& = GetFreeSpaceForDrive(drive$)
  407.   ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  408.   ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  409.    ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  410.     cost1& = 0
  411.   ReplaceListItem DRIVETEXT$, 4, ""
  412.   ReplaceListItem DRIVETEXT$, 5, ""
  413.   ReplaceListItem DRIVETEXT$, 6, ""
  414.  
  415.   IF drive$ <> WINDRIVE$ THEN
  416.       IF GetListItem(CHECKSTATES$, QTW) = "ON" THEN
  417.         cost1& = QTWCOST
  418.       free1& = GetFreeSpaceForDrive(WINDRIVE$)
  419.       ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  420.       ReplaceListItem DRIVETEXT$, 5, STR$(cost1& / 1024) + " K"
  421.       ReplaceListItem DRIVETEXT$, 6, STR$(free1& / 1024) + " K"
  422.     END IF
  423.   END IF
  424. END SUB
  425.  
  426.  
  427. '**
  428. '** Purpose:
  429. '**     offers dialogs to continue or quit
  430. '** Returns:
  431. '**     nothing
  432. '*************************************************************************
  433. Sub AskExit(nDialog%) STATIC
  434.  
  435.   sz$ = UIStartDlg(CUIDLL$, nDialog%, "FQuitDlgProc", 0, "")
  436.   IF sz$ = "EXIT" THEN
  437.     UIPopAll
  438.     ERROR STFQUIT
  439.   ELSEIF sz$ = "REACTIVATE" THEN
  440.     AskExit(nDialog%)
  441.   ELSE
  442.     UIPop 1
  443.   END IF
  444. End Sub
  445.  
  446.  
  447.  
  448. '**
  449. '** Purpose:
  450. '**     offers dialogs to continue or quit
  451. '** Returns:
  452. '**     nothing
  453. '*************************************************************************
  454. Sub AskQuit(nDialog%) STATIC
  455.  
  456.   sz$ = UIStartDlg(CUIDLL$, nDialog%, "FQuitDlgProc", 0, "")
  457.   IF sz$ = "EXIT" THEN
  458.     UIPopAll
  459.     ERROR STFQUIT
  460.   ELSEIF sz$ = "REACTIVATE" THEN
  461.     AskQuit(nDialog%)
  462.   ELSE
  463.     UIPop 1
  464.   END IF
  465. End Sub
  466.  
  467. '**
  468. '** Purpose:
  469. '**     Sees if File exists on users system with specified date
  470. '**     offers dialogs to continue or quit
  471. '** Returns:
  472. '**     Directory path without filename
  473. '*************************************************************************
  474. Function CheckFileForDateAndVersion(szFile$, szDate$, szVersion$) STATIC As String
  475.  
  476.     GetLocalHardDrivesList HDLIST$
  477.     i% = GetListLength(HDLIST$)
  478.     
  479.     For j% = 1 To i% Step 1
  480.         szDrive$ = GetListItem(HDLIST$, j%)
  481.         szDrive$ = szDrive$ + ":\"
  482.         szFound$ = FindFileInTree(szFile$, szDrive$)
  483.         If szFound$ <> ""    Then
  484.             Exit For
  485.         End If
  486.     Next J%            
  487.   RestoreCursor CursorSave%
  488.     If szFound$ <> "" Then
  489.         szFileDate$ = GetDateOfFile(szFound$)
  490.         j% = GetVerInfo(szFound$, szVersion$, PRODUCT)
  491.         CurrentPath$ = GetEnvVariableValue("PATH")
  492.         i% = InStr(1, CurrentPath$, MakeDirPath(szFound$))
  493.         If (Mid$(szFileDate$, 1, Len(szDate$)) = szDate$) And (j% = 1) And (i% <> 0) Then
  494.           ReplaceListItem CHECKSTATES$, 2, ""
  495.             CheckFileForDateAndVersion = MakeDirPath(szFound$)
  496.         Else
  497.             CheckFileForDateAndVersion = ""
  498.         End If        
  499.     Else
  500.         CheckFileForDateAndVersion = ""
  501.     End If
  502. END Function '' CheckForfile
  503.  
  504.  
  505. Function GetProcessor() Static As Integer
  506. Dim WinFlags As Long
  507.  
  508. '' Operating System Info.
  509.     WinFlags = GetWinFlags()
  510.  
  511. '' CPU Info.
  512.     If WinFlags And WF_CPU486 Then
  513.             GetProcessor = 2
  514.     ElseIf WinFlags And WF_CPU386 Then
  515.             GetProcessor = 1
  516.     ElseIf WinFlags And WF_CPU286 Then
  517.             GetProcessor = 0
  518.     End If
  519. End Function
  520.  
  521. Function MeetsMinRequired() Static As Integer
  522.  
  523.  
  524.     Min% = 1
  525.     f% = GetDosMajorVersion()
  526.     g% = GetDosMinorVersion()
  527.   ReplaceListItem REQUIREDTEXT$, 2, STR$(f%) + "." + STR$(g%)
  528.  
  529.     h% = GetWindowsMajorVersion()
  530.     i% = GetWindowsMinorVersion()
  531.   ReplaceListItem REQUIREDTEXT$, 1, STR$(h%) + "." + STR$(i%)
  532.     If (f% < 3)     Then
  533.         Min% = 0
  534.     ElseIf (f% = 3) AND (g% < 1) Then
  535.         Min% = 0
  536.     END IF
  537.     IF (h% < 3) Then
  538.         Min% = 0
  539.     ElseIf (h% = 3) AND (i% < 1) Then
  540.         Min% = 0
  541.     END IF
  542.  
  543.   d% = GetSystemMetrics(SM_MOUSEPRESENT)
  544.   ReplaceListItem REQUIREDTEXT$, 3, "Mouse Present"
  545.     If d% = 0 Then
  546.       ReplaceListItem REQUIREDTEXT$, 3, "*No Mouse"
  547.         Min% = 0
  548.     End If
  549.  
  550.  
  551.     g% = GetProcessor()
  552.     If g% = 0 Then
  553.       ReplaceListItem REQUIREDTEXT$, 4, "*286"
  554.     ElseIf g% = 1 Then
  555.     ReplaceListItem REQUIREDTEXT$, 4, "386"
  556.     ElseIf g% = 2 Then
  557.     ReplaceListItem REQUIREDTEXT$, 4, "486 or 586"
  558.     End If
  559.     If g% = 0 Then
  560.         Min% = 0
  561.     End If
  562.  
  563.     totalpages& = DoMemManInfo(7)
  564.     pagesize& = DoMemManInfo(10)
  565.   ReplaceListItem REQUIREDTEXT$, 5, Str$((totalpages& * pagesize&) / 1024) +" Kb"
  566.     IF (totalpages& * pagesize&) < 2500000 THEN
  567.       ReplaceListItem REQUIREDTEXT$, 5,  "*" + Str$((totalpages& * pagesize&) / 1024) +" Kb"
  568.         Min% = 0
  569.     END IF
  570.     '' Video
  571.     j% = SetTo256Min()
  572.     If j% < 0 Then
  573.       ReplaceListItem REQUIREDTEXT$, 6, "*Less than 256"
  574.         Min% = 0
  575.     Else
  576.       ReplaceListItem REQUIREDTEXT$, 6, "256 or more"
  577.     End If
  578.  
  579.   e% = waveOutGetNumDevs()
  580.   ReplaceListItem REQUIREDTEXT$, 7, "WAVE Okay"
  581.     If e% = 0 Then
  582.       ReplaceListItem REQUIREDTEXT$, 7, "*No WAVE driver"
  583.         Min% = 0
  584.     End If
  585.  
  586.     MeetsMinRequired = Min%
  587.  
  588. End Function
  589.  
  590. Sub InstallGroup STATIC
  591.   IF GetListItem(CHECKSTATES$, GROUP) = "ON" THEN
  592.       SrcDir$ = GetSymbolValue("STF_SRCDIR")
  593.       CreateProgmanGroup "STARGATE", "", cmoNone
  594.       ShowProgmanGroup   "STARGATE", 2, cmoNone
  595.       CreateProgmanItem  "STARGATE", "STARGATE",MakePath(SrcDir$,"STARGATE.exe"),MakePath(SrcDir$,"STARGATE.ico")+",IDC_ICON7,0,0,"+SrcDir$, cmoOverwrite
  596. ''      CreateProgmanItem  "STARGATE", "STARGATE",MakePath(SrcDir$,"STARGATE.exe"),",,,,"+SrcDir$, cmoOverwrite
  597.       ShowProgmanGroup   "STARGATE", 1, cmoNone
  598.     End If
  599. End Sub
  600.  
  601. Sub InstallQTWFiles STATIC
  602.   If (GetListItem(CHECKSTATES$, QTW) = "ON") Then
  603.       ClearCopyList
  604.       AddOptFilesToCopyList
  605.  
  606.       ClearBillboardList
  607.       SetCopyGaugePosition -1, 40
  608.       SetRestartDir(WinDir$)
  609.       CopyFilesInCopyList
  610.       ClearBillboardList
  611.     End If
  612. End Sub
  613.  
  614.  
  615. Sub ModifyIniForQTW STATIC
  616.   IF (GetListItem(CHECKSTATES$, QTW) = "ON") THEN
  617.         SrcPath$ = MakePath(WinDir$,"WIN.INI")
  618.         DstPath$ = MakePath(WinDir$,"WIN.CNM")
  619.         CopyFile SrcPath$, DstPath$, cmoOverwrite, 0
  620.         SrcPath$ = MakePath(WinDir$,"SYSTEM.INI")
  621.         DstPath$ = MakePath(WinDir$,"SYSTEM.CNM")
  622.         CopyFile SrcPath$, DstPath$, cmoOverwrite, 0
  623.         SrcPath$ = MakePath(WinDir$,"CONTROL.INI")
  624.         DstPath$ = MakePath(WinDir$,"CONTROL.CNM")
  625.         CopyFile SrcPath$, DstPath$, cmoOverwrite, 0
  626.  
  627.       I% = DoesIniKeyExist (WinDir$ + "system.ini", "mci", "QTWVideo")
  628.       IF I% = 0  THEN
  629.         CreateIniKeyValue WinDir$ + "system.ini", "mci", "QTWVideo", "mciqtw.drv", cmoOverwrite
  630.             CreateIniKeyValue WinDir$ + "system.ini", "mci", ";Added QTWVideo", "mciqtw.drv by Compton's Setup", cmoOverwrite
  631.       END IF
  632.  
  633.       I% = DoesIniKeyExist (WinDir$ + "control.ini", "drivers.desc", "mciqtw.drv")
  634.       IF I% = 0  THEN
  635.         CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "mciqtw.drv", "[MCI] Quicktime for Windows", cmoOverwrite
  636.         CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", ";Added mciqtw.drv", "[MCI] Quicktime for Windows by Compton's Setup", cmoOverwrite
  637.       END IF
  638.  
  639.       I% = DoesIniKeyExist ("WIN.INI", "Extensions", "mov")
  640.       IF I% = 0  THEN
  641.         CreateIniKeyValue "WIN.INI", "Extensions", "mov", "player.exe ^.mov", cmoOverwrite
  642.         CreateIniKeyValue "WIN.INI", "Extensions", ";Added mov", "player.exe ^.mov by Compton's Setup", cmoOverwrite
  643.       END IF
  644.       I% = DoesIniKeyExist ("WIN.INI", "Extensions", "pic")
  645.       IF I% = 0  THEN
  646.         CreateIniKeyValue "WIN.INI", "Extensions", "pic", "viewer.exe ^.pic", cmoOverwrite
  647.         CreateIniKeyValue "WIN.INI", "Extensions", ";Added pic", "viewer.exe ^.pic by Compton's Setup", cmoOverwrite
  648.       END IF
  649.  
  650.       I% = DoesIniKeyExist ("WIN.INI", "mci extensions", "mov")
  651.       IF I% = 0  THEN
  652.         CreateIniKeyValue "WIN.INI", "mci extensions", "mov", "QTWVideo", cmoOverwrite
  653.         CreateIniKeyValue "WIN.INI", "mci extensions", ";Added mov", "QTWVideo by Compton's Setup", cmoOverwrite
  654.       END IF
  655.       I% = DoesIniKeyExist ("WIN.INI", "mci extensions", "pic")
  656.       IF I% = 0  THEN
  657.         CreateIniKeyValue "WIN.INI", "mci extensions", "pic", "QTWVideo", cmoOverwrite
  658.         CreateIniKeyValue "WIN.INI", "mci extensions", ";Added pic", "QTWVideo by Compton's Setup", cmoOverwrite
  659.       END IF
  660.       I% = DoesIniKeyExist ("WIN.INI", "mci extensions", "jpg")
  661.       IF I% = 0  THEN
  662.         CreateIniKeyValue "WIN.INI", "mci extensions", "jpg", "QTWVideo", cmoOverwrite
  663.         CreateIniKeyValue "WIN.INI", "mci extensions", ";Added jpg", "QTWVideo by Compton's Setup", cmoOverwrite
  664.       END IF
  665.  
  666.       I% = DoesIniKeyExist ("WIN.INI", "embedding", "PlayerFrameClass")
  667. ''      IF I% = 0  THEN
  668.         CreateIniKeyValue "WIN.INI", "embedding", "PlayerFrameClass", "QuickTime Movie,QuickTime Movie,"+MakePath(DEST$,"player.exe")+",picture", cmoOverwrite
  669.         CreateIniKeyValue "WIN.INI", "embedding", ";Added PlayerFrameClass", "QuickTime Movie,QuickTime Movie,"+MakePath(DEST$,"player.exe")+",picture by Compton's Setup", cmoOverwrite
  670. ''      END IF
  671.       I% = DoesIniKeyExist ("WIN.INI", "embedding", "ViewerFrameClass")
  672. ''      IF I% = 0  THEN
  673.         CreateIniKeyValue "WIN.INI", "embedding", "ViewerFrameClass", "QuickTime Movie,QuickTime Movie,"+MakePath(DEST$,"viewer.exe")+",picture", cmoOverwrite
  674.         CreateIniKeyValue "WIN.INI", "embedding", ";Added ViewerFrameClass", "QuickTime Movie,QuickTime Movie,"+MakePath(DEST$,"viewer.exe")+",picture by Compton's Setup", cmoOverwrite
  675. ''      END IF
  676.     End If
  677. End Sub
  678.  
  679. Sub GetPath    STATIC
  680.     SetSymbolValue "EditTextIn", DEST$
  681.     SetSymbolValue "EditFocus", "END"
  682. GETPATHL1:
  683.   sz$ = UIStartDlg(CUIDLL$, DESTPATHQTW, "FEditDlgProc", PRODHELP, HELPPROC$)
  684.   IF sz$ = "CONTINUE" THEN
  685.     olddest$ = DEST$
  686.     DEST$ = GetSymbolValue("EditTextOut")
  687.     drive$ = MID$(DEST$, 1, 1)
  688.         '' make sure they entered a valid path - it does not have to already exist.
  689.     j% = IsDirWritable(DEST$)
  690.     IF (j% = 0) THEN
  691.             BadDirPath
  692.             GOTO GETPATHL1
  693.     END IF
  694.         '' dest$ may or may not have a \ at this point
  695.     UIPop 1
  696.     ''Truncate display if too long.
  697.     IF LEN(DEST$) > 23 THEN
  698.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  699.     ELSE
  700.             ReplaceListItem DRIVETEXT$, 7, DEST$
  701.     END IF
  702.     ''Recalc if path changed.
  703.     IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  704.             RecalcPath
  705.             SetDriveStatus
  706.     END IF
  707.     olddest$ = ""
  708. ''    GOTO CUSTINST
  709.   ELSEIF sz$ = "REACTIVATE" THEN
  710.     RecalcPath
  711.     SetDriveStatus
  712.     GOTO GETPATHL1
  713.   ELSEIF sz$ = "EXIT" THEN
  714.     AskQuit(ASKQUITQTW)
  715.     GOTO GETPATHL1
  716.   ELSE
  717.     UIPop 1
  718. ''    GOTO CUSTINST
  719.   END IF
  720. End Sub
  721.  
  722. Sub BadDirPath STATIC
  723.   sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  724.   If sz$ = "REACTIVATE" Then
  725.         RecalcPath
  726.         SetDriveStatus
  727.         BadDirPath
  728.   End If
  729.   UIPop 1
  730. End Sub
  731.  
  732.  
  733. Sub NotEnoughRoom STATIC
  734.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  735.     IF sz$ = "CONTINUE" THEN
  736.             UIPop 1
  737.     ELSEIF sz$ = "EXIT" THEN
  738.             UIPop 1
  739.             AskExit(ASKQUITSETUP)
  740.     ELSEIF sz$ = "REACTIVATE" THEN
  741.       RecalcPath
  742.       SetDriveStatus
  743.       NotEnoughRoom
  744.     END IF
  745.     UIPop 1
  746. End Sub
  747.  
  748. Sub WelcomeToSetup STATIC
  749.   sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", PRODHELP, HELPPROC$)
  750.   IF sz$ = "CONTINUE" THEN
  751.     UIPop 1
  752.   ELSE
  753.     AskQuit(ASKQUITSETUP)
  754.     WelcomeToSetup
  755.   END IF
  756. End Sub    
  757.  
  758. Sub MinimumRequired STATIC
  759.   sz$ = UIStartDlg(CUIDLL$, MINREQUIRED, "FMinReqDlgProc", PRODHELP, HELPPROC$)
  760.   IF sz$ = "CONTINUE" THEN
  761.     UIPop 1
  762.   ELSE
  763.     AskQuit(ASKQUITSETUP)
  764.     MinimumRequired
  765.   END IF
  766. End Sub    
  767.  
  768.  
  769. Sub CustomInstall STATIC
  770.   '' destination path
  771.   ReplaceListItem DRIVETEXT$, 7, DEST$
  772.   RecalcPath
  773.   SetDriveStatus
  774.  
  775.   sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", PRODHELP, HELPPROC$)
  776.  
  777.   IF sz$ = "CONTINUE" THEN
  778.         ''Check diskspace
  779.     IF ((cost& > free&) OR (cost1& > free1&)) THEN
  780.       NotEnoughRoom
  781.     END IF
  782.         IF GetListItem(CHECKSTATES$, GROUP) <> "ON" THEN
  783.             IF GetListItem(CHECKSTATES$, QTW) <> "ON" THEN
  784.             AskQuit(ASKQUITNOTHING)
  785.             CustomInstall
  786.           End If
  787.         End If
  788.     UIPop 1
  789. ''    GOTO INSTALL
  790.   ELSEIF sz$ = "PATH" THEN
  791.     GetPath
  792.     CustomInstall
  793.   ELSEIF sz$ = "CHK1" THEN
  794.     RecalcOptFiles GROUP
  795.     SetDriveStatus
  796.     CustomInstall
  797.   ELSEIF sz$ = "CHK2" THEN
  798.     RecalcOptFiles QTW
  799.     SetDriveStatus
  800.     CustomInstall
  801.   ELSEIF sz$ = "REACTIVATE" THEN
  802.     RecalcPath
  803.     SetDriveStatus
  804.     CustomInstall
  805.   ELSE
  806.         If (GetListItem(CHECKSTATES$, GROUP) <> "ON") And (GetListItem(CHECKSTATES$, QTW) <> "ON") Then
  807.         AskQuit(ASKQUITNOTHING)
  808.         CustomInstall
  809.         ElseIf GetListItem(CHECKSTATES$, GROUP) <> "ON" Then
  810.         AskQuit(ASKQUITQTW)
  811.         CustomInstall
  812.         Else
  813.         AskQuit(ASKQUITSETUP)
  814.         CustomInstall
  815.         End If
  816.   END IF
  817. End Sub
  818.  
  819.  
  820. Sub ModifyAutoexec STATIC
  821.     CurrentPath$ = GetEnvVariableValue("PATH")
  822.     j% = InStr(1, CurrentPath$, RemoveSlash(DEST$))
  823.  
  824.     If j% <> 0 Then
  825.         i% = DoMsgBox(CurrentPath$,"Debug",MB_OK+MB_TASKMODAL+MB_ICONHAND)
  826.     Else
  827.         i% = DoMsgBox(CurrentPath$, "Debug",MB_OK+MB_TASKMODAL+MB_ICONHAND)
  828.     End If
  829. End Sub    
  830.  
  831.  
  832. '' end of FOCUS.MST
  833.