home *** CD-ROM | disk | FTP | other *** search
/ Computerworld: Internet 97 / Computerworld_1997-01_cd.bin / vfw / setup.mst < prev    next >
Encoding:
Text File  |  1995-01-12  |  10.4 KB  |  298 lines

  1. '**************************************************************************
  2. '*                  VfW 1.1 Runtime Setup
  3. '**************************************************************************
  4. '$INCLUDE 'setupapi.inc'
  5. '$INCLUDE 'mscpydis.inc'    ''System
  6. '$INCLUDE 'msdetect.inc'    ''Detects Avalilable Disk Space
  7.  
  8. ''Dialog ID's
  9. CONST WELCOME       = 100
  10. CONST ASKQUIT       = 200
  11. CONST EXITFAILURE   = 400
  12. CONST EXITQUIT      = 600
  13. CONST EXITSUCCESS   = 700
  14. CONST APPHELP       = 900
  15. CONST CHECK         = 2500
  16. CONST SMALLWIN      = 2200
  17. CONST RESTART       = 2600
  18. CONST RESTARTII     = 2700
  19.  
  20. ''Bitmap ID
  21. CONST LOGO = 1
  22.  
  23. GLOBAL SizeReq&  '' Total Disk Size required for installation
  24.  
  25. ''File Types
  26. GLOBAL WinDir$
  27. GLOBAL WinSysDir$
  28. GLOBAL WINDRIVE$    ''Windows Drive Letter.
  29. GLOBAL CHECKSTATES$
  30. GLOBAL MinorVer%
  31. GLOBAL OnNT$
  32.  
  33. DECLARE SUB Install
  34. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  35. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  36. DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
  37. DECLARE SUB Reboot LIB "iniupd.dll"
  38. DECLARE fUNCTION ExitWindowsExec  LIB "User" (Exec$, Param$) AS INTEGER
  39.  
  40. INIT:
  41.  
  42.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  43.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  44.  
  45.     WIN32ENABLED% = 0
  46.     MajorVer% = GetWindowsMajorVersion()
  47.     MinorVer% = GetWindowsMinorVersion()
  48.     Processor% = GetProcessorType()
  49.     WinDir$ = GetWindowsDir()
  50.     DEST$ = GetWindowsDir()
  51.     WinSysDir$ = GetWindowsSysDir()
  52.  
  53.     IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
  54.     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)
  55.     END
  56.     END IF
  57.  
  58.     'Prevents installation on 286
  59.     IF Processor% < 3 THEN
  60.     i% = DoMsgBox("Video for Windows requires a 386 or greater processor or emulator.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  61.     END
  62.     END IF
  63.  
  64.     ' Use Wowexec to determine version of NT.  3.1 did not stamp wowexec and wow returns 3.1 as version
  65.     IF OnWindowsNT() THEN
  66.       OnNT$ = "TRUE"
  67.       WowVersion$ = GetVersionOfFile(WinDir$ + "system32\wowexec.exe")
  68.       IF WowVersion$ = "" THEN
  69.          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)
  70.          END
  71.       END IF
  72.     END IF
  73.  
  74.     SetBitmap CUIDLL$, LOGO
  75.     SetTitle "Video for Windows 1.1 Runtime"
  76.  
  77.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  78.     IF szInf$ = "" THEN
  79.        szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  80.     END IF
  81.     ReadInfFile szInf$
  82.  
  83.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  84.  
  85. WELCOME:
  86.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  87.     IF sz$ = "CONTINUE" THEN
  88.        UIPop 1
  89.      ELSE
  90.     GOSUB ASKQUIT
  91.     GOTO WELCOME
  92.     END IF
  93.  
  94. ''Prepare Copy list and check size
  95.  
  96.     ClearCopyList
  97.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  98.  
  99. ''  Runtime files (on Windows disk)
  100. ''  Do not install OLE or MPlayer if on next release of NT or Windows
  101.  
  102.     IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN            'These files not necessary on Windows NT
  103.     AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$
  104.     AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$
  105.     END IF
  106.     AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
  107.     AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
  108.     AddSectionFilesToCopyList "AVICodecs", SrcDir$, WinSysDir$
  109.  
  110.  
  111. ''*************************************************************************************************************************
  112. ''*************************************************************************************************************************
  113. ''To add a DCI provider, please un-comment the AddSectionFilesToCopyList.
  114. ''
  115. ''!!ELSA
  116.       AddSectionFilesToCopyList "DCI Provider", SrcDir$, WinSysDir$
  117. ''*************************************************************************************************************************
  118. ''*************************************************************************************************************************
  119.  
  120. ''  Check windrive diskspace
  121.     SizeReq& = GetCopyListCost ("","", "")
  122.     IF SizeReq& <> 0 THEN
  123.     GOSUB SMALLWIN
  124.     END
  125.     END IF
  126.  
  127. Install
  128.  
  129. '' Restart Windows: if it has to updates ACM from DOS, it restarts Windows automatically
  130. '' else, it gives the user the choice
  131.     RESTRT% = RestartListEmpty ()
  132.     Exe$ = DEST$ + "\_msrstrt.exe"
  133.     Batch$ = DEST$ + "\_mssetup.bat"
  134.     empty$ = ""
  135. RESTART:
  136.     IF RESTRT% = 0 THEN
  137.        sz$ = UIStartDlg(cuidll$, RESTART, "FInfo0DlgProc", 0, "")
  138.        IF sz$ = "REACTIVATE" THEN
  139.       GOTO RESTART
  140.        ENDIF
  141.        I% = ExitExecRestart ()
  142.        RemoveFile Exe$, cmoForce
  143.        RemoveFile Batch$, cmoForce
  144.        END
  145.     ELSE
  146.        sz$ = UIStartDlg(CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "")
  147.        IF sz$ = "CONTINUE" THEN
  148.       I% = ExitWindowsExec (Exe$, empty$)
  149.       IF I% = 0 THEN
  150.          GOTO RESTART
  151.       ELSE
  152.          END
  153.      ENDIF
  154.        ELSEIF sz$ = "EXIT" THEN
  155.       UIPopAll
  156.       END
  157.        ELSEIF sz$ = "REACTIVATE" THEN
  158.       GOTO RESTART
  159.        ELSE
  160.       UIPop 1
  161.        END IF
  162.     END IF
  163.  
  164.  
  165. QUIT:
  166.     ON ERROR GOTO ERRQUIT
  167.  
  168.     IF ERR = 0 THEN
  169.     dlg% = EXITSUCCESS
  170.     ELSEIF ERR = STFQUIT THEN
  171.     dlg% = EXITQUIT
  172.     ELSE
  173.     dlg% = EXITFAILURE
  174.     END IF
  175. QUITL1:
  176.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  177.     IF sz$ = "REACTIVATE" THEN
  178.     GOTO QUITL1
  179.     END IF
  180.     UIPop 1
  181.     END
  182.  
  183. ERRQUIT:
  184.     i% = DoMsgBox("An installation problem occured, call the product support service", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  185.     END
  186.  
  187.  
  188. ASKQUIT:
  189.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  190.  
  191.     IF sz$ = "EXIT" THEN
  192.     UIPopAll
  193. ''        ERROR STFQUIT
  194.     END
  195.     ELSEIF sz$ = "REACTIVATE" THEN
  196.     GOTO ASKQUIT
  197.     ELSE
  198.     UIPop 1
  199.     END IF
  200.     RETURN
  201.  
  202. SMALLWIN:
  203.     sz$ = UIStartDlg(CUIDLL$, SMALLWIN, "FInfo0DlgProc", 0, "")
  204.     IF sz$ = "REACTIVATE" THEN
  205.     GOTO SMALLWIN
  206.     END IF
  207.     UIPop 1
  208.     RETURN
  209.  
  210. '**
  211. '** Purpose:
  212. '**     Performs all installation operations.
  213. '** Arguments:
  214. '**     none.
  215. '** Returns:
  216. '**     none.
  217. '*************************************************************************
  218. SUB Install STATIC
  219.  
  220.     SetRestartDir WinDir$
  221.     CopyFilesInCopyList
  222.  
  223. ''Updating WIN.INI and SYSTEM.INI
  224. ''Only update SYSTEM.INI  on NT or next version of Windows for other codecs
  225.  
  226. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  227.     IF VflatdPresent() = 0 THEN
  228.        CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  229.     END IF
  230. END IF
  231.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  232.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  233.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  234.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite
  235.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  236.     I% = DoesIniKeyExist ("system.ini", "Drivers", "VIDC.RT21")
  237.     IF I% = 0  THEN
  238.        CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
  239.     END IF
  240.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
  241.     CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  242.     CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  243.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  244.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  245.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  246.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  247.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  248.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  249.  
  250. ''*************************************************************************************************************************
  251. ''*************************************************************************************************************************
  252. ''To add a DCI provider, please un-comment the UDH line, and un-comment and replace the    <provider> with your own file name
  253. ''
  254.  
  255. ''!!ELSA
  256.   CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "DCI", "display", cmoOverwrite
  257.   CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "vids.draw", "udh.dll", cmoOverwrite
  258.   CreateIniKeyValue WinDir$ + "system.ini", "Winner.drv", "DCI-SUPPORT", "1", cmoOverwrite
  259.  
  260. ''*************************************************************************************************************************
  261. ''*************************************************************************************************************************
  262.  
  263. ''Do not register components not installed with Video for Windows on NT or next version of Windows.
  264. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  265.     Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  266.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  267.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  268.  
  269. '' Mplayer
  270.     CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
  271.  
  272. END IF    ''NT and next version of Windows installation stop here.
  273.  
  274.     Run ("profdisp.exe")
  275. END SUB
  276.  
  277. '**
  278. '** Purpose:
  279. '**     Appends a file name to the end of a directory path,
  280. '**     inserting a backslash character as needed.
  281. '** Arguments:
  282. '**     szDir$  - full directory path (with optional ending "\")
  283. '**     szFile$ - filename to append to directory
  284. '** Returns:
  285. '**     Resulting fully qualified path name.
  286. '*************************************************************************
  287. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  288.     IF szDir$ = "" THEN
  289.     MakePath = szFile$
  290.     ELSEIF szFile$ = "" THEN
  291.     MakePath = szDir$
  292.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  293.     MakePath = szDir$ + szFile$
  294.     ELSE
  295.     MakePath = szDir$ + "\" + szFile$
  296.     END IF
  297. END FUNCTION
  298.