ntdll: Try4: Fix IOCTL_SCSI_GET_ADDRESS

Vitaliy Margolen wine-patch at kievinfo.com
Mon Aug 1 08:26:24 CDT 2005


Fix IOCTL_SCSI_GET_ADDRESS to return proper interface/bus/device/lun for IDE and
SCSI. For now I've put SCSI devices starting from interface 2 (first two reserved
for IDE). I will change this as soon as I'll have patch for
HKLM\HARDWARE\DEVICEMAP\Scsi entries finished.

Vitaliy Margolen

changelog:
  dlls/ntdll/cdrom.c
    Fix IOCTL_SCSI_GET_ADDRESS
-------------- next part --------------
Index: dlls/ntdll/cdrom.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/cdrom.c,v
retrieving revision 1.63
diff -u -p -r1.63 cdrom.c
--- dlls/ntdll/cdrom.c	20 Jul 2005 10:28:27 -0000	1.63
+++ dlls/ntdll/cdrom.c	27 Jul 2005 18:37:03 -0000
@@ -547,11 +550,11 @@ static void CDROM_ClearCacheEntry(int de
  *		CDROM_GetInterfaceInfo
  *
  * Determines the ide interface (the number after the ide), and the
- * number of the device on that interface for ide cdroms (*port == 0).
- * Determines the scsi information for scsi cdroms (*port >= 1).
+ * number of the device on that interface for ide cdroms (*iface <= 1).
+ * Determines the scsi information for scsi cdroms (*iface >= 2).
  * Returns false if the info cannot not be obtained.
  */
-static int CDROM_GetInterfaceInfo(int fd, int* port, int* iface, int* device,int* lun)
+static int CDROM_GetInterfaceInfo(int fd, UCHAR* iface, UCHAR* port, UCHAR* device, UCHAR* lun)
 {
 #if defined(linux)
     struct stat st;
@@ -580,8 +583,8 @@ static int CDROM_GetInterfaceInfo(int fd
         UINT32 idlun[2];
         if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, &idlun) != -1)
         {
-            *port = ((idlun[0] >> 24) & 0xff) + 1;
-            *iface = (idlun[0] >> 16) & 0xff;
+            *port = (idlun[0] >> 24) & 0xff;
+            *iface = ((idlun[0] >> 16) & 0xff) + 2;
             *device = idlun[0] & 0xff;
             *lun = (idlun[0] >> 8) & 0xff;
         }
@@ -1702,15 +1709,15 @@ static NTSTATUS CDROM_ScsiGetCaps(PIO_SC
  */
 static NTSTATUS CDROM_GetAddress(int fd, SCSI_ADDRESS* address)
 {
-    int portnum, busid, targetid, lun;
+    UCHAR portnum, busid, targetid, lun;
 
     address->Length = sizeof(SCSI_ADDRESS);
     if ( ! CDROM_GetInterfaceInfo(fd, &portnum, &busid, &targetid, &lun))
         return STATUS_NOT_SUPPORTED;
 
-    address->PortNumber = portnum;
-    address->PathId = busid; /* bus number */
-    address->TargetId = targetid;
+    address->PortNumber = portnum; /* primary=0 secondary=1 for ide */
+    address->PathId = busid;       /* always 0 for ide */
+    address->TargetId = targetid;  /* master=0 slave=1 for ide */
     address->Lun = lun;
     return STATUS_SUCCESS;
 }


More information about the wine-patches mailing list