home *** CD-ROM | disk | FTP | other *** search
/ TestDrive Super Store 3.0 / TESTDRIVE_3.ISO / jasmine / setup.mst < prev    next >
Encoding:
Text File  |  1994-04-05  |  13.7 KB  |  501 lines

  1. '********************************************************
  2. '*
  3. '* Jasmine Catalog Installation Script
  4. '*
  5. '* Copyright 1993 Jasmine Multimedia Publishing
  6. '*
  7. '* V1.0        12/1/93 Marshall Robin
  8. '*
  9. '* V1.1        12/22/93 Updated for Video for Windows 1.1 MR
  10. '* 
  11. '* V1.11     1/13/94 Bug fixes - Restart and PATH setting - MR
  12. '* 
  13. '* V1.11TD    4/5/94 Without VFW for Test Drive
  14. '* 
  15. '********************************************************
  16.  
  17. '$DEFINE DEBUG  
  18.  
  19. '$INCLUDE 'setupapi.inc'
  20. '$INCLUDE 'msdetect.inc'
  21. '$INCLUDE 'jasmine.inc'
  22.  
  23. '********************************************************
  24.  
  25. ''Dialog ID's
  26. CONST WELCOME       = 100
  27. CONST ASKQUIT       = 200
  28. CONST DESTPATH      = 300
  29. CONST EXITFAILURE   = 400
  30. CONST EXITQUIT      = 600
  31. CONST EXITSUCCESS   = 700
  32. CONST APPHELP       = 900
  33. CONST INFO          = 6300
  34. CONST RESTARTI      = 2600
  35. CONST RESTARTII     = 2700
  36.  
  37. '********************************************************
  38.  
  39. '' GLOBAL VARS AND CONSTANTS.
  40.  
  41. CONST INFNAME$ = "setup.inf"     ' Name of INF file
  42.  
  43. CONST MINWINDMAJ = 3             ' Minimum version of Windows required (MAJOR)
  44. CONST MINWINDMIN = 10            ' Minimum version of Windows required (MINOR)
  45. CONST MINDOSMAJ = 3              ' Minimum version of DOS required (MAJOR)
  46. CONST MINDOSMIN = 10             ' Minimum version of DOS required (MINOR)
  47. CONST MINMEM = 4096              ' Minimum system memory required
  48. CONST MINCPU = 386               ' Minimum CPU required
  49. CONST MINCOLORS = 256            ' Minimum screen colors required
  50.  
  51. '' For ExitInstall call
  52.  
  53. CONST QUIT = 0
  54. CONST FAIL = 1
  55. CONST SUCCESS = 2
  56.  
  57. '' for GetDeviceCaps call
  58.  
  59. CONST BITSPIXEL = 12
  60.  
  61. '' for ShowWindow call
  62.  
  63. CONST SW_SHOWMAXIMIZED = 3
  64.  
  65. CONST LOGO = 1                   ' Bitmap ID
  66. CONST CUIDLL$ = "mscuistf.dll"   ' Custom User Interface
  67. CONST HELPPROC$ = "FHelpDlgProc" ' Help dialog procedure
  68.  
  69. GLOBAL SrcDir$                   ' Source Directory
  70. GLOBAL SrcDrv$                   ' Source Drive
  71. GLOBAL WinDir$                   ' Windows Directory
  72. GLOBAL WinSysDir$                ' Windows System Directory
  73. GLOBAL DestDir$                  ' Destination directory
  74. GLOBAL SaveCursor%               ' Temporary save for cursor
  75. GLOBAL Cancel%                   ' True if user cancelled install
  76. GLOBAL WinVersion$               ' String to hold Windows version status
  77. GLOBAL DOSVersion$               ' String to hold DOS version status
  78. GLOBAL CPUType$                  ' String to hold CPU type status
  79. GLOBAL NumColors$                ' String to hold number of system colors
  80.  
  81. '********************************************************
  82.  
  83. '' Function Prototypes
  84.  
  85. DECLARE SUB SetupInstall
  86. DECLARE FUNCTION CheckSystem AS INTEGER
  87. DECLARE SUB ShowSystemAttribs
  88. DECLARE SUB WriteIniFiles
  89. DECLARE SUB CreateProgGroups
  90. DECLARE SUB ExitInstall(code%)
  91. DECLARE FUNCTION MakePath (szDir$,szFile$) AS STRING
  92.  
  93. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  94. DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
  95. DECLARE SUB Reboot LIB "iniupd.dll"
  96.  
  97. '' System DLL Calls
  98.  
  99. DECLARE FUNCTION CreateDC LIB "gdi.exe" (driver$, device&, port&, initdata&) AS INTEGER
  100. DECLARE SUB DeleteDC LIB "gdi.exe" (hdc%)
  101. DECLARE FUNCTION GetDeviceCaps LIB "gdi.exe" (hdc%, capability%) AS INTEGER
  102. DECLARE FUNCTION ShowWindow LIB "USER" (hwnd%, nCmdShow%) AS INTEGER
  103.  
  104. '********************************************************
  105.  
  106. '' Main Routine
  107.  
  108. '' Init installer.
  109.  
  110. SaveCursor% = ShowWaitCursor
  111. SetupInstall
  112.  
  113. '' Exit if user is running Windows NT
  114.  
  115. IF OnWindowsNT() THEN
  116.     i% = DoMsgBox("Jasmine Catalog does not run on Windows NT.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  117.     END
  118. END IF
  119.  
  120. '' Welcome the user
  121.  
  122. i% = ShowWindow(HwndFrame(),SW_SHOWMAXIMIZED)
  123. RestoreCursor SaveCursor%
  124. i% = DoMsgBox("Jasmine Catalog Install"+CHR$(13)+CHR$(13)+"Press OK to continue.","Jasmine Multimedia Publishing",MB_ICONINFORMATION+MB_OK)
  125. SaveCursor% = ShowWaitCursor
  126.  
  127. '' Check the system to make sure that it is up to minimum requirements.
  128. '' Warn the user if it isn't, but allow them to continue if they choose.
  129. '' Procedure returns the success status of the call.
  130.  
  131. IF CheckSystem = 0 THEN
  132.     ShowSystemAttribs
  133.     RestoreCursor SaveCursor%
  134.     sz$ = "Your computer does not meet the"+CHR$(13)+"minimum system requirements for running the Jasmine Catalog."+CHR$(13)+CHR$(13)+"Do you wish to continue anyway?"
  135.     i% = DoMsgBox(sz$,"Jasmine Multimedia Publishing",MB_ICONQUESTION+MB_YESNO)
  136.     SaveCursor% = ShowWaitCursor
  137.     IF i% = IDNO THEN
  138.         ExitInstall(QUIT)
  139.     END IF
  140. END IF
  141.  
  142. '' Modify INI files. 
  143.  
  144. sz$ = UIStartDlg(CUIDLL$, INFO, "FModelessDlgProc", APPHELP, HELPPROC$)
  145.  
  146. WriteIniFiles
  147.  
  148. UIPop 1
  149.  
  150. ' Create icons for the catalog
  151.  
  152. CreateProgGroups        
  153.  
  154. ' Exit the installation
  155.  
  156. QUIT:
  157.  
  158. ON ERROR GOTO ERRQUIT
  159.  
  160. IF ERR = 0 THEN
  161.     ExitInstall(SUCCESS)
  162. ELSEIF ERR = STFQUIT THEN
  163.     SaveCursor% = ShowWaitCursor
  164.     ExitInstall(QUIT)
  165. ELSE
  166.     RestoreCursor SaveCursor%
  167.     i% = DoMsgBox("Error: "+ERROR$+" "+STR$(ERR)+" on line "+STR$(ERL), "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  168.     i% = DoMsgBox("There is an installation problem, call the included support number.", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  169.     END
  170. END IF
  171.  
  172. ERRQUIT:
  173.     i% = DoMsgBox("Error: "+ERROR$+" "+STR$(ERR)+" on line "+STR$(ERL), "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  174.     i% = DoMsgBox("There is an installation problem, call the included support number.", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  175.     END
  176.  
  177. '********************************************************
  178.  
  179. SUB SetupInstall STATIC
  180.  
  181. '[OK]
  182. ' Set install defaults.
  183. '
  184. ' Needed globals: 
  185. ' CUIDLL$       : Custom UI DLL name
  186. ' INFNAME$      : Name of default .INF file
  187. ' DEFAULTDEST$  : Default installation directory
  188. '
  189. ' Modified variables: 
  190. ' SrcDir$           : Source directory
  191. ' WinDir$           : Windows directory
  192. ' WinSysDir$        : Windows system directory
  193. '
  194. ' Return value: None.
  195. '
  196. ' Called from: MAIN
  197. '
  198. ' -----------------------------------------------------------
  199.  
  200. ' Initialize screen appearance
  201.  
  202. '    SetBitmap CUIDLL$, LOGO
  203.     SetTitle "Jasmine Multimedia Publishing"
  204.  
  205. ' Load the INF file which lists the files to be installed
  206.  
  207.     sz$ = GetSymbolValue("STF_SRCINFPATH")
  208.     IF sz$ = "" THEN
  209.         sz$ = GetSymbolValue("STF_CWDDIR") + INFNAME$
  210.     END IF
  211.     ReadInfFile sz$
  212.  
  213. ' Initialize source and destination globals
  214.  
  215.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  216.     SrcDrv$ = MID$(SrcDir$,1,1)
  217.     WinDir$ = GetWindowsDir()
  218.     WinSysDir$ = GetWindowsSysDir()
  219.  
  220. END SUB
  221.  
  222. '********************************************************
  223.  
  224. FUNCTION CheckSystem STATIC AS INTEGER
  225.  
  226. '[OK]
  227. ' Test the system attributes to see if it meets the minimum
  228. ' requirements for running the Jasmine Catalog. If they
  229. ' do not meet or exceed the minimum platform requirements, return
  230. ' 0, else return 1.
  231. '
  232. ' Needed variables: none.
  233. '
  234. ' Modified variables:
  235. ' WinVersion$       : String to hold Windows version status
  236. ' DOSVersion$       : String to hold DOS version status
  237. ' CPUType$          : String to hold CPU type status
  238. ' NumColors$        : String to hold number of system colors
  239. '
  240. ' Return value: Success code.
  241. '
  242. ' Called from: MAIN
  243. '
  244. ' Calls to: none.
  245. '
  246. ' -----------------------------------------------------------
  247.  
  248. ' Set default return value
  249.  
  250.     ret% = 1
  251.  
  252. ' Check system software. Catalog requires Windows 3.1 and DOS 3.1 or better.
  253.  
  254. ' Check Windows
  255.  
  256.     sz$ = MID$(STR$(GetWindowsMajorVersion()),2)+"."+MID$(STR$(GetWindowsMinorVersion()),2)
  257.     
  258.     IF (GetWindowsMajorVersion() < MINWINDMAJ) THEN
  259.         WinVersion$ = sz$ + CHR$(13)+ "  (need at least "+ MID$(STR$(MINWINDMAJ),2) + "." + MID$(STR$(MINWINDMIN),2) +")"
  260.         ret% = 0
  261.     ELSEIF (GetWindowsMajorVersion() = MINWINDMAJ) AND (GetWindowsMinorVersion() < MINWINDMIN) THEN
  262.         WinVersion$ = sz$ + CHR$(13)+ "  (need at least "+ MID$(STR$(MINWINDMAJ),2) + "." + MID$(STR$(MINWINDMIN),2) +")"
  263.         ret% = 0
  264.     ELSE
  265.         WinVersion$ = sz$
  266.     END IF
  267.  
  268. ' Check DOS
  269.  
  270.     sz$ = MID$(STR$(GetDOSMajorVersion()),2)+"."+MID$(STR$(GetDOSMinorVersion()),2)
  271.     
  272.     IF (GetDOSMajorVersion() < MINDOSMAJ) THEN
  273.         DOSVersion$ = sz$ + CHR$(13)+ "  (need at least "+ MID$(STR$(MINDOSMAJ),2) + "." + MID$(STR$(MINDOSMIN),2) +")"
  274.         ret% = 0
  275.     ELSEIF (GetDOSMajorVersion() = MINDOSMAJ) AND (GetDOSMinorVersion() < MINDOSMIN) THEN
  276.         DOSVersion$ = sz$ + CHR$(13)+ "  (need at least "+ MID$(STR$(MINDOSMAJ),2) + "." + MID$(STR$(MINDOSMIN),2) +")"
  277.         ret% = 0
  278.     ELSE
  279.         DOSVersion$ = sz$
  280.     END IF
  281.  
  282. ' Determine type of CPU, Catalog requires a 80386 or better
  283.  
  284.     i% = GetProcessorType()
  285.     IF i% = 0 THEN
  286.         CPUType$ = "8086"+ CHR$(13)+ "  (80386 or better required)"
  287.         ret% = 0
  288.     ELSEIF i% = 1 THEN
  289.         CPUType$ = "80186"+ CHR$(13)+ "  (80386 or better required)"
  290.         ret% = 0
  291.     ELSEIF i% = 2 THEN
  292.         CPUType$ = "80286"+ CHR$(13)+ "  (80386 or better required)"
  293.         ret% = 0
  294.     ELSEIF i% = 3 THEN
  295.         CPUType$ = "80386"
  296.     ELSEIF i% = 4 THEN
  297.         CPUType$ = "80486"
  298.     ELSE
  299.         CPUType$ = "Unrecognized by this software"
  300.     END IF
  301.  
  302. ' Determine available colors, Catalog requires 256 or more
  303. ' GetDeviceCaps returns 0 for 16 or 24 bit color
  304.  
  305.     hdc%=CreateDC ("DISPLAY", 0, 0, 0)
  306.     bitspxl% = GetDeviceCaps (hdc%, BITSPIXEL)
  307.     DeleteDC (hdc%)
  308.  
  309. ' Exponent function 
  310.  
  311.     j% = 1
  312.     FOR i% = 1 TO bitspxl% STEP 1
  313.         j% = j% * 2
  314.     NEXT
  315.     bitspxl% = j%
  316.  
  317.     IF bitspxl% = 0 THEN
  318.         NumColors$ = " > 256"
  319.     ELSEIF bitspxl% < 256 THEN
  320.         NumColors$ = STR$(bitspxl%) + CHR$(13)+ "  (need at least 256 colors)"
  321.         ret% = 0
  322.     ELSE
  323.         NumColors$ = STR$(bitspxl%)
  324.     END IF
  325.         
  326.     CheckSystem = ret%      
  327. END FUNCTION
  328.  
  329. '********************************************************
  330.  
  331. SUB ShowSystemAttribs STATIC
  332.  
  333. '[OK]
  334. ' Display the system attributes to the user. This is called only
  335. ' if there is a problem with their system configuration.
  336. '
  337. ' Needed variables: 
  338. ' WinVersion$       : String to hold Windows version status (initialized by CheckSystem)
  339. ' DOSVersion$       : String to hold DOS version status (initialized by CheckSystem)
  340. ' CPUType$          : String to hold CPU type status (initialized by CheckSystem)
  341. ' NumColors$        : String to hold number of system colors (initialized by CheckSystem)
  342. '
  343. ' Modified variables: none.
  344. '
  345. ' Return value: none.
  346. '
  347. ' Called from: MAIN
  348. '
  349. ' Calls to: none.
  350. '
  351. ' -----------------------------------------------------------
  352.  
  353. ' Prepare strings for the dialog, to overcome Microsoft Test
  354. ' 256 char per line limitation
  355.  
  356.     szA$ = "Here is a summary of your system."+CHR$(13)
  357.     szB$ = "(Please note the listed incompatibilities)"+CHR$(13)+CHR$(13)
  358.     szC$ = "Operating System Version:  "+DOSVersion$+CHR$(13)
  359.     szD$ = "Windows Version:  "+WinVersion$+CHR$(13)
  360.     szE$ = "CPU Type:  "+CPUType$+CHR$(13)
  361.     szF$ = "Number of Colors:  "+NumColors$+CHR$(13)
  362.  
  363.     RestoreCursor SaveCursor%
  364.     i% = DoMsgBox(szA$+szB$+szC$+szD$+szE$+szF$,"System Incompatibility",MB_ICONINFORMATION+MB_OK)
  365.     SaveCursor% = ShowWaitCursor
  366. END SUB
  367.  
  368. '********************************************************
  369.  
  370. SUB WriteIniFiles STATIC
  371.  
  372. '[OK]
  373. ' Writes profile value to WIN.INI.
  374. '
  375. ' Needed variables: none.
  376. '
  377. ' Modified variables: none.
  378. '
  379. ' Return value: none.
  380. '
  381. ' Called from: MAIN
  382. '
  383. ' Calls to: MakePath
  384. '
  385. ' -----------------------------------------------------------
  386.  
  387. ' Backup WIN.INI as WIN.BAK
  388.  
  389.     CopyFile MakePath(WinDir$,"WIN.INI"),MakePath(WinDir$,"WIN.BAK"),cmoNone,0
  390.  
  391. ' Write changes to WIN.INI
  392.  
  393.     CreateIniKeyValue MakePath(WinDir$,"WIN.INI"), "ToolBook", "StartupSysBooks", "TBKMM.SBK", cmoOverwrite
  394.  
  395. END SUB
  396.  
  397. '********************************************************
  398.  
  399. SUB CreateProgGroups STATIC
  400.  
  401. '[OK]
  402. ' Creates a Program Manager group and icon for the Jasmine Catalog
  403. '
  404. ' Needed variables: 
  405. ' SrcDir$         : Directory the Catalog is being installed from
  406. '
  407. ' Modified variables: none.
  408. '
  409. ' Return value: none.
  410. '
  411. ' Called from: MAIN
  412. '
  413. ' Calls to: MakePath
  414. '
  415. ' -----------------------------------------------------------
  416.  
  417. ' Create group and icons for the Jasmine Catalog
  418.  
  419.     CreateProgmanGroup "Jasmine Multimedia", "", cmoOverwrite
  420.     ShowProgmanGroup  "Jasmine Multimedia", 1, cmoNone
  421.     CreateProgmanItem "Jasmine Multimedia", "Jasmine Catalog", MakePath(SrcDir$,"TBKRUN\tbook.EXE")+" "+MakePath(SrcDir$,"TBKRUN\jascat.tbk"),"", cmoOverwrite
  422. END SUB
  423.  
  424. '********************************************************
  425.  
  426. SUB ExitInstall(code%) STATIC
  427.  
  428. '[OK]
  429. ' Exit after successful installation.
  430. '
  431. ' Arguments:
  432. ' code%: Code to determine type of exit, either SUCCESS, QUIT, or FAIL
  433. '
  434. ' Needed variables: none.
  435. '
  436. ' Modified variables: none.
  437. '
  438. ' Return value: none.
  439. '
  440. ' Called from: MAIN
  441. '
  442. ' Calls to: none.
  443. '
  444. '
  445. ' -----------------------------------------------------------
  446.  
  447.     IF code% = SUCCESS THEN
  448.     dlg% = EXITSUCCESS
  449.     ELSEIF code% = QUIT THEN
  450.     dlg% = EXITQUIT
  451.     ELSE
  452.     dlg% = EXITFAILURE
  453.     END IF
  454.  
  455.     sz$ = "REACTIVATE"
  456.     WHILE sz$ = "REACTIVATE"
  457.         RestoreCursor SaveCursor%
  458.         sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  459.     WEND
  460.     UIPop 1
  461.  
  462.     END
  463.  
  464. END SUB
  465.  
  466. '********************************************************
  467.  
  468. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  469.  
  470. '[OK]
  471. ' Appends a file name to the end of a directory path,
  472. ' inserting a backslash character as needed.
  473. '
  474. ' Arguments:
  475. '     szDir$  - full directory path (with optional ending "\")
  476. '     szFile$ - filename to append to directory
  477. '
  478. ' Needed variables: none.
  479. '
  480. ' Modified variables: none.
  481. '
  482. ' Return value: File path
  483. '
  484. ' Called from: MAIN,CreateProgGroups,WriteIniFiles,InstallFiles,GetTheFiles
  485. '
  486. ' Calls to: none.
  487. '
  488. ' -----------------------------------------------------------
  489.  
  490.     IF szDir$ = "" THEN
  491.     MakePath = szFile$
  492.     ELSEIF szFile$ = "" THEN
  493.     MakePath = szDir$
  494.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  495.     MakePath = szDir$ + szFile$
  496.     ELSE
  497.     MakePath = szDir$ + "\" + szFile$
  498.     END IF
  499. END FUNCTION
  500.  
  501.