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