home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Games 9 / CD_1.iso / wingames / comix / comix.mst < prev    next >
Text File  |  1995-10-09  |  26KB  |  740 lines

  1. '**************************************************************************
  2. '*                  MS Test script for Comix Zone setup program
  3. '**************************************************************************
  4.  
  5. '' $DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST WELCOME                  = 100
  12. CONST ASKQUIT                  = 200
  13. CONST DESTPATH                 = 300
  14. CONST EXITFAILURE              = 400
  15. CONST EXITQUIT                 = 600
  16. CONST EXITSUCCESS              = 700
  17. CONST OPTIONS                  = 800
  18. CONST BADPATH                  = 6400
  19.  
  20. CONST HELPWELCOME              = 1000
  21. CONST VERPATH                  = 1100
  22. CONST EXITFAILNOTWIN31         = 1200
  23. CONST EXITFAILNOTENH           = 1300
  24. CONST EXITFAILNOTPAGING        = 1325
  25. CONST EXITFAILNOTINTEL         = 1350
  26. CONST EXITFAILRUNAPP           = 1360
  27. CONST COMIXINST             = 1400
  28. CONST COMIXINSTNOWIN32S     = 1450
  29. CONST COMIXPATH             = 1500
  30. CONST HELPCOMIX             = 1600
  31.  
  32.  
  33. ''Bitmap ID
  34. CONST LOGO = 1
  35.  
  36. ''GetTempFileName flags
  37. CONST TF_FORCEDRIVE            = 128
  38.  
  39. GLOBAL DESTWIN$      ''Windows directory.
  40. GLOBAL DESTSYS$      ''Windows\System directory.
  41. GLOBAL DEST32S$      ''Windows\System\Win32s directory
  42. GLOBAL DESTCOMIX$     ''Comix Zone directory
  43. GLOBAL OLE_PROTECT%  ''Indicates whether ole2 dlls were protected from being
  44.                      '' copied.
  45. GLOBAL OLE_OLEBOOT%
  46. GLOBAL VERNUM$       '' Win32s Version Number (i.e., for v1.25 VERNUM$="125"
  47.  
  48. DECLARE SUB Install(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%)
  49. DECLARE SUB RecoverFromCopy(szFileName$)
  50. DECLARE SUB UpdateSystemIni
  51. DECLARE FUNCTION RebootSystem(OLEONLY%) AS INTEGER
  52. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  53. DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER
  54. DECLARE FUNCTION RestartWindows LIB "INIUPD.DLL" AS INTEGER
  55. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  56. DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER
  57. DECLARE FUNCTION ShareEnabled LIB "INIUPD.DLL" AS INTEGER
  58. DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
  59. DECLARE FUNCTION IsRunningApp LIB "INIUPD.DLL" AS INTEGER
  60. DECLARE FUNCTION SetCuiFlags LIB "MSCUISTF.DLL" (arg1%, arg2%) AS INTEGER
  61. DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
  62. DECLARE FUNCTION GetModuleHandle LIB "KRNL386.EXE" (arg1$) AS INTEGER
  63. DECLARE FUNCTION LoadLibrary LIB "KRNL386.EXE" (arg1$) AS INTEGER
  64. DECLARE SUB FreeLibrary LIB "KRNL386.EXE" (arg1%)
  65. DECLARE FUNCTION SetErrorMode LIB "KRNL386.EXE" (arg1%) AS INTEGER
  66.  
  67. DECLARE FUNCTION GetTempFileName LIB "KRNL386.EXE" (drive%, prefix$, u%, filename$) AS INTEGER
  68. DECLARE SUB WriteLine LIB "INIUPD.DLL" (filename$, text$)
  69. DECLARE FUNCTION GetTempFileAt(szDir$, szPrefix$) as string
  70. INIT:
  71.     CUIDLL$ = "mscuistf.dll"            '' Custom user interface dll
  72.     HELPPROC$ = "FHelpDlgProc"          '' Help dialog procedure
  73.     szOldVer$ ="1.00.000     "          '' Reserve space in string for version
  74.     WIN32ENABLED% = 0
  75.     OLEONLY% = 0
  76.     OLE2_16% = 0
  77.     OLE2AUTO_16% = 0
  78.     OLE16RUNAPP% = 0
  79.     OLE_PROTECT% = 0
  80.     OLE_OLEBOOT% = 0
  81.  
  82.     ON ERROR GOTO ERRNORMAL
  83.     SetRestartDir GetWindowsDir()
  84.  
  85.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  86.  
  87.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  88.     IF szInf$ = "" THEN
  89.         szInf$ = GetSymbolValue("STF_CWDDIR") + "comix.inf"
  90.     END IF
  91.     ReadInfFile szInf$
  92.  
  93.     SetBitmap CUIDLL$, LOGO
  94.  
  95.     WIN32SVER$ = MID$(GetSectionKeyVersion("WindowsSystem", "win32s16"), 1, 4)
  96. '    SetTitle "Microsoft Win32s version " + WIN32SVER$ + " Setup Program"
  97.     VERNUM$ = MID$(WIN32SVER$, 1, 1) + MID$(WIN32SVER$, 3 , 2)
  98.  
  99.     DESTWIN$ = GetWindowsDir()
  100.     DESTSYS$ = GetWindowsSysDir()
  101.     DEST32S$ = DESTSYS + "WIN32S\"
  102.  
  103. '$IFDEF DEBUG
  104.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  105.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  106.     IF IsDriveValid(WinDrive$) = 0 THEN
  107.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  108.         GOTO QUIT
  109.     END IF
  110. '$ENDIF ''DEBUG
  111.  
  112. CHECK:
  113.     '' Can not run on versions less than 3.10.
  114.     WINDOWSVERSION = GetWindowsMajorVersion * 100 + GetWindowsMinorVersion
  115.     IF WINDOWSVERSION < 310 THEN
  116.         ExitCode% = EXITFAILNOTWIN31
  117.         GOTO QUIT
  118.     END IF
  119.     '' Check that we are not runnig on Chicago, including pre-released
  120.     '' Chicago versions.
  121.     IF WINDOWSVERSION > 350 THEN
  122.         ExitCode% = EXITSUCCESS
  123.         WIN32ENABLED% = 1
  124.         GOTO COMIX
  125.     END IF
  126.     IF GetWindowsMode < 2  THEN
  127.         IF OnWindowsNT() THEN
  128.             ExitCode% = EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
  129.         ELSE
  130.             ExitCode% = EXITFAILNOTENH   '' Standard Mode Windows
  131.         END IF
  132.         GOTO QUIT
  133.     END IF
  134.     IF OnWindowsNT() THEN
  135.         ExitCode% = EXITSUCCESS
  136.         WIN32ENABLED% = 1
  137.         GOTO COMIX
  138.     END IF
  139.     ExitCode% = EXITSUCCESS
  140.  
  141.     if IsRunningApp() <> 0 THEN
  142.         ExitCode% = EXITFAILRUNAPP
  143.         GOTO QUIT
  144.     END IF
  145.  
  146.     '' Get version of Win32s to be installed from version info in INF file
  147.     szNewVer$ = GetSectionKeyVersion("WindowsSystem", "win32s16")
  148.  
  149.     '' See if OLE is included.
  150.  
  151.     OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "OLE2THK.DL_", femExists )
  152.  
  153.     IF OLEINCLUDED% = 1 THEN
  154.         '' See whether one of the OLE 16 bit components is loaded.
  155.         IF GetModulehandle("compobj") <> 0 THEN
  156.             OLE16RUNAPP% = 1
  157.             GOTO GetOleVersion
  158.         END IF
  159.         IF GetModuleHandle("ole2") <> 0 THEN
  160.             OLE16RUNAPP% = 1
  161.             GOTO GetOleVersion
  162.         END IF
  163.         IF GetModuleHandle("ole2prox") <> 0 THEN
  164.             OLE16RUNAPP% = 1
  165.             GOTO GetOleVersion
  166.         END IF
  167.         IF GetModuleHandle("ole2conv") <> 0 THEN
  168.             OLE16RUNAPP% = 1
  169.             GOTO GetOleVersion
  170.         END IF
  171.         IF GetModuleHandle("storage") <> 0 THEN
  172.             OLE16RUNAPP% = 1
  173.             GOTO GetOleVersion
  174.         END IF
  175.         IF GetModuleHandle("ole2nls") <> 0 THEN
  176.             OLE16RUNAPP% = 1
  177.             GOTO GetOleVersion
  178.         END IF
  179.         IF GetModuleHandle("ole2disp") <> 0 THEN
  180.             OLE16RUNAPP% = 1
  181.             GOTO GetOleVersion
  182.         END IF
  183.         IF GetModuleHandle("typelib") <> 0 THEN
  184.             OLE16RUNAPP% = 1
  185.             GOTO GetOleVersion
  186.         END IF
  187.  
  188. GetOleVersion:
  189.         szOleNewVer$ = GetSectionKeyVersion("OleWindowsSystemWin32s", "ole2thk")
  190.  
  191.         '' Get version of currently installed OLE32 from version info of
  192.         '' ole2thk file
  193.         szOleOldVer$ = GetVersionOfFile( DESTSYS$ + "WIN32S\OLE2THK.DLL" )
  194.  
  195.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "COMPOBJ.DLL" )
  196.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "compobj")
  197.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  198.             OLE2_16% = 1
  199.         END IF
  200.  
  201.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2.DLL" )
  202.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2")
  203.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  204.             OLE2_16% = 1
  205.         END IF
  206.  
  207.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2PROX.DLL" )
  208.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2prox")
  209.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  210.             OLE2_16% = 1
  211.         END IF
  212.  
  213.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "STORAGE.DLL" )
  214.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "storage")
  215.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  216.             OLE2_16% = 1
  217.         END IF
  218.  
  219.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2CONV.DLL" )
  220.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2conv")
  221.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  222.             OLE2_16% = 1
  223.         END IF
  224.  
  225.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OL