- New function in aspi.c SCSI_Fix_CMD_LEN which determines if Linux is
  guessing the command length correctly, and if not, tell's it what's up.
- Changed strcat to strcpy in SendASPI32Command to avoid requiring the
  caller to clear the fields.
- Added a new field to HA_Unique content to fix some applications.  Will
  fix this for good at a later date.
- Added TRACE to GetASPI32DLLVersion (and FIXME when not running under
  Linux)
- Added some constants to winescsi.h
(with the help of Bernd Bernie Meyer <bmeyer@cs.monash.edu.au>)

diff --git a/dlls/winaspi/aspi.c b/dlls/winaspi/aspi.c
index f0c4dbc..3e67ef2 100644
--- a/dlls/winaspi/aspi.c
+++ b/dlls/winaspi/aspi.c
@@ -199,6 +199,22 @@
 }
 
 #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 b63a70e..8f6da80 100644
--- a/dlls/winaspi/winaspi32.c
+++ b/dlls/winaspi/winaspi32.c
@@ -363,6 +363,8 @@
     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 @@
  */
 DWORD WINAPI GetASPI32SupportInfo()
 {
-    return ((SS_COMP << 8) | 1); /* FIXME: get # of host adapters installed */
+    return ((SS_COMP << 8) | ASPI_GetNumControllers());
 }
 
 
@@ -468,10 +470,11 @@
     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 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 7719434..a133776 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 @@
 		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