home *** CD-ROM | disk | FTP | other *** search
/ P.B. Bear's Birthday Party / DKMMPBBP.iso / dksetup / dkgen.bak < prev    next >
Text File  |  1995-05-22  |  23KB  |  669 lines

  1. '12/03/95 Alternative function added, readme icon has shortened name
  2.  
  3. '$INCLUDE 'setupapi.inc'
  4. '$INCLUDE 'msdetect.inc'
  5. '$INCLUDE 'dklang.inc'
  6.  
  7. CONST SOURCE_BINARIES_SUBDIR = "DKCODE"
  8. CONST SOURCE_SETUP_SUBDIR = "DKSETUP"
  9. CONST SETUP_INF_FILENAME = "SETUP.INF"
  10. CONST CUIDLL_FILENAME = "mscuistf.dll"
  11. CONST SETUP_INI_BINARIES_SECTION_NAME = "BIN"
  12. CONST SETUP_INI_WING_BINARIES_NAME = "WinG Runtime"
  13. CONST SETUP_INI_WING32_BINARIES_NAME = "WinG32"
  14. CONST SETUP_INI_ACM_SECTION_NAME = "ACM Drivers"
  15. CONST SETUP_INI_FONTS_SECTION_NAME = "Fonts"
  16.  
  17. CONST PRODUCT_INI_DIR_SECTION_NAME = "Directory"
  18. CONST PRODUCT_INI_DIR_ENTRY_NAME = "Data"
  19.  
  20. CONST MINIMUM_DISK_SPACE = 2048 ' For Minimum install
  21.  
  22. ' Procs
  23. CONST PROC_HELP = "FHelpDlgProc"
  24.  
  25. DECLARE FUNCTION TestForCirrus LIB "dkutils.dll" () As INTEGER
  26.  
  27. DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (szEXE$, szParams$) AS INTEGER
  28.  
  29. DECLARE FUNCTION Ctl3dRegister LIB "CTL3D.DLL" (hInst%) AS INTEGER
  30. DECLARE FUNCTION Ctl3dUnregister LIB "CTL3D.DLL" (hInst%) AS INTEGER
  31. DECLARE FUNCTION Ctl3dAutoSubClass LIB "CTL3D.DLL" (hInst%) AS INTEGER
  32.  
  33. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  34. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  35. DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  36. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  37. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  38. DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$)
  39.  
  40. DECLARE FUNCTION FIsVGA LIB "mscuistf.dll" AS INTEGER
  41. DECLARE FUNCTION FIs256Colour LIB "mscuistf.dll" AS INTEGER
  42. DECLARE FUNCTION Welcome() AS INTEGER
  43. DECLARE FUNCTION TestSystem() AS INTEGER
  44. DECLARE FUNCTION GetDiskSpaceNeeded(drive%) AS LONG
  45. DECLARE SUB Initialise(prodName$, defInstallPath$, msgCaption$)
  46. DECLARE SUB DeInitialise()
  47. DECLARE SUB AskQuit()
  48. DECLARE SUB BadPath()
  49. DECLARE SUB NetworkDrive()
  50. DECLARE SUB UpdateIndeoAVIDrivers()
  51. DECLARE SUB UpdateWinGDrivers()
  52. DECLARE SUB UpdateADPCMDrivers()
  53. DECLARE SUB UpdateProgramManager(prodName$, appExeFile$, appPengeFile$, readmeFile$, readmeStr$, onCDROM%)
  54. DECLARE SUB UpdateProgramManagerAlt(prodName$, readmeName$, appExeFile$, appPengeFile$, readmeFile$, readmeStr$, onCDROM%)
  55. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  56. DECLARE FUNCTION GetRealWindowsSysDir AS STRING
  57. DECLARE SUB UpdateWinG32 (szOrig$)
  58. DECLARE SUB HandleRestart()
  59. DECLARE SUB InitCommonInstall()
  60. DECLARE SUB EndCommonInstall(appReadmeFile$, inRoot%)
  61.  
  62. ' Error messages
  63. CONST ERR_OK = 100
  64. CONST ERR_EXITFAIL = 101
  65. CONST ERR_WINVERFAIL = 102
  66. CONST ERR_NODISKSPACE = 103
  67.  
  68. ' Navigation messages
  69. CONST NAV_FORWARD = 0
  70. CONST NAV_BACK = 1
  71.  
  72.  
  73. ' Bitmap ID
  74. CONST LOGO = 1
  75.  
  76. ' Dialog ID's
  77. CONST IDD_WELCOME       = 100
  78. CONST IDD_CUSTOMHELP    = 106
  79. CONST IDD_SPEED         = 111
  80. CONST IDD_ASKQUIT       = 200
  81. CONST IDD_DESTPATH      = 300
  82. CONST IDD_EXITFAILURE   = 400
  83. CONST IDD_EXITQUIT      = 600
  84. CONST IDD_EXITSUCCESS   = 700
  85. CONST IDD_APPHELP       = 900
  86. CONST IDD_DONENEWSYSSOFT    = 1100
  87. CONST IDD_DONENOSYSSOFT     = 1800
  88. CONST IDD_NEWSYSTEMSOFTWARE = 2300
  89. CONST IDD_NEWADPCM      = 2600
  90. CONST IDD_WARNNOSYSSOFT = 3100
  91. CONST IDD_MAILMAN       = 1500
  92. CONST IDD_CUSTOM        = 6200
  93. CONST IDD_BADPATH       = 6400
  94. CONST IDD_NEED31        = 6401
  95. CONST IDD_NOMOUSE       = 6402
  96. CONST IDD_BADVGA        = 6403
  97. CONST IDD_NOT256        = 6404
  98. CONST IDD_POORMACHINE   = 6405
  99. CONST IDD_AWFULMACHINE  = 6406
  100. CONST IDD_PATHHELP      = 6407
  101. CONST IDD_WHIZZHELP     = 6408
  102. CONST IDD_URKADPCM      = 6409
  103. CONST IDD_ADPCMHELP     = 6410
  104. CONST IDD_NODISKSPACE   = 6411
  105. CONST IDD_NETWORKDRIVE  = 6412
  106.  
  107.  
  108. GLOBAL szWinPath As String
  109. GLOBAL szWinSysPath As String
  110. GLOBAL szWinDrive As String
  111. GLOBAL szSrcSetupPath As String
  112. GLOBAL szSrcBinPath As String
  113. GLOBAL szDestPath As String
  114. GLOBAL szOldDestPath As String
  115. GLOBAL szPengePath As String
  116. GLOBAL szINFPath As String
  117. GLOBAL szAppINIPath As String
  118. GLOBAL szMsgCaption As String
  119. GLOBAL szButton As String
  120. GLOBAL szMinimalInstall As String
  121. GLOBAL szAddPMItem As String
  122. GLOBAL szExpressCustomChoice As String
  123.  
  124. GLOBAL fPreviousMode As Integer
  125. GLOBAL fWillNotFit As Integer
  126. GLOBAL fSystemUpdated As Integer
  127. GLOBAL hDlg As Integer
  128. GLOBAL dButton As Integer
  129. GLOBAL dWinDrive As Integer
  130. GLOBAL dDestDrive As Integer
  131. GLOBAL dCursor As Integer
  132.  
  133.  
  134. Sub InitCommonInstall() STATIC
  135.     AddToBillboardList CUIDLL_FILENAME, IDD_MAILMAN, "MailmanDlgProc", 2500
  136.     SetCopyGaugePosition -1, 150
  137. End Sub
  138.  
  139. Sub EndCommonInstall(appReadmeFile$, inRoot%) STATIC
  140.     if RestartListEmpty = 0 or fSystemUpdated = 1 then
  141.         hDlg = IDD_DONENEWSYSSOFT
  142.     else
  143.         hDlg = IDD_DONENOSYSSOFT
  144.     end if
  145.  
  146. QuitLoop:
  147.     szButton = UIStartDlg(CUIDLL_FILENAME, hDlg, "FInfoDlgProc", 0, "")
  148.     select case szButton
  149.     case "REACTIVATE"
  150.         goto QuitLoop
  151.     case "CONTINUE"
  152.         if inRoot% = 1 then
  153.             szReadMe$ = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), appReadmeFile$)
  154.         else
  155.             szReadMe$ = MakePath(szSrcBinPath, appReadmeFile$)
  156.         end if
  157.         run "write.exe " + szReadMe$, NOWAIT
  158.         goto QuitLoop
  159.     case "BACK"
  160.         HandleRestart
  161.     case "EXIT"
  162.         if hDlg = IDD_DONENEWSYSSOFT then
  163.             dButton = DoMsgBox( STR_SYSMESSAGE, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  164.         end if
  165.     end select
  166.  
  167.     UIPop 1
  168. End Sub
  169.  
  170.  
  171.  
  172. Sub Initialise(prodName$, defInstallPath$, msgCaption$) STATIC
  173.     ret% = Ctl3dRegister(HinstFrame())
  174.     ret% = Ctl3dAutoSubClass(HinstFrame())
  175.  
  176.     szMsgCaption$ = msgCaption$
  177.  
  178.     cursor% = ShowWaitCursor()
  179.  
  180.     ClearCopyList
  181.     szWinSysPath = ucase$(GetWindowsSysDir ())
  182.     szWinPath = ucase$(GetWindowsDir ())
  183.     dWinDrive = asc(mid$((szWinPath), 1,1)) - asc("A")+1
  184.     szWinDrive = mid$(szWinPath, 1,1)
  185.  
  186.     szSrcSetupPath = ucase$(GetSymbolValue ("STF_SRCDIR"))
  187.     szSrcBinPath = mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1) + SOURCE_BINARIES_SUBDIR
  188.     szDestPath = szWinDrive + ":" + defInstallPath$
  189.  
  190.     SetTitle szMsgCaption$
  191.     SetBitmap CUIDLL_FILENAME, 1
  192.     SetAbout prodName$, STR_COPYRIGHT
  193.  
  194.     fPreviousMode = SetBeepingMode (1)
  195.     fPreviousMode = SetDecompMode (1)
  196.     fPreviousMode = SetSilentMode (0)
  197.  
  198.     szINFPath = ucase$(GetSymbolValue("STF_SRCINFPATH"))
  199.     if szINFPath = "" then
  200.         szINFPath = ucase$(GetSymbolValue("STF_CWDDIR")) + SETUP_INF_FILENAME
  201.     end if
  202.     ReadInfFile szINFPath
  203.  
  204.     szExpressCustomChoice = "EXPRESS"
  205.     szMinimalInstall = "OFF"
  206.     szAddPMItem = "ON"
  207.  
  208.     fSystemUpdated = 0
  209.  
  210.     RestoreCursor(cursor%)
  211. End Sub
  212.  
  213.  
  214. Sub DeInitialise() STATIC
  215.     ret% = Ctl3dRegister(HinstFrame())
  216. End Sub
  217.  
  218.  
  219. Sub AskQuit() STATIC
  220. begin:
  221.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_ASKQUIT, "FQuitDlgProc", 0, "")
  222.     select case szButton
  223.     case "REACTIVATE"
  224.         goto begin
  225.     case "EXIT"
  226.         error STFQUIT
  227.     case "CONTINUE"
  228.         UIPop 1
  229.     end select
  230. End Sub
  231.  
  232. Sub BadPath() STATIC
  233. begin:
  234.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_BADPATH, "FInfo0DlgProc", 0, "")
  235.     select case szButton
  236.     case "REACTIVATE"
  237.         goto begin
  238.     end select
  239.     UIPop 1
  240. End Sub
  241.  
  242. Sub NetworkDrive() STATIC
  243. begin:
  244.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_NETWORKDRIVE, "FInfo0DlgProc", 0, "")
  245.     select case szButton
  246.     case "REACTIVATE"
  247.         goto begin
  248.     end select
  249.     UIPop 1
  250. End Sub
  251.  
  252.  
  253. Function Welcome() STATIC As Integer
  254. begin:
  255.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_WELCOME, "FInfoDlgProc", IDD_APPHELP, PROC_HELP)
  256.     select case szButton
  257.     case "REACTIVATE"
  258.         goto begin
  259.     case "CONTINUE"
  260.         UIPop 1
  261.         Welcome = NAV_FORWARD
  262.     case "EXIT"
  263.         AskQuit
  264.         goto begin
  265.     end select
  266. End Function
  267.  
  268.  
  269.  
  270.  
  271. Function TestSystem() STATIC As Integer
  272. TestWinVer:
  273.     if GetWindowsMajorVersion() < 3 or (GetWindowsMajorVersion() = 3 and GetWindowsMinorVersion() < 10) then
  274.         TestWinVerDlgLoop:
  275.             szButton = UIStartDlg (CUIDLL_FILENAME, IDD_NEED31, "FInfoDlgProc", IDD_AWFULMACHINE, PROC_HELP)
  276.             select case szButton
  277.             case "REACTIVATE"
  278.                 goto TestWinVerDlgLoop
  279.             case "BACK"
  280.                 UIPop 1
  281.                 TestSystem = NAV_BACK
  282.                 goto back
  283.             case "CONTINUE"
  284.                 UIPop 1
  285.                 goto TestVGA
  286.             case "EXIT"
  287.                 AskQuit
  288.                 goto TestWinVerDlgLoop
  289.             end select
  290.     end if
  291.  
  292. TestVGA:
  293.     if GetScreenWidth () < 640 or GetScreenHeight () < 480 then
  294.         TestVGADlgLoop:
  295.             szButton = UIStartDlg (CUIDLL_FILENAME, IDD_BADVGA, "FInfoDlgProc", IDD_AWFULMACHINE, PROC_HELP)
  296.             select case szButton
  297.             case "REACTIVATE"
  298.                 goto TestVGADlgLoop
  299.             case "BACK"
  300.                 UIPop 1
  301.                 TestSystem = NAV_BACK
  302.                 goto back
  303.             case "CONTINUE"
  304.                 UIPop 1
  305.                 goto TestMouse
  306.             case "EXIT"
  307.                 AskQuit
  308.                 goto TestVGADlgLoop
  309.             end select
  310.         end if
  311.  
  312. TestMouse:
  313.     if HasMouseInstalled() = false then
  314.     TestMouseDlgLoop:
  315.         szButton = UIStartDlg (CUIDLL_FILENAME, IDD_NOMOUSE, "FInfoDlgProc", IDD_AWFULMACHINE, PROC_HELP)
  316.         select case szButton
  317.         case "REACTIVATE"
  318.             goto TestMouseDlgLoop
  319.         case "BACK"
  320.             UIPop 1
  321.             TestSystem = NAV_BACK
  322.         case "CONTINUE"
  323.             UIPop 1
  324.             goto TestColour
  325.         case "EXIT"
  326.             AskQuit
  327.             goto TestMouseDlgLoop
  328.         end select
  329.     end if
  330.  
  331. TestCirrus:
  332.     if TestForCirrus() = true then
  333.         dButton = DoMsgBox(STR_CIRRUS, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  334.     end if
  335.  
  336.  
  337. TestColour:
  338.     if FIs256Colour() = false then
  339.     TestColourDlgLoop:
  340.         szButton = UIStartDlg (CUIDLL_FILENAME, IDD_NOT256, "FInfoDlgProc", IDD_POORMACHINE, PROC_HELP)
  341.         select case szButton
  342.         case "REACTIVATE"
  343.             goto TestColourDlgLoop
  344.         case "BACK"
  345.             UIPop 1
  346.             TestSystem = NAV_BACK
  347.             goto back
  348.         case "CONTINUE"
  349.             UIPop 1
  350.             TestSystem = NAV_FORWARD
  351.         case "EXIT"
  352.             AskQuit
  353.             goto TestColourDlgLoop
  354.         end select
  355.     end if
  356.  
  357. back:
  358. End Function
  359.  
  360.  
  361.  
  362. '**
  363. '** Purpose:
  364. '**     Appends a file name to the end of a directory path,
  365. '**     inserting a backslash character as needed.
  366. '** Arguments:
  367. '**     szDir$  - full directory path (with optional ending "\")
  368. '**     szFile$ - filename to append to directory
  369. '** Returns:
  370. '**     Resulting fully qualified path name.
  371. '*************************************************************************
  372. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  373.     IF szDir$ = "" THEN
  374.         MakePath = szFile$
  375.     ELSEIF szFile$ = "" THEN
  376.         MakePath = szDir$
  377.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  378.         MakePath = szDir$ + szFile$
  379.     ELSE
  380.         MakePath = szDir$ + "\" + szFile$
  381.     END IF
  382. END FUNCTION
  383.  
  384.  
  385.  
  386.  
  387. Sub HandleRestart() STATIC
  388.     ' Check there are system files to install AND check if Windows v3.1 or greater
  389.     if RestartListEmpty = 0 and GetWindowsMajorVersion >= 3 and GetWindowsMajorVersion >= 1 then
  390.         dButton = DoMsgBox(STR_EXIT, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  391.         tryagain:
  392.         if ExitExecRestart = 1 then
  393.             ' Exit failed
  394.             dButton = DoMsgBox(STR_EXITFAIL, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONSTOP)
  395.             goto tryagain
  396.         end if
  397.     end if
  398.  
  399.     if RestartListEmpty = 1 then ' Empty, but we have to reboot
  400.         dummy% = ExitWindowsExec(MakePath(szDestPath, "_msrstrt.exe"), "")
  401.     end if
  402. End Sub
  403.  
  404.  
  405. Sub UpdateProgramManager(prodName$, appExeFile$, appPengeFile$, readmeFile$, readmeStr$, onCDROM%) STATIC
  406. Dim szReadmeTitle As String
  407. Dim szInf As String
  408.  
  409.     if onCDROM% = 1 then    'sampler
  410.         CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  411.         ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  412.         szReadmeTitle = prodName$ + " " + readmeStr$
  413.  
  414.         szInf = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), appExeFile$)
  415.         CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, MakePath(szDestPath, "sampler.ico"), cmoOverwrite
  416. '        CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), readmeFile$), "", cmoOverwrite
  417.     else
  418.         if szAddPMItem = "ON" then
  419.             CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  420.             ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  421.             szReadmeTitle = prodName$ + " " + readmeStr$
  422.             if szMinimalInstall = "ON" then
  423.                 szInf = MakePath(szSrcBinPath, appExeFile$) + " " + MakePath(szSrcBinPath, appPengeFile$)
  424.                 CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, szInf, cmoOverwrite
  425.                 CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath(szSrcBinPath, readmeFile$), "", cmoOverwrite
  426.             else
  427.                 szInf = MakePath(szDestPath, appExeFile$) + " " + MakePath(szDestPath, appPengeFile$)
  428.                 CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, szInf, cmoOverwrite
  429.                 CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath(szDestPath, readmeFile$), "", cmoOverwrite
  430.             end if
  431.         end if
  432.     end if
  433.  
  434. End Sub
  435.  
  436.  
  437.  
  438.  
  439. ' Alternative function for french stowaway
  440. ' Readme icon has shortened name
  441. Sub UpdateProgramManagerAlt(prodName$, readmeName$, appExeFile$, appPengeFile$, readmeFile$, readmeStr$, onCDROM%) STATIC
  442. Dim szReadmeTitle As String
  443. Dim szInf As String
  444.  
  445.     if onCDROM% = 1 then    'sampler
  446.         CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  447.         ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  448.         szReadmeTitle = readmeName$ + " " + readmeStr$
  449.  
  450.         szInf = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), appExeFile$)
  451.         CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, MakePath(szDestPath, "sampler.ico"), cmoOverwrite
  452. '        CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), readmeFile$), "", cmoOverwrite
  453.     else
  454.         if szAddPMItem = "ON" then
  455.             CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  456.             ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  457.             szReadmeTitle = readmeName$ + " " + readmeStr$
  458.             if szMinimalInstall = "ON" then
  459.                 szInf = MakePath(szSrcBinPath, appExeFile$) + " " + MakePath(szSrcBinPath, appPengeFile$)
  460.                 CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, szInf, cmoOverwrite
  461.                 CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath(szSrcBinPath, readmeFile$), "", cmoOverwrite
  462.             else
  463.                 szInf = MakePath(szDestPath, appExeFile$) + " " + MakePath(szDestPath, appPengeFile$)
  464.                 CreateProgmanItem STR_COMPANYNAME, prodName$, szInf, szInf, cmoOverwrite
  465.                 CreateProgmanItem STR_COMPANYNAME, szReadmeTitle, "notepad.exe " + MakePath(szDestPath, readmeFile$), "", cmoOverwrite
  466.             end if
  467.         end if
  468.     end if
  469.  
  470. End Sub
  471.  
  472.  
  473.  
  474.  
  475. Function GetDiskSpaceNeeded( drive% ) STATIC As Long
  476. Dim dDummy As Long
  477.  
  478.     cursor% = ShowWaitCursor()
  479.  
  480.     SetSymbolValue "ExtraSpace", ""
  481.     SetSymbolValue "Needed", ""
  482.     SetSymbolValue "Cost", ""
  483.  
  484.     'Drives A - Z
  485.     for i% = 1 to 26
  486.         AddListItem "ExtraSpace", ""
  487.     next i%
  488.  
  489.     ReplaceListItem "ExtraSpace", dWinDrive, str$(MINIMUM_DISK_SPACE)    '2K for the INI file
  490.  
  491.     dDummy = GetCopyListCost("ExtraSpace","Needed","Cost")
  492.  
  493.     GetDiskSpaceNeeded = val(GetListItem ("Needed", drive))
  494.  
  495.     RemoveSymbol "Needed"
  496.     RemoveSymbol "Cost"
  497.     RemoveSymbol "ExtraSpace"
  498.  
  499.     RestoreCursor(cursor%)
  500. End Function
  501.  
  502.  
  503. Sub UpdateIndeoAVIDrivers() STATIC
  504. Dim szWMDriver As String
  505. Dim szACMDriver As String
  506.  
  507.     szWMDriver = GetIniKeyString(MakePath(szWinPath,"system.ini"), "drivers", "WaveMapper")
  508.  
  509.     if not(szWMDriver = "msacm.drv") then
  510.         fSystemUpdated = 1
  511.     end if
  512.  
  513.  
  514.     if VflatdPresent() = 0 then
  515.         CreateSysIniKeyValue szWinPath + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  516.         fSystemUpdated = 1
  517.     end if
  518.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  519.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.IV31", "ir32.dll", cmoOverwrite
  520.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.RT21", "ir21.dll", cmoOverwrite
  521.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.YVU9", "iyvu9.dll", cmoOverwrite
  522.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  523.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  524.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  525.     CreateIniKeyValue szWinPath + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  526.     CreateIniKeyValue szWinPath + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  527.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  528.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  529.     CreateIniKeyValue szWinPath + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  530.     CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "ir21.dll", "Intel Indeo(TM) Video R2.1", cmoOverwrite
  531.     CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  532.     CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  533.     CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  534. End Sub
  535.  
  536. Sub UpdateWinGDrivers() STATIC
  537. Dim szDest As String
  538. Dim szDest1 As String
  539. Dim szDest2 As String
  540.  
  541.     ' only use DVA on Windows 3.x
  542.     if OnWin3x() = 1 then
  543.         AddSectionFilesToCopyList "dva", szSrcBinPath, szWinSysPath
  544.         if VflatdPresent() = 0 then
  545.             CreateSysIniKeyValue szWinPath + "system.ini", "386Enh", "device", szWinSysPath+"dva.386", cmoOverwrite
  546.             fSystemUpdated = 1
  547.         end if
  548.     end if
  549.  
  550.     szDest = GetRealWindowsSysDir
  551.     szDest1 = MakePath(szDest,"wing32.dll")
  552.     szDest2 = MakePath(szDest,"wing32.xxx")
  553.     RenameFilePlease szDest1, szDest2
  554.  
  555.     UpdateWinG32 GetRealWindowsSysDir()
  556. End Sub
  557.  
  558. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  559.     szBuf$ = string$(260, 32)
  560.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  561.     IF cbBuf% = 0 THEN
  562.         ERROR STFERR
  563.     ELSE
  564.         IF cbBuf% > 259 THEN
  565.             res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  566.             ERROR STFERR
  567.         END IF
  568.         szBuf$ = RTRIM$(szBuf$)
  569.         IF MID$(szBuf$, 1, 1) = "\" THEN
  570.             szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  571.         ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  572.             szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  573.         END IF
  574.         IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  575.             szBuf$ = szBuf$ + "\"
  576.         END IF
  577.         GetRealWindowsSysDir = szBuf$
  578.     END IF
  579.  
  580.     szBuf$ = ""
  581. END FUNCTION
  582.  
  583. SUB UpdateWinG32 (szOrig$) STATIC
  584.     '
  585.     ' Here we check the version ourselves of wing32.dll, since
  586.     ' we can't get version checking for Win32 apps from Win16
  587.     '
  588.     FileNew$ = MakePath(szOrig$, "wing32.dll")
  589.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  590.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  591.     RemoveFile FileOrig$, cmoForce
  592.     ELSE
  593.         RemoveFile FileNew$, cmoForce       ' get rid of new file
  594.     RenameFilePlease FileOrig$,FileNew$ ' put back old file
  595.     END IF
  596. END SUB
  597.  
  598.  
  599.  
  600. Sub UpdateADPCMDrivers() STATIC
  601. Dim szWMDriver As String
  602. Dim szACMDriver As String
  603. Dim fUpdate As Integer
  604.  
  605.     ' Check WaveMapper driver
  606.     szWMDriver = GetIniKeyString(MakePath(szWinPath,"system.ini"), "drivers", "WaveMapper")
  607.     szACMDriver = GetIniKeyString (MakePath(szWinPath, "system.ini"), "MSACM", "Install")
  608.  
  609.     if not(szWMDriver = "msacm.drv") then
  610.     ' Isn't installed so...
  611.  
  612.         ' If NO ADPCM drivers are installed so...
  613.         if (szWMDriver = "") then
  614.             ' Display a dialog saying "there are no ADPCM drivers on your system..."
  615.             fUpdate = 1
  616.         else
  617.             ' There is a different adpcm driver in there so warn about compatibility
  618.         loop1:
  619.             szButton = UIStartDlg(CUIDLL_FILENAME, IDD_URKADPCM, "FInfoDlgProc", IDD_ADPCMHELP, PROC_HELP)
  620.             select case szButton
  621.             case "REACTIVATE"
  622.                 goto loop1
  623.             case "EXIT"
  624.                 AskQuit
  625.                 goto loop1
  626.             case "CONTINUE"     ' YES
  627.                 UIPop 1
  628.                 fUpdate = 1
  629.             case "CANCEL"       ' NO
  630.                 UIPop 1
  631.                 fUpdate = 0
  632.             case "BACK"
  633.                 UIPop 1
  634.                 ' return back flag
  635.             end select
  636.         end if
  637.  
  638.  
  639.         if fUpdate = 1 then
  640.             CreateIniKeyValue szWinPath + "system.ini", "drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  641.             CreateIniKeyValue szWinPath + "system.ini", "MSACM", "Install", "msadpcm.acm", cmoOverwrite
  642.             CreateIniKeyValue szWinPath + "control.ini", "drivers.desc", "msacm.drv","MS Audio Compression Manager", cmoOverwrite
  643.             CreateIniKeyValue szWinPath + "control.ini", "Userinstallable.drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  644.             CreateIniKeyValue szWinPath + "control.ini", "related.desc", "WaveMapper", "", cmoOverwrite
  645.             fSystemUpdated = 1
  646.         else
  647.         noSysSoftware:
  648.             ' No install warning
  649.             szButton = UIStartDlg(CUIDLL_FILENAME, IDD_WARNNOSYSSOFT, "FInfoDlgProc", 0, "")
  650.             select case szButton
  651.             case "REACTIVATE"
  652.                 goto noSysSoftware
  653.             case "EXIT"
  654.                 AskQuit
  655.                 goto noSysSoftware
  656.             case "CONTINUE"
  657.                 UIPop 1
  658.             case "BACK"
  659.                 UIPop 1
  660.                 goto loop1
  661.             end select
  662.         end if
  663.  
  664.     end if
  665.  
  666. End Sub
  667.  
  668.  
  669.