home *** CD-ROM | disk | FTP | other *** search
/ CD Direkt 1997 #6-#7 / CDD_6_7_97.ISO / demos / sierra / win32s / 32sinst.mst < prev    next >
Text File  |  1996-11-09  |  26KB  |  737 lines

  1. '**************************************************************************
  2. '*                  MS Test script for Win32s 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 FREECELLINST             = 1400
  28. CONST FREECELLINSTNOWIN32S     = 1450
  29. CONST FREECELLPATH             = 1500
  30. CONST HELPFREECELL             = 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 DESTFREE$     ''Freecell 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(OLEINCLUDED%, OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%)
  49. DECLARE SUB RecoverFromCopy(szFileName$)
  50. DECLARE FUNCTION UpdateSystemIni AS INTEGER
  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.  
  84.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  85.  
  86.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  87.     IF szInf$ = "" THEN
  88.         szInf$ = GetSymbolValue("STF_CWDDIR") + "32sinst.inf"
  89.     END IF
  90.     ReadInfFile szInf$
  91.  
  92.     SetBitmap CUIDLL$, LOGO
  93.  
  94.     WIN32SVER$ = MID$(GetSectionKeyVersion("WindowsSystem", "win32s16"), 1, 4)
  95.     SetTitle "Microsoft Win32s version " + WIN32SVER$ + " Setup Program"
  96.     VERNUM$ = MID$(WIN32SVER$, 1, 1) + MID$(WIN32SVER$, 3 , 2)
  97.  
  98.     DESTWIN$ = GetWindowsDir()
  99.     DESTSYS$ = GetWindowsSysDir()
  100.     DEST32S$ = DESTSYS + "WIN32S\"
  101.  
  102. '$IFDEF DEBUG
  103.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  104.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  105.     IF IsDriveValid(WinDrive$) = 0 THEN
  106.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  107.         GOTO QUIT
  108.     END IF
  109. '$ENDIF ''DEBUG
  110.  
  111. CHECK:
  112.     '' Can not run on versions less than 3.10.
  113.     IF GetWindowsMajorVersion < 3 THEN
  114.         ExitCode% = EXITFAILNOTWIN31
  115.         GOTO QUIT
  116.     END IF
  117.     IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 10 THEN
  118.         ExitCode% = EXITFAILNOTWIN31
  119.         GOTO QUIT
  120.     END IF
  121.     '' Check that we are not runnig on Chicago, including pre-released
  122.     '' Chicago versions.
  123.     IF GetWindowsMajorVersion * 100 + GetWindowsMinorVersion > 350 THEN
  124.         ExitCode% = EXITSUCCESS
  125.         WIN32ENABLED% = 1
  126.         GOTO FREECELL
  127.     END IF
  128.     IF GetWindowsMode < 2  THEN
  129.         IF OnWindowsNT() THEN
  130.             ExitCode% = EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
  131.         ELSE
  132.             ExitCode% = EXITFAILNOTENH   '' Standard Mode Windows
  133.         END IF
  134.         GOTO QUIT
  135.     END IF
  136.     IF OnWindowsNT() THEN
  137.         ExitCode% = EXITSUCCESS
  138.         WIN32ENABLED% = 1
  139.         GOTO FREECELL
  140.     END IF
  141.     ExitCode% = EXITSUCCESS
  142.  
  143.     if IsRunningApp() <> 0 THEN
  144.         ExitCode% = EXITFAILRUNAPP
  145.         GOTO QUIT
  146.     END IF
  147.  
  148.     '' Get version of Win32s to be installed from version info in INF file
  149.     szNewVer$ = GetSectionKeyVersion("WindowsSystem", "win32s16")
  150.  
  151.     '' See if OLE is included.
  152.  
  153.     OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "OLE2THK.DL_", femExists )
  154.     '' Do the same for ole2thk.dll, if it is not compressed
  155.     OLEINCLUDED% = OLEINCLUDED% OR DoesFileExist( GetSymbolValue("STF_SRCDIR") + "OLE2THK.DLL", femExists )
  156.  
  157.     IF OLEINCLUDED% = 1 THEN
  158.         '' See whether one of the OLE 16 bit components is loaded.
  159.         IF GetModulehandle("compobj") <> 0 THEN
  160.             OLE16RUNAPP% = 1
  161.             GOTO GetOleVersion
  162.         END IF
  163.         IF GetModuleHandle("ole2") <> 0 THEN
  164.             OLE16RUNAPP% = 1
  165.             GOTO GetOleVersion
  166.         END IF
  167.         IF GetModuleHandle("ole2prox") <> 0 THEN
  168.             OLE16RUNAPP% = 1
  169.             GOTO GetOleVersion
  170.         END IF
  171.         IF GetModuleHandle("ole2conv") <> 0 THEN
  172.             OLE16RUNAPP% = 1
  173.             GOTO GetOleVersion
  174.         END IF
  175.         IF GetModuleHandle("storage") <> 0 THEN
  176.             OLE16RUNAPP% = 1
  177.             GOTO GetOleVersion
  178.         END IF
  179.         IF GetModuleHandle("ole2nls") <> 0 THEN
  180.             OLE16RUNAPP% = 1
  181.             GOTO GetOleVersion
  182.         END IF
  183.         IF GetModuleHandle("ole2disp") <> 0 THEN
  184.             OLE16RUNAPP% = 1
  185.             GOTO GetOleVersion
  186.         END IF
  187.         IF GetModuleHandle("typelib") <> 0 THEN
  188.             OLE16RUNAPP% = 1
  189.             GOTO GetOleVersion
  190.         END IF
  191.  
  192. GetOleVersion:
  193.         szOleNewVer$ = GetSectionKeyVersion("OleWindowsSystemWin32s", "ole2thk")
  194.  
  195.         '' Get version of currently installed OLE32 from version info of
  196.         '' ole2thk file
  197.         szOleOldVer$ = GetVersionOfFile( DESTSYS$ + "WIN32S\OLE2THK.DLL" )
  198.  
  199.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "COMPOBJ.DLL" )
  200.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "compobj")
  201.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  202.             OLE2_16% = 1
  203.         END IF
  204.  
  205.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2.DLL" )
  206.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2")
  207.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  208.             OLE2_16% = 1
  209.         END IF
  210.  
  211.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2PROX.DLL" )
  212.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2prox")
  213.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  214.             OLE2_16% = 1
  215.         END IF
  216.  
  217.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "STORAGE.DLL" )
  218.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "storage")
  219.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  220.             OLE2_16% = 1
  221.         END IF
  222.  
  223.         szOle16O