home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer 2.1 / 1996-02_Disc_2.1.iso / nomercy / wing / wing.mst < prev    next >
Text File  |  1994-09-26  |  11KB  |  383 lines

  1. '**************************************************************************
  2. '*                       WinG Setup Program
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8.  
  9. ''Dialog ID's
  10. CONST WELCOME       = 100
  11. CONST ASKQUIT       = 200
  12. CONST DESTPATH      = 300
  13. CONST DESTPATH2     = 301
  14. CONST EXITFAILURE   = 400
  15. CONST EXITQUIT      = 600
  16. CONST EXITSUCCESS   = 700
  17. CONST APPHELP       = 900
  18. CONST CHECK         = 2500
  19. CONST BADPATH       = 6400
  20. CONST RESTART       = 1000
  21.  
  22. ''File Types
  23. CONST WING_RUNFILES     = 1
  24. CONST WING_BUILDFILES   = 2
  25.  
  26. ''Bitmap ID
  27. CONST LOGO = 1
  28.  
  29. GLOBAL FILEDIALOG   ''File path dialog ID
  30.  
  31. GLOBAL DEST$        ''Default destination directory.
  32.  
  33. GLOBAL CHECKSTATES$ ''Dialog list symbol names
  34. GLOBAL WINDRIVE$    ''Windows drive letter.
  35.  
  36. GLOBAL TMPDEST$        '' tmpfile destination
  37.  
  38. GLOBAL bInstallDVA%
  39.  
  40. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  41. DECLARE FUNCTION GetRealWindowsSysDir AS STRING
  42. DECLARE SUB UpdateWinG32 (szOrig$) 
  43.  
  44. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  45. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  46. DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  47. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  48. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  49. DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$) 
  50.  
  51. INIT:
  52.     bInstallDVA% = 0
  53.     
  54.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  55.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  56.  
  57.     SetBitmap CUIDLL$, LOGO
  58.     SetTitle "Microsoft WinG Setup"
  59.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  60.     IF szInf$ = "" THEN
  61.     szInf$ = GetSymbolValue("STF_CWDDIR") + "wing.inf"
  62.     END IF
  63.     ReadInfFile szInf$
  64.  
  65. WELCOME:
  66.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  67.     IF sz$ = "CONTINUE" THEN
  68.     UIPop 1
  69.     ELSE
  70.     GOSUB ASKQUIT
  71.     GOTO WELCOME
  72.     END IF
  73.  
  74.  
  75.     CHECKSTATES$ = "CheckItemsIn"
  76.     AddListItem CHECKSTATES$, "ON"
  77. '    AddListItem CHECKSTATES$, "OFF"
  78.     AddListItem CHECKSTATES$, "ON"
  79.  
  80. CHECK:
  81. ''    sz$ = UIStartDlg(CUIDLL$, CHECK, "FCheckDlgProc", APPHELP, HELPPROC$)
  82. ''    IF sz$ = "CONTINUE" THEN
  83. ''    UIPop 1
  84. ''    ELSE
  85. ''    GOSUB ASKQUIT
  86. ''    GOTO CHECK
  87. ''    END IF
  88.  
  89. ''    CHECKSTATES$ = "CheckItemsOut"
  90. ''    IF GetListItem(CHECKSTATES$, WING_RUNFILES) = "ON" THEN
  91.  
  92.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  93.     DEST$ = GetWindowsSysDir
  94.     
  95.     AddSectionFilesToCopyList "runtime", SrcDir$, DEST$
  96.     
  97.            '
  98.     ' only use DVA on Windows 3.x
  99.     '
  100.     IF OnWin3x() = 1 THEN
  101.         AddSectionFilesToCopyList "dva", SrcDir$, DEST$
  102.         IF VflatdPresent() = 0 THEN
  103.         CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite
  104.         bInstallDVA% = 1
  105.         END IF
  106.     END IF
  107.     
  108.     DEST$ = GetRealWindowsSysDir
  109.     
  110.     AddSectionFilesToCopyList "wing32", SrcDir$, DEST$
  111.            Dest1$ = MakePath(DEST$,"wing32.dll")
  112.            Dest2$ = MakePath(DEST$,"wing32.xxx")
  113.     RenameFilePlease Dest1$,Dest2$
  114.     
  115.     CopyFilesInCopyList
  116.     
  117.     UpdateWinG32 GetRealWindowsSysDir()
  118.  
  119. ''    END IF
  120.  
  121. ''    IF GetListItem(CHECKSTATES$, WING_BUILDFILES) = "ON" THEN
  122. ''    WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  123. ''    DEST$ = WINDRIVE$ + ":\WING"
  124. ''    FILEDIALOG = DESTPATH2
  125. ''    GOSUB GETPATH
  126. ''    SrcDir$ = GetSymbolValue("STF_SRCDIR")
  127. ''    CreateDir DEST$, cmoVital
  128.  
  129.     '' add devkit files to destination
  130.     
  131. ''    ' WinBug.exe taken out for first beta, maybe add it in later, and fix up .lyt file too!
  132. ''    'CreateDir MakePath(DEST$,"winbug"), cmoNone
  133. ''    'AddSectionFilesToCopyList "winbug", SrcDir$, MakePath(DEST$,"winbug")
  134.  
  135. ''    CreateDir MakePath(DEST$,"bin"), cmoNone
  136. ''    AddSectionFilesToCopyList "runtime", SrcDir$, MakePath(DEST$,"bin")
  137.     
  138. ''    AddSectionFilesToCopyList "wing32", SrcDir$, MakePath(DEST$,"bin")
  139. ''           Dest1$ = MakePath(DEST$,"bin\wing32.dll")
  140. ''           Dest2$ = MakePath(DEST$,"bin\wing32.xxx")
  141. ''    RenameFilePlease Dest1$,Dest2$
  142.     
  143. ''    AddSectionFilesToCopyList "bin", SrcDir$, MakePath(DEST$,"bin")
  144. ''    AddSectionFilestoCopyList "readme", SrcDir$, DEST$
  145. ''    CreateDir MakePath(DEST$,"include"), cmoNone
  146. ''    AddSectionFilesToCopyList "include", SrcDir$, MakePath(DEST$,"include")
  147. ''    CreateDir MakePath(DEST$,"help"), cmoNone
  148. ''    AddSectionFilesToCopyList "help", SrcDir$, MakePath(DEST$,"help")
  149. ''    CreateDir MakePath(DEST$,"lib"), cmoNone
  150. ''    AddSectionFilesToCopyList "lib", SrcDir$, MakePath(DEST$,"lib")
  151.     
  152. ''    GOSUB ADDSAMPLEFILESTOLIST
  153. ''    CopyFilesInCopyList
  154. ''    UpdateWinG32 MakePath( DEST$, "bin" )
  155. ''    GOSUB ADDGROUP
  156. ''    END IF
  157.  
  158. QUIT:
  159.     ON ERROR GOTO ERRQUIT
  160.  
  161.     IF ERR = 0 THEN
  162.     dlg% = EXITSUCCESS
  163.     ELSEIF ERR = STFQUIT THEN
  164.     dlg% = EXITQUIT
  165.     ELSE
  166.     dlg% = EXITFAILURE
  167.     END IF
  168.  
  169. QUITL1:
  170.     if dlg% = EXITSUCCESS AND bInstallDVA% = 1 then
  171.     sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfoDlgProc", APPHELP, HELPPROC$)
  172.     UIPop 1
  173.     IF sz$ = "CONTINUE" THEN
  174.         rc% = RestartWindows
  175.     ENDIF
  176.     endif
  177.  
  178.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  179.     IF sz$ = "REACTIVATE" THEN
  180.     GOTO QUITL1
  181.     END IF
  182.     UIPop 1
  183.     
  184.  
  185.     END
  186.  
  187. ERRQUIT:
  188.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  189.     END
  190.  
  191.  
  192. BADPATH:
  193.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  194.     IF sz$ = "REACTIVATE" THEN
  195.     GOTO BADPATH
  196.     END IF
  197.     UIPop 1
  198.     RETURN
  199.  
  200.  
  201. ASKQUIT:
  202.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  203.  
  204.     IF sz$ = "EXIT" THEN
  205.     UIPopAll
  206.     ERROR STFQUIT
  207.     ELSEIF sz$ = "REACTIVATE" THEN
  208.     GOTO ASKQUIT
  209.     ELSE
  210.     UIPop 1
  211.     END IF
  212.     RETURN
  213.  
  214.  
  215. GETPATH:
  216.     SetSymbolValue "EditTextIn", DEST$
  217.     SetSymbolValue "EditFocus", "END"
  218.  
  219. GETPATHL1:
  220.     sz$ = UIStartDlg(CUIDLL$, FILEDIALOG, "FEditDlgProc", APPHELP, HELPPROC$)
  221.     DEST$ = GetSymbolValue("EditTextOut")
  222.  
  223.     IF sz$ = "CONTINUE" THEN
  224.     IF IsDirWritable(DEST$) = 0 THEN
  225.         GOSUB BADPATH
  226.         GOTO GETPATHL1
  227.     END IF
  228.     UIPop 1
  229.     ELSEIF sz$ = "REACTIVATE" THEN
  230.     GOTO GETPATHL1
  231.     ELSEIF sz$ = "BACK" THEN
  232.     UIPop 1
  233.     GOTO CHECK
  234.     ELSE
  235.     GOSUB ASKQUIT
  236.     GOTO GETPATH
  237.     END IF
  238.  
  239.     RETURN
  240.  
  241. ADDSAMPLEFILESTOLIST:
  242.     SamplePath$ = MakePath(DEST$,"samples")
  243.     CreateDir SamplePath$, cmoNone
  244.  
  245. '       Add doggie example program
  246.  
  247.     sample$ = "doggie"
  248.  
  249.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  250.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  251.  
  252. '       Add cube example program
  253.  
  254.     sample$ = "cube"
  255.  
  256.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  257.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  258.  
  259. '       Add utils example code
  260.  
  261.     sample$ = "utils"
  262.  
  263.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  264.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  265.  
  266. '       Add timewing example program
  267.  
  268.     sample$ = "timewing"
  269.  
  270.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  271.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  272.  
  273. '       Add halftone example program
  274.  
  275.     sample$ = "halftone"
  276.  
  277.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  278.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  279.  
  280. '       Add palanim example program
  281.  
  282.     sample$ = "palanim"
  283.  
  284.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  285.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  286.  
  287. '       Other sample programs go here
  288.  
  289.     RETURN
  290.     
  291. ADDGROUP:
  292.     SamplePath$ = MakePath(DEST$,"samples")
  293.     proggroup$ = "WinG SDK"
  294.     CreateProgmanGroup proggroup$, "", cmoNone
  295.     
  296.         path$ = MakePath( DEST$, "help\wing.hlp" )
  297.     CreateProgmanItem proggroup$, "WinG Help", "winhelp "+path$, "", cmoOverwrite
  298.     
  299.         path$ = MakePath( DEST$, "bin\wingbug.exe" )
  300.     CreateProgmanItem proggroup$, "WinG Bug Reporting Tool", path$, "", cmoOverwrite
  301.     
  302.     path$ = MakePath( SamplePath$,"doggie\doggie.exe")
  303.     CreateProgmanItem proggroup$, "Doggie", path$, "", cmoOverwrite
  304.     
  305.     path$ = MakePath( SamplePath$,"cube\cube.exe")
  306.     CreateProgmanItem proggroup$, "Cube",path$,"", cmoOverwrite
  307.     
  308.     path$ = MakePath( SamplePath$,"timewing\timewing.exe")
  309.     CreateProgmanItem proggroup$, "Time WinG",path$,"", cmoOverwrite
  310.     
  311.     path$ = MakePath( SamplePath$,"halftone\halftone.exe")
  312.     CreateProgmanItem proggroup$, "Halftone",path$,"", cmoOverwrite
  313.     
  314.     path$ = MakePath( SamplePath$,"palanim\palanim.exe")
  315.     CreateProgmanItem proggroup$, "Palette Animation",path$,"", cmoOverwrite
  316.     
  317. '       Other sample programs get added here
  318.     
  319.     RETURN
  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.  
  344. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  345.     szBuf$ = string$(260, 32)
  346.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  347.     IF cbBuf% = 0 THEN
  348.         ERROR STFERR
  349.     ELSE
  350.         IF cbBuf% > 259 THEN
  351.             res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  352.             ERROR STFERR
  353.         END IF
  354.         szBuf$ = RTRIM$(szBuf$)
  355.         IF MID$(szBuf$, 1, 1) = "\" THEN
  356.             szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  357.         ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  358.             szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  359.         END IF
  360.         IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  361.             szBuf$ = szBuf$ + "\"
  362.         END IF
  363.         GetRealWindowsSysDir = szBuf$
  364.     END IF
  365.  
  366.     szBuf$ = ""
  367. END FUNCTION
  368.  
  369. SUB UpdateWinG32 (szOrig$) STATIC 
  370.     '
  371.     ' Here we check the version ourselves of wing32.dll, since 
  372.     ' we can't get version checking for Win32 apps from Win16
  373.     '
  374.     FileNew$ = MakePath(szOrig$, "wing32.dll")
  375.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  376.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  377.     RemoveFile FileOrig$, cmoForce
  378.     ELSE
  379.         RemoveFile FileNew$, cmoForce        ' get rid of new file
  380.     RenameFilePlease FileOrig$,FileNew$    ' put back old file
  381.     END IF
  382. END SUB
  383.