home *** CD-ROM | disk | FTP | other *** search
/ Eyewitness: Encyclopedia of Space & the Universe / DKMMSPAC.iso / dksetup / dkgen.inc < prev    next >
Text File  |  1996-04-23  |  33KB  |  856 lines

  1. '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2. '
  3. '   DKGEN.INC
  4. '
  5. '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  6. ' See the change history in DKSETUP.MST for more recent changes.
  7. '
  8. '27/02/96 Added the InstallQTW function.
  9. '25/01/96 Change the EndCommonInstall and HandleRestart SUB's to Functions to
  10. '         utilise return values. So the user does NOT get the 'You must restart
  11. '         windows' warning AND THEN the 'Successful install' dialog box.
  12. '25/01/96 Change path checking to look for Max of 8 chars first.
  13. '08/08/95 Test for Norton Anti Virus
  14. '03/08/95 const for uninstall and min register added
  15. '07/07/95 Correct so unregisters use of ctl3d
  16. '01/06/95 No choice about adding icons to progman
  17. '?/05/95  If bundle with sampler need to test for cirrus driver - put into mst file
  18. '12/03/95 Alternative function added, readme icon has shortened name
  19.  
  20. '$INCLUDE 'setupapi.inc'
  21. '$INCLUDE 'msdetect.inc'
  22. '$INCLUDE 'dklang.inc'
  23. '$INCLUDE 'product.inc' 'Defines which change for every product
  24.  
  25. '   Defines unlikely to change
  26. CONST APPLICATION_MENU_FILE     = "custmenu.exe"
  27. CONST INI_FILE_SOURCE = "AppPath" ' OR  "WinPath"
  28. CONST EDITOR_EXE        = "write.exe "
  29. CONST SAMPLER_PATH      = "SAMPLER"
  30. CONST SAMPLER_EXE_FILE  = "sampler.exe"
  31. CONST SAMPLER_INI_FILE  = "sampler.ini"
  32. CONST SAMPLER_BINARIES_SECTION_NAME = "SAMPBIN"
  33.  
  34. CONST SOURCE_BINARIES_SUBDIR = "DKCODE"
  35. CONST SOURCE_SETUP_SUBDIR = "DKSETUP"
  36. CONST SETUP_INF_FILENAME = "SETUP.INF"
  37. CONST CUIDLL_FILENAME = "mscuistf.dll"
  38. CONST SETUP_INI_BINARIES_SECTION_NAME = "BIN"
  39. CONST SETUP_INI_SH_BINARIES_SECTION_NAME = "BIN Shared"
  40. CONST SETUP_INI_WING_BINARIES_NAME = "WinG Runtime"
  41. CONST SETUP_INI_WING32_BINARIES_NAME = "WinG32"
  42. CONST SETUP_INI_ACM_SECTION_NAME = "ACM Drivers"
  43. CONST SETUP_INI_FONTS_SECTION_NAME = "Fonts"
  44.  
  45. 'unin, min register
  46. CONST UNINSTALL_EXE_FILE = "UNINSTAL.exe"
  47. CONST DKREG_INI_DIR = "\MMAPP"
  48. CONST DKREG_INI_PATH = "\MMAPP\MMAPP.ini"
  49. CONST WIN_INI_ENTRY = "path"
  50.  
  51. CONST PRODUCT_INI_DIR_SECTION_NAME = "Directory"
  52. CONST PRODUCT_INI_DIR_ENTRY_NAME = "Data"
  53.  
  54. CONST MINIMUM_DISK_SPACE = 2048 ' For Minimum install
  55.  
  56. ' Procs
  57. CONST PROC_HELP = "FHelpDlgProc"
  58.  
  59. DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (szEXE$, szParams$) AS INTEGER
  60. DECLARE FUNCTION GetActiveWindow    lib "User" () as integer
  61. DECLARE FUNCTION SetWindowPos       lib "User" (hwnd as integer, hwnd as integer, i as integer, i as integer, i as integer, i as integer, w as integer) as integer
  62.  
  63. DECLARE FUNCTION Ctl3dRegister LIB "CTL3D.DLL" (hInst%) AS INTEGER
  64. DECLARE FUNCTION Ctl3dUnregister LIB "CTL3D.DLL" (hInst%) AS INTEGER
  65. DECLARE FUNCTION Ctl3dAutoSubClass LIB "CTL3D.DLL" (hInst%) AS INTEGER
  66.  
  67. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  68. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  69. DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  70. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  71. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  72. DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$)
  73.  
  74. DECLARE FUNCTION FIsVGA LIB "mscuistf.dll" AS INTEGER
  75. DECLARE FUNCTION FIs256Colour LIB "mscuistf.dll" AS INTEGER
  76. DECLARE FUNCTION Welcome() AS INTEGER
  77. DECLARE FUNCTION TestSystem() AS INTEGER
  78. DECLARE FUNCTION GetDiskSpaceNeeded(drive%) AS LONG
  79. DECLARE SUB Initialise(prodName$, defInstallPath$, msgCaption$)
  80. DECLARE SUB DeInitialise()
  81. DECLARE SUB AskQuit()
  82. DECLARE SUB BadPath()
  83. DECLARE SUB NetworkDrive()
  84. DECLARE SUB UpdateIndeoAVIDrivers()
  85. DECLARE SUB UpdateWinGDrivers()
  86. 'DECLARE SUB UpdateProgramManager(prodName$, appExeFile$, appPengeFile$, readmeFile$, readmeStr$, onCDROM%)
  87. 'DECLARE SUB UpdateProgramManagerAlt(prodName$, readmeName$, appExeFile$, appPengeFile$, readmeFile$, readmeStr$, onCDROM%)
  88. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  89. DECLARE FUNCTION GetRealWindowsSysDir AS STRING
  90. DECLARE SUB UpdateWinG32 (szOrig$)
  91. DECLARE SUB InitCommonInstall()
  92. DECLARE FUNCTION LicenseAgreement() AS INTEGER
  93. DECLARE FUNCTION Win32sRequiredDLG() AS INTEGER
  94. DECLARE FUNCTION UpdateADPCMDrivers() AS INTEGER
  95. DECLARE FUNCTION EndCommonInstall( AppReadmeFile$, InRoot%, szEditorExe$ ) AS INTEGER
  96. DECLARE FUNCTION HandleRestart() AS INTEGER
  97. DECLARE FUNCTION InstallQTW() As Integer
  98.  
  99. '  SetWindowPos() flags
  100. const SWP_NOSIZE         = &H0001
  101. const SWP_NOMOVE         = &H0002
  102. const SWP_NOACTIVATE     = &H0010
  103. const SWP_SHOWWINDOW     = &H0040
  104. const SWP_HIDEWINDOW     = &H0080
  105. const HWND_TOP       = (0)
  106. const HWND_BOTTOM    = (1)
  107. const HWND_TOPMOST   = (-1)
  108. const HWND_NOTOPMOST = (-2)
  109.  
  110.  
  111. 'Dialog Box ID's
  112. CONST DLG_ABORT                       =100
  113. CONST DLG_ADDSYSTEMSOFT               =101
  114. CONST DLG_ADPCMHELP                   =102
  115. CONST DLG_AWFULMACHINE                =103
  116. CONST DLG_BADEXIT                     =110
  117. CONST DLG_BADVGA                      =111
  118. CONST DLG_BADPATH                     =112
  119. CONST DLG_BILLBOARD                   =113
  120. CONST DLG_CUSTOM                      =120
  121. CONST DLG_CUSTOMHELP                  =121
  122. CONST DLG_DESTPATH                    =130
  123. CONST DLG_DONEVIDEO                   =131
  124. CONST DLG_DONENOVIDEO                 =132
  125. CONST DLG_EXITFAILNOTENH              =140
  126. CONST DLG_EXITFAILNOTINTEL            =141
  127. CONST DLG_EXITFAILNOTWIN31            =142
  128. CONST DLG_EXITFAILRUNAPP              =143
  129. CONST DLG_FREECELLINST                =150
  130. CONST DLG_INSTALLQTW                  =180
  131. CONST DLG_LICENSE                     =210
  132. CONST DLG_MAILMAN                     =220
  133. CONST DLG_NOSPACE                     =230
  134. CONST DLG_NEEDS31                     =231
  135. CONST DLG_NOMOUSE                     =232
  136. CONST DLG_NOT256                      =233
  137. CONST DLG_NOSYSSOFT                   =234
  138. CONST DLG_NODISKSPACE                 =235
  139. CONST DLG_NEEDSWIN32S                 =236
  140. CONST DLG_NETWORKDRIVE                =237
  141. CONST DLG_PATHHELP                    =240
  142. CONST DLG_POORMACHINE                 =241
  143. CONST DLG_PROGMANGROUP                =242
  144. CONST DLG_PROGMANGRP                  =243
  145. CONST DLG_QUIT                        =250
  146. CONST DLG_SPEED                       =270
  147. CONST DLG_SUCCESS                     =271
  148. CONST DLG_URKADPCM                    =290
  149. CONST DLG_WELCOME                     =310
  150. CONST DLG_WELHELP                     =311
  151. CONST DLG_WRONGADPCM                  =312
  152. CONST DLG_WHIZZHELP                   =313
  153. 'Bitmap ID
  154. CONST IDB_BITMAP                      =1000
  155.  
  156. ' Error messages
  157. CONST ERR_OK = 100
  158. CONST ERR_EXITFAIL = 101
  159. CONST ERR_WINVERFAIL = 102
  160. CONST ERR_NODISKSPACE = 103
  161.  
  162. ' Navigation messages
  163. CONST NAV_FORWARD = 0
  164. CONST NAV_BACK = 1
  165. CONST NAV_EXIT = 2
  166. CONST NAV_RUN = 3
  167.  
  168.  
  169. GLOBAL szWinPath As String
  170. GLOBAL szWinSysPath As String
  171. GLOBAL szWinDrive As String
  172. GLOBAL szSrcSetupPath As String
  173. GLOBAL szSrcBinPath As String
  174. GLOBAL szDestPath As String
  175. GLOBAL szOldDestPath As String
  176. GLOBAL szPengePath As String
  177. GLOBAL szINFPath As String
  178. GLOBAL szAppINIPath As String
  179. GLOBAL szMsgCaption As String
  180. GLOBAL szButton As String
  181. GLOBAL szMinimalInstall As String
  182. GLOBAL szAddPMItem As String
  183. GLOBAL szExpressCustomChoice As String
  184. GLOBAL szMMappPath As String
  185. GLOBAL szInstExePath As String
  186. GLOBAL szInstExeDate As String
  187. GLOBAL szCdExePath As String
  188. GLOBAL szCdExeDate As String
  189. GLOBAL szCopyright As String
  190. GLOBAL szFullSampPath As String
  191. GLOBAL szSampINIPath As String
  192. GLOBAL szSampData As String
  193. GLOBAL szSampVersion As String
  194. GLOBAL szMsacmPriority1 As String
  195. GLOBAL szMsacmPriority2 As String
  196. GLOBAL szMsacmPriority3 As String
  197. GLOBAL bInstalledWin32s As Integer
  198. GLOBAL APPLICATION_INI_FILE As String
  199. GLOBAL APPLICATION_EXE_FILE As String
  200. GLOBAL APPLICATION_PENGE_FILE As String
  201.  
  202. GLOBAL fPreviousMode As Integer
  203. GLOBAL fWillNotFit As Integer
  204. GLOBAL fSystemUpdated As Integer
  205. GLOBAL hDlg As Integer
  206. GLOBAL dButton As Integer
  207. GLOBAL dWinDrive As Integer
  208. GLOBAL dDestDrive As Integer
  209. GLOBAL dCursor As Integer
  210. GLOBAL hwndSetup As Integer
  211.  
  212.  
  213. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  214. Sub InitCommonInstall() STATIC
  215.     AddToBillboardList CUIDLL_FILENAME, DLG_MAILMAN, "MailmanDlgProc", 2500
  216.     SetCopyGaugePosition -1, 150
  217. End Sub
  218.  
  219.  
  220. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  221. Function EndCommonInstall( AppReadmeFile$, InRoot%, szEditorExe$ ) STATIC AS INTEGER
  222.  
  223.     if RestartListEmpty = 0 or fSystemUpdated = 1 or bInstalledWin32s = 1 then
  224.         hDlg = DLG_DONEVIDEO
  225.     else
  226.         hDlg = DLG_DONENOVIDEO
  227.     end if
  228.  
  229. QuitLoop:
  230.     szButton = UIStartDlg(CUIDLL_FILENAME, hDlg, "FInfoDlgProc", 0, "")
  231.     select case szButton
  232.     case "REACTIVATE"
  233.         goto QuitLoop
  234.     case "CONTINUE"     'Read me
  235.         if inRoot% = 1 then
  236.             szReadMe$ = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), appReadmeFile$)
  237.         else
  238.             szReadMe$ = MakePath(szSrcBinPath, appReadmeFile$)
  239.         end if
  240.         if szEditorExe$ = "write.exe " then
  241.             run szEditorExe$ + szReadMe$, nowait
  242.         else
  243.             run szEditorExe$ + szReadMe$
  244.         end if
  245.         goto QuitLoop
  246.     case "BACK"     'Restart Windows
  247.         if HandleRestart = 0 then
  248.             dButton = DoMsgBox( STR_SYSMESSAGE, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  249.             EndCommonInstall = NAV_EXIT
  250.         else
  251.             EndCommonInstall = NAV_FORWARD
  252.         end if
  253.     case "EXIT" , "CANCEL"         'Return to Windows
  254.         if hDlg = DLG_DONEVIDEO then
  255.             dButton = DoMsgBox( STR_SYSMESSAGE, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  256.             EndCommonInstall = NAV_EXIT
  257.         else
  258.             EndCommonInstall = NAV_FORWARD
  259.         end if
  260.     end select
  261.  
  262.     UIPop 1
  263. End Function
  264.  
  265.  
  266. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  267. Sub Initialise(prodName$, defInstallPath$, msgCaption$) STATIC
  268.     ret% = Ctl3dRegister(HinstFrame())
  269.     ret% = Ctl3dAutoSubClass(HinstFrame())
  270.  
  271.     szMsgCaption$ = msgCaption$
  272.  
  273.     cursor% = ShowWaitCursor()
  274.  
  275.     ClearCopyList
  276.     szWinSysPath = ucase$(GetWindowsSysDir ())
  277.     szWinPath = ucase$(GetWindowsDir ())
  278.     dWinDrive = asc(mid$((szWinPath), 1,1)) - asc("A")+1
  279.     szWinDrive = mid$(szWinPath, 1,1)
  280.  
  281.     szSrcSetupPath = ucase$(GetSymbolValue ("STF_SRCDIR"))
  282.     szSrcBinPath = mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1) + SOURCE_BINARIES_SUBDIR
  283.     szDestPath = szWinDrive + ":" + defInstallPath$
  284.  
  285. '+++
  286. '$IFDEF WITH_FULL_SAMPLER
  287.     szFullSampPath = szWinDrive + ":" + "\DKMM\" + SAMPLER_PATH
  288. '$ENDIF
  289. '---
  290.  
  291.     SetTitle szMsgCaption$
  292.     SetBitmap CUIDLL_FILENAME, IDB_BITMAP
  293.     szCopyright = STR_COPYRIGHT + "     Setup " + STR_VERSION
  294.     SetAbout prodName$, szCopyright
  295.  
  296.     fPreviousMode = SetBeepingMode (1)
  297.     fPreviousMode = SetDecompMode (1)
  298.     fPreviousMode = SetSilentMode (0)
  299.  
  300.     szINFPath = ucase$(GetSymbolValue("STF_SRCINFPATH"))
  301.     if szINFPath = "" then
  302.         szINFPath = ucase$(GetSymbolValue("STF_CWDDIR")) + SETUP_INF_FILENAME
  303.     end if
  304.     ReadInfFile szINFPath
  305.  
  306.     szExpressCustomChoice = "EXPRESS"
  307.     szMinimalInstall = "OFF"
  308. '    szAddPMItem = "ON"
  309.  
  310.     fSystemUpdated = 0
  311.     bInstalledWin32s = 0
  312.  
  313.     ' Set up Application file names
  314.     APPLICATION_INI_FILE = APP_SHORTNAME + ".INI"
  315.     APPLICATION_EXE_FILE = APP_SHORTNAME + ".EXE"
  316.     APPLICATION_PENGE_FILE = APP_SHORTNAME + ".PNG"
  317.  
  318.     RestoreCursor(cursor%)
  319. End Sub
  320.  
  321.  
  322. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  323. Sub DeInitialise() STATIC
  324.     ret% = Ctl3dUnregister(HinstFrame())
  325. End Sub
  326.  
  327.  
  328. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  329. Sub AskQuit() STATIC
  330. begin:
  331.     szButton = UIStartDlg(CUIDLL_FILENAME, DLG_QUIT, "FQuitDlgProc", 0, "")
  332.     select case szButton
  333.     case "REACTIVATE"
  334.         goto begin
  335.     case "EXIT" , "CANCEL"
  336.         error STFQUIT
  337.     case "CONTINUE"
  338.         UIPop 1
  339.     end select
  340. End Sub
  341.  
  342.  
  343. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  344. Sub BadPath() STATIC
  345. begin:
  346.     szButton = UIStartDlg(CUIDLL_FILENAME, DLG_BADPATH, "FInfo0DlgProc", 0, "")
  347.     select case szButton
  348.     case "REACTIVATE"
  349.         goto begin
  350.     end select
  351.     UIPop 1
  352. End Sub
  353.  
  354.  
  355.  
  356. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  357. Sub NetworkDrive() STATIC
  358. begin:
  359.     szButton = UIStartDlg(CUIDLL_FILENAME, DLG_NETWORKDRIVE, "FInfo0DlgProc", 0, "")
  360.     select case szButton
  361.     case "REACTIVATE"
  362.         goto begin
  363.     end select
  364.     UIPop 1
  365. End Sub
  366.  
  367. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  368. Function LicenseAgreement() STATIC As Integer
  369. begin:
  370.     szButton = UIStartDlg( CUIDLL_FILENAME, DLG_LICENSE, "FInfoDlgProc", 0, "" )
  371.     select case szButton
  372.     case "CONTINUE"
  373.         UIPop 1
  374.         LicenseAgreement = NAV_FORWARD
  375.     case "EXIT" , "CANCEL"
  376.         LicenseAgreement = NAV_EXIT
  377.     end select
  378. End Function
  379.  
  380. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  381. Function Welcome() STATIC As Integer
  382. begin:
  383.     szButton = UIStartDlg(CUIDLL_FILENAME, DLG_WELCOME, "FInfoDlgProc", DLG_WELHELP, PROC_HELP)
  384.     select case szButton
  385.     case "REACTIVATE"
  386.         goto begin
  387.     case "CONTINUE"
  388.         UIPop 1
  389.         Welcome = NAV_FORWARD
  390.     case "EXIT" , "CANCEL"
  391.         AskQuit
  392.         goto begin
  393.     end select
  394. End Function
  395.  
  396. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  397. Function TestSystem() STATIC As Integer
  398.  
  399. TestNortonAntiVirus:
  400.     szWinString$ = GetIniKeyString( "win.ini", "windows", "load")
  401.     ret% = instr( szWinString,"NAV\navtsrw.exe" )
  402.     if ret% <> 0  then
  403.         dButton = DoMsgBox(STR_NAV, szMsgCaption$, MB_OK)
  404.     endif
  405.  
  406. TestWinVer:
  407.     if GetWindowsMajorVersion() < 3 or (GetWindowsMajorVersion() = 3 and GetWindowsMinorVersion() < 10) then
  408.         TestWinVerDlgLoop:
  409.             szButton = UIStartDlg (CUIDLL_FILENAME, DLG_NEED31, "FInfoDlgProc", DLG_AWFULMACHINE, PROC_HELP)
  410.             select case szButton
  411.             case "EXIT" , "CANCEL"
  412.                 goto TestWinVerDlgLoop
  413.             end select
  414.     end if
  415.  
  416. TestVGA:
  417.     if GetScreenWidth () < 640 or GetScreenHeight () < 480 then
  418.         TestVGADlgLoop:
  419.             szButton = UIStartDlg (CUIDLL_FILENAME, DLG_BADVGA, "FInfoDlgProc", DLG_AWFULMACHINE, PROC_HELP)
  420.             select case szButton
  421.             case "REACTIVATE"
  422.                 goto TestVGADlgLoop
  423.             case "BACK"
  424.                 UIPop 1
  425.                 TestSystem = NAV_BACK
  426.                 goto back
  427.             case "CONTINUE"
  428.                 TestSystem = NAV_FORWARD
  429.                 UIPop 1
  430.                 goto TestMouse
  431.             case "EXIT" , "CANCEL"
  432.                 AskQuit
  433.                 goto TestVGADlgLoop
  434.             end select
  435.         end if
  436.  
  437. TestMouse:
  438.     if HasMouseInstalled() = false then
  439.     TestMouseDlgLoop:
  440.         szButton = UIStartDlg (CUIDLL_FILENAME, DLG_NOMOUSE, "FInfoDlgProc", DLG_AWFULMACHINE, PROC_HELP)
  441.         select case szButton
  442.         case "REACTIVATE"
  443.             goto TestMouseDlgLoop
  444.         case "BACK"
  445.             UIPop 1
  446.             TestSystem = NAV_BACK
  447.         case "CONTINUE"
  448.             TestSystem = NAV_FORWARD
  449.             UIPop 1
  450.             goto TestColour
  451.         case "EXIT" , "CANCEL"
  452.             AskQuit
  453.             goto TestMouseDlgLoop
  454.         end select
  455.     end if
  456.  
  457. TestColour:
  458.     if FIs256Colour() = false then
  459.     TestColourDlgLoop:
  460.         szButton = UIStartDlg (CUIDLL_FILENAME, DLG_NOT256, "FInfoDlgProc", DLG_POORMACHINE, PROC_HELP)
  461.         select case szButton
  462.         case "REACTIVATE"
  463.             goto TestColourDlgLoop
  464.         case "BACK"
  465.             UIPop 1
  466.             TestSystem = NAV_BACK
  467.             goto back
  468.         case "CONTINUE"
  469.             UIPop 1
  470.             TestSystem = NAV_FORWARD
  471.         case "EXIT" , "CANCEL"
  472.             AskQuit
  473.             goto TestColourDlgLoop
  474.         end select
  475.     end if
  476.  
  477. back:
  478. End Function
  479.  
  480.  
  481. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  482. '**
  483. '** Purpose:
  484. '**     Appends a file name to the end of a directory path,
  485. '**     inserting a backslash character as needed.
  486. '** Arguments:
  487. '**     szDir$  - full directory path (with optional ending "\")
  488. '**     szFile$ - filename to append to directory
  489. '** Returns:
  490. '**     Resulting fully qualified path name.
  491. '*************************************************************************
  492. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  493.     IF szDir$ = "" THEN
  494.         MakePath = szFile$
  495.     ELSEIF szFile$ = "" THEN
  496.         MakePath = szDir$
  497.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  498.         MakePath = szDir$ + szFile$
  499.     ELSE
  500.         MakePath = szDir$ + "\" + szFile$
  501.     END IF
  502. END FUNCTION
  503.  
  504.  
  505.  
  506. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  507. Function HandleRestart() STATIC AS INTEGER
  508.     ' Check there are system files to install AND check if Windows v3.1 or greater
  509.     if RestartListEmpty = 0 and GetWindowsMajorVersion >= 3 and GetWindowsMajorVersion >= 1 then
  510.         dButton = DoMsgBox(STR_EXIT, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  511.         tryagain:
  512.         if ExitExecRestart = 1 then
  513.             ' Exit failed
  514.             dButton = DoMsgBox(STR_EXITFAIL, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONSTOP)
  515.             goto tryagain
  516.         end if
  517.     end if
  518.  
  519.     HandleRestart = 1
  520.  
  521.     if RestartListEmpty = 1 then ' Empty, but we have to reboot
  522.         dummy% = ExitWindowsExec(MakePath(szDestPath, "_msrstrt.exe"), "")
  523.         if dummy% = 0 then
  524.             HandleRestart = 0
  525.         end if
  526.     end if
  527.  
  528. End Function
  529.  
  530. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  531. 'Sub UpdateProgramManager(prodName$, appExeFile$, appPengeFile$, readmeFile$, readmeStr$, onCDROM%) STATIC
  532. 'Dim szReadmeTitle As String
  533. 'Dim szInf As String
  534. '
  535. '    if onCDROM% = 1 then    'sampler
  536. '        CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  537. '        ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  538. '        szReadmeTitle = prodName$ + " " + readmeStr$
  539. '
  540. '        szInf = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), appExeFile$)
  541. '        CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, MakePath(szDestPath, "sampler.ico"), cmoOverwrite
  542. ''        CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), readmeFile$), "", cmoOverwrite
  543. '    else
  544. '        if szAddPMItem = "ON" then
  545. '            CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  546. '            ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  547. '            szReadmeTitle = prodName$ + " " + readmeStr$
  548. '            if szMinimalInstall = "ON" then
  549. '                szInf = MakePath(szSrcBinPath, appExeFile$) + " " + MakePath(szSrcBinPath, appPengeFile$)
  550. '                CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, szInf, cmoOverwrite
  551. '                CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath(szSrcBinPath, readmeFile$), "", cmoOverwrite
  552. '            else
  553. '                szInf = MakePath(szDestPath, appExeFile$) + " " + MakePath(szDestPath, appPengeFile$)
  554. '                CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, szInf, cmoOverwrite
  555. '                CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath(szDestPath, readmeFile$), "", cmoOverwrite
  556. '            end if
  557. '        end if
  558. '    end if
  559. '
  560. 'End Sub
  561.  
  562.  
  563. ''''''''''''''''''''''''''''''''''''''''''''
  564.  
  565. '' Alternative function for french stowaway
  566. '' Readme icon has shortened name
  567. 'Sub UpdateProgramManagerAlt(prodName$, readmeName$, appExeFile$, appPengeFile$, readmeFile$, readmeStr$, onCDROM%) STATIC
  568. 'Dim szReadmeTitle As String
  569. 'Dim szInf As String
  570. '
  571. '    if onCDROM% = 1 then    'sampler
  572. '        CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  573. '        ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  574. '        szReadmeTitle = readmeName$ + " " + readmeStr$
  575. '
  576. '        szInf = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), appExeFile$)
  577. '        CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, MakePath(szDestPath, "sampler.ico"), cmoOverwrite
  578. ''        CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), readmeFile$), "", cmoOverwrite
  579. '   else
  580. '        if szAddPMItem = "ON" then
  581. '            CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  582. '            ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  583. '            szReadmeTitle = readmeName$ + " " + readmeStr$
  584. '            if szMinimalInstall = "ON" then
  585. '                szInf = MakePath(szSrcBinPath, appExeFile$) + " " + MakePath(szSrcBinPath, appPengeFile$)
  586. '                CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, szInf, cmoOverwrite
  587. '                CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath(szSrcBinPath, readmeFile$), "", cmoOverwrite
  588. '            else
  589. '                szInf = MakePath(szDestPath, appExeFile$) + " " + MakePath(szDestPath, appPengeFile$)
  590. '                CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, szInf, cmoOverwrite
  591. '                CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath(szDestPath, readmeFile$), "", cmoOverwrite
  592. '            end if
  593. '        end if
  594. '    end if
  595. '
  596. 'End Sub
  597.  
  598.  
  599.  
  600. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  601. Function GetDiskSpaceNeeded( drive% ) STATIC As Long
  602. Dim dDummy As Long
  603.  
  604.     cursor% = ShowWaitCursor()
  605.  
  606.     SetSymbolValue "ExtraSpace", ""
  607.     SetSymbolValue "Needed", ""
  608.     SetSymbolValue "Cost", ""
  609.  
  610.     'Drives A - Z
  611.     for i% = 1 to 26
  612.         AddListItem "ExtraSpace", ""
  613.     next i%
  614.  
  615.     ReplaceListItem "ExtraSpace", dWinDrive, str$(MINIMUM_DISK_SPACE)    '2K for the INI file
  616.  
  617.     dDummy = GetCopyListCost("ExtraSpace","Needed","Cost")
  618.  
  619.     GetDiskSpaceNeeded = val(GetListItem ("Needed", drive))
  620.  
  621.     RemoveSymbol "Needed"
  622.     RemoveSymbol "Cost"
  623.     RemoveSymbol "ExtraSpace"
  624.  
  625.     RestoreCursor(cursor%)
  626. End Function
  627.  
  628.  
  629.  
  630. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  631. Sub UpdateIndeoAVIDrivers() STATIC
  632. Dim szWMDriver As String
  633. Dim szACMDriver As String
  634.  
  635.     szWMDriver = GetIniKeyString(MakePath(szWinPath,"system.ini"), "drivers", "WaveMapper")
  636.  
  637.     if not(szWMDriver = "msacm.drv") then
  638.         fSystemUpdated = 1
  639.     end if
  640.  
  641.  
  642.     if VflatdPresent() = 0 then
  643.         CreateSysIniKeyValue szWinPath + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  644.         fSystemUpdated = 1
  645.     end if
  646.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  647.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.IV31", "ir32.dll", cmoOverwrite
  648.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.RT21", "ir21.dll", cmoOverwrite
  649.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.YVU9", "iyvu9.dll", cmoOverwrite
  650.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  651.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  652.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  653.     CreateIniKeyValue szWinPath + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  654.     CreateIniKeyValue szWinPath + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  655.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  656.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  657.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  658.     CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "ir21.dll", "Intel Indeo(TM) Video R2.1", cmoOverwrite
  659.     CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  660.     CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  661.     CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  662.  
  663.     szMsacmPriority1 = GetIniKeyString(szWinPath + "MSACM.INI","PRIORITY","PRIORITY1")
  664.     szMsacmPriority2 = GetIniKeyString(szWinPath + "MSACM.INI","PRIORITY","PRIORITY2")
  665.     szMsacmPriority3 = GetIniKeyString(szWinPath + "MSACM.INI","PRIORITY","PRIORITY3")
  666.  
  667.     if mid$( szMsacmPriority1, 1, 1 ) = "0" then
  668.         szMsacmPriority1 = "1" + mid$( szMsacmPriority1, 2, len(szMsacmPriority1)-1 )
  669.         CreateIniKeyValue szWinPath + "msacm.ini", "PRIORITY", "PRIORITY1", szMsacmPriority1, cmoOverwrite
  670.         fSystemUpdated = 1
  671.     endif
  672.  
  673.     if mid$( szMsacmPriority2, 1, 1 ) = "0" then
  674.         szMsacmPriority2 = "1" + mid$( szMsacmPriority2, 2, len(szMsacmPriority2)-1 )
  675.         CreateIniKeyValue szWinPath + "msacm.ini", "PRIORITY", "PRIORITY2", szMsacmPriority2, cmoOverwrite
  676.         fSystemUpdated = 1
  677.     endif
  678.  
  679.     if mid$( szMsacmPriority3, 1, 1 ) = "0" then
  680.         szMsacmPriority3 = "1" + mid$( szMsacmPriority3, 2, len(szMsacmPriority3)-1 )
  681.         CreateIniKeyValue szWinPath + "msacm.ini", "PRIORITY", "PRIORITY3", szMsacmPriority3, cmoOverwrite
  682.         fSystemUpdated = 1
  683.     endif
  684.  
  685. End Sub
  686.  
  687.  
  688. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  689. Sub UpdateWinGDrivers() STATIC
  690. Dim szDest As String
  691. Dim szDest1 As String
  692. Dim szDest2 As String
  693.  
  694.     ' only use DVA on Windows 3.x
  695.     if OnWin3x() = 1 then
  696.         AddSectionFilesToCopyList "dva", szSrcBinPath, szWinSysPath
  697.         if VflatdPresent() = 0 then
  698.             ' Taken out the path in the following device=dva.386 system.ini entry
  699.             CreateSysIniKeyValue szWinPath + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  700.             fSystemUpdated = 1
  701.         end if
  702.     end if
  703.  
  704.     szDest = GetRealWindowsSysDir
  705.     szDest1 = MakePath(szDest,"wing32.dll")
  706.     szDest2 = MakePath(szDest,"wing32.xxx")
  707.     RenameFilePlease szDest1, szDest2
  708.  
  709.     UpdateWinG32 GetRealWindowsSysDir()
  710. End Sub
  711.  
  712. '''''''''''''''''''''''''''''''''''''''''''''''''
  713.  
  714. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  715.     szBuf$ = string$(260, 32)
  716.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  717.     IF cbBuf% = 0 THEN
  718.         ERROR STFERR
  719.     ELSE
  720.         IF cbBuf% > 259 THEN
  721.             res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  722.             ERROR STFERR
  723.         END IF
  724.         szBuf$ = RTRIM$(szBuf$)
  725.         IF MID$(szBuf$, 1, 1) = "\" THEN
  726.             szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  727.         ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  728.             szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  729.         END IF
  730.         IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  731.             szBuf$ = szBuf$ + "\"
  732.         END IF
  733.         GetRealWindowsSysDir = szBuf$
  734.     END IF
  735.  
  736.     szBuf$ = ""
  737. END FUNCTION
  738.  
  739. '''''''''''''''''''''''''''''''''''''''''''''''''
  740.  
  741. SUB UpdateWinG32 (szOrig$) STATIC
  742.     '
  743.     ' Here we check the version ourselves of wing32.dll, since
  744.     ' we can't get version checking for Win32 apps from Win16
  745.     '
  746.     FileNew$ = MakePath(szOrig$, "wing32.dll")
  747.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  748.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  749.     RemoveFile FileOrig$, cmoForce
  750.     ELSE
  751.         RemoveFile FileNew$, cmoForce       ' get rid of new file
  752.     RenameFilePlease FileOrig$,FileNew$ ' put back old file
  753.     END IF
  754. END SUB
  755.  
  756. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  757. Function UpdateADPCMDrivers() STATIC As Integer
  758. Dim szWMDriver As String
  759. Dim szACMDriver As String
  760. Dim fUpdate As Integer
  761.  
  762.     ' Check WaveMapper driver
  763.     szWMDriver = GetIniKeyString(MakePath(szWinPath,"system.ini"), "drivers", "WaveMapper")
  764.     szACMDriver = GetIniKeyString (MakePath(szWinPath, "system.ini"), "MSACM", "Install")
  765.  
  766.     if not(szWMDriver = "msacm.drv") then
  767.     ' Isn't installed so...
  768.  
  769.         ' If NO ADPCM drivers are installed so...
  770.         if (szWMDriver = "") then
  771.             ' Display a dialog saying "there are no ADPCM drivers on your system..."
  772.             fUpdate = 1
  773.         else
  774.             ' There is a different adpcm driver in there so warn about compatibility
  775.         loop1:
  776.             szButton = UIStartDlg(CUIDLL_FILENAME, DLG_URKADPCM, "FInfoDlgProc", DLG_ADPCMHELP, PROC_HELP)
  777.             select case szButton
  778.             case "REACTIVATE"
  779.                 goto loop1
  780.             case "EXIT" , "CANCEL"
  781.                 AskQuit
  782.                 goto loop1
  783.             case "CONTINUE"     ' YES
  784.                 UpdateADPCMDrivers = NAV_FORWARD
  785.                 UIPop 1
  786.                 fUpdate = 1
  787. '            case "CANCEL"       ' NO
  788. '                UIPop 1
  789. '                fUpdate = 0
  790.             case "BACK"
  791.                 UIPop 1
  792.                 UpdateADPCMDrivers = NAV_BACK
  793.                 goto back
  794.             end select
  795.         end if
  796.  
  797.  
  798.         if fUpdate = 1 then
  799.             CreateIniKeyValue szWinPath + "system.ini", "drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  800.             CreateIniKeyValue szWinPath + "system.ini", "MSACM", "Install", "msadpcm.acm", cmoOverwrite
  801.             CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "msacm.drv","MS Audio Compression Manager", cmoOverwrite
  802.             CreateIniKeyValue szWinPath + "control.ini", "Userinstallable.drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  803.             CreateIniKeyValue szWinPath + "control.ini", "related.desc", "WaveMapper", "", cmoOverwrite
  804.             fSystemUpdated = 1
  805.         else
  806.         noSysSoftware:
  807.             ' No install warning
  808.             szButton = UIStartDlg(CUIDLL_FILENAME, DLG_NOSYSSOFT, "FInfoDlgProc", 0, "")
  809.             select case szButton
  810.             case "REACTIVATE"
  811.                 goto noSysSoftware
  812.             case "EXIT" , "CANCEL"
  813.                 AskQuit
  814.                 goto noSysSoftware
  815.             case "CONTINUE"
  816.                 UIPop 1
  817.             case "BACK"
  818.                 UIPop 1
  819.                 goto loop1
  820.             end select
  821.         end if
  822.  
  823.     end if
  824. back:
  825. End Function
  826.  
  827. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  828. Function InstallQTW() STATIC As Integer
  829.  
  830. begin:
  831.     szButton = UIStartDlg( CUIDLL_FILENAME, DLG_INSTALLQTW, "FInfoDlgProc", 0, "" )
  832.     select case szButton
  833.     case "REACTIVATE"
  834.         goto begin
  835.     case "CONTINUE" ' Yes Install QTW
  836.         IF (GetWindowsMajorVersion * 100) + GetWindowsMinorVersion > 350 THEN
  837.             ' Install the 32 bit version on Windows 95
  838.             Run ( MakePath( szSrcBinPath, "qt32b42.exe" ) )
  839.         Else
  840.             ' Else Install the 16 bit version
  841.             Run ( MakePath( szSrcBinPath, "qt16b42.exe" ) )
  842.         END IF
  843.  
  844.         UIPop 1
  845.         InstallQTW = NAV_FORWARD
  846.     case "BACK"     ' No Don't Install QTW
  847.         UIPop 1
  848.         InstallQTW = NAV_BACK
  849.     case "EXIT" , "CANCEL"
  850.         AskQuit
  851.         goto begin
  852.     end select
  853.  
  854. End Function
  855.  
  856. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''