home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazin 1997 January / CD_01_97.ISO / driver / setup.mst < prev    next >
Text File  |  1996-03-23  |  11KB  |  302 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.     RESTRT% = 1
  143.     IF RESTRT% = 0 THEN
  144.        sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "")
  145.        IF sz$ = "REACTIVATE" THEN
  146.       GOTO RESTART
  147.        ENDIF
  148.        I% = ExitExecRestart ()
  149.        RemoveFile Exe$, cmoForce
  150.        RemoveFile Batch$, cmoForce
  151.        END
  152.     ELSE
  153. ''     sz$ = UIStartDlg(CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "")
  154. sz$ = "EXIT"
  155.        IF sz$ = "CONTINUE" THEN
  156.       I% = ExitWindowsExec (Exe$, empty$)
  157.       IF I% = 0 THEN
  158.          GOTO RESTART
  159.       ELSE
  160.          END
  161.      ENDIF
  162.        ELSEIF sz$ = "EXIT" THEN
  163.       UIPopAll
  164.       END
  165.        ELSEIF sz$ = "REACTIVATE" THEN
  166.       GOTO RESTART
  167.        ELSE
  168.       UIPop 1
  169.        END IF
  170.     END IF
  171.  
  172.  
  173. QUIT:
  174.     ON ERROR GOTO ERRQUIT
  175.  
  176.     IF ERR = 0 THEN
  177.     dlg% = EXITSUCCESS
  178.     ELSEIF ERR = STFQUIT THEN
  179.     dlg% = EXITQUIT
  180.     ELSE
  181.     dlg% = EXITFAILURE
  182.     END IF
  183. QUITL1:
  184.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  185.     IF sz$ = "REACTIVATE" THEN
  186.     GOTO QUITL1
  187.     END IF
  188.     UIPop 1
  189.     END
  190.  
  191. ERRQUIT:
  192.     i% = DoMsgBox("An installation problem occured, call the product support service", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  193.     END
  194.  
  195.  
  196. ASKQUIT:
  197.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  198.  
  199.     IF sz$ = "EXIT" THEN
  200.     UIPopAll
  201. ''        ERROR STFQUIT
  202.     END
  203.     ELSEIF sz$ = "REACTIVATE" THEN
  204.     GOTO ASKQUIT
  205.     ELSE
  206.     UIPop 1
  207.     END IF
  208.     RETURN
  209.  
  210. SMALLWIN:
  211.     sz$ = UIStartDlg(CUIDLL$, SMALLWIN, "FInfo0DlgProc", 0, "")
  212.     IF sz$ = "REACTIVATE" THEN
  213.     GOTO SMALLWIN
  214.     END IF
  215.     UIPop 1
  216.     RETURN
  217.  
  218. '**
  219. '** Purpose:
  220. '**     Performs all installation operations.
  221. '** Arguments:
  222. '**     none.
  223. '** Returns:
  224. '**     none.
  225. '*************************************************************************
  226. SUB Install STATIC
  227.  
  228.     SetRestartDir WinDir$
  229.     CopyFilesInCopyList
  230.  
  231. ''Updating WIN.INI and SYSTEM.INI
  232. ''Only update SYSTEM.INI  on NT or next version of Windows for other codecs
  233.  
  234. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  235.     IF VflatdPresent() = 0 THEN
  236.        CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  237.     END IF
  238. END IF
  239.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  240.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  241.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  242.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite
  243.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  244.     I% = DoesIniKeyExist ("system.ini", "Drivers", "VIDC.RT21")
  245.     IF I% = 0  THEN
  246.        CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
  247.     END IF
  248.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
  249.     CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  250.     CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  251.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  252.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  253.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  254.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  255.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  256.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  257.  
  258. ''*************************************************************************************************************************
  259. ''*************************************************************************************************************************
  260. ''To add a DCI provider, please un-comment the UDH line, and un-comment and replace the    <provider> with your own file name
  261. ''
  262. ''  CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "DCI", "<provider>", cmoOverwrite
  263. ''  CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "vids.draw", "udh.dll", cmoOverwrite
  264. ''*************************************************************************************************************************
  265. ''*************************************************************************************************************************
  266.  
  267. ''Do not register components not installed with Video for Windows on NT or next version of Windows.
  268. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  269.     Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  270.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  271.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  272.  
  273. '' Mplayer
  274.     CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
  275.  
  276. END IF    ''NT and next version of Windows installation stop here.
  277.  
  278.     Run ("profdisp.exe")   
  279. END SUB
  280.  
  281. '**
  282. '** Purpose:
  283. '**     Appends a file name to the end of a directory path,
  284. '**     inserting a backslash character as needed.
  285. '** Arguments:
  286. '**     szDir$  - full directory path (with optional ending "\")
  287. '**     szFile$ - filename to append to directory
  288. '** Returns:
  289. '**     Resulting fully qualified path name.
  290. '*************************************************************************
  291. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  292.     IF szDir$ = "" THEN
  293.     MakePath = szFile$
  294.     ELSEIF szFile$ = "" THEN
  295.     MakePath = szDir$
  296.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  297.     MakePath = szDir$ + szFile$
  298.     ELSE
  299.     MakePath = szDir$ + "\" + szFile$
  300.     END IF
  301. END FUNCTION
  302.