home *** CD-ROM | disk | FTP | other *** search
/ Computer & Games 12 / SISAL12.iso / SETCG.MST < prev    next >
Encoding:
Text File  |  1996-10-18  |  12.1 KB  |  343 lines

  1. '$INCLUDE 'setupapi.inc'
  2. '$INCLUDE 'mscpydis.inc'    ''System
  3. '$INCLUDE 'msdetect.inc'    ''Detects Avalilable Disk Space
  4.  
  5. ''Dialog ID's
  6. CONST WELCOME       = 100
  7. CONST ASKQUIT       = 200
  8. CONST DESTPATH      = 300
  9. CONST EXITFAILURE   = 400
  10. CONST EXITQUIT      = 600
  11. CONST EXITSUCCESS   = 700
  12. CONST APPHELP       = 900
  13. CONST CHECK         = 2500
  14. CONST SMALLWIN      = 2200
  15. CONST RESTART       = 2600
  16. CONST RESTARTII     = 2700
  17. CONST BADPATH       = 6400
  18.  
  19. ''Bitmap ID
  20. CONST LOGO = 1
  21.  
  22. GLOBAL SizeReq&  '' Total Disk Size required for installation no diret≤rio de instalacao
  23. GLOBAL WinSysReq& '' Requerido no diret≤rio do windows\system
  24.  
  25. ''File Types
  26. GLOBAL appDEST$        ''Default destination directory.
  27. GLOBAL WinDir$
  28. GLOBAL WinSysDir$
  29. GLOBAL WinSys32Dir$
  30. GLOBAL WINDRIVE$    ''Windows Drive Letter.
  31. GLOBAL CHECKSTATES$
  32. GLOBAL MinorVer%
  33. GLOBAL OnNT$
  34. GLOBAL SrcDir$
  35. GLOBAL QuerInstalar%
  36.  
  37. DECLARE SUB Install
  38. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  39. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  40. DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
  41. DECLARE SUB Reboot LIB "iniupd.dll"
  42.  
  43. DECLARE FUNCTION ExitWindowsExec  LIB "User" (Exec$, Param$) AS INTEGER
  44.  
  45. DECLARE FUNCTION GetDC LIB "User" (hWnd%) As Integer
  46. DECLARE FUNCTION ReleaseDC LIB "User" (hWnd%,hDC%) AS INTEGER
  47. DECLARE FUNCTION GetDeviceCaps LIB "GDI" (hDC%,nIndex%) AS INTEGER
  48.  
  49. INIT:
  50.   
  51.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  52.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  53.     
  54.     WIN32ENABLED% = 0
  55.     MajorVer% = GetWindowsMajorVersion()
  56.     MinorVer% = GetWindowsMinorVersion()
  57.     Processor% = GetProcessorType()
  58.     WinDir$ = GetWindowsDir()
  59.     DEST$ = GetWindowsDir()    
  60.     WinSysDir$ = GetWindowsSysDir()
  61.     WinSys32Dir$ = WinDir$ + "system32"
  62.  
  63.     x% = GetScreenWidth
  64.     y% = GetScreenHeight 
  65.  
  66.     
  67.    IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
  68.     i% = DoMsgBox("Para a instalaτπo deste software Θ necessßria uma versπo mais nova do windows. Por favor, atualize o seu software.", "Problema na Instalaτπo", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  69.     'i% = DoMsgBox("You need an upgrade version of your MS Windows to install this software.", "Installation Error", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  70.     'END
  71.     END IF
  72.  
  73.     'Prevents installation on 286
  74.     IF Processor% < 3 THEN
  75.     i% = DoMsgBox("Este software precisa de um processador mais atual.", "Problema na instalaτπo.", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  76. '    i% = DoMsgBox("You need a powerfull processor to run this software.","Installation Error.", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  77.     END
  78.     END IF
  79.  
  80.     ' Use Wowexec to determine version of NT.  3.1 did not stamp wowexec and wow returns 3.1 as version
  81.      IF OnWindowsNT() THEN
  82.       OnNT$ = "TRUE"
  83.       WowVersion$ = GetVersionOfFile(WinSys32Dir$ + "\wowexec.exe")
  84.       IF WowVersion$ = "" THEN
  85.          'i% = DoMsgBox("O MS Video for Windows nπo executa no windows NT versπo 3.1.", "Problema na instalaτπo", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  86. '         i% = DoMsgBox("You can't run MS Video for Windows in then MS Windows NT 3.1.", "Installation Error", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  87.          END
  88.       END IF
  89.     END IF
  90.  
  91.     SetBitmap CUIDLL$, LOGO
  92.     SetTitle "Computer & Games - Instalaτπo"
  93.  
  94.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  95.     IF szInf$ = "" THEN
  96.        szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  97.     END IF
  98.     ReadInfFile szInf$
  99.  
  100.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  101.  
  102. WELCOME:
  103.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  104.     IF sz$ = "CONTINUE" THEN
  105.        UIPop 1
  106.      ELSE
  107.     GOSUB ASKQUIT
  108.     GOTO WELCOME
  109.     END IF
  110.  
  111.      
  112.  
  113.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  114. ''Prepare Copy list and check size
  115.  
  116.    ClearCopyList
  117.  
  118.    appDEST$ = "C:\COMGAMES"
  119.  
  120. GETPATH:        
  121.         SetSymbolValue "EditTextIn", appDEST$
  122.         SetSymbolValue "EditFocus", "END"
  123. GETPATHL1:
  124.  
  125. ''Aqui Termina o exemplo do setup do windows...
  126.  
  127. ''  Runtime files (on Windows disk)
  128. ''  Do not install OLE or MPlayer if on next release of NT or Windows
  129.  
  130.  
  131.  IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN            'These files not necessary on Windows NT
  132.     AddSectionFilesToCopyList "MPlayer", MakePath(SrcDir$,"setup"), WinDir$
  133.     AddSectionFilesToCopyList "OLE2", MakePath(SrcDir$,"setup"), WinSysDir$
  134.     END IF
  135.     AddSectionFilesToCopyList "WINSYS", MakePath(SrcDir$,"setup"), WinSysDir$
  136.     AddSectionFilesToCopyList "runtime", MakePath(SrcDir$,"setup"), WinSysDir$
  137.     AddSectionFilesToCopyList "VfW Runtime", MakePath(SrcDir$,"setup"), WinSysDir$
  138.     AddSectionFilesToCopyList "ACM Drivers", MakePath(SrcDir$,"setup"), WinSysDir$
  139.     AddSectionFilesToCopyList "AVICodecs", MakePath(SrcDir$,"setup"), WinSysDir$
  140.     IF OnNT$ = "TRUE" THEN
  141.     AddSectionFilesToCopyList "NT MSVideo", MakePath(SrcDir$,"setup"), WinSys32Dir$
  142.     ENDIF
  143. ''*************************************************************************************************************************
  144. ''*************************************************************************************************************************
  145. ''To add a DCI provider, please un-comment the AddSectionFilesToCopyList,
  146. ''and add a "DCI Provider" section with to the SETUP.INF file.
  147. ''
  148. ''    AddSectionFilesToCopyList "DCI Provider", MakePath(SrcDir$,"setup"), WinSysDir$
  149. ''*************************************************************************************************************************
  150. ''*************************************************************************************************************************
  151. ''  Check windrive diskspace
  152.     SizeReq& = GetCopyListCost ("","", "")
  153.     IF SizeReq& <> 0 THEN
  154.     GOSUB SMALLWIN
  155.     END
  156.     END IF
  157.  
  158. Install
  159.  
  160. '' Restart Windows: if it has to updates ACM from DOS, it restarts Windows automatically
  161. '' else, it gives the user the choice
  162.     RESTRT% = RestartListEmpty ()
  163.     Exe$ = DEST$ + "\_msrstrt.exe"
  164.     Batch$ = DEST$ + "\_mssetup.bat"
  165.     empty$ = ""
  166. RESTART:
  167.     IF RESTRT% = 0 THEN
  168.        sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "")
  169.        IF sz$ = "REACTIVATE" THEN
  170.       GOTO RESTART
  171.        ENDIF
  172.        I% = ExitExecRestart ()
  173.        RemoveFile Exe$, cmoForce
  174.        RemoveFile Batch$, cmoForce
  175.        END
  176.     ELSE
  177.        sz$ = UIStartDlg(CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "")
  178.        IF sz$ = "CONTINUE" THEN
  179.       I% = ExitWindowsExec (Exe$, empty$)
  180.       IF I% = 0 THEN
  181.          GOTO RESTART
  182.       ELSE
  183.          END
  184.      ENDIF
  185.        ELSEIF sz$ = "EXIT" THEN
  186.       UIPopAll
  187.       END
  188.        ELSEIF sz$ = "REACTIVATE" THEN
  189.       GOTO RESTART
  190.        ELSE
  191.       UIPop 1
  192.        END IF
  193.     END IF
  194.  
  195.  
  196. QUIT:
  197.     ON ERROR GOTO ERRQUIT
  198.  
  199.     IF ERR = 0 THEN
  200.     dlg% = EXITSUCCESS
  201.     ELSEIF ERR = STFQUIT THEN
  202.     dlg% = EXITQUIT
  203.     ELSE
  204.     dlg% = EXITFAILURE
  205.     END IF
  206. QUITL1:
  207.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  208.     IF sz$ = "REACTIVATE" THEN
  209.     GOTO QUITL1
  210.     END IF
  211.     UIPop 1
  212.     END
  213.  
  214. ERRQUIT:
  215.     i% = DoMsgBox("An installation problem occured, call the product support service", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  216.     END
  217.  
  218.  
  219. ASKQUIT:
  220.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  221.  
  222.     IF sz$ = "EXIT" THEN
  223.     UIPopAll
  224. ''        ERROR STFQUIT
  225.     END
  226.     ELSEIF sz$ = "REACTIVATE" THEN
  227.     GOTO ASKQUIT
  228.     ELSE
  229.     UIPop 1
  230.     END IF
  231.     RETURN
  232.  
  233. BADPATH:
  234.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  235.     IF sz$ = "REACTIVATE" THEN
  236.         GOTO BADPATH
  237.     END IF
  238.     UIPop 1
  239.     RETURN
  240.  
  241.  
  242. SMALLWIN:
  243.     sz$ = UIStartDlg(CUIDLL$, SMALLWIN, "FInfo0DlgProc", 0, "")
  244.     IF sz$ = "REACTIVATE" THEN
  245.     GOTO SMALLWIN
  246.     END IF
  247.     UIPop 1
  248.     RETURN
  249.  
  250. '**
  251. '** Purpose:
  252. '**     Performs all installation operations.
  253. '** Arguments:
  254. '**     none.
  255. '** Returns:
  256. '**     none.
  257. '*************************************************************************
  258. SUB Install STATIC
  259.  
  260.     SetRestartDir WinDir$
  261.     CopyFilesInCopyList
  262.  
  263. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  264.     IF VflatdPresent() = 0 THEN
  265.        CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  266.     END IF
  267. END IF
  268.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  269.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  270.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  271.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite
  272.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  273.     I% = DoesIniKeyExist ("system.ini", "Drivers", "VIDC.RT21")
  274.     IF I% = 0  THEN
  275.        CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
  276.     END IF
  277.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
  278.     CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  279.     CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  280.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  281.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  282.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  283.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  284.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  285.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  286.  
  287. ''*************************************************************************************************************************
  288. ''*************************************************************************************************************************
  289. ''To add a DCI provider, please un-comment the UDH line, and un-comment and replace the    <provider> with your own file name
  290. ''
  291. ''  CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "DCI", "<provider>", cmoOverwrite
  292. ''  CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "vids.draw", "udh.dll", cmoOverwrite
  293. ''*************************************************************************************************************************
  294. ''*************************************************************************************************************************
  295.  
  296. ''Do not register components not installed with Video for Windows on NT or next version of Windows.
  297. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  298.     ''Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  299.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  300.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  301.  
  302. '' Mplayer
  303. '' CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
  304.  
  305. END IF    ''NT and next version of Windows installation stop here.
  306.  Run ("profdisp.exe") 
  307.    
  308. ''Meus arquivos e etc
  309.     CreateProgmanGroup "COMPUTER &games", "", cmoNone
  310.     ShowProgmanGroup  "COMPUTER &games", 1, cmoNone
  311.  
  312.     CreateProgmanItem "COMPUTER &games", "COMPUTER &games",MakePath(SrcDir$,"sisal.exe"), "", cmoOverwrite    
  313.     CreateProgmanItem "COMPUTER &games", "CyberStorm",MakePath(SrcDir$,"\cyber\cstorm.exe"), "", cmoOverwrite    
  314.  
  315.  
  316.    
  317.    
  318.  
  319. END SUB
  320.  
  321. '**
  322. '** Purpose:
  323. '**     Appends a file name to the end of a directory path,
  324. '**     inserting a backslash character as needed.
  325. '** Arguments:
  326. '**     szDir$  - full directory path (with optional ending "\")
  327. '**     szFile$ - filename to append to directory
  328. '** Returns:
  329. '**     Resulting fully qualified path name.
  330. '*************************************************************************
  331. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  332.     IF szDir$ = "" THEN
  333.     MakePath = szFile$
  334.     ELSEIF szFile$ = "" THEN
  335.     MakePath = szDir$
  336.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  337.     MakePath = szDir$ + szFile$
  338.     ELSE
  339.     MakePath = szDir$ + "\" + szFile$
  340.     END IF
  341. END FUNCTION
  342.  
  343.