diff --git a/dlls/winaspi/aspi.c b/dlls/winaspi/aspi.c index f0c4dbc1a81d358b3a33959d2991e1efddbed287..3e67ef2836ecdc7e37335a6240ad8fabff184eff 100644 --- a/dlls/winaspi/aspi.c +++ b/dlls/winaspi/aspi.c @@ -199,6 +199,22 @@ SCSI_OpenDevice( int h, int c, int t, int d ) } #ifdef linux +/* SCSI_Fix_CMD_LEN + * Checks to make sure the CMD_LEN is correct + */ +void +SCSI_Fix_CMD_LEN(int fd, int cmd, int len) +{ + int index=(cmd>>5)&7; + + if (len!=scsi_command_size[index]) + { + TRACE("CDBLen for command %d claims to be %d, expected %d\n", + cmd, len, scsi_command_size[index]); + ioctl(fd,SG_NEXT_CMD_LEN,&len); + } +} + int SCSI_LinuxSetTimeout( int fd, int timeout ) { diff --git a/dlls/winaspi/winaspi32.c b/dlls/winaspi/winaspi32.c index b63a70e69521a7970df35347350240eaa747ee09..8f6da80d95d38c37a05470408a45595734270aea 100644 --- a/dlls/winaspi/winaspi32.c +++ b/dlls/winaspi/winaspi32.c @@ -363,6 +363,8 @@ ASPI_ExecScsiCmd(SRB_ExecSCSICmd *lpPRB) sg_hd->reply_len = out_len; } + SCSI_Fix_CMD_LEN(fd, lpPRB->CDBByte[0], lpPRB->SRB_CDBLen); + if(!SCSI_LinuxDeviceIo( fd, sg_hd, in_len, sg_reply_hdr, out_len, @@ -453,7 +455,7 @@ error_exit: */ DWORD WINAPI GetASPI32SupportInfo() { - return ((SS_COMP << 8) | 1); /* FIXME: get # of host adapters installed */ + return ((SS_COMP << 8) | ASPI_GetNumControllers()); } @@ -468,10 +470,11 @@ DWORD __cdecl SendASPI32Command(LPSRB lpSRB) lpSRB->inquiry.SRB_Status = SS_COMP; /* completed successfully */ lpSRB->inquiry.HA_Count = 1; /* not always */ lpSRB->inquiry.HA_SCSI_ID = 7; /* not always ID 7 */ - strcat(lpSRB->inquiry.HA_ManagerId, "ASPI for WIN32"); /* max 15 chars, don't change */ - strcat(lpSRB->inquiry.HA_Identifier, "Wine host"); /* FIXME: return host adapter name */ + strcpy(lpSRB->inquiry.HA_ManagerId, "ASPI for WIN32"); /* max 15 chars, don't change */ + strcpy(lpSRB->inquiry.HA_Identifier, "Wine host"); /* FIXME: return host adapter name */ memset(lpSRB->inquiry.HA_Unique, 0, 16); /* default HA_Unique content */ lpSRB->inquiry.HA_Unique[6] = 0x02; /* Maximum Transfer Length (128K, Byte> 4-7) */ + lpSRB->inquiry.HA_Unique[3] = 0x08; /* Maximum number of SCSI targets */ FIXME("ASPI: Partially implemented SC_HA_INQUIRY for adapter %d.\n", lpSRB->inquiry.SRB_HaId); return SS_COMP; @@ -540,8 +543,10 @@ DWORD __cdecl SendASPI32Command(LPSRB lpSRB) DWORD WINAPI GetASPI32DLLVersion() { #ifdef linux + TRACE("Returning version 1\n"); return (DWORD)1; #else + FIXME("Please add SCSI support for your operating system, returning 0\n"); return (DWORD)0; #endif } diff --git a/dlls/winaspi/winescsi.h b/dlls/winaspi/winescsi.h index 7719434a8b0804dc965b09e204ef02bf4511218a..a13377613fd60f236e98bebb7c90e454f71b7183 100644 --- a/dlls/winaspi/winescsi.h +++ b/dlls/winaspi/winescsi.h @@ -5,6 +5,16 @@ /* Copy of info from 2.2.x kernel */ #define SG_MAX_SENSE 16 /* too little, unlikely to change in 2.2.x */ +#define SG_NEXT_CMD_LEN 0x2283 /* override SCSI command length with given + number on the next write() on this file descriptor */ + +/* This is what the linux kernel thinks.... */ +const static unsigned char scsi_command_size[8] = +{ + 6, 10, 10, 12, + 12, 12, 10, 10 +}; + struct sg_header { int pack_len; /* [o] reply_len (ie useless), ignored as input */ @@ -54,6 +64,9 @@ SCSI_LinuxDeviceIo( int fd, struct sg_header * lpvInBuffer, DWORD cbInBuffer, struct sg_header * lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned ); + +void +SCSI_Fix_CMD_LEN( int fd, int cmd, int len ); #endif BOOL