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