home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazin 1998 November (Power Rangers) / Rangers.bin / MediaMania / SETUP.MST < prev    next >
Text File  |  1998-08-10  |  28KB  |  657 lines

  1. '**************************************************************************
  2. '*                       MediaMaster Setup Script
  3. '**************************************************************************
  4. '$DEFINE DEBUG  ''Define for script development/debugging
  5. '$INCLUDE 'setupapi.inc'
  6. '$INCLUDE 'msdetect.inc'
  7. '' Dialog ID's are stored in file created by COLLIDD utility
  8. '$INCLUDE 'dialogs.inc'
  9. '' Bitmap ID
  10. CONST LOGOTIT = 1
  11. CONST LOGOTYP = 1000
  12. '' -------------------------------------------------------------------------
  13. '' --------- Option checkbox names (see Custom Installation Dialog) --------
  14. '' --------- Corresponding section names and target directories
  15. '' ----------------     see AddOptFilesToCopyList function body
  16. '' -------------------------------------------------------------------------
  17. CONST OPT_MEDIAMANIA = 1
  18. CONST OPT_CAPTURE = 2
  19. CONST OPT_SAMPLES = 3
  20. CONST OPT_LAST = 1      '' Maximum option number
  21. '' -------------------------------------------------------------------------
  22. '' -------------------------- Global Variables -----------------------------
  23. '' -------------------------------------------------------------------------
  24. GLOBAL DEST$        ''Default destination directory.
  25. GLOBAL MMGROUP$
  26. GLOBAL CUIDLL$
  27. GLOBAL SHAREDIR$
  28. GLOBAL TOTALNEEDED& ''Extra space required
  29. GLOBAL CBTPATH$
  30. GLOBAL WinDir$
  31. GLOBAL WinSysDir$
  32. GLOBAL WinSys32Dir$
  33. GLOBAL MinorVer%
  34. GLOBAL OnNT$
  35. '' -------------------------------------------------------------------------
  36. '' -------------------------- Dialog Functions -----------------------------
  37. '' -------------------------------------------------------------------------
  38. DECLARE SUB CustInstInfo0Dlg(template%)
  39. '' -------------------------------------------------------------------------
  40. '' -------------------------- Utility Functions ----------------------------
  41. '' -------------------------------------------------------------------------
  42. DECLARE FUNCTION IDC(s$) AS INTEGER
  43. DECLARE FUNCTION DriveN (path$) AS INTEGER
  44. DECLARE SUB ClearCopyListExtra
  45. DECLARE SUB AddExtraCost (drive%,cost&)
  46. DECLARE SUB AddOptFilesToCopyList (ftype%,falways%)
  47. DECLARE SUB RecalcOptFiles (ftype%)
  48. DECLARE SUB RecalcPath
  49. DECLARE SUB SetDriveStatus
  50. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  51. DECLARE FUNCTION FCreateLogoWnd LIB "mscuistf.dll" (hParent%,nID%) AS INTEGER
  52. DECLARE FUNCTION FGetAvailableRAM LIB "mscuistf.dll" AS LONG
  53. DECLARE FUNCTION FGetSwapFileSize LIB "mscuistf.dll" AS LONG
  54. DECLARE FUNCTION FGetLicenseInfo LIB "mscuistf.dll" AS INTEGER
  55. DECLARE FUNCTION FGetUpdateValid LIB "mscuistf.dll" AS INTEGER
  56. DECLARE FUNCTION FGetLicenseInfoPreinst LIB "mscuistf.dll" AS INTEGER
  57. DECLARE FUNCTION DestroyWindow LIB "user" (hWnd%) AS INTEGER
  58. DECLARE SUB MessageBeep LIB "user" (idBeep%)
  59. DECLARE SUB ShowWindow LIB "user" (hWnd%,nShowCmd%)
  60. DECLARE FUNCTION ExitWindowsExec LIB "user" (Exe$, empty$) AS INTEGER
  61. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  62. DECLARE SUB Reboot LIB "iniupd.dll"
  63. DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
  64. '' -------------------------------------------------------------------------
  65. '' -------------------------------------------------------------------------
  66. '' ----------                                                   ------------
  67. '' ----------                 B E G I N N I N G                 ------------
  68. '' ----------                                                   ------------
  69. '' -------------------------------------------------------------------------
  70. '' -------------------------------------------------------------------------
  71.             '' ----------- Several common definitions
  72.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  73.     INFFILE$ = "setup.inf"
  74.     WIN32ENABLED% = 0
  75.     TITLE$ = "MediaMania Broadcast" + " Setup"
  76.     DEST$ = "C:\MDMDEMO"
  77.     WINDIR$ = GetWindowsDir
  78.     IF IsWindowsShared THEN
  79.         SHAREDIR$ = WINDIR$
  80.     ELSE
  81.         SHAREDIR$ = GetWindowsSysDir
  82.     END IF
  83.     MajorVer% = GetWindowsMajorVersion()
  84.     MinorVer% = GetWindowsMinorVersion()
  85.     Processor% = GetProcessorType()
  86.     WinSysDir$ = SHAREDIR$
  87.     WinSys32Dir$ = WinDir$ + "system32"
  88.     IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
  89.     i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software.  Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  90.     END
  91.     END IF
  92.     'Prevents installation on 286
  93.     IF Processor% < 3 THEN
  94.     i% = DoMsgBox("Video for Windows requires a 386 or greater processor or emulator.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  95.     END
  96.     END IF
  97.     ' Use Wowexec to determine version of NT.  3.1 did not stamp wowexec and wow returns 3.1 as version
  98.     IF OnWindowsNT() THEN
  99.       OnNT$ = "TRUE"
  100.       WowVersion$ = GetVersionOfFile(WinSys32Dir$ + "\wowexec.exe")
  101.       IF WowVersion$ = "" THEN
  102.          i% = DoMsgBox("Video for Windows does not run on Windows NT 3.1.  Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  103.          END
  104.       END IF
  105.     END IF
  106.     MEDIAMANIA_EXE$ = "PROGRAMS\\"+"MDMANIA"+".EXE"
  107.    MEDIAMANIA_INI$ = MakePath(GetWindowsDir(),"mmdemo22.ini")
  108.     STAMP_SUBDIR$ = "PROGRAMS"
  109.     LOGOTYPE_DELAY& = 5000
  110.     '' ShowWindow  HwndFrame(),3       '' Maximize frame
  111.     SetBitmap CUIDLL$, LOGOTIT
  112.     SetTitle TITLE$
  113.            '' -------------- Display logotype for some period of time
  114. ''    sz$ = UIStartDlg(CUIDLL$,IDD_MODELESS,"FModelessDlgProc",0,"")
  115.     hLogoWnd% = FCreateLogoWnd(HwndFrame(),LOGOTYP)
  116.     IF hLogoWnd% <> 0 THEN
  117.         CursorSave% = ShowWaitCursor
  118.         time0& = Timer
  119.     ABOUTL1:
  120.         time1& = Timer
  121.         IF time1& >= time0& AND time1 < time0&+LOGOTYPE_DELAY& THEN
  122.             GOTO ABOUTL1
  123.         END IF
  124.         i% = DestroyWindow(hLogoWnd%)
  125.         RestoreCursor CursorSave%
  126.     END IF
  127. '' ---------------------------------------------------------------------
  128. '' ------------------------- INF FILE READING --------------------------
  129. '' ---------------------------------------------------------------------
  130.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  131.     IF szInf$ = "" THEN
  132.         szInf$ = GetSymbolValue("STF_CWDDIR") + INFFILE$
  133.     END IF
  134.     ReadInfFile szInf$
  135. '' ---------------------------------------------------------------------
  136. '' --------------------- SYSTEM PROPERTY CHECK   -----------------------
  137. '' ---------------------------------------------------------------------
  138. SECT$ = "SSS_23UUE"
  139. DRVPR$ = GetIniKeyString(MakePath(GetWindowsDir(),"WIN.INI"),SECT$,"UUE_DRVPR")
  140. i% = FGetUpdateValid
  141. if i% = 0 THEN
  142.          sz$ = GetIniKeyString(MakePath(GetWindowsDir(),"WIN.INI"),SECT$,"NOUPGRADEMESS")
  143. END IF
  144. if i% = 1 THEN
  145.          sz$ = GetIniKeyString(MakePath(GetWindowsDir(),"WIN.INI"),SECT$,"ILLEGALNUMBERMESS")
  146. END IF
  147. RemoveIniSection  WinDir$ + "Win.ini", SECT$, cmoNone
  148. if i% = 2  THEN
  149.          GOTO ENDLABEL
  150. END IF
  151. if i% < 2  THEN
  152.          i% = DoMsgBox(sz$, "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  153.          GOTO ENDLABEL
  154. END IF
  155. '' ---------------------------------------------------------------------
  156. '' ------------------- WELCOME DIALOG PROCESSING -----------------------
  157. '' ---------------------------------------------------------------------
  158. WELCOME:
  159.     sz$ = UIStartDlg(CUIDLL$, IDD_WELCOME, "FInfoDlgProc", IDD_WELCOME_HELP, "FHelpDlgProc" )
  160.     IF sz$ = "CONTINUE" THEN
  161.         UIPop 1
  162.     ELSE
  163.         GOSUB ASKQUIT
  164.         GOTO WELCOME
  165.     END IF
  166. '' ---------------------------------------------------------------------
  167. '' -------------------- SYSREQ DIALOG PROCESSING -----------------------
  168. '' ---------------------------------------------------------------------
  169.     DIM  req(6) AS INTEGER
  170.     req(1) = 1
  171.     IF GetWindowsMajorVersion < 3 THEN
  172.         req(1) = 0
  173.     ELSEIF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 10 THEN
  174.         req(1) = 0
  175.     END IF
  176.     req(2) = 1
  177.     req(3) = Has87MathChip
  178.     req(4) = FGetSwapFileSize <> 0
  179.     req(5) = FGetAvailableRAM >= 6*1024
  180.     req(6) = HasMouseInstalled
  181.     req(0) = 1
  182.     FOR i% = 1 TO 6 STEP 1
  183.         IF req(i%) = 0 THEN
  184.             req(0) = 0
  185.         END IF
  186.     NEXT i%
  187.     IF req(0) THEN
  188.         GOTO LICENSE
  189.     END IF
  190.     req(0) = 1
  191.     FOR i% = 1 TO 3 STEP 1
  192.         IF req(i%) = 0 THEN
  193.             req(0) = 0
  194.         END IF
  195.     NEXT i%
  196.     IF req(0) = 0 THEN
  197.         AddListItem "ControlsDisabled",Str$(IDC("C"))
  198.     END IF
  199.     FOR i% = 1 TO 6 STEP 1
  200.         IF req(i) THEN
  201.             AddListItem "StatusItemsText", "Present"
  202.         ELSE
  203.             AddListItem "StatusItemsText", "Absent"
  204.         END IF
  205.     NEXT i%
  206. SYSREQ:
  207.     sz$ = UIStartDlg(CUIDLL$, IDD_SYSREQ, "FCustInstDlgProc", IDD_SYSREQ_HELP, "FHelpDlgProc" )
  208.     IF sz$ = "CONTINUE" THEN
  209.         UIPop 1
  210.     ELSEIF sz$ = "CANCEL" THEN
  211.         IF req(0) = 0 THEN
  212.             UIPopAll
  213.             ERROR STFQUIT
  214.         ELSE
  215.             GOSUB ASKQUIT
  216.             GOTO SYSREQ
  217.         END IF
  218.     ELSE
  219.         GOTO SYSREQ
  220.     END IF
  221.     RemoveSymbol "StatusItemsText"
  222. '' ---------------------------------------------------------------------
  223. '' --------------------- LICENSE DIALOG PROCESSING ---------------------
  224. '' ---------------------------------------------------------------------
  225. LICENSE:
  226. '' ---------------------------------------------------------------------
  227. '' --------------- CUSTOM INSTALLATION DIALOG PROCESSING ---------------
  228. '' ---------------------------------------------------------------------
  229. CUSTINST:
  230.             '' --------- Try to find MediaMaster if previously installed
  231.             '' --------- Custom Installation Dialog Box Initialization
  232.                 '' Clear the list of extra space (not listed in setup.inf)
  233.                 '' required per drive. This list is used in calls to
  234.                 '' GetCopyListCost function to provide the information
  235.                 '' about additional required space.
  236.     FOR i% = 1 TO 26 STEP 1
  237.         AddListItem "ExtraCosts", "0"
  238.     NEXT i%
  239.     FOR i% = 1 TO 6 STEP 1
  240.         AddListItem "DriveStatusText", ""
  241.     NEXT i%
  242.     AddListItem "DriveStatusText", DEST$
  243.                 '' Compute data to be displayed in the dialog
  244.     RecalcPath
  245.     SetDriveStatus
  246.     SetSymbolValue "RadioDefault", ""
  247.             '' -------- Custom Installation Dialog Box Loop
  248. CUSTINSTLDEMO1:
  249.     sz$ = UIStartDlg(CUIDLL$, IDD_CUSTINSTDEMO, "FCustInstDemoDlgProc", IDD_CUSTINSTDEMO_HELP, "FHelpDlgProc")
  250.     IF sz$ = "CONTINUE" THEN
  251.         IF TOTALNEEDED& > 0 THEN
  252.             CustInstInfo0Dlg IDD_TOOBIG
  253.         ELSE
  254.             UIPop 1
  255.             GOTO INSTALL
  256.         ENDIF
  257.     ELSEIF sz$ = "PATH" THEN
  258.         GOSUB GETPATH
  259.     ELSEIF len(sz$) >= 3 AND mid$(sz$,1,3) = "CHK" THEN
  260.         SetDriveStatus
  261.     ELSEIF sz$ = "CANCEL" THEN
  262.         GOSUB ASKQUIT
  263.     ELSEIF sz$ = "REACTIVATE" THEN
  264.         RecalcPath
  265.         SetDriveStatus
  266.     END IF
  267.     GOTO CUSTINSTLDEMO1
  268. '' ---------------------------------------------------------------------
  269. '' --------------------- GET PATH DIALOG PROCESSING --------------------
  270. '' ---------------------------------------------------------------------
  271. GETPATH:
  272.     SetSymbolValue "EditTextIn", DEST$
  273.     SetSymbolValue "EditFocus", "END"
  274. GETPATHL1:
  275.     sz$ = UIStartDlg(CUIDLL$, IDD_DESTPATH, "FEditDlgProc", IDD_DESTPATH_HELP, "FHelpDlgProc")
  276.     IF sz$ = "CONTINUE" THEN
  277.         olddest$ = DEST$
  278.         DEST$ = GetSymbolValue("EditTextOut")
  279.         ''Validate new path.
  280.         IF IsDirWritable(DEST$) = 0 THEN
  281.             CustInstInfo0Dlg IDD_BADPATH
  282.             DEST$ = olddest$
  283.             GOTO GETPATHL1
  284.         END IF
  285.         UIPop 1
  286.         ''Truncate display if too long.
  287.         IF LEN(DEST$) > 30 THEN
  288.             ReplaceListItem "DriveStatusText", 7, MID$(DEST$, 1, 30)+"..."
  289.         ELSE
  290.             ReplaceListItem "DriveStatusText", 7, DEST$
  291.         END IF
  292.         ''Recalc if path changed.
  293.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  294.             RecalcPath
  295.             SetDriveStatus
  296.         END IF
  297.         olddest$ = ""
  298.         RETURN
  299.     ELSEIF sz$ = "REACTIVATE" THEN
  300.         RecalcPath
  301.         SetDriveStatus
  302.     ELSE
  303.         UIPop 1
  304.         RETURN
  305.     END IF
  306.     GOTO GETPATHL1
  307. GETLANG:
  308.     AddListItem "ListItemsIn","English"
  309.     AddListItem "ListItemsIn","Russian"
  310.     SetSymbolValue "ListItemsOut",LANGUAGE$
  311. GETLANG1:
  312.     sz$ = UIStartDlg(CUIDLL$, IDD_LANGDEMO, "FComboDlgProc", IDD_LANGDEMO_HELP, "FHelpDlgProc")
  313.     IF sz$ = "CONTINUE" THEN
  314.         LANGUAGE$ = GetSymbolValue("ListItemsOut")
  315.         UIPop 1
  316.         GOTO INSTALL
  317.     ELSEIF sz$ = "CANCEL" THEN
  318.         GOSUB ASKQUIT
  319.     END IF
  320.     GOTO GETLANG1
  321. '' ---------------------------------------------------------------------
  322. '' ---------------------------- INSTALLATION ---------------------------
  323. '' ---------------------------------------------------------------------
  324. INSTALL:
  325.     CBTPATH$ = MakePath(DEST$, "DEMO")
  326.     ClearCopyListExtra
  327.     FOR i% = 1 TO OPT_LAST
  328.         AddOptFilesToCopyList i%,0
  329.     NEXT i%
  330.     CreateDir DEST$, cmoNone
  331.     SetRestartDir WINDIR$
  332.     CopyFilesInCopyList
  333.     CreateIniKeyValue MEDIAMANIA_INI$, "Directories", "DEMO", CBTPATH$, cmoOverwrite
  334.     IF 1 THEN
  335. ''Updating WIN.INI and SYSTEM.INI
  336. ''Only update SYSTEM.INI  on NT or next version of Windows for other codecs
  337. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  338.     IF VflatdPresent() = 0 THEN
  339.        CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  340.     END IF
  341. END IF
  342.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  343.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  344.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  345.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite
  346.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  347.     I% = DoesIniKeyExist (WinDir$ + "system.ini", "Drivers", "VIDC.RT21")
  348.     IF I% = 0  THEN
  349.        CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
  350.     END IF
  351.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
  352.     CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  353.     CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  354.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  355.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  356.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  357.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  358.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  359.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  360. ''*************************************************************************************************************************
  361. ''*************************************************************************************************************************
  362. ''To add a DCI provider, please un-comment the UDH line, and un-comment and replace the    <provider> with your own file name
  363. ''
  364. ''  CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "DCI", "<provider>", cmoOverwrite
  365. ''  CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "vids.draw", "udh.dll", cmoOverwrite
  366. ''*************************************************************************************************************************
  367. ''*************************************************************************************************************************
  368. ''Do not register components not installed with Video for Windows on NT or next version of Windows.
  369. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  370.     Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  371.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  372.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  373. CreateProgmanItem "Zubeh÷r", "Medien-Wiedergabe", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite 
  374.     Run ("profdisp.exe")
  375. END IF    ''NT and next version of Windows installation stop here.
  376.     END IF
  377.     IF 1 THEN
  378.         CreateIniKeyValue MEDIAMANIA_INI$,"Directories","Root",DEST$,cmoOverwrite
  379.         CreateProgmanGroup "MediaMania Demo", "", cmoNone
  380.         ShowProgmanGroup  "MediaMania Demo", 1, cmoNone
  381.         IF 1 THEN
  382.             CreateProgmanItem "MediaMania Demo", "MediaMania Broadcast", MakePath(DEST$,MEDIAMANIA_EXE$), "", cmoOverwrite
  383.               CreateProgmanItem "MediaMania Demo", "Uninstall", MakePath(DEST$,"PROGRAMS\UNINST.EXE ")+MEDIAMANIA_INI$+","+"MediaMania Demo"+","+"0", ",,,,c:\", cmoOverwrite
  384.         END IF
  385.         IF 1 THEN
  386.             CreateProgmanItem "MediaMania Demo", "Capture", MakePath(DEST$,"PROGRAMS\MDMCAP.EXE"), "", cmoOverwrite
  387.         END IF
  388.     END IF
  389. '' Restart Windows: if it has to updates ACM from DOS, it restarts Windows
  390. '' automatically; else, it gives the user the choice
  391.     RESTRT% = RestartListEmpty ()
  392.     Exe$ = WINDIR$ + "\_msrstrt.exe"
  393.     Batch$ = WINDIR$ + "\_mssetup.bat"
  394.     empty$ = ""
  395. RESTART:
  396.     IF RESTRT% = 0 THEN
  397.         sz$ = UIStartDlg(CUIDLL$, IDD_RESTART, "FInfo0DlgProc", 0, "")
  398.         IF sz$ = "REACTIVATE" THEN
  399.              GOTO RESTART
  400.         ENDIF
  401.         I% = ExitExecRestart ()
  402.         RemoveFile Exe$, cmoForce
  403.         RemoveFile Batch$, cmoForce
  404.         END
  405.     ELSE
  406.         sz$ = UIStartDlg(CUIDLL$, IDD_RESTARTQUERY, "FQuitDlgProc", 0, "")
  407.         IF sz$ = "CONTINUE" THEN
  408.             I% = ExitWindowsExec (Exe$, empty$)
  409.             IF I% = 0 THEN
  410.                 GOTO RESTART
  411.             ELSE
  412.             END
  413.         ENDIF
  414.         ELSEIF sz$ = "EXIT" THEN
  415.             UIPopAll
  416.             END
  417.         ELSEIF sz$ = "REACTIVATE" THEN
  418.             GOTO RESTART
  419.         ELSE
  420.             UIPop 1
  421.         END IF
  422.     END IF
  423.     GOTO ENDLABEL
  424. '' ---------------------------------------------------------------------
  425. '' ------------------------ SETUP QUIT PROCESSING ----------------------
  426. '' ---------------------------------------------------------------------
  427. QUIT:
  428.     ON ERROR GOTO ERRQUIT
  429.     IF ERR = 0 THEN
  430.         dlg% = IDD_EXITSUCCESSREG
  431.     ELSEIF ERR = STFQUIT THEN
  432.         dlg% = IDD_EXITQUIT
  433.     ELSE
  434.         dlg% = IDD_EXITFAILURE
  435.     END IF
  436. QUITL1:
  437.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  438.     IF sz$ = "REACTIVATE" THEN
  439.         GOTO QUITL1
  440.     END IF
  441.     UIPop 1
  442.     END
  443. ERRQUIT:
  444.     i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  445. ENDLABEL:
  446.     END
  447. '' -------------------------------------------------------------------------
  448. '' -------------------------------------------------------------------------
  449. '' ----------                                                   ------------
  450. '' ----------         A U X I L I A R Y   D I A L O G S         ------------
  451. '' ----------                                                   ------------
  452. '' -------------------------------------------------------------------------
  453. '' -------------------------------------------------------------------------
  454. '' ---------------------------------------------------------------------
  455. '' --------------------- ASK QUIT DIALOG PROCESSING --------------------
  456. '' ---------------------------------------------------------------------
  457. ASKQUIT:
  458.     sz$ = UIStartDlg(CUIDLL$, IDD_ASKQUIT, "FQuitDlgProc", 0, "")
  459.     IF sz$ = "EXIT" THEN
  460.         UIPopAll
  461.         ERROR STFQUIT
  462.     ELSEIF sz$ = "REACTIVATE" THEN
  463.         GOTO ASKQUIT
  464.     ELSE
  465.         UIPop 1
  466.     END IF
  467.     RETURN
  468. '' ---------------------------------------------------------------------
  469. '' ------------------- CUSTINST INFO0 DIALOG PROCESSING ----------------
  470. '' ---------------------------------------------------------------------
  471. SUB CustInstInfo0Dlg(template%) STATIC
  472. L1:
  473.     sz$ = UIStartDlg(CUIDLL$, template%, "FInfo0DlgProc", 0, "")
  474.     IF sz$ = "REACTIVATE" THEN
  475.         ''RecalcPath
  476.         ''SetDriveStatus
  477.         GOTO L1
  478.     END IF
  479.     UIPop 1
  480. END SUB
  481. '' -------------------------------------------------------------------------
  482. '' -------------------------------------------------------------------------
  483. '' ----------                                                   ------------
  484. '' ----------         U T I L I T Y   F U N C T I O N S         ------------
  485. '' ----------                                                   ------------
  486. '' -------------------------------------------------------------------------
  487. '' -------------------------------------------------------------------------
  488. '' --------------- Returns control identifier by given string
  489. ''                 for letters and statics,
  490. ''                      e.g. IDC("A")=IDC_A, IDC("B")=IDC_B,
  491. ''                           IDC("STATIC1")=IDC_STATIC1, etc.
  492. FUNCTION IDC(s$) STATIC AS INTEGER
  493.     IF Len(s$) = 1 THEN
  494.         IDC = 401+asc(s$)-asc("A")
  495.     ELSEIF Mid$(s$,1,6) = "STATIC" THEN
  496.         IDC = 600+val(Mid$(s$,7))
  497.     ELSEIF Mid$(s$,1,4) = "LIST" THEN
  498.         IDC = 428+val(Mid$(s$,5))
  499.     ELSE
  500.         IDC = -1
  501.     END IF
  502. END FUNCTION
  503. '' --------------- Converts ASCII path to integer drive number
  504. FUNCTION DriveN(path$) STATIC AS INTEGER
  505.     DriveN = asc(ucase$(path$))-asc("A")+1
  506. END FUNCTION
  507. '' --------------- Clears copy list and ExtraCosts list
  508. SUB ClearCopyListExtra STATIC
  509.     ClearCopyList
  510.     FOR i% = 1 TO 26 STEP 1
  511.         ReplaceListItem "ExtraCosts", i%, "0"
  512.     NEXT i%
  513. END SUB
  514. '' -------- Adds specified cost to the drive% item of the ExtraCosts list
  515. SUB AddExtraCost (drive%,cost&) STATIC
  516.     ReplaceListItem "ExtraCosts", drive%, STR$( VAL(GetListItem("ExtraCosts",drive%))+cost& )
  517. END SUB
  518. '**
  519. '** Purpose:
  520. '**     Adds the specified section files to the copy list.
  521. '** Arguments:
  522. '**     ftype%  - type of option to add, one of the following:
  523. '**             OPT_MEDIAMANIA, OPT_SAMPLES
  524. '**     falways% - if this parameter is zero then the section is added
  525. '**             depending on the corresponding checkbox state. If this
  526. '**             parameter is non-zero the section is always added.
  527. '** Returns:
  528. '**     none.
  529. '*************************************************************************
  530. SUB AddOptFilesToCopyList (ftype%,falways%) STATIC
  531.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  532.     AddSectionFilesToCopyList "ProgramFiles", SrcDir$, MakePath$(DEST$,"PROGRAMS")
  533.     AddSectionFilesToCopyList "CaptureFiles", SrcDir$, MakePath$(DEST$,"PROGRAMS")
  534.     AddSectionFilesToCopyList "BehaviourFiles", SrcDir$, MakePath$(DEST$,"BEHAVIOR")
  535.     AddSectionFilesToCopyList "SystemFiles", SrcDir$, SHAREDIR$
  536.     IF ((OnNT$ = "TRUE")) THEN
  537.     AddSectionFilesToCopyList "WinNTDlls", SrcDir$, WinSys32Dir$
  538.     END IF
  539.             IF ((OnNT$ = "TRUE")) THEN
  540.             AddSectionFilesToCopyList "WinNTFiles", SrcDir$, MakePath$(DEST$,"PROGRAMS")
  541.             ELSE
  542.             AddSectionFilesToCopyList "NonWinNTFiles", SrcDir$, SHAREDIR$
  543.             AddSectionFilesToCopyList "NonWinNTFilesVM", SrcDir$, MakePath$(DEST$,"PROGRAMS")
  544.             END IF
  545. '' Remove DCISVGA file
  546.     AddSectionFilesToCopyList "remove", SrcDir$, WinSysDir$
  547. ''  Runtime files (on Windows disk)
  548. ''  Do not install OLE or MPlayer if on next release of NT or Windows
  549.     IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN            'These files not necessary on Windows NT
  550.     AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$
  551.     AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$
  552.     END IF
  553.     AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
  554.     AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
  555.     AddSectionFilesToCopyList "AVICodecs", SrcDir$, WinSysDir$
  556.     AddSectionFilesToCopyList "ProgramWinFiles", SrcDir$, WINDIR$
  557.                 ''Add extra cost to Windows drive for ini/progman, etc.
  558.                 ''Also add extra cost to Dest drive for inifile
  559.     AddExtraCost    DriveN(WINDIR$),10240
  560.     AddExtraCost    DriveN(DEST$),10240
  561.     IF 1 THEN
  562.         AddSectionFilesToCopyList "CBTFiles", SrcDir$, MakePath$(DEST$,"DEMO")
  563.     END IF
  564. END SUB
  565. '**
  566. '** Purpose:
  567. '**     Recalculates disk space for the given option files and sets
  568. '**     the status info symbol "StatusItemsText".
  569. '** Arguments:
  570. '**     ftype% - type of option to add, one of the following:
  571. '**             OPT_MEDIAMANIA, OPT_SAMPLES
  572. '** Returns:
  573. '**     none.
  574. '*************************************************************************
  575. SUB RecalcOptFiles (ftype%) STATIC
  576. END SUB
  577. '**
  578. '** Purpose:
  579. '**     Recalculates disk space and sets option status info according
  580. '**     to the current destination path.
  581. '** Arguments:
  582. '**     none.
  583. '** Returns:
  584. '**     none.
  585. '*************************************************************************
  586. SUB RecalcPath STATIC
  587.     CursorSave% = ShowWaitCursor()
  588.     for i% = 1 TO OPT_LAST STEP 1
  589.         RecalcOptFiles i%
  590.     NEXT i%
  591.     RestoreCursor CursorSave%
  592. END SUB
  593. '**
  594. '** Purpose:
  595. '**     Sets drive status info according to latest disk space calcs.
  596. '** Arguments:
  597. '**     none.
  598. '** Returns:
  599. '**     none.
  600. '*************************************************************************
  601. SUB SetDriveStatus STATIC
  602.     CursorSave% = ShowWaitCursor()
  603.     ClearCopyListExtra
  604.     FOR i% = 1 TO OPT_LAST STEP 1
  605.         AddOptFilesToCopyList i%,0
  606.     NEXT i%
  607.     TOTALNEEDED& = GetCopyListCost("ExtraCosts","SizeList","")
  608.     drive$ = UCASE$(MID$(DEST$,1,1))
  609.     ndrive% = DriveN(drive$)
  610.     cost& = VAL(GetListItem("SizeList", ndrive%))
  611.     free& = GetFreeSpaceForDrive(drive$)
  612.     ReplaceListItem "DriveStatusText", 1, drive$ + ":"
  613.     ReplaceListItem "DriveStatusText", 2, STR$((cost&+1023) / 1024) + " K"
  614.     ReplaceListItem "DriveStatusText", 3, STR$(free& / 1024) + " K"
  615.     IF ndrive% = DriveN(WINDIR$) THEN
  616.         ReplaceListItem "DriveStatusText", 4, ""
  617.         ReplaceListItem "DriveStatusText", 5, ""
  618.         ReplaceListItem "DriveStatusText", 6, ""
  619.     ELSE
  620.         drive$ = UCASE$(MID$(WINDIR$,1,1))
  621.         ndrive% = DriveN(WINDIR$)
  622.         cost& = VAL(GetListItem("SizeList", ndrive%))
  623.         IF cost& = 0 THEN
  624.             ReplaceListItem "DriveStatusText", 4, ""
  625.             ReplaceListItem "DriveStatusText", 5, ""
  626.             ReplaceListItem "DriveStatusText", 6, ""
  627.         ELSE
  628.             free& = GetFreeSpaceForDrive(drive$)
  629.             ReplaceListItem "DriveStatusText", 4, drive$ + ":"
  630.             ReplaceListItem "DriveStatusText", 5, STR$((cost&+1023) / 1024) + " K"
  631.             ReplaceListItem "DriveStatusText", 6, STR$(free& / 1024) + " K"
  632.         END IF
  633.     END IF
  634.     RestoreCursor CursorSave%
  635. END SUB
  636. '**
  637. '** Purpose:
  638. '**     Appends a file name to the end of a directory path,
  639. '**     inserting a backslash character as needed.
  640. '** Arguments:
  641. '**     szDir$  - full directory path (with optional ending "\")
  642. '**     szFile$ - filename to append to directory
  643. '** Returns:
  644. '**     Resulting fully qualified path name.
  645. '*************************************************************************
  646. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  647.     IF szDir$ = "" THEN
  648.         MakePath = szFile$
  649.     ELSEIF szFile$ = "" THEN
  650.         MakePath = szDir$
  651.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  652.         MakePath = szDir$ + szFile$
  653.     ELSE
  654.         MakePath = szDir$ + "\" + szFile$
  655.     END IF
  656. END FUNCTION
  657.