home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1996 January / buyer-0196.iso / setup.mst < prev    next >
Text File  |  1995-10-03  |  26KB  |  684 lines

  1. rem ****************************************************************************
  2. rem *
  3. rem *    File:        setup.mst
  4. rem *
  5. rem *    Author:        Clive Nutter
  6. rem *
  7. rem *    Purpose:    Script file for MS setup engine.
  8. rem *
  9. rem *    Change History:
  10. rem *
  11. rem *        01.09.95, CLN    Created, based on AV title setup.mst.
  12. rem *        02.09.95, CLN    Added QuickTime version checking.
  13. rem *        03.09.95, CLN    Amended so each promo has its own copy of
  14. rem *                engine.
  15. rem *        06.09.95, CLN    Added code for First World War & War in the
  16. rem *                Pacific promos.
  17. rem *        15.09.95, CLN    Add DLL call to update system configuration.
  18. rem *                Add code to display read-me file.
  19. rem *
  20. rem ****************************************************************************
  21.  
  22. '$INCLUDE 'setupapi.inc'
  23. '$INCLUDE 'mscpydis.inc'    ''System
  24. '$INCLUDE 'msdetect.inc'    ''Detects Available Disk Space      
  25. '$INCLUDE 'pmgrdde.inc'        ''Program Manager DDE
  26. '$INCLUDE 'flagtowr.inc'    ''FlagTower title values
  27.  
  28. ''Dialog ID's
  29. CONST WELCOME       = 100
  30. CONST ASKQUIT       = 200
  31. CONST ASKPATH       = 300
  32. CONST EXITFAILURE   = 400
  33. CONST EXITQUIT      = 600
  34. CONST EXITSUCCESS   = 700
  35. CONST APPHELP       = 900
  36. CONST SMALLWIN      = 2200
  37. CONST RESTART       = 2600
  38. CONST RESTARTII     = 2700
  39. CONST BADPATH       = 6400
  40.  
  41. 'GLOBAL SizeReq&        '' Total Disk Size required for installation
  42.  
  43. GLOBAL WinDir$            ''Windows directory
  44. GLOBAL WinSysDir$        ''Windows system directory
  45. GLOBAL WinSys32Dir$        ''Win32 system directory
  46. GLOBAL MinorVer%        ''Windows minor version number
  47. GLOBAL OnNT$            ''NT flag
  48.  
  49. GLOBAL SrcDir$            ''Source directory                   
  50. GLOBAL CDDrive$            ''CD-Rom drive letter
  51. GLOBAL DbPath$            ''Database directory
  52.  
  53. GLOBAL AVDest$            ''Directory to put AV engine libraries
  54.  
  55. global isInstallQTW as integer
  56.  
  57. ''----- External functions called by Video for Windows setup
  58. DECLARE FUNCTION ExitWindowsExec  LIB "user" (Exec$, Param$) AS INTEGER
  59. DECLARE FUNCTION OnWindowsNT LIB "iniupd.dll" AS INTEGER
  60. DECLARE SUB      Reboot LIB "iniupd.dll"
  61. DECLARE FUNCTION VflatdPresent LIB "iniupd.dll" AS INTEGER
  62. DECLARE FUNCTION WritePrivateProfileString LIB "krnl386.exe" (szSect$, szEntry$, szString$, szINI$) AS INTEGER
  63.  
  64. ''----- External functions called by WinG setup
  65. DECLARE FUNCTION GetRealSystemDirectory LIB "setuphlp.dll" (szDir$, cbBuf%) AS INTEGER
  66. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.dll" (szOrig$, szNew$) AS INTEGER
  67. DECLARE SUB      RenameFilePlease LIB "setuphlp.dll" (szOrig$, szNew$)
  68. DECLARE FUNCTION RestartWindows LIB "setuphlp.dll" AS INTEGER
  69.                  
  70. ''----- Effects library functions used
  71. DECLARE FUNCTION DivertBackMessage LIB "avsetup.dll" (WinHandle%, InstHandle%) AS INTEGER
  72. DECLARE SUB      MaxWindowArea LIB "avsetup.dll" (WinHandle%)
  73. DECLARE FUNCTION ShowBitmap LIB "avsetup.dll" (WinHandle%, szName$, nFx%, nFxTime%) AS INTEGER          
  74. DECLARE FUNCTION SetFileAttribute LIB "avsetup.dll" (szName$, nMode%) AS INTEGER
  75. DECLARE FUNCTION setDOSFileAttr LIB "avsetup.dll" (szName$, nAttr%, nIsOverwrite%) AS INTEGER
  76. DECLARE FUNCTION getSystemRAM LIB "avsetup.dll" AS INTEGER
  77. DECLARE FUNCTION readTitleDescription LIB "avsetup.dll" (szDesc$, lenDesc%, szDescFile$) AS INTEGER
  78. DECLARE FUNCTION fnnGetQTWVersion LIB "qtw_vers.dll" (ourVersion&) AS INTEGER
  79. DECLARE FUNCTION CallModifyCONFIG LIB "confchk.dll" (WinHandle%) AS INTEGER
  80.  
  81. ''----- Local functions
  82. DECLARE FUNCTION CheckVideoSystem(WinMajVer%, WinMinVer%, ProcType%) AS INTEGER
  83. DECLARE FUNCTION CreateTitleINIFile(szINI$, szCD$, szDbPath$) AS INTEGER
  84. declare sub     CopyTitlePromoBinaries(pathBinary$, sectBinary$, sectCDilla$, sectEngine$, sectAccusoft$ )
  85. declare sub     CopyTitlePromoDatabase(pathDatabase$, sectDatabase$ )
  86. declare sub     InstallTitlePromo( pathRoot$, pathBinary$, pathDatabase$, iniFile$, dllFile$, iconNo% )
  87. DECLARE SUB      Install
  88. DECLARE FUNCTION MakePath(szDir$, szFile$) AS STRING
  89. DECLARE SUB      UpdateWinG32(szOrig$)
  90.  
  91. INIT:
  92.   
  93.     CUIDLL$   = "ftcuistf.dll"          ''Custom user interface dll
  94.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  95.  
  96.     MajorVer%      = GetWindowsMajorVersion()
  97.     MinorVer%      = GetWindowsMinorVersion()
  98.     Processor%      = GetProcessorType()
  99.     WinDir$       = GetWindowsDir()
  100.     WinSysDir$      = GetWindowsSysDir()
  101.     WinSys32Dir$  = WinDir$ + "system32"
  102.     SrcDir$       = GetSymbolValue("STF_SRCDIR")
  103.     
  104.     'Make sure the user's system can handle Video for Windows
  105.     dummy% = CheckVideoSystem(MajorVer%, MinorVer%, Processor%) 
  106.     IF OnWindowsNT() THEN
  107.         OnNT$ = "TRUE"
  108.     END IF
  109.                            
  110.     'Read setup's .INF file                           
  111.     szInf$ = GetSymbolValue("STF_SRCINFPATH")                                 
  112.     IF szInf$ = "" THEN
  113.        szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  114.     END IF
  115.     ReadInfFile szInf$
  116.  
  117.     'Divert paint messages of background window to our own routine                      
  118.     dummy% = DivertBackMessage(HwndFrame(), HinstFrame())
  119.     MaxWindowArea(HwndFrame())
  120.     dummy% = ShowBitmap(HwndFrame(), SrcDir$+"logo.bmp",106,1000)     
  121.             
  122.                
  123. WELCOME:
  124.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  125.  
  126.     IF sz$ = "CONTINUE" THEN
  127.         UIPop 1
  128.     ELSE
  129.         GOSUB ASKQUIT
  130.         GOTO WELCOME
  131.     END IF
  132.  
  133.                                                       
  134. GETPATH: 
  135.     AVDest$ = Dir_DefaultInstall
  136.  
  137.     SetSymbolValue "EditTextIn", AVDest$
  138.     SetSymbolValue "EditTextOut", AVDest$
  139.     SetSymbolValue "EditFocus", "END"
  140. GETPATHL1:
  141.     SetSymbolValue "DLGEVENT", ""
  142.  
  143.     sz$ = UIStartDlg(CUIDLL$, ASKPATH, "FEditDlgProc", 0, "")
  144.     AVDest$ = GetSymbolValue("EditTextOut")
  145.     
  146.     IF sz$ = "CONTINUE" THEN
  147.         IF IsDirWritable(AVDest$) = 0 THEN 
  148.            GOSUB BADPATH
  149.            GOTO GETPATHL1
  150.         END IF
  151.         UIPop 1
  152.     ELSE 
  153.         IF sz$ = "EXIT" THEN
  154.             GOSUB ASKQUIT
  155.         END IF
  156.         GOTO GETPATH        
  157.     END IF
  158.           
  159.           
  160.     rem *** Prepare copy list
  161.  
  162.     ClearCopyList                                           
  163.  
  164. '$ifdef IsAdvert
  165.     Path_AdvertRoot = AVDest$ + Dir_AdvertRoot
  166.     Path_AdvertBinary = Path_AdvertRoot + Dir_Binary
  167.     Path_AdvertEngine = Path_AdvertRoot + Dir_Binary
  168.     Path_AdvertDatabase = Path_AdvertRoot + Dir_Database
  169. '$endif
  170.  
  171. '$ifdef IsSpacePromo
  172.     Path_SpaceRoot = AVDest$ + Dir_SpaceRoot
  173.     Path_SpaceBinary = Path_SpaceRoot + Dir_Binary
  174.     Path_SpaceEngine =  Path_SpaceRoot + Dir_Binary
  175.     Path_SpaceDatabase =  Path_SpaceRoot + Dir_Database
  176. '$endif
  177.  
  178. '$ifdef IsWW2Promo
  179.     Path_WW2Root = AVDest$ + Dir_WW2Root
  180.     Path_WW2Binary = Path_WW2Root + Dir_Binary
  181.     Path_WW2Engine =  Path_WW2Root + Dir_Binary
  182.     Path_WW2Database =  Path_WW2Root + Dir_Database
  183. '$endif
  184.  
  185. '$ifdef IsFWWPromo
  186.     Path_FWWRoot = AVDest$ + Dir_FWWRoot
  187.     Path_FWWBinary = Path_FWWRoot + Dir_Binary
  188.     Path_FWWEngine =  Path_FWWRoot + Dir_Binary
  189.     Path_FWWDatabase =  Path_FWWRoot + Dir_Database
  190. '$endif
  191.  
  192. '$ifdef IsWPCPromo
  193.     Path_WPCRoot = AVDest$ + Dir_WPCRoot
  194.     Path_WPCBinary = Path_WPCRoot + Dir_Binary
  195.     Path_WPCEngine =  Path_WPCRoot + Dir_Binary
  196.     Path_WPCDatabase =  Path_WPCRoot + Dir_Database
  197. '$endif
  198.  
  199. '' ------------------- Copy list for Video for Windows --------------------
  200. ''Remove DCISVGA file
  201.     RemoveFile WinSysDir$+"dcisvga.drv", cmoForce
  202.  
  203.     IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN            
  204.         'These files not necessary on Windows NT
  205.         AddSectionFilesToCopyList "VfW MPlayer", SrcDir$, WinDir$
  206.         AddSectionFilesToCopyList "VfW OLE2", SrcDir$, WinSysDir$
  207.     END IF
  208.     AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
  209.     AddSectionFilesToCopyList "VfW ACM Drivers", SrcDir$, WinSysDir$
  210.     AddSectionFilesToCopyList "VfW AVICodecs", SrcDir$, WinSysDir$
  211.     IF OnNT$ = "TRUE" THEN
  212.         AddSectionFilesToCopyList "VfW NT MSVideo", SrcDir$, WinSys32Dir$
  213.     ENDIF
  214.  
  215. '' --------------------- Copy list for WinG -----------------------
  216.     AddSectionFilesToCopyList "WinG runtime", SrcDir$, WinSysDir$
  217.     Dest1$ = MakePath (WinSysDir$,"Wing32.dll")
  218.     Dest2$ = MakePath (WinSysDir$,"Wing32.xxx")
  219.     RenameFilePlease Dest1$, Dest2$
  220.  
  221. '' ---------------------- Copy list for WinToon -----------------------
  222.     AddSectionFilesToCopyList "WinToon runtime", SrcDir$, WinSysDir$
  223.  
  224. '' --------------------- Copy list for MediaView ----------------------
  225.     AddSectionFilesToCopyList "MediaView runtime", SrcDir$, WinSysDir$
  226.  
  227.     rem *** Copy list for QuickTime
  228.  
  229.     isInstallQTW = 0
  230.  
  231.     qtwVersion& = 8748
  232.  
  233.     s% = fnnGetQTWVersion( qtwVersion& )
  234.  
  235.     if s% = 1 then
  236.         isInstallQTW = 1
  237.  
  238.         AddSectionFilesToCopyList "QuickTime 2.02 runtime", SrcDir$, WinSysDir$
  239.     endif
  240.  
  241. '' ------------------------ Copy list for ADS -------------------------
  242.     AddSectionFilesToCopyList "ADS", SrcDir$, WinSysDir$
  243.  
  244. '' ------------------------ Copy list for AAPLAY -------------------------
  245.     AddSectionFilesToCopyList "AAPLAY Animation", SrcDir$, WinSysDir$
  246.  
  247. '' ------------------------ Copy list for Accusoft Pro Gold -------------------------
  248. rem    AddSectionFilesToCopyList "Accusoft Pro Gold", SrcDir$, WinSysDir$
  249.  
  250. '$ifdef IsEncrypted
  251.     rem *** Copy list for C-Dilla
  252.  
  253.     AddSectionFilesToCopyList "C-Dilla system", SrcDir$, WinDir$
  254. '$endif
  255.  
  256.     rem *** Common utilities and system files
  257.  
  258.     AddSectionFilesToCopyList Sect_GenericUtility, SrcDir$, AVDest$
  259.     AddSectionFilesToCopyList Sect_GenericSystem, SrcDir$, WinSysDir$
  260.  
  261. '$ifdef IsAdvert
  262.     CopyTitlePromoBinaries Path_AdvertBinary, Sect_AdvertBinary, Sect_AdvertCDilla, Sect_AdvertEngine, Sect_AdvertAccusoftGold
  263.     CopyTitlePromoDatabase Path_AdvertDatabase, Sect_AdvertDatabase
  264. '$endif
  265.  
  266. '$ifdef IsSpacePromo
  267.     CopyTitlePromoBinaries Path_SpaceBinary, Sect_SpaceBinary, Sect_SpaceCDilla, Sect_SpaceEngine, Sect_SpaceAccusoftGold
  268.     CopyTitlePromoDatabase Path_SpaceDatabase, Sect_SpaceDatabase
  269. '$endif
  270.  
  271. '$ifdef IsWW2Promo
  272.     CopyTitlePromoBinaries Path_WW2Binary, Sect_WW2Binary, Sect_WW2CDilla, Sect_WW2Engine, Sect_WW2AccusoftGold
  273.     CopyTitlePromoDatabase Path_WW2Database, Sect_WW2Database
  274. '$endif
  275.  
  276. '$ifdef IsFWWPromo
  277.     CopyTitlePromoBinaries Path_FWWBinary, Sect_FWWBinary, Sect_FWWCDilla, Sect_FWWEngine, Sect_FWWAccusoftGold
  278.     CopyTitlePromoDatabase Path_FWWDatabase, Sect_FWWDatabase
  279. '$endif
  280.  
  281. '$ifdef IsWPCPromo
  282.     CopyTitlePromoBinaries Path_WPCBinary, Sect_WPCBinary, Sect_WPCCDilla, Sect_WPCEngine, Sect_WPCAccusoftGold
  283.     CopyTitlePromoDatabase Path_WPCDatabase, Sect_WPCDatabase
  284. '$endif
  285.  
  286. '' -------- Check space on hard disk --------
  287.     SizeReq& = GetCopyListCost ("","", "")
  288.     IF SizeReq& <> 0 THEN
  289.         GOSUB SMALLWIN
  290.         END
  291.     END IF
  292.  
  293.                               
  294. '' Perform install                              
  295.     Install
  296.  
  297. '' Restart Windows: if it has to updates ACM from DOS, it restarts Windows automatically
  298. '' else, it gives the user the choice
  299.     RESTRT% = RestartListEmpty ()
  300.     Exe$ = WinDir$ + "\_msrstrt.exe"
  301.     Batch$ = WinDir$ + "\_mssetup.bat"
  302.     empty$ = ""
  303.  
  304. RESTART:
  305.     IF RESTRT% = 0 THEN
  306.        sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "")
  307.        IF sz$ = "REACTIVATE" THEN
  308.                GOTO RESTART
  309.        ENDIF
  310.        I% = ExitExecRestart ()
  311.        RemoveFile Exe$, cmoForce
  312.        RemoveFile Batch$, cmoForce
  313.        END
  314.     ELSE
  315.        sz$ = UIStartDlg(CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "")
  316.        IF sz$ = "CONTINUE" THEN
  317.                I% = ExitWindowsExec (Exe$, empty$)                             
  318.                IF I% = 0 THEN
  319.                    GOTO RESTART
  320.                ELSE
  321.                  END
  322.                ENDIF
  323.        ELSEIF sz$ = "EXIT" THEN
  324.                UIPopAll
  325.               END
  326.        ELSEIF sz$ = "REACTIVATE" THEN
  327.                GOTO RESTART
  328.        ELSE
  329.               UIPop 1
  330.        END IF
  331.     END IF
  332.  
  333.  
  334. QUIT:
  335.     ON ERROR GOTO ERRQUIT
  336.  
  337.     IF ERR = 0 THEN
  338.         dlg% = EXITSUCCESS
  339.     ELSEIF ERR = STFQUIT THEN
  340.         dlg% = EXITQUIT
  341.     ELSE
  342.         dlg% = EXITFAILURE
  343.     END IF
  344. QUITL1:
  345.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  346.     IF sz$ = "REACTIVATE" THEN
  347.         GOTO QUITL1
  348.     END IF
  349.     UIPop 1
  350.     END
  351.  
  352. ERRQUIT:
  353.     i% = DoMsgBox("An installation problem occured.", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  354.     END
  355.  
  356.  
  357. ASKQUIT:
  358.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  359.  
  360.     IF sz$ = "EXIT" THEN
  361.         UIPopAll
  362. ''        ERROR STFQUIT
  363.     END
  364.     ELSEIF sz$ = "REACTIVATE" THEN
  365.         GOTO ASKQUIT
  366.     ELSE
  367.         UIPop 1
  368.     END IF
  369.     RETURN
  370.  
  371. SMALLWIN:
  372.     sz$ = UIStartDlg(CUIDLL$, SMALLWIN, "FInfo0DlgProc", 0, "")
  373.     IF sz$ = "REACTIVATE" THEN
  374.         GOTO SMALLWIN
  375.     END IF
  376.     UIPop 1
  377.     RETURN
  378.           
  379. BADPATH:
  380.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  381.     IF sz$ = "REACTIVATE" THEN
  382.         GOTO BADPATH
  383.     END IF
  384.     UIPop 1
  385.     RETURN
  386.  
  387. '**
  388. '** Purpose:
  389. '**     Performs all installation operations.
  390. '** Arguments:
  391. '**     none.
  392. '** Returns:
  393. '**     none.
  394. '*************************************************************************
  395. SUB Install STATIC           
  396.  
  397.     rem *** Change file attribute of 'flagtowr.ttl' to "normal" so it is visible
  398.  
  399. rem    dummy% = setDOSFileAttr( Path_TitleUtility + FN_Description, 0, 1 )
  400. rem    dummy% = setDOSFileAttr( Path_AdvertUtility + FN_Description, 0, 1 )
  401.  
  402.     SetRestartDir WinDir$
  403.     CopyFilesInCopyList
  404.     UpdateWinG32 WinSysDir$
  405.  
  406. ''<-------------------- BACK UP INI FILES HERE !!! ---------------------->
  407.     inia$ = MakePath(WinDir$, "win.ini")
  408.     inib$ = MakePath(WinDir$, "win.ftw")
  409.     CopyFile inia$, inib$, cmoOverwrite, 0
  410.     inia$ = MakePath(WinDir$, "system.ini")
  411.     inib$ = MakePath(WinDir$, "system.ftw")
  412.     CopyFile inia$, inib$, cmoOverwrite, 0
  413.                                                                               
  414.                                                                               
  415. ''----------------- Update INI files for Video for Windows ---------------
  416. ''Updating WIN.INI and SYSTEM.INI
  417. ''Only update SYSTEM.INI  on NT or next version of Windows for other codecs
  418.  
  419.     IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  420.         IF VflatdPresent() = 0 THEN
  421.                CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  422.         END IF
  423.     END IF
  424.  
  425.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  426.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  427.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  428.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite
  429.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  430.     I% = DoesIniKeyExist ("system.ini", "Drivers", "VIDC.RT21")
  431.     IF I% = 0  THEN
  432.        CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
  433.     END IF
  434.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
  435.     CreateIniKeyValue WinDir$ + "win.ini", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  436.     CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  437.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  438.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  439.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  440.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  441.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  442.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  443.  
  444.     if isInstallQTW = 1 then
  445.  
  446.         rem *** Update INI files for QuickTime
  447.  
  448.         CreateIniKeyValue "win.ini", "MCI Extensions", "mov", "QTWVideo", cmoOverwrite
  449.         CreateIniKeyValue "win.ini", "MCI Extensions", "pic", "QTWVideo", cmoOverwrite
  450.         CreateIniKeyValue "win.ini", "MCI Extensions", "jpg", "QTWVideo", cmoOverwrite
  451.         i% = WritePrivateProfileString("MCI", "QTWVideo", MakePath(WinSysDir$, "mciqtw.drv"), "SYSTEM.INI")
  452.  
  453.         rem *** Create QTW.INI
  454.         ini$ = MakePath(WinDir$, "qtw.ini")
  455.         CreateIniKeyValue ini$, "QuickTime for Windows", "Implementation", "Full" , cmoOverwrite
  456.         RemoveIniKey ini$, "video", "optimize", cmoNone
  457.     endif
  458.  
  459.     rem Compatibility hacks.
  460.     i% = WritePrivateProfileString("Macx", "DeviceBitmap", "OFF", "system.ini")
  461.     CreateIniKeyValue "win.ini", "Mach", "DeviceBitmap", "off", cmoOverwrite
  462.  
  463.     rem *** Update INI files for AAPLAY
  464.  
  465.     CreateIniKeyValue WinDir$ + "win.ini", "AAPLAY Animation", "FullScreen", "AAVGA.DLL", cmoOverwrite
  466.     CreateIniKeyValue WinDir$ + "win.ini", "AAPLAY Animation", "DualScreen", "yes", cmoOverwrite
  467.     CreateIniKeyValue WinDir$ + "win.ini", "AAPLAY Animation", "Int2fSwitch", "no", cmoOverwrite
  468.     CreateIniKeyValue WinDir$ + "win.ini", "AAPLAY Animation", "WaveAudio", "c,522", cmoOverwrite
  469.     CreateIniKeyValue WinDir$ + "win.ini", "mci extensions", "flc", "Animation1", cmoOverwrite
  470.     CreateIniKeyValue WinDir$ + "win.ini", "mci extensions", "fli", "Animation1", cmoOverwrite
  471.     CreateIniKeyValue WinDir$ + "win.ini", "mci extensions", "aas", "Animation1", cmoOverwrite
  472.     CreateIniKeyValue WinDir$ + "system.ini", "mci", "Animation1", "mciaap.drv", cmoOverwrite
  473.  
  474.     ''------ Register Video for Windows components -----
  475.     ''Do not register components not installed with Video for Windows on NT or next version of Windows.
  476.     IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  477.             Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  478.             Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  479.             Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  480.                                    
  481.         '' Mplayer
  482.             CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
  483.  
  484.     END IF    ''NT and next version of Windows installation stop here.
  485.  
  486.     Run ("profdisp.exe")  ''Profile display for Video for Windows
  487.  
  488. '$ifdef IsAdvert
  489.     InstallTitlePromo Path_AdvertRoot, Path_AdvertBinary, Path_AdvertDatabase, INI_Advert, DLL_Advert, Icon_Advert
  490. '$endif
  491.  
  492. '$ifdef IsSpacePromo
  493.     InstallTitlePromo Path_SpaceRoot, Path_SpaceBinary, Path_SpaceDatabase, INI_Space, DLL_Space, Icon_Space
  494. rem    CreateProgmanItem PMG_FlagTower, PMI_Menu, AVDest$ + "\prommenu.exe" + " " + AVDest$, "", cmoOverwrite
  495. '$endif
  496.  
  497. '$ifdef IsWW2Promo
  498.     InstallTitlePromo Path_WW2Root, Path_WW2Binary, Path_WW2Database, INI_WW2, DLL_WW2, Icon_WW2
  499. rem    CreateProgmanItem PMG_FlagTower, PMI_Menu, AVDest$ + "\prommenu.exe" + " " + AVDest$, "", cmoOverwrite
  500. '$endif
  501.  
  502. '$ifdef IsFWWPromo
  503.     InstallTitlePromo Path_FWWRoot, Path_FWWBinary, Path_FWWDatabase, INI_FWW, DLL_FWW, Icon_FWW
  504. rem    CreateProgmanItem PMG_FlagTower, PMI_Menu, AVDest$ + "\prommenu.exe" + " " + AVDest$, "", cmoOverwrite
  505. '$endif
  506.  
  507. '$ifdef IsWPCPromo
  508.     InstallTitlePromo Path_WPCRoot, Path_WPCBinary, Path_WPCDatabase, INI_WPC, DLL_WPC, Icon_WPC
  509. rem    CreateProgmanItem PMG_FlagTower, PMI_Menu, AVDest$ + "\prommenu.exe" + " " + AVDest$, "", cmoOverwrite
  510. '$endif
  511.  
  512.     CreateProgmanItem PMG_FlagTower, PMI_Uninstall, AVDest$ + "\uninstal.exe", "", cmoOverwrite
  513.  
  514.     i% = CallModifyCONFIG( HwndFrame() )
  515.  
  516.         Run ( "notepad  " + SrcDir$ + "readme.txt" )
  517.  
  518. END SUB
  519.                                                                                               
  520. ' -------------------------------------------------------------------------------------------- 
  521. ' -------------------------------------------------------------------------------------------- 
  522. ' -------------------------------------------------------------------------------------------- 
  523. ' Miscellaneous Functions 
  524. ' -------------------------------------------------------------------------------------------- 
  525.  
  526. '**
  527. '** Purpose:
  528. '**     Appends a file name to the end of a directory path,
  529. '**     inserting a backslash character as needed.
  530. '** Arguments:
  531. '**     szDir$  - full directory path (with optional ending "\")
  532. '**     szFile$ - filename to append to directory
  533. '** Returns:
  534. '**     Resulting fully qualified path name.
  535. '*************************************************************************
  536. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  537.     IF szDir$ = "" THEN
  538.         MakePath = szFile$
  539.     ELSEIF szFile$ = "" THEN
  540.         MakePath = szDir$
  541.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  542.         MakePath = szDir$ + szFile$
  543.     ELSE
  544.         MakePath = szDir$ + "\" + szFile$
  545.     END IF
  546. END FUNCTION
  547.  
  548. SUB UpdateWinG32(szOrig$) STATIC
  549.     '
  550.     ' Check the version of wing32.dll since cannot get version
  551.     ' checking for Win32 apps from Win16
  552.     '
  553.     FileNew$  = MakePath(szOrig$, "wing32.dll")
  554.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  555.  
  556.     IF IsWin32FileNewer(FileOrig$, FileNew$) THEN
  557.         RemoveFile FileOrig$, cmoForce
  558.     ELSE
  559.         RemoveFile FileNew$, cmoForce
  560.         RenameFilePlease FileOrig$, FileNew$
  561.     END IF
  562. END SUB                                                                
  563.                                                         
  564.                                                      
  565. FUNCTION CreateTitleINIFile(szINI$, szCD$, szDbPath$) STATIC AS INTEGER
  566.  
  567.     ramSize% = getSystemRAM()
  568.     ramSizeStr$ = str$( ramSize% )
  569.     ramSizeStr$ = ltrim$( ramSizeStr$ )
  570.  
  571.     CreateIniKeyValue szINI$, "METRICS", "CDROM", szCD$ , cmoOverwrite
  572.     CreateIniKeyValue szINI$, "METRICS", "RAM", ramSizeStr$, cmoOverwrite
  573.     CreateIniKeyValue szINI$, "METRICS", "VOLUME", "5" , cmoOverwrite
  574.  
  575.     CreateIniKeyValue szINI$, "DBPATH", "ROUTING", szDbPath$+"\ROUTING.MBF" , cmoOverwrite
  576.     CreateIniKeyValue szINI$, "DBPATH", "RUNTIME", szDbPath$+"\RUNTIME.MBF" , cmoOverwrite
  577.     CreateIniKeyValue szINI$, "DBPATH", "UNITBASE", szDbPath$+"\UNITBASE.MBF" , cmoOverwrite
  578.     CreateIniKeyValue szINI$, "DBPATH", "FILEBASE", szDbPath$+"\FILEBASE.MBF" , cmoOverwrite
  579.     CreateIniKeyValue szINI$, "DBPATH", "TIMELINE", szDbPath$+"\TL_BASE.MBF" , cmoOverwrite
  580.     CreateIniKeyValue szINI$, "DBPATH", "GCACHE", szDbPath$+"\GCACHE.MBF" , cmoOverwrite
  581.  
  582.     CreateTitleINIFile = 0                                              
  583.     
  584. END FUNCTION                                               
  585.  
  586. sub CopyTitlePromoBinaries(pathBinary$, sectBinary$, sectCDilla$, sectEngine$, sectAccusoft$ ) static
  587.  
  588.     rem *** Copy list for Accusoft Pro Gold
  589.  
  590.     AddSectionFilesToCopyList sectAccusoft$, SrcDir$, pathBinary$
  591.  
  592. '$ifdef IsEncrypted
  593.     rem *** Copy list for C-Dilla
  594.  
  595.     AddSectionFilesToCopyList Sect_CDillaSystem, SrcDir$, WinDir$
  596.     AddSectionFilesToCopyList sectCDilla$, SrcDir$, pathBinary$
  597. '$endif
  598.  
  599.     rem *** Copy list for AV ENGINE
  600.  
  601.     AddSectionFilesToCopyList sectEngine$, SrcDir$, pathBinary$
  602.  
  603.     rem *** Copy list for title
  604.  
  605.     AddSectionFilesToCopyList sectBinary$, SrcDir$, pathBinary$
  606.  
  607.     dummy% = setDOSFileAttr( pathBinary$ + FN_Description, 0, 1 )
  608.  
  609. end sub
  610.  
  611. sub CopyTitlePromoDatabase(pathDatabase$, sectDatabase$ ) static
  612.  
  613.     AddSectionFilesToCopyList sectDatabase$, SrcDir$, pathDatabase$
  614.  
  615. end sub
  616.  
  617. sub InstallTitlePromo( pathRoot$, pathBinary$, pathDatabase$, iniFile$, dllFile$, iconNo% ) static           
  618.  
  619.     CDDrive$ = MID$(SrcDir$,1,1)          
  620.  
  621.     CreateDir pathRoot$, cmoNone
  622.     CreateDir pathBinary$, cmoNone
  623.     CreateDir pathDatabase$, cmoNone
  624.     dummy% = CreateTitleINIFile( pathBinary$+"\"+iniFile$, CDDrive$, pathDatabase$ )
  625.  
  626.     rem *** Change file attribute of 'flagtowr.ttl' to Read-only+Hidden
  627.  
  628.     dummy% = setDOSFileAttr( pathBinary$ + FN_Description, 3, 1 )
  629.  
  630.     rem *** create unitdb.mbf in title database directory to aid performance
  631.  
  632.     CopyFile pathDatabase+"\unitbase.mbf", pathDatabase+"\unitdb.mbf", cmoOverwrite, 0
  633.  
  634.     dim    PMI_Title as string
  635.  
  636.     PMI_Title = string$( 110, 32 )
  637.     s% = readTitleDescription( PMI_Title, 110, pathBinary$ + FN_Description )
  638.  
  639.     rem *** Create Program Manager Group
  640.  
  641.     CreateProgmanGroup PMG_FlagTower, "", cmoNone
  642.     ShowProgmanGroup PMG_FlagTower, 1, cmoNone
  643.     
  644.     rem *** Create Icon(s)
  645.  
  646.     s% = pmDeleteItem( PMI_Title )
  647.  
  648.     TitleDLL$ = pathBinary$+"\"+dllFile$
  649.     Launch$   = pathBinary$+"\LAUNCH.EXE "
  650. '$ifdef IsEncrypted
  651.     Other$    = pathBinary$+"\ZLAUNCH.EXE "+","+ str$( iconNo% ) +",0,0,"+pathBinary$
  652. '$else
  653.     Other$    = Launch$+","+ str$( iconNo% ) +",0,0,"+pathBinary$
  654. '$endif
  655.  
  656.     CreateProgmanItem PMG_FlagTower, PMI_Title, Launch$+TitleDLL$ , Other$ , cmoOverwrite
  657.  
  658. END SUB
  659.  
  660. FUNCTION CheckVideoSystem(WinMajVer%, WinMinVer%, ProcType%) STATIC AS INTEGER
  661. 'Check if system have necessary processor and version of Windows running to install Video for Windows
  662.     ''Video for Windows tests
  663.     IF WinMajVer% < 3 OR (WinMajVer% = 3 AND WinMinVer% < 10) THEN
  664.         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)
  665.         END
  666.     END IF
  667.  
  668.     'Prevents installation on 286
  669.     IF ProcType% < 3 THEN
  670.         i% = DoMsgBox("Video for Windows requires a 386 or greater processor or emulator.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  671.         END
  672.     END IF
  673.  
  674.     ' Use Wowexec to determine version of NT.  3.1 did not stamp wowexec and wow returns 3.1 as version
  675.     IF OnWindowsNT() THEN
  676.       WowVersion$ = GetVersionOfFile(WinSys32Dir$ + "\wowexec.exe")
  677.       IF WowVersion$ = "" THEN
  678.          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)
  679.          END
  680.       END IF
  681.     END IF
  682.  
  683. END FUNCTION
  684.