home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Multimedia Moz…t - The Dissonant Quartet / Microsoft_Multimedia_Mozart_The_Dissonant_Quartet_Microsoft_Home_1993.iso / mozart / msstp / setup.mst < prev    next >
Text File  |  1995-03-05  |  20KB  |  686 lines

  1. '**************************************************************************
  2. '*            Microsoft Multimedia Publishing Group Setup
  3. '*                     Microsoft Music
  4. '*       (c) 1993 Microsoft Corporation.  All Rights Reserved.
  5. '**************************************************************************
  6.  
  7. '$DEFINE DEBUG  ''Define for script development/debugging
  8.  
  9. '$INCLUDE 'setupapi.inc'
  10. '$INCLUDE 'msdetect.inc'
  11. '$INCLUDE 'product.inc'
  12. '$INCLUDE 'mmperf.inc'
  13. '$INCLUDE 'mmcat.inc'
  14.  
  15. ''Dialog ID's
  16. CONST WELCOME       = 100
  17. CONST ASKQUITDLG    = 200
  18. CONST DESTPATH      = 300
  19. CONST DESTPATH_EXISTING      = 1000
  20. CONST EXITFAILURE   = 400
  21. CONST EXITQUIT      = 600
  22. CONST EXITSUCCESS   = 700
  23. CONST EXITSUCCESS_OVERVIEW   = 1100
  24. CONST EXITSUCCESS_NORESTART  = 1800
  25. CONST OPTIONS       = 800
  26. CONST APPHELP       = 900
  27. CONST BADPATH       = 6400
  28. CONST PALEXPLAIN    = 1400
  29. CONST MAILMAN       = 1500
  30. CONST ACTIVATEFONTS = 1700
  31. CONST TOOBIG        = 6300
  32.  
  33. CONST ASKCONFIGADPCM  =  2200
  34.  
  35. CONST TGRPBOXID     = 3742
  36.  
  37.  
  38. ''Bitmap ID
  39. CONST LOGO = 1
  40.  
  41. GLOBAL SRCDIR$      '' CD root path (location of setup.exe)
  42. GLOBAL PRODINI$    '' Fully-qualified path to products .INI
  43. GLOBAL SYSINI$      '' Fully-qualified path to SYSTEM.INI
  44. GLOBAL WININI$      '' Fully-qualified path to WIN.INI
  45. GLOBAL DEST$        '' Default destination directory.
  46. GLOBAL CUIDLL$      '' Name of Custom User Interface DLL
  47. GLOBAL VIDACT$      '' Stores user decision to use Palettized VGA.
  48. GLOBAL TARGRP$
  49. GLOBAL szVideoResult$
  50.  
  51. DECLARE FUNCTION Install () AS INTEGER
  52. DECLARE SUB InstallFonts
  53. DECLARE FUNCTION SetADPCMIni () AS INTEGER
  54. DECLARE FUNCTION SetCDAudioIni () AS INTEGER
  55. DECLARE FUNCTION NumVGAColors () AS INTEGER
  56. DECLARE SUB InstallFont (strIniKey$, strFontFile$)
  57. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  58. DECLARE FUNCTION CmpVersion (szNew$, szOld$) AS INTEGER
  59. DECLARE FUNCTION IsDateLater(szNew$, szOld$) AS INTEGER
  60. DECLARE FUNCTION AddIfNewer(strSec$, strSDir$, strDDir$, strFile$) AS INTEGER
  61.  
  62. CONST HWND_BROADCAST = &HFFFF
  63. CONST WM_FONTCHANGE = &H001D
  64. declare function SendMessage    lib "User" (hwnd%, uint%, wparam%, lp as any) as long
  65. declare function AddFontResource    lib "Gdi" (lpstr$) as integer
  66. const NUMCOLORS     = 24
  67.  
  68. '**************************************************************************
  69. '**  General Installation Script
  70. '**************************************************************************
  71. INIT:
  72.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  73.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  74.  
  75.     SetBitmap CUIDLL$, LOGO
  76.     SetTitle strProduct$ + " Setup"
  77.  
  78.     'AddToBillboardList CUIDLL$, MAILMAN, "MailmanDlgProc", 1000
  79.  
  80.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  81.     If szInf$ = "" Then
  82.     szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  83.     End If
  84.     ReadInfFile szInf$
  85.  
  86.  
  87.     SRCDIR$ = GetSymbolValue("STF_SRCDIR")
  88.     PRODINI$ = MakePath(GetWindowsDir(),strIni$)
  89.     SYSINI$ = MakePath(GetWindowsDir(),"SYSTEM.INI")
  90.     WININI$ = MakePath(GetWindowsDir(),"WIN.INI")
  91.  
  92.  
  93. '$IFDEF DEBUG
  94.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  95.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  96.     If IsDriveValid(WinDrive$) = 0 Then
  97.     i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  98.     GOTO QUIT
  99.     End If
  100. '$ENDIF ''DEBUG
  101.  
  102.  
  103. INITWINCHECK:
  104.     If ((GetWindowsMajorVersion() = 3) And (GetWindowsMinorVersion() >= 1)) Or (GetWindowsMajorVersion() > 3) Then
  105.     'Version of Windows is OK.  Continue with Setup...
  106.     Else
  107.     i% = DoMsgBox(strProduct$ + " requires Windows 3.1 or greater.","Setup Failed", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  108.     dlg% = EXITFAILURE
  109.     GOTO QUITL3
  110.     End If
  111.  
  112. WELCOME:
  113.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  114.     If sz$ = "CONTINUE" Then
  115.     UIPop 1
  116.     Else
  117.     GOSUB ASKQUIT
  118.     GOTO WELCOME
  119.     End If
  120.  
  121.  
  122. DOPERFCHECK:
  123.     GoSub SYSCHECK
  124.  
  125.     szVideoResult$ = GetSymbolValue( "DIAG_VIDEO" )
  126.  
  127.     If szVideoResult$ = "ERROR" Then
  128.     i% = DoMsgBox( strProduct$ + " requires a VGA display.", "Setup Failed", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  129.     dlg% = EXITFAILURE
  130.     GOTO QUITL3
  131.     End If
  132.  
  133.     If RunningNT() <> 0 Then
  134.     If szVideoResult$ = "16COLOR" Then
  135.         i% = DoMsgBox( "16-color displays not supported under Windows NT.  Please consult the Read Me file for more information.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONEXCLAMATION)
  136.         dlg% = EXITFAILURE
  137.         Goto QUITL3
  138.     Endif
  139.     End If
  140.  
  141. GETPATH:
  142.     DEST$ = strDefaultDest$
  143.  
  144.     SetSymbolValue "EditTextIn", DEST$
  145.     SetSymbolValue "EditFocus", "END"
  146.  
  147. GETPATHL1:
  148.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  149.  
  150.     DEST$ = GetSymbolValue("EditTextOut")
  151.  
  152.     If sz$ = "CONTINUE" Then
  153.     If IsDirWritable(DEST$) = 0 Then
  154.         GOSUB BADPATH
  155.         GOTO GETPATHL1
  156.     End If
  157.     'If GetFreeSpaceForDrive( MID$( DEST$, 1, 1 ) ) < cbDiskNeeded Then
  158.     '    GOSUB DRIVEFULL
  159.     '    GOTO GETPATHL1
  160.     'End If
  161.     If DoesDirExist( DEST$ ) = 0 Then
  162.     i% = DoMsgBox( "The specified directory does not exist.  Do you want to create the directory?", "Install Location", 8228)
  163.     If i% = 7 Then
  164.         GOTO GETPATHL1
  165.     End If
  166.     End If
  167.     UIPop 1
  168.     ElseIf sz$ = "REACTIVATE" Then
  169.     GOTO GETPATHL1
  170.     ElseIf sz$ = "BACK" Then
  171.     UIPop 1
  172.     GOTO WELCOME
  173.     Else
  174.     GOSUB ASKQUIT
  175.     GOTO GETPATHL1
  176.     End If
  177.  
  178.     SetRestartDir DEST$
  179.  
  180. ''*****************************************************************
  181.  
  182.     fRebootWindows% = Install()
  183.  
  184. ''*****************************************************************
  185.  
  186. QUIT:
  187.     ON ERROR GOTO ERRQUIT
  188.  
  189.     If ERR = STFQUIT Then 
  190.     END
  191.     End if
  192.  
  193.     dlg% = EXITFAILURE
  194.  
  195.     If ERR = 0 Then
  196.  
  197.     If fRebootWindows% <> 0 Then
  198.         If RunningNT() = 0 Then
  199.         dlg% = EXITSUCCESS_OVERVIEW
  200.         Else
  201.         'For some reason doing a restart under NT causes a crash.
  202.         dlg% = EXITSUCCESS_NORESTART
  203.         Endif
  204.     Else
  205.         dlg% = EXITSUCCESS_NORESTART
  206.     End If
  207.  
  208.     sz$ = UIStartDlg(CUIDLL$, MAILMAN, "MailmanDlgProc", APPHELP, HELPPROC$)
  209.     UIPop 1
  210.  
  211.     End If 
  212.     
  213. QUITL3:
  214.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  215.     If sz$ = "REACTIVATE" Then
  216.     GOTO QUITL3
  217.     ElseIf sz$ = "OVERVIEW" Then
  218.     EXEFILE$  = MakePath( DEST$, strExe$ )
  219.     RUN EXEFILE$, NOWAIT
  220.     ElseIf sz$ = "README" Then
  221.     RUN "NOTEPAD.EXE" + " " + MakePath(DEST$,"README.TXT"), NOWAIT
  222.     GOTO QUITL3
  223.     ElseIf sz$ = "RESTART" Then
  224.     ForceRestartOn
  225.     i% = ExitExecRestart()
  226.     i% = DoMsgBox( "The new system configuration will not be loaded until Windows is restarted.", "Restart Failed", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  227.     ElseIf (sz$ = "EXIT") And fRebootWindows Then
  228.     i% = DoMsgBox( "The new system configuration will not be loaded until Windows is restarted.", strProduct$ + " Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  229.     End If
  230.     UIPop 1
  231.  
  232.     END
  233.  
  234. DIAG_QUIT:
  235.     dlg% = EXITFAILURE
  236.     GOTO QUITL3
  237.  
  238.  
  239. ERRQUIT:
  240.     i% = DoMsgBox("Setup sources were corrupted, consult your manual for a Product Support phone number.", "Setup Error", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  241.     END
  242.  
  243.  
  244.  
  245. BADPATH:
  246.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  247.     If sz$ = "REACTIVATE" Then
  248.     GOTO BADPATH
  249.     End If
  250.     UIPop 1
  251.     RETURN
  252.  
  253.  
  254.  
  255. DRIVEFULL:
  256.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  257.     If sz$ = "REACTIVATE" Then
  258.     GOTO DRIVEFULL
  259.     End If
  260.     UIPop 1
  261.     RETURN
  262.  
  263.  
  264.  
  265. ASKQUIT:
  266.     sz$ = UIStartDlg(CUIDLL$, ASKQUITDLG, "FQuitDlgProc", 0, "")
  267.  
  268.     If sz$ = "EXIT" Then
  269.     UIPopAll
  270.     ERROR STFQUIT
  271.     ElseIf sz$ = "REACTIVATE" Then
  272.     GOTO ASKQUIT
  273.     Else
  274.     UIPop 1
  275.     End If
  276.     RETURN
  277.  
  278.  
  279. '*************************************************************************
  280. '**
  281. '** Install
  282. '** -------
  283. '**
  284. '** Purpose:
  285. '**     Builds the copy list and performs all installation operations.
  286. '** Arguments:
  287. '**     none.
  288. '** Returns:
  289. '**     1 if windows should be restarted 0 otherwise.
  290. '*************************************************************************
  291. FUNCTION Install () STATIC AS INTEGER
  292.  
  293.     Install = 0
  294.  
  295.     SrcDir$ = GetSymbolValue("STF_SRCDIR") + strProductDir
  296.     CreateDir DEST$, cmoNone
  297.     WinDir$ = GetWindowsDir()
  298.     SysDir$ = GetWindowsSysDir()
  299.  
  300. ASKTARGET:
  301.     sz$ = UIStartDlg(CUIDLL$, TGRPBOXID, "GBOXDlgProc", 0, "")
  302.     If sz$ = "REACTIVATE" Then
  303.     GOTO ASKTARGET
  304.     ElseIf sz$ = "CANCELPRESSED" Then
  305.     UIPop 1
  306.     GOSUB DOYAWANNAQUIT
  307.     GOTO ASKTARGET
  308.     End If
  309.     UIPop 1
  310.  
  311.     ' Now we can't pass commas or close-parenthesis in Program Group
  312.     ' names because the DDE passes the argument directly as a string
  313.     ' parameter (e.g., CreateGroup(PROGGRP$, whatever)) and the commas
  314.     ' and close-parenthesis mess it up.  So we can quote the string,
  315.     ' but then you can't have quotation marks inside the string.
  316.     ' Best solution is to remove all quotation marks, then quote
  317.     ' the string.  This allows commas, which are probably more common
  318.     ' than quotation marks, and also avoid problems like: "Real" Good
  319.     ' which also crashes.
  320. STRIP_PAREN:
  321.     N = INSTR(1, sz$, """")  ' Look for "
  322.     IF N > 0 THEN
  323.       sz$ = MID$(sz$,1,N-1) + MID$(sz$,N+1,100)
  324.       GOTO STRIP_PAREN
  325.     END IF
  326.     IF RTRIM$(sz$) = "" THEN
  327.       sz$ = "Microsoft Multimedia"
  328.     END IF
  329.     TARGRP$ = """" + sz$ + """"
  330.     SetSymbolValue "TARGETGROUP", TARGRP$
  331.  
  332.     AddSectionFilesToCopyList "Main", SrcDir$, DEST$
  333.  
  334.     'If user specified a trailing \ on the destination remove it.
  335.     If MID$(DEST$,LEN(DEST$),1) = "\" Then 
  336.     DEST$ = MID$(DEST$, 1, LEN(DEST$)-1)
  337.     End If
  338.  
  339.     If szVideoResult$ = "16COLOR" Then
  340.     AddSectionFilesToCopyList C16_SECTION$, SrcDir$ + C16_DIR$, DEST$ + C16_DIR$
  341.     Else
  342.     AddSectionFilesToCopyList C256_SECTION$, SrcDir$ + C256_DIR$, DEST$ + C256_DIR$
  343.     End if
  344.  
  345.     'Checking version numbers alone is unreliable, if we see two identical version
  346.     'numbers (or if the version number is missing) then use the dates on the files.
  347.  
  348.     strSharedDir$ = SrcDir$ + "\msstp\shared"
  349.     strSection$ = "Shared"
  350.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "bmutils.dll")
  351.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "mci.vbx")
  352.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "msgblast.vbx")
  353.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "mvfs2.dll")
  354.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "picclip.vbx")
  355.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "rtfcc.vbx")
  356.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "spush.vbx")
  357.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$, "vbrun300.dll")
  358.     If LEN(strF1IniKey$) <> 0 Then
  359.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$,  LCASE$(strF1IniVal$))
  360.     Endif               
  361.     If LEN(strF2IniKey$) <> 0 Then
  362.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$,  LCASE$(strF2IniVal$))
  363.     Endif               
  364.     If LEN(strF3IniKey$) <> 0 Then
  365.     iDontCare = AddIfNewer(strSection$, strSharedDir$, SysDir$,  LCASE$(strF3IniVal$))
  366.     Endif
  367.  
  368.     If RunningNT() = 0 Then
  369.     If SetADPCMIni() <> 0 Then
  370.         Install = 1
  371.     End If
  372.     strSection$ = "System"
  373.     strSystemDir$ = SrcDir$ + "\msstp\system"
  374.     If AddIfNewer(strSection$, strSystemDir$, SysDir$, "msacm.drv") <> 0 Then
  375.         Install = 1
  376.     Endif
  377.     If AddIfNewer(strSection$, strSystemDir$, SysDir$, "msadpcm.acm") <> 0 Then
  378.         Install = 1
  379.     Endif
  380.     
  381.     ' mcicda.drv may not be present even if the system.ini says
  382.     ' that it has been installed.  Check to see if we need to
  383.     ' install mcicda.drv regardless of what system.ini says.
  384.     If SetCDAudioIni() <> 0 Then
  385.         Install = 1
  386.     Endif
  387.     If AddIfNewer(strSection$, strSystemDir$, SysDir$, "mcicda.drv") Then
  388.         Install = 1
  389.     Endif
  390.  
  391.     Endif
  392.  
  393.     '** Verify that there is enough space on drive
  394. DISK_SPACE_CHECK:
  395.     IF GetCopyListCost ("", "", "") <> 0 THEN
  396. WINDRIVEISFULL:
  397.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  398.     IF sz$ = "REACTIVATE" THEN
  399.         GOTO WINDRIVEISFULL
  400.     ELSEIF sz$ = "CONTINUE" THEN
  401.         UIPop 1
  402.         GOTO DISK_SPACE_CHECK
  403.     ELSE
  404.         UIPop 1
  405. QUIT:   
  406.         sz$ = UIStartDlg(CUIDLL$, ASKQUITDLG, "FInfoDlgProc", 0, "")
  407.         IF sz$ = "CONTINUE" THEN
  408.         UIPop 1
  409.         GOTO WINDRIVEISFULL
  410.         END IF
  411.         UIPop 1
  412.         END
  413.     END IF
  414.     END IF
  415.  
  416.     SetCopyGaugePosition 15, 125
  417.     CopyFilesInCopyList
  418.  
  419.     If RestartListEmpty = 0 Then
  420.     Install = 1
  421.     Endif
  422.  
  423.     InstallFonts
  424.  
  425.     SetupMMCatalog
  426.  
  427.     CreateProgManGroup TARGRP$, "", cmoNone
  428.     ShowProgManGroup   TARGRP$, 1,  cmoNone
  429.  
  430.     EXE$ = MakePath( DEST$, strExe$ )
  431.  
  432.     CreateProgManItem TARGRP$, strItemName, EXE$, EXE$, cmoOverwrite
  433.     CreateProgManItem TARGRP$, strReadMeItemName$, "NOTEPAD.EXE " + MakePath(DEST$, "readme.txt") , "", cmoOverwrite
  434.  
  435.  
  436.     CreateIniKeyValue PRODINI$, strIniSection$, "CDPath", SrcDir$, cmoOverwrite
  437.     CreateIniKeyValue PRODINI$, strIniSection$, "HDPath", DEST$, cmoOverwrite
  438.  
  439.     MMCatSetProgman
  440.  
  441.     'Previous (Beta) versions of stravinsky used to place bmutils into the \strav
  442.     'directory.  This in now placed in the windows system directory, however if we
  443.     'have an old one in the "product" directory that will be bound to instead.  So
  444.     'get rid of it.
  445.     RemoveFile MakePath( DEST$, "bmutils.dll"), cmoForce
  446.  
  447.     'Apparently earlier versions of VB installed vbx's and dll's into the windows
  448.     'directory.  Make sure we remove these or they will get bound to instead of our
  449.     'new ones.
  450.     RemoveFile MakePath( WinDir$, "mci.vbx" ), cmoForce
  451.     RemoveFile MakePath( WinDir$, "msgblast.vbx" ), cmoForce
  452.     RemoveFile MakePath( WinDir$, "mvfs2.dll" ), cmoForce
  453.     RemoveFile MakePath( WinDir$, "picclip.vbx" ), cmoForce
  454.  
  455.     GOTO INSTSUBEND
  456.  
  457. DOYAWANNAQUIT:
  458.     sz$ = UIStartDlg(CUIDLL$, ASKQUITDLG, "FQuitDlgProc", 0, "")
  459.  
  460.     If sz$ = "EXIT" Then
  461.     UIPopAll
  462.     ERROR STFQUIT
  463.     ElseIf sz$ = "REACTIVATE" Then
  464.     GOTO DOYAWANNAQUIT
  465.     Else
  466.     UIPop 1
  467.     End If
  468.     RETURN
  469.     
  470. INSTSUBEND:
  471.  
  472.  
  473. END FUNCTION
  474.  
  475.  
  476.  
  477.  
  478. '*************************************************************************
  479. '**
  480. '** MakePath
  481. '** --------
  482. '** Purpose:
  483. '**     Appends a file name to the end of a directory path,
  484. '**     inserting a backslash character as needed.
  485. '** Arguments:
  486. '**     szDir$  - full directory path (with optional ending "\")
  487. '**     szFile$ - filename to append to directory
  488. '** Returns:
  489. '**     Resulting fully qualified path name.
  490. '*************************************************************************
  491. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  492.     If szDir$ = "" Then
  493.     MakePath = szFile$
  494.     ElseIf szFile$ = "" Then
  495.     MakePath = szDir$
  496.     ElseIf MID$(szDir$, LEN(szDir$), 1) = "\" Then
  497.     MakePath = szDir$ + szFile$
  498.     Else
  499.     MakePath = szDir$ + "\" + szFile$
  500.     End If
  501. END FUNCTION
  502.  
  503. SUB InstallFonts STATIC
  504.  
  505.     InstallFont strF1IniKey$, strF1IniVal$
  506.     InstallFont strF2IniKey$, strF2IniVal$
  507.     InstallFont strF3IniKey$, strF3IniVal$
  508.  
  509.     iDontCare = SendMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0 )
  510. END SUB
  511.  
  512. SUB InstallFont (strIniKey$, strFile$) STATIC
  513.  
  514.     If LEN(strIniKey$) <> 0 Then
  515.     CreateIniKeyValue "win.ini", "fonts", strIniKey$, strFile$, cmoNone
  516.     iDontCare = AddFontResource( strFile$ )
  517.     End If
  518.  
  519. END SUB
  520.  
  521. FUNCTION SetADPCMIni () STATIC AS INTEGER
  522.  
  523.     SetADPCMIni = 0
  524.  
  525.     strSysIni$ = GetWindowsDir() + "system.ini"
  526.  
  527.     'Change WIN.INI and SYSTEM.INI for ACM driver and ADPCM compresser
  528.  
  529.     strWavMapper$ = GetIniKeyString (strSysIni$, "drivers", "WaveMapper")
  530.     strInstall$ = GetIniKeyString (strSysIni$, "MSACM", "Install")
  531.  
  532.     If (UCASE$(strWavMapper$) = "MSACM.DRV") And (UCASE$(strInstall$) = "MSADPCM.ACM")  THEN
  533.     EXIT FUNCTION
  534.     End If
  535.  
  536.     CreateIniKeyValue strSysIni$, "drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  537.     CreateIniKeyValue strSysIni$, "MSACM", "Install", "msadpcm.acm", cmoOverwrite
  538.     SetADPCMIni = 1
  539.  
  540. END FUNCTION
  541.  
  542. FUNCTION SetCDAudioIni () STATIC AS INTEGER
  543.  
  544.     SetCDAudioIni = 0
  545.  
  546.     strSysIni$ = GetWindowsDir() + "system.ini"
  547.  
  548.     If (Len(GetIniKeyString (strSysIni$, "mci", "CDAudio")) <> 0) Or (Len(GetIniKeyString (strSysIni$, "mci", "CDAudio1")) <> 0)  THEN
  549.     EXIT FUNCTION
  550.     End If
  551.  
  552.     CreateIniKeyValue strSysIni$, "mci", "CDAudio", "mcicda.drv", cmoOverwrite
  553.     SetCDAudioIni = 1
  554.  
  555. END FUNCTION
  556.  
  557. FUNCTION NumVGAColors () STATIC AS INTEGER
  558.  
  559.     hdc% = GetDC( 0 )
  560.     NumVGAColors = GetDeviceCaps( hdc%, NUMCOLORS )
  561.     iDontCare% = ReleaseDC( 0, hdc% )
  562.  
  563. END FUNCTION
  564.  
  565. FUNCTION AddIfNewer(strSec$, strSDir$, strDDir$, strFile$) STATIC AS INTEGER
  566.  
  567.     AddIfNewer = 0
  568.  
  569.     strNewFile$ = MakePath (strSDir$, strFile$)
  570.     strOldFile$ = MakePath (strDDir$, strFile$)
  571.     If DoesFileExist(strOldFile, femExists) <> 0 Then
  572.  
  573.         i% = CmpVersion(GetVersionOfFile(strOldFile$), GetVersionOfFile(strNewFile$))
  574.  
  575.         If i% = -1 Then
  576.             'New version is older 'dont add to list
  577.             exit function
  578.         Endif
  579.  
  580.         If i% = 0 Then
  581.             'Versions are same go by date.
  582.             If IsDateLater(GetDateOfFile(strOldFile$), GetDateOfFile(strNewFile$)) = 0 Then
  583.                 'New file is same or older, dont add.
  584.                 exit function
  585.             Endif
  586.             'Drop through to add file to copy list.
  587.         Endif
  588.     Endif
  589.  
  590.     AddSpecialFileToCopyList strSec$, strFile$, strSDir$, strOldFile$
  591.     AddIfNewer = 1
  592. END FUNCTION
  593.  
  594. '*************************************************************************
  595. '**
  596. '** IsDateLater
  597. '** --------
  598. '** Purpose:
  599. '**     Compares two file dates
  600. '** Arguments:
  601. '**     DateOld$ in YYYY-MM-DD-HH-MM-SS format
  602. '**     DateNew$ in YYYY-MM-DD-HH-MM-SS format
  603. '** Returns:
  604. '**     1 if new date is later, 0 if new date is older or the same
  605. '*************************************************************************
  606. FUNCTION IsDateLater (DateOld$, DateNew$) STATIC AS INTEGER
  607.     
  608.  
  609.     'First compare year
  610.  
  611.     OldYear% = GetYearFromDate (DateOld$)
  612.     NewYear% = GetYearFromDate (DateNew$)
  613.  
  614.     If NewYear% < OldYear% Then
  615.         IsDateLater = 0
  616.  
  617.     ElseIf NewYear% = OldYear% Then
  618.  
  619.         'If year is the same, compare month
  620.         
  621.         OldMonth% = GetMonthFromDate (DateOld$)
  622.         NewMonth% = GetMonthFromDate (DateNew$)
  623.  
  624.         If NewMonth% < OldMonth% Then
  625.             IsDateLater = 0
  626.  
  627.         ElseIf NewMonth% = OldMonth% Then
  628.  
  629.             'If month is the same, compare day
  630.  
  631.             OldDay% = GetDayFromDate (DateOld$)
  632.             NewDay% = GetDayFromDate (DateNew$)
  633.  
  634.             If NewDay% <= OldDay% Then
  635.                 IsDateLater = 0
  636.             Else
  637.                 IsDateLater = 1
  638.             End If
  639.          
  640.         Else
  641.             IsDateLater = 1
  642.         End If
  643.  
  644.     Else
  645.         IsDateLater = 1
  646.     ENDIF
  647.     
  648. END FUNCTION
  649.  
  650. '*************************************************************************
  651. '**
  652. '** CmpVersion
  653. '** --------
  654. '** Purpose:
  655. '**     Compares two file versions
  656. '** Arguments:
  657. '**     VerOld$ - Old file version string (in format N.N.N.N)
  658. '**     VerNew$ - New file version string (in format N.N.N.N)
  659. '** Returns:
  660. '**     1 if new version is later, -1 if new version is older, 0 if the same
  661. '*************************************************************************
  662. FUNCTION CmpVersion (VerOld$, VerNew$) STATIC AS INTEGER
  663.  
  664.     CmpVersion = 0
  665.  
  666.     FOR I=1 TO 4 
  667.  
  668.         VOld = GetVersionNthField (VerOld$, I)
  669.         VNew = GetVersionNthField (VerNew$, I)
  670.  
  671.         If VNew > VOld Then 
  672.             CmpVersion = 1
  673.             Goto LBL_CmpVersionEnd
  674.         Endif
  675.  
  676.         If VNew < VOld Then
  677.             CmpVersion = -1
  678.             Goto LBL_CmpVersionEnd
  679.         End If
  680.  
  681.     NEXT I
  682.  
  683. LBL_CmpVersionEnd:
  684.  
  685. END FUNCTION
  686.