home *** CD-ROM | disk | FTP | other *** search
/ Millennium Auction / AUCTION_1.bin / setup / auction.mst < prev    next >
Text File  |  1994-06-18  |  28KB  |  804 lines

  1. '****************************************************************************
  2. '   Setup routine for Program Auction
  3. '   Prog: Vatche
  4. '   Rev: 1.0
  5. '
  6. '   Features:
  7. '   1.0:    Set Path
  8. '           Exit Confirmation
  9. '           Bad Path trap
  10. '           Help hooks (actual files still have to be implemented)
  11. '           Installation of Auction group and two icons
  12. '           Copy of the files to the correct location
  13. '
  14. '   2.0:    Must add the version control on the files being copied
  15. '           The version control is done by the disklay program and so I
  16. '           do not need to do it here.
  17. '
  18. '   Currently the sections in the auction.inf file are
  19. '           ACM Drivers
  20. '           AVI Codecs
  21. '           VfW Runtime
  22. '           Exe and Dll
  23. '
  24. '   Copyright ⌐ 1993-1994, Eidolon, Inc.
  25. '****************************************************************************
  26.  
  27. '$INCLUDE 'setupapi.inc'
  28. '$INCLUDE 'msdetect.inc'
  29.  
  30.  
  31. DECLARE FUNCTION InitTests(DestDrv$)           AS INTEGER
  32. DECLARE FUNCTION NumberOfColors                AS INTEGER
  33. DECLARE FUNCTION MakePath(szDir$, szFile$)     AS STRING
  34. DECLARE FUNCTION InstallVFW                    AS INTEGER
  35. DECLARE SUB      InstallFont(IniKey$, szFile$)
  36. DECLARE FUNCTION FreeDiskSpace                 AS INTEGER
  37.  
  38. DECLARE FUNCTION GetDC           LIB "user.exe"   (hWnd%)      AS INTEGER
  39. DECLARE FUNCTION ReleaseDC       LIB "User" (hwnd%, hdc%)      AS INTEGER
  40. DECLARE FUNCTION GetDeviceCaps   LIB "gdi.exe"    (hdc%,icap%) AS INTEGER
  41. DECLARE FUNCTION GetFreeSpace    LIB "kernel.exe" (ununsed%)   AS LONG
  42. ''DECLARE FUNCTION FValidFATDir    LIB "MSCOMSTF.DLL" (szDir$)   AS INTEGER
  43. DECLARE FUNCTION AddFontResource LIB "Gdi.exe" (szFile$)       AS INTEGER
  44. DECLARE FUNCTION OnWindowsNT     LIB "iniupd.dll"              AS INTEGER
  45. DECLARE FUNCTION VflatdPresent   LIB "iniupd.dll"              AS INTEGER
  46. DECLARE SUB      Reboot          LIB "iniupd.dll"
  47. DECLARE FUNCTION ExitWindowsExec LIB "User" (Exec$, Param$)    AS INTEGER
  48. DECLARE FUNCTION ShowWindow      LIB "User.exe" (hWnd%,iShow%) AS INTEGER
  49. DECLARE FUNCTION SetWindowLong   LIB "User.exe" (hWnd%, offset%, style&) AS LONG
  50. ''DECLARE SUB FixScreenProc LIB "mscuistf.dll" (arg%)
  51.  
  52. DECLARE FUNCTION DisableMurmur   LIB "leidsetd.dll"            AS INTEGER
  53.  
  54. '****************************************************************************
  55. 'Error trap
  56. '****************************************************************************
  57. ON ERROR GOTO ERRORQUIT
  58.  
  59.  
  60. '***************************************************************************
  61. 'CONSTANTS
  62. '****************************************************************************
  63. CONST VGA_WIDTH                = 640        'VGA
  64. CONST VGA_HEIGHT               = 480
  65. CONST HARD_DISK_SPACE_REQUIRED = 3000000
  66. CONST RAM_REQUIRED             = 4000
  67. CONST MAJ_DOS_VERSION          = 5
  68. CONST PROCESSOR_386            = 3
  69. CONST COLOR_256                = 256
  70.  
  71. '****************************************************************************
  72. 'Window.h stuff
  73. '****************************************************************************
  74. CONST WS_VISIBLE       = &H10000000
  75. CONST WS_BORDER        = &H00800000
  76. CONST WS_CLIPCHILDREN  = &H02000000
  77. CONST GWL_STYLE        = -16
  78. CONST SW_SHOWMAXIMIZED = 3
  79. CONST NUMCOLORS        = 24         'windows constants
  80. CONST RASTERCAPS       = 38         '
  81. CONST SIZEPALETTE      = 104        '
  82. CONST RC_PALETTE       = &H0100     'mask for cheking VGA mode
  83.  
  84. CONST PMILOGO          = 2          'Bitmap value from dialogs.rc file
  85.  
  86. 'These are all the values for the dialog boxes copies from the header file
  87. 'manually
  88.  
  89. CONST WELCOME              =       100
  90. CONST PLEASE_WAIT          =       105
  91. CONST FILESWILLBEINSTALLED =       106
  92. CONST RESTART              =       107
  93. CONST RESTART2             =       108
  94. CONST ASKQUIT              =       200
  95. CONST DESTPATH             =       300
  96. CONST EXITFAILURE          =       400
  97. CONST EXITQUIT             =       600
  98. CONST EXITSUCCESS          =       700
  99. CONST APPHELP              =       900
  100. CONST HELP2                =       901
  101. CONST HELP3_2DRIVES        =       902
  102. CONST OVERWRITE_OPTIONS    =      1000
  103. CONST DIRECTORY_NEW        =      1100
  104. CONST HARD_DISK            =      6200
  105. CONST DISKFULL             =      6300
  106. CONST BADPATH              =      6400
  107. CONST MODELESS             =      7000
  108.  
  109. '''$Define DEBUG
  110.  
  111. '****************************************************************************
  112. 'VARIABLES
  113. 'Required for the DialogProc values
  114. '****************************************************************************
  115. GLOBAL WINFILE$
  116.  
  117. ''Dialog list symbol names
  118. GLOBAL BUTTONSTATE$
  119. GLOBAL STATUSTEXT$
  120. GLOBAL DRIVETEXT$
  121.  
  122. '' Source and Destination information
  123. GLOBAL DEST$
  124. GLOBAL DestDrv$
  125. GLOBAL WinDrv$
  126. GLOBAL WinDir$
  127. GLOBAL WinSysDir$
  128. GLOBAL SrcDir$
  129. GLOBAL SrcDrv$
  130.  
  131. '' Ini files (with paths)
  132. GLOBAL ControlIni$
  133. GLOBAL SystemIni$
  134. GLOBAL WinIni$
  135.  
  136.  
  137. GLOBAL Flg%
  138.  
  139.  
  140. '****************************************************************************
  141. 'Start of program
  142. '****************************************************************************
  143.  
  144. INIT:
  145.     'DLL for Dialog boxes
  146.     CUIDLL$   = "auc_cui.dll"           ''Source of dialog boxes
  147.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  148.  
  149.     hWnd%=HwndFrame()
  150. ''    AddToBillboardList CUIDLL$, MODELESS, "FBitmapDlgProc", 1
  151. ''    SetBitmap CUIDLL$, 2
  152.     SWLxx&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
  153.     SWyy%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
  154.  
  155.    '' Initialisation of various values
  156.     DEST$       = "C:\Auction"
  157.     SrcDir$     = GetSymbolValue("STF_SRCDIR") + "Setup"
  158.     SrcDrv$     = MID$(SrcDir$,1,1)
  159.     WinDir$     = GetWindowsDir()
  160.     WinSysDir$  = GetWindowsSysDir()
  161.     WinDrv$     = MID$(WinDir$,1,1)
  162.     ControlIni$ = MakePath(WinDir$, "control.ini")
  163.     SystemIni$  = MakePath(WinDir$, "system.ini")
  164.     WinIni$     = MakePath(WinDir$, "win.ini")
  165.  
  166.  
  167.     ''CustInst list symbols, these symbols are hard coded in dlgprocs.c
  168.     ''ButtonState refers to button INSTALL in the HardDiskAvailable Dialog
  169.     BUTTONSTATE$ = "ButtonState"
  170.     STATUSTEXT$  = "StatusItemsText"
  171.     DRIVETEXT$   = "DriveStatusText"
  172.  
  173.     FOR i% = 1 TO 1 STEP 1
  174.        AddListItem BUTTONSTATE$, ""
  175.     NEXT i%
  176.     FOR i% = 1 TO 7 STEP 1
  177.        AddListItem STATUSTEXT$, ""
  178.     NEXT i%
  179.     FOR i% = 1 TO 9 STEP 1
  180.           AddListItem DRIVETEXT$, ""
  181.     NEXT i%
  182.  
  183.  
  184.     'SetBitmap CUIDLL$, PMILOGO
  185.     SetTitle "Millennium Auction installation routine"
  186.  
  187. WELCOME:
  188.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  189.  
  190.     IF sz$ = "CONTINUE" THEN
  191.         UIPop 1
  192.     ELSEIF sz$ = "REACTIVATE" THEN
  193.         GOTO WELCOME
  194.     ELSEIF sz$ = "EXIT" THEN
  195.         UIPop 1
  196.         GOSUB ASKQUIT
  197.         GOTO WELCOME
  198.     ELSE
  199.         UIPop 1
  200.         GOTO WELCOME
  201.     ENDIF
  202.  
  203. GETPATH:
  204.        SetSymbolValue "EditTextIn", DEST$
  205.        SetSymbolValue "EditFocus" , "END"
  206.  
  207. GETPATHL1:
  208.        sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  209.  
  210.        IF sz$ = "CONTINUE" THEN
  211.           oldest$  = DEST$
  212.           DEST$    = GetSymbolValue("EditTextOut")
  213.           DestDrv$ = MID$(LTRIM$(DEST$),1,1)
  214.  
  215. '$ifdef DEBUG
  216.            PRINT "DestDrv$ ??",DestDrv$
  217. '$endif ''DEBUG
  218.  
  219.           IF IsDriveValid(DestDrv$) = 0 THEN
  220.              GOSUB BADDRIVE
  221.              GOTO  GETPATHL1
  222.           END IF
  223.  
  224.           IF IsDirWritable(DEST$) = 0 THEN   ''Not Writeable
  225.              i% = DoMsgBox("This directory is invalid","Stop",MB_OK)
  226.              GOTO GETPATHL1
  227.           ELSE                               '' Directory writeable
  228.              IF DoesDirExist(DEST$) = 0 THEN
  229.                 GOSUB NEWPATH
  230.                 IF Flg = 0 THEN
  231.                    GOTO GETPATHL1
  232.                 END IF
  233.              END IF
  234.           END IF
  235.           UIPop 1
  236.        ELSEIF sz$ = "REACTIVATE" THEN
  237.           GOTO GETPATHL1
  238.        ELSEIF sz$ = "EXIT" THEN
  239.           GOSUB ASKQUIT
  240.           GOTO GETPATHL1
  241.        END IF
  242.  
  243.     i% = InitTests(DestDrv$)
  244.     IF i% = 2 THEN
  245.        GOTO QUIT
  246.     END IF
  247.  
  248.     ClearCopyList
  249.  
  250.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  251.     If szInf$ = "" Then
  252.        szInf$ = GetSymbolValue("STF_CWDDIR") + "AUCT.INF"
  253.     End If
  254.     ReadInfFile szInf$
  255.  
  256.     sz$ = UIStartDlg(CUIDLL$, PLEASE_WAIT, "FModelessDlgProc", 0, "")
  257.     cursor% = ShowWaitCursor()
  258.  
  259.     ' Check the amount of space required
  260.     EnoughSpace% = FreeDiskSpace
  261.  
  262.     RestoreCursor(cursor%)
  263.     UIPop 1
  264.  
  265.     IF enoughSpace% = 1 THEN
  266.  
  267. DISKFULL:
  268.        sz$ = UIStartDlg(CUIDLL$, DISKFULL, "FInfoDlgProc", 0, "")
  269.  
  270.        IF sz$ = "CONTINUE" THEN
  271.          UIPop 1
  272.        ELSE
  273.          GOTO DISKFULL
  274.        ENDIF
  275.     ENDIF
  276.  
  277.  
  278. HARDDISK:
  279.     '' Differentiate help between one and two drive installation
  280.     IF DestDrv$ = WinDrv$ THEN
  281.        sz$ = UIStartDlg(CUIDLL$, HARD_DISK, "FCustInstDlgProc", HELP2, HELPPROC$)
  282.     ELSE
  283.        sz$ = UIStartDlg(CUIDLL$, HARD_DISK, "FCustInstDlgProc", HELP3_2DRIVES, HELPPROC$)
  284.     ENDIF
  285.  
  286.     IF sz$ = "CONTINUE" THEN
  287.        UIPop 1
  288.     ELSEIF sz$ = "REACTIVATE" THEN
  289.        GOTO HARDDISK
  290.     ELSEIF sz$ = "EXIT" THEN
  291.        GOSUB ASKQUIT
  292.        GOTO  HARDDISK
  293.     ELSE
  294.        UIPop 1
  295.        GOTO GETPATH
  296.     ENDIF
  297.  
  298.  
  299. INSTALL:
  300.     sz$ = UIStartDlg(CUIDLL$, FILESWILLBEINSTALLED, "FModelessDlgProc", 0, "")
  301.     cursor% = ShowWaitCursor()
  302.  
  303. ' Make a backup copy of the system files: system.ini, win.ini, control.ini, reg.dat
  304.     CopyFile SystemIni$ , MakePath(WinDir$, "system.auc"), cmoOverwrite, 0
  305.     CopyFile WinIni$    , MakePath(WinDir$, "win.auc"), cmoOverwrite, 0
  306.     CopyFile ControlIni$, MakePath(WinDir$, "control.auc"), cmoOverwrite, 0
  307.     CopyFile MakePath(WinDir$, "reg.dat"), MakePath(WinDir$, "REG.auc"), cmoOverwrite, 0
  308.  
  309. ' Add the MSRLEC codec to the system.ini file
  310.     test$ = GetIniKeyString(SystemIni$,"Drivers","VIDC.RLEC")
  311.     IF test$ = "" THEN
  312.        CreateSysIniKeyValue SystemIni$,"Drivers","VIDC.RLEC","msrlec.drv", cmoVital
  313.     ENDIF
  314.  
  315. ' Add the MSACM driver to the control panel so that we may use it
  316.     test$ = GetIniKeyString(SystemIni$, "MSACM", "EnableControl")
  317.     IF test$ = "" THEN
  318.        CreateIniKeyValue SystemIni$, "MSACM", "EnableControl", "1",cmoOverwrite
  319.     ENDIF
  320.  
  321.     test2$ = GetIniKeyString(SystemIni$, "Drivers", "Wavemapper")
  322.     IF test2$ = "" THEN
  323.        CreateIniKeyValue SystemIni$, "Drivers", "Wavemapper" , "msacm.drv"  , cmoOverwrite
  324.     ENDIF
  325.  
  326.     test3$ = GetIniKeyString(SystemIni$, "Drivers", "MSACM.msadpcm")
  327.     IF test3$ = "" THEN
  328.        CreateIniKeyValue SystemIni$, "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  329.     ENDIF
  330.  
  331.     test4$ = GetIniKeyString(SystemIni$, "Drivers", "MSACM.imaadpcm")
  332.     IF test4$ = "" THEN
  333.        CreateIniKeyValue SystemIni$, "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  334.     ENDIF
  335.  
  336.  
  337.  
  338. ' Add the CD Audio driver if it is not installed
  339.     ClearCopyList
  340.     AddSectionFilesToCopyList "VfW Runtime",  SrcDir$, WinSysDir$
  341.     AddSectionFilesToCopyList "ACM Drivers",  SrcDir$, WinSysDir$
  342.     AddSectionFilesToCopyList "AVI Codecs",   SrcDir$, WinSysDir$
  343.     AddSectionFilesToCopyList "Exe and Dlls", SrcDir$, DEST$
  344.     AddSectionFilesToCopyList "MPlayer",      SrcDir$, WinDir$
  345.     AddSectionFilesToCopyList "OLE2",         SrcDir$, WinSysDir$
  346.     AddSectionFilesToCopyList "MSRLEC",       SrcDir$, WinSysDir$
  347.     AddSectionFilesToCopyList "Auctioneer",   SrcDir$, MakePath(DEST$, "Aud")
  348.     AddSectionFilesToCopyList "Data",         SrcDir$, MakePath(DEST$, "Dat")
  349.     UIPop 1
  350.  
  351.     ''PRINT "CD drive = ", SrcDrv$
  352.     ''RestartDir$ = MakePath(DestDrv$, "Auctmp")
  353.     RestartDir$ = DEST$
  354.  
  355.     SetRestartDir RestartDir$
  356.     CopyFilesInCopyList
  357.  
  358.     '' Add the correct ini key for the CD in Auction.ini
  359.     AuctionIni$ = MakePath(DEST$, "Auction.ini")
  360.     PRINT "Destination drive = ", DestDrv$
  361.     CreateIniKeyValue AuctionIni$, "config", "CD-Drive", SrcDrv$, cmoOverwrite
  362.  
  363.     '' If MediaVision Card disable the murmur
  364.     test5% = DisableMurmur()
  365.     CreateIniKeyValue AuctionIni$, "Engine", "DisableMurmur", LTRIM$(STR$(test5%)), cmoOverwrite
  366.  
  367.     '' Set up the ini values for VFW
  368.     dummy% = InstallVFW
  369.  
  370.     '' Do the windows display stuff
  371.     AucExe$    = MakePath(DEST$, "Auction.exe")
  372.     AucReadme$ = MakePath(DEST$, "Readme.txt")
  373.     AucDemo$   = SrcDrv$ + ":\Demo\Demo.exe"
  374.     AucIntro$  = SrcDrv$ + ":\Intro\Intro.exe"
  375.  
  376.     CreateProgmanGroup  "Auction","",cmoNone
  377.     ShowProgmanGroup    "Auction",1 ,cmoNone
  378.     CreateProgmanItem   "Auction","Millennium Auction", AucExe$,"",cmoOverwrite
  379.     CreateProgmanItem   "Auction","Readme", AucReadme$,"",cmoOverwrite
  380.     CreateProgmanItem   "Auction","Demo", AucDemo$,"",cmoOverwrite
  381.     CreateProgmanItem   "Auction","One World History", AucIntro$,"",cmoOverwrite
  382.     RestoreCursor(cursor%)
  383.  
  384. '' Restart Windows: if system files have been added (SYSTEM flag in Dsklayt)
  385. '' then restart automatically else, give the user the choice
  386.     RESTRT%   = RestartListEmpty ()
  387.     PRINT       "RESTART% = ", RESTRT%
  388.  
  389.     WinExe$   = MakePath(RESTARTDIR$, "\_msrstrt.exe")
  390.     WinBatch$ = MakePath(RESTARTDIR$, "\_mssetup.bat")
  391.     Empty$    = ""
  392.  
  393. RESTART:
  394.     IF RESTRT% = 0 THEN
  395.        sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "")
  396.        IF sz$ = "REACTIVATE" THEN
  397.           GOTO RESTART
  398.        ENDIF
  399.  
  400.        I% = ExitExecRestart ()
  401.        RemoveFile WinExe$, cmoForce
  402.        RemoveFile WinBatch$, cmoForce
  403.        END
  404.     ELSE
  405.        sz$ = UIStartDlg(CUIDLL$, RESTART2, "FQuitDlgProc", 0, "")
  406.        IF sz$ = "CONTINUE" THEN
  407.           I% = ExitWindowsExec (WinExe$, Empty$)
  408.           IF I% = 0 THEN
  409.             GOTO RESTART
  410.           ELSE
  411.              END
  412.           ENDIF
  413.        ELSEIF sz$ = "EXIT" THEN
  414.           UIPopAll
  415.           END
  416.        ELSEIF sz$ = "REACTIVATE" THEN
  417.           GOTO RESTART
  418.       ELSE
  419.           UIPop 1
  420.        END IF
  421.     END IF
  422.  
  423. GOTO QUIT
  424.  
  425. '****************************************************************************
  426. 'The drive given for a path is bad
  427. '****************************************************************************
  428. BADDRIVE:
  429.     i% = DoMsgBox("Cannot use this drive","No good",MB_OK)
  430. RETURN
  431.  
  432.  
  433. '****************************************************************************
  434. 'If Directory name is OK but does not exist
  435. '****************************************************************************
  436. NEWPATH:
  437.     Flg% = 0
  438.     SetSymbolValue "EditTextIn", DEST$
  439.     sz$ = UIStartDlg(CUIDLL$, DIRECTORY_NEW, "FInfo0DlgProc", 0, "")
  440.  
  441.     IF sz$ = "CONTINUE" THEN  ''Create
  442.         CreateDir DEST$, cmoNone
  443.         UIPop 1
  444.         Flg% = 1
  445.     ELSEIF sz$ = "REACTIVATE" THEN
  446.         GOTO NEWPATH
  447.     ELSE
  448.         UIPop 1
  449.     ENDIF
  450. RETURN
  451.  
  452.  
  453. '****************************************************************************
  454. 'Requires MSDETECT.INC
  455. 'Check whether for timing it is worth checking first in the windows directory
  456. 'It is better to use GetWindowsDir rather than using FindFileInTree
  457. 'Note that path name is terminated with a backslash
  458. '****************************************************************************
  459. FORCEQUIT:
  460.    i%=DoMsgBox("Your system does not have adequate capabilities for auction", "Warning", MB_OK)
  461. END
  462.  
  463.  
  464. ASKQUIT:
  465.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FRadioDlgProc", APPHELP, HELPPROC$)
  466.     IF sz$ = "EXIT" THEN
  467.         UIPopAll
  468.         GOTO QUIT
  469.     ELSEIF sz$ = "REACTIVATE" THEN
  470.         GOTO ASKQUIT
  471.     ELSE
  472.         UIPop 1
  473.     ENDIF
  474. RETURN
  475.  
  476.  
  477. ERRORQUIT:
  478. '$ifdef DEBUG
  479.     PRINT "Error line number is ",ERL
  480.     PRINT "File in which error occurred is ",ERF
  481.     PRINT "The error code is", ERR
  482.     PRINT "The error is ",ERROR$(ERR)
  483. '$endif ''DEBUG
  484.  
  485. 'GOODQUIT:
  486.  
  487.  
  488.  
  489. QUIT:
  490.     END
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497. '****************************************************************************
  498. '****************************************************************************
  499. '        FUNCTIONS AND SUBDIRECTORIES
  500. '****************************************************************************
  501. '****************************************************************************
  502.  
  503.  
  504.  
  505. '****************************************************************************
  506. 'Installs the user defined fonts
  507. '****************************************************************************
  508. SUB InstallFont (IniKey$, szFile$) STATIC
  509.  
  510.   CreateIniKeyValue WinDir$ + "win.ini", "fonts", IniKey$, szFile$, cmoNone
  511.   dummy% = AddFontResource(szFile$)
  512.  
  513. END SUB
  514.  
  515.  
  516.  
  517. '****************************************************************************
  518. 'Set up all the ini key values for video for windows
  519. ' ADPCM stuff is done further up
  520. '****************************************************************************
  521. FUNCTION InstallVFW STATIC AS INTEGER
  522.  
  523. ''Updating WIN.INI and SYSTEM.INI
  524.    CreateIniKeyValue SystemIni$,  "Drivers",      "VIDC.MSVC",    "msvidc.drv", cmoOverwrite
  525.    CreateIniKeyValue SystemIni$,  "Drivers",      "VIDC.RT21",    "indeov.drv",  cmoOverwrite
  526.    CreateIniKeyValue SystemIni$,  "Drivers",      "VIDC.MRLE",    "msrle.drv",  cmoOverwrite
  527.    CreateIniKeyValue WinIni$,     "mci extensions", "avi",        "AVIVideo",   cmoOverwrite
  528.    CreateIniKeyValue SystemIni$,  "mci",          "AVIVideo",     "mciavi.drv",                      cmoOverwrite
  529.    CreateIniKeyValue SystemIni$,  "Drivers",      "VIDC.CVID",    "iccvid.drv",                      cmoOverwrite
  530.    CreateIniKeyValue SystemIni$,  "Drivers",      "VIDC.IV31",    "indeov.drv",                     cmoOverwrite
  531.    CreateIniKeyValue SystemIni$,  "Drivers",      "VIDC.YVU9",    "indeov.drv",                     cmoOverwrite
  532.    CreateIniKeyValue ControlIni$, "drivers.desc", "msacm.drv",    "Microsoft Sound Mapper V2.00",    cmoOverwrite
  533.    CreateIniKeyValue ControlIni$, "drivers.desc", "msadpcm.acm",  "Microsoft ADPCM Codec V2.00",     cmoOverwrite
  534.    CreateIniKeyValue ControlIni$, "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  535.  
  536. '' Update the VfW options to ensure our setup
  537.    CreateIniKeyValue WinIni$, "MCIAVI", "SkipFrames", "1", cmoOverwrite
  538.    CreateIniKeyValue WinIni$, "MCIAVI", "DefaultVideo", "Window", cmoOverwrite
  539.  
  540.    IF VflatdPresent() = 0 THEN
  541.       CreateSysIniKeyValue SystemIni$, "386Enh", "device", "dva.386", cmoOverwrite
  542.    END IF
  543.  
  544.    Run ("regedit.exe /s " + MakePath(WinDir$,    "mplayer.reg"))
  545.    Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  546.    Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  547.  
  548. '' Mplayer
  549.    CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
  550.  
  551.    Run ("profdisp.exe")
  552. END FUNCTION
  553.  
  554.  
  555.  
  556. '***********************************************************************
  557. 'Check if there is enough space on the hard drive to install the files
  558. ' DEST$ is a global value
  559. '***********************************************************************
  560. FUNCTION FreeDiskSpace STATIC AS INTEGER
  561.  
  562. ''Add all files to the copy list and check the amount of free space
  563.     ReturnVal% = 0        ''All is OK
  564.  
  565.     ClearCopyList
  566.  
  567.     ''  Files to be added to the windows directory
  568.     AddSectionFilesToCopyList "OLE2",         SrcDir$, WinSysDir$
  569.     AddSectionFilesToCopyList "VfW Runtime",  SrcDir$, WinSysDir$
  570.     AddSectionFilesToCopyList "ACM Drivers",  SrcDir$, WinSysDir$
  571.     AddSectionFilesToCopyList "AVI Codecs",   SrcDir$, WinSysDir$
  572.     AddSectionFilesToCopyList "MSRLEC",       SrcDir$, WinSysDir$
  573.     AddSectionFilesToCopyList "MPlayer",      SrcDir$, WinDir$
  574.     AddSectionFilesToCopyList "Exe and Dlls", SrcDir$, DEST$
  575.     AddSectionFilesToCopyList "Auctioneer",   SrcDir$, MakePath(DEST$, "Aud")
  576.     AddSectionFilesToCopyList "Data",         SrcDir$, MakePath(DEST$, "Dat")
  577.  
  578. '$ifdef DEBUG
  579.     DumpCopyList "e:\auction.out"
  580.     PRINT "I am copying the auctioneer file to ", MakePath(DEST$, "Aud")
  581. '$endif ''DEBUG
  582.  
  583.     szExtras$  = "Extras"
  584.     szCosts$   = "Costs"
  585.     szNeededs$ = "Neededs"
  586.     FOR i% = 1 TO 26 STEP 1
  587.          AddListItem szExtras$,  "0"
  588.          AddListItem szCosts$,   "0"
  589.          AddListItem szNeededs$, "0"
  590.     NEXT i%
  591.  
  592.     aucDrive% = ASC(ucase$(DestDrv$)) - ASC("A") + 1
  593.     sysDrive% = ASC(ucase$(WinDrv$))  - ASC("A") + 1
  594.     ret& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  595.  
  596.     '' ret = 0 means that all is OK otherwise not enough space
  597.     IF ret& <> 0 THEN
  598.        '' Grey out the INSTALL BUTTON in the dialog box
  599.        PRINT "BAD BAD button"
  600.        ReplaceListItem BUTTONSTATE$, 1, "ON"
  601.        ReturnVal% = 1        ''Not enough space
  602.        ReplaceListItem DRIVETEXT$, 8, "There is not enough room on your hard disk to install the Game!!"
  603.        ReplaceListItem DRIVETEXT$, 9, "Change your destination directory or erase some file from your hard disk"
  604.     ELSE
  605.        '' Normal format
  606.        PRINT "We have a normal button"
  607.        ReplaceListItem BUTTONSTATE$, 1, ""
  608.        '' No need for the extra text
  609.        ReplaceListItem DRIVETEXT$, 8, ""
  610.        ReplaceListItem DRIVETEXT$, 9, ""
  611.     ENDIF
  612.  
  613. '$ifdef DEBUG
  614.     PRINT "Windows Drive number = ", sysDrive%
  615.     PRINT "Auction Drive number = ", aucDrive%
  616.     PRINT "DestDir$ = ", DestDir$
  617. '$endif ''DEBUG
  618.  
  619.     wincost&  = VAL(GetListItem(szCosts$, sysDrive%))
  620.     destcost& = VAL(GetListItem(szCosts$, aucDrive%))
  621.  
  622.     '' No need for the second column of information
  623.     IF DestDrv$ = WinDrv$ THEN
  624.         ReplaceListItem DRIVETEXT$, 4, ""
  625.         ReplaceListItem DRIVETEXT$, 5, ""
  626.         ReplaceListItem DRIVETEXT$, 6, ""
  627.         ReplaceListItem DRIVETEXT$, 7, ""
  628.     ELSE
  629.         winfree& = GetFreeSpaceForDrive(WinDrv$)
  630.         ReplaceListItem DRIVETEXT$, 4, WinDrv$
  631.         ReplaceListItem DRIVETEXT$, 5, STR$(wincost& / 1024) + " K"
  632.         ReplaceListItem DRIVETEXT$, 6, STR$(winfree& / 1024) + " K"
  633.         ReplaceListItem DRIVETEXT$, 7, "Windows Drive:"
  634.    END IF
  635.  
  636.    destfree& = GetFreeSpaceForDrive(DestDrv$)
  637.    ReplaceListItem DRIVETEXT$, 1, DestDrv$
  638.    ReplaceListItem DRIVETEXT$, 2, STR$(destcost& / 1024) + " K"
  639.    ReplaceListItem DRIVETEXT$, 3, STR$(destfree& / 1024) + " K"
  640.  
  641. '$ifdef DEBUG
  642.     PRINT "Cost for Drive C = ", wincost&
  643.     PRINT "Cost for install Drive = ", destcost&
  644. '$endif ''DEBUG
  645.  
  646.    FreeDiskspace = ReturnVal%
  647. END FUNCTION
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658. '****************************************************************************
  659. 'NumberOfColors returns the number of colors that windows is running in
  660. '****************************************************************************
  661. FUNCTION NumberOfColors STATIC AS INTEGER
  662.  
  663.   hdc%=GetDC(HwndFrame())
  664.  
  665.  
  666.   IF GetDeviceCaps(hdc%, RASTERCAPS) AND RC_PALETTE THEN
  667.      numclrs%=GetDeviceCaps(hdc%,SIZEPALETTE)
  668.   ELSE
  669.       numclrs%=GetDeviceCaps(hdc%, NUMCOLORS)
  670.   ENDIF
  671.  
  672.   dummy% = ReleaseDC( 0, hdc%)
  673.  
  674. END FUNCTION
  675.  
  676.  
  677.  
  678. '****************************************************************************
  679. 'These are the routines to check if the configuration of the system is not
  680. 'correct for the game. The tests performed are:
  681. '       Processor type                  (to ensure MPC specs)
  682. '       Display                         (256 color VGA)
  683. '       Available Hard DIsk Space
  684. '       Available RAM on the machine    (includes Swap file)
  685. '       DOS 5.0 should be loaded
  686. '       Windows 3.1                     (need multimedia extensions)
  687. '       Mouse                           (may require test for multiinput
  688. '                                         device
  689. 'Return:        0 if all is OK
  690. '               1 if a warning box should be put but can install
  691. '               2 Exit installation
  692. '****************************************************************************
  693. FUNCTION InitTests(DestDrv$) STATIC AS INTEGER
  694.  
  695.    '*************************************************************************
  696.    'Check Processor type
  697.    '*************************************************************************
  698.    InitTests%=0
  699.  
  700.    c1% = GetProcessorType
  701.    IF c1% < 3 THEN
  702.       InitTests%=2
  703.       i%=DoMsgBox(STR$(c1%), "Processor Type", MB_OK)
  704.    ENDIF
  705.  
  706.    '*************************************************************************
  707.    'Check for 256 color mode VGA
  708.    'Also see colors.mst for number of colors test
  709.    '*************************************************************************
  710.    c2% = GetScreenHeight()
  711.    c3% = GetScreenWidth()
  712.    c4% = NumberOfColors
  713.  
  714.    IF c2% <> VGA_WIDTH THEN
  715.       'i%=DoMsgBox(STR$(c2%), "Screen width", MB_OK)
  716.       InitTests%=1
  717.  
  718.    ELSEIF c3% <> VGA_HEIGHT THEN
  719.       'i%=DoMsgBox(STR$(c3%), "Screen Height", MB_OK)
  720.       InitTests%=1
  721.  
  722.    ELSEIF c4% <> COLOR_256 THEN
  723.       'i%=DoMsgBox(STR$(c4%), "Number of Colors", MB_OK)
  724.       InitTests%=1
  725.  
  726.    ENDIF
  727.  
  728.  
  729.  
  730.    '*************************************************************************
  731.    'Check available RAM on the machine
  732.    '*************************************************************************
  733.    RAM& = GetFreeSpace (unused%)
  734.  
  735.    IF RAM& < RAM_REQUIRED THEN
  736.       i%=DoMsgBox(STR$(RAM&), "RAM Required", MB_OK)
  737.       InitTests%=1
  738.    ENDIF
  739.  
  740.    '*************************************************************************
  741.    'Ensure DOS 5.0 is loaded
  742.    '*************************************************************************
  743.    cDos% = GetDOSMajorVersion()
  744.    IF cDOS% < MAJ_DOS_VERSION THEN
  745.       i%=DoMsgBox(STR$(cDos%), "Dos Version required", MB_OK)
  746.       InitTests%=2
  747.    ENDIF
  748.  
  749.  
  750.    '*************************************************************************
  751.    'Ensure that windows version is OK
  752.    '*************************************************************************
  753.    cWin% = GetWindowsMajorVersion()
  754.    IF cWin% < MAJ_Win_VERSION THEN
  755.       i%=DoMsgBox(STR$(cWin%), "Win Version required", MB_OK)
  756.       InitTests%=2
  757.    ENDIF
  758.  
  759.  
  760.    '*************************************************************************
  761.    'Check if mouse has been installed
  762.    'Requires MSDETECT.INC
  763.    'cmouse% = 1 if exists
  764.    '*************************************************************************
  765.    cmouse% = HasMouseInstalled()
  766.    IF cmouse% <> 1 THEN
  767.       i%=DoMsgBox(STR$(cmouse%), "Mouse Present", MB_OK)
  768.       InitTests%=2
  769.  
  770.    '  Write Dialog box stating that mouse is not installed, and that
  771.    '  instruction must be followed to play the game without a mouse
  772.    ENDIF
  773.  
  774. END FUNCTION
  775.  
  776.  
  777. '*************************************************************************
  778. '** Purpose:
  779. '**     Appends a file name to the end of a directory path,
  780. '**     inserting a backslash character as needed.
  781. '** Arguments:
  782. '**     szDir$  - full directory path (with optional ending "\")
  783. '**     szFile$ - filename to append to directory
  784. '** Returns:
  785. '**     Resulting fully qualified path name.
  786. '*************************************************************************
  787. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  788.     IF szDir$ = "" THEN
  789.         MakePath = szFile$
  790.     ELSEIF szFile$ = "" THEN
  791.         MakePath = szDir$
  792.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  793.         MakePath = szDir$ + szFile$
  794.     ELSE
  795.         MakePath = szDir$ + "\" + szFile$
  796.     END IF
  797. END FUNCTION
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.