home *** CD-ROM | disk | FTP | other *** search
/ Jak to Dziala / Jak.iso / dksetup / dkgen.inc < prev    next >
Text File  |  1996-04-30  |  31KB  |  836 lines

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