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