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