home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today (UK) (Spanish) 15 / CDRT.iso / win_g / wing.mst < prev    next >
Text File  |  1995-03-13  |  11KB  |  384 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. ' DL 13/03/95
  171. '    if dlg% = EXITSUCCESS AND bInstallDVA% = 1 then
  172. '    sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfoDlgProc", APPHELP, HELPPROC$)
  173. '    UIPop 1
  174. '    IF sz$ = "CONTINUE" THEN
  175. '        rc% = RestartWindows
  176. '    ENDIF
  177. '    endif
  178. '
  179. '    sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  180. '    IF sz$ = "REACTIVATE" THEN
  181. '    GOTO QUITL1
  182. '    END IF
  183. '    UIPop 1
  184.     
  185.  
  186.     END
  187.  
  188. ERRQUIT:
  189.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  190.     END
  191.  
  192.  
  193. BADPATH:
  194.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  195.     IF sz$ = "REACTIVATE" THEN
  196.     GOTO BADPATH
  197.     END IF
  198.     UIPop 1
  199.     RETURN
  200.  
  201.  
  202. ASKQUIT:
  203.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  204.  
  205.     IF sz$ = "EXIT" THEN
  206.     UIPopAll
  207.     ERROR STFQUIT
  208.     ELSEIF sz$ = "REACTIVATE" THEN
  209.     GOTO ASKQUIT
  210.     ELSE
  211.     UIPop 1
  212.     END IF
  213.     RETURN
  214.  
  215.  
  216. GETPATH:
  217.     SetSymbolValue "EditTextIn", DEST$
  218.     SetSymbolValue "EditFocus", "END"
  219.  
  220. GETPATHL1:
  221.     sz$ = UIStartDlg(CUIDLL$, FILEDIALOG, "FEditDlgProc", APPHELP, HELPPROC$)
  222.     DEST$ = GetSymbolValue("EditTextOut")
  223.  
  224.     IF sz$ = "CONTINUE" THEN
  225.     IF IsDirWritable(DEST$) = 0 THEN
  226.         GOSUB BADPATH
  227.         GOTO GETPATHL1
  228.     END IF
  229.     UIPop 1
  230.     ELSEIF sz$ = "REACTIVATE" THEN
  231.     GOTO GETPATHL1
  232.     ELSEIF sz$ = "BACK" THEN
  233.     UIPop 1
  234.     GOTO CHECK
  235.     ELSE
  236.     GOSUB ASKQUIT
  237.     GOTO GETPATH
  238.     END IF
  239.  
  240.     RETURN
  241.  
  242. ADDSAMPLEFILESTOLIST:
  243.     SamplePath$ = MakePath(DEST$,"samples")
  244.     CreateDir SamplePath$, cmoNone
  245.  
  246. '       Add doggie example program
  247.  
  248.     sample$ = "doggie"
  249.  
  250.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  251.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  252.  
  253. '       Add cube example program
  254.  
  255.     sample$ = "cube"
  256.  
  257.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  258.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  259.  
  260. '       Add utils example code
  261.  
  262.     sample$ = "utils"
  263.  
  264.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  265.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  266.  
  267. '       Add timewing example program
  268.  
  269.     sample$ = "timewing"
  270.  
  271.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  272.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  273.  
  274. '       Add halftone example program
  275.  
  276.     sample$ = "halftone"
  277.  
  278.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  279.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  280.  
  281. '       Add palanim example program
  282.  
  283.     sample$ = "palanim"
  284.  
  285.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  286.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  287.  
  288. '       Other sample programs go here
  289.  
  290.     RETURN
  291.     
  292. ADDGROUP:
  293.     SamplePath$ = MakePath(DEST$,"samples")
  294.     proggroup$ = "WinG SDK"
  295.     CreateProgmanGroup proggroup$, "", cmoNone
  296.     
  297.         path$ = MakePath( DEST$, "help\wing.hlp" )
  298.     CreateProgmanItem proggroup$, "WinG Help", "winhelp "+path$, "", cmoOverwrite
  299.     
  300.         path$ = MakePath( DEST$, "bin\wingbug.exe" )
  301.     CreateProgmanItem proggroup$, "WinG Bug Reporting Tool", path$, "", cmoOverwrite
  302.     
  303.     path$ = MakePath( SamplePath$,"doggie\doggie.exe")
  304.     CreateProgmanItem proggroup$, "Doggie", path$, "", cmoOverwrite
  305.     
  306.     path$ = MakePath( SamplePath$,"cube\cube.exe")
  307.     CreateProgmanItem proggroup$, "Cube",path$,"", cmoOverwrite
  308.     
  309.     path$ = MakePath( SamplePath$,"timewing\timewing.exe")
  310.     CreateProgmanItem proggroup$, "Time WinG",path$,"", cmoOverwrite
  311.     
  312.     path$ = MakePath( SamplePath$,"halftone\halftone.exe")
  313.     CreateProgmanItem proggroup$, "Halftone",path$,"", cmoOverwrite
  314.     
  315.     path$ = MakePath( SamplePath$,"palanim\palanim.exe")
  316.     CreateProgmanItem proggroup$, "Palette Animation",path$,"", cmoOverwrite
  317.     
  318. '       Other sample programs get added here
  319.     
  320.     RETURN
  321.  
  322. '**
  323. '** Purpose:
  324. '**     Appends a file name to the end of a directory path,
  325. '**     inserting a backslash character as needed.
  326. '** Arguments:
  327. '**     szDir$  - full directory path (with optional ending "\")
  328. '**     szFile$ - filename to append to directory
  329. '** Returns:
  330. '**     Resulting fully qualified path name.
  331. '*************************************************************************
  332. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  333.     IF szDir$ = "" THEN
  334.     MakePath = szFile$
  335.     ELSEIF szFile$ = "" THEN
  336.     MakePath = szDir$
  337.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  338.     MakePath = szDir$ + szFile$
  339.     ELSE
  340.     MakePath = szDir$ + "\" + szFile$
  341.     END IF
  342. END FUNCTION
  343.  
  344.  
  345. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  346.     szBuf$ = string$(260, 32)
  347.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  348.     IF cbBuf% = 0 THEN
  349.         ERROR STFERR
  350.     ELSE
  351.         IF cbBuf% > 259 THEN
  352.             res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  353.             ERROR STFERR
  354.         END IF
  355.         szBuf$ = RTRIM$(szBuf$)
  356.         IF MID$(szBuf$, 1, 1) = "\" THEN
  357.             szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  358.         ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  359.             szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  360.         END IF
  361.         IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  362.             szBuf$ = szBuf$ + "\"
  363.         END IF
  364.         GetRealWindowsSysDir = szBuf$
  365.     END IF
  366.  
  367.     szBuf$ = ""
  368. END FUNCTION
  369.  
  370. SUB UpdateWinG32 (szOrig$) STATIC 
  371.     '
  372.     ' Here we check the version ourselves of wing32.dll, since 
  373.     ' we can't get version checking for Win32 apps from Win16
  374.     '
  375.     FileNew$ = MakePath(szOrig$, "wing32.dll")
  376.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  377.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  378.     RemoveFile FileOrig$, cmoForce
  379.     ELSE
  380.         RemoveFile FileNew$, cmoForce        ' get rid of new file
  381.     RenameFilePlease FileOrig$,FileNew$    ' put back old file
  382.     END IF
  383. END SUB
  384.