- added multiple cdrom support for win32 (NT/2000 version untested). The ASPI

version uses the cdrom drives in the system's order. Drive letters are not
  used by ASPI.
- wrong BX_INFO message for ASPI disabled. The version number is never checked.
This commit is contained in:
Volker Ruppert 2002-10-03 11:59:37 +00:00
parent eef4867ca4
commit f3b7378307
2 changed files with 28 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cdrom.cc,v 1.44 2002-09-26 09:00:51 mlerwill Exp $
// $Id: cdrom.cc,v 1.45 2002-10-03 11:59:37 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -103,14 +103,12 @@ DWORD (*GetASPI32DLLVersion)(void);
static BOOL bUseASPI = FALSE;
static BOOL bHaveDev = FALSE;
static int hid = 0;
static int tid = 0;
static int lun = 0;
static BOOL bHaveDev;
static UINT cdromCount = 0;
static HINSTANCE hASPI = NULL;
#define BX_CD_FRAMESIZE 2048
#define CD_FRAMESIZE 2048
HANDLE hFile = NULL;
#endif
@ -210,7 +208,7 @@ cdrom_interface::cdrom_interface(char *dev)
void
cdrom_interface::init(void) {
BX_DEBUG(("Init $Id: cdrom.cc,v 1.44 2002-09-26 09:00:51 mlerwill Exp $"));
BX_DEBUG(("Init $Id: cdrom.cc,v 1.45 2002-10-03 11:59:37 vruppert Exp $"));
BX_INFO(("file = '%s'",path));
}
@ -249,7 +247,7 @@ cdrom_interface::insert_cdrom(char *dev)
BX_INFO (("Using direct access for cdrom."));
// This trick only works for Win2k and WinNT, so warn the user of that.
} else {
BX_INFO(("Using ASPI for cdrom."));
BX_INFO(("Using ASPI for cdrom. Drive letters are unused yet."));
bUseASPI = TRUE;
}
}
@ -262,17 +260,21 @@ cdrom_interface::insert_cdrom(char *dev)
}
if(bUseASPI) {
DWORD d;
int cnt, max;
int cdr, cnt, max;
int i, j, k;
SRB_HAInquiry sh;
SRB_GDEVBlock sd;
HINSTANCE hASPI = LoadLibrary("WNASPI32.DLL");
if (!hASPI) {
hASPI = LoadLibrary("WNASPI32.DLL");
}
if(hASPI) {
SendASPI32Command = (DWORD(*)(LPSRB))GetProcAddress( hASPI, "SendASPI32Command" );
GetASPI32DLLVersion = (DWORD(*)(void))GetProcAddress( hASPI, "GetASPI32DLLVersion" );
GetASPI32SupportInfo = (DWORD(*)(void))GetProcAddress( hASPI, "GetASPI32SupportInfo" );
BX_INFO(("Using first CDROM. Please upgrade your ASPI drivers to version 4.01 or later if you wish to specify a cdrom driver."));
// BX_INFO(("Using first CDROM. Please upgrade your ASPI drivers to version 4.01 or later if you wish to specify a cdrom driver."));
cdr = 0;
bHaveDev = FALSE;
d = GetASPI32SupportInfo();
cnt = LOBYTE(LOWORD(d));
for(i = 0; i < cnt; i++) {
@ -294,10 +296,14 @@ cdrom_interface::insert_cdrom(char *dev)
SendASPI32Command((LPSRB)&sd);
if(sd.SRB_Status == SS_COMP) {
if(sd.SRB_DeviceType == DTYPE_CDROM) {
hid = i;
tid = j;
lun = k;
bHaveDev = TRUE;
cdr++;
if(cdr > cdromCount) {
hid = i;
tid = j;
lun = k;
cdromCount++;
bHaveDev = TRUE;
}
}
}
if(bHaveDev) break;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cdrom.h,v 1.9 2002-08-28 16:45:18 bdenney Exp $
// $Id: cdrom.h,v 1.10 2002-10-03 11:59:37 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -54,5 +54,11 @@ private:
char *path;
int using_file;
#ifdef WIN32
HANDLE hFile;
int hid;
int tid;
int lun;
#endif
};