ntdll: Try2: Fix IOCTL_SCSI_GET_ADDRESS and HKLM\HARDWARE\DEVICEMAP\Scsi entries

Vitaliy Margolen wine-patch at kievinfo.com
Sun Jul 24 08:20:33 CDT 2005


Fix compiler warnings about type mismatch. Type should be UCHAR not int.

Reverse PortNumber and PathId the way it should be. Tested against win2k.
Fix creation of HKLM\HARDWARE\DEVICEMAP\Scsi entries accordingly.

Vitaliy Margolen

changelog:
  dlls/ntdll/cdrom.c
    Fix IOCTL_SCSI_GET_ADDRESS
  dlls/kernel/oldconfig.c
    Fix creation of HKLM\HARDWARE\DEVICEMAP\Scsi entries according to fixed
    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	24 Jul 2005 13:14:58 -0000
@@ -551,7 +556,7 @@ static void CDROM_ClearCacheEntry(int de
  * Determines the scsi information for scsi cdroms (*port >= 1).
  * 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* port, UCHAR* iface, UCHAR* device, UCHAR* lun)
 {
 #if defined(linux)
     struct stat st;
@@ -1702,15 +1713,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 = busid; /* bus number - primary=0 secondary=1 for ide */
+    address->PathId = portnum;
+    address->TargetId = targetid; /* master=0 slave=1 for ide */
     address->Lun = lun;
     return STATUS_SUCCESS;
 }
Index: dlls/kernel/oldconfig.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/oldconfig.c,v
retrieving revision 1.7
diff -u -p -r1.7 oldconfig.c
--- dlls/kernel/oldconfig.c	11 Jul 2005 20:44:59 -0000	1.7
+++ dlls/kernel/oldconfig.c	20 Jul 2005 17:07:23 -0000
@@ -171,7 +171,7 @@ static void init_cdrom_registry( HANDLE 
     NtSetValueKey( portKey,&nameW, 0, REG_DWORD, (BYTE *)&value, sizeof(DWORD));
     RtlFreeUnicodeString( &nameW );
 
-    snprintf(buffer,40,"Scsi Bus %d", scsi_addr.PathId);
+    snprintf(buffer,40,"Scsi Bus %d", scsi_addr.TargetId);
     attr.RootDirectory = portKey;
     if (!RtlCreateUnicodeStringFromAsciiz( &nameW, buffer ) ||
         NtCreateKey( &busKey, KEY_ALL_ACCESS, &attr, 0,
@@ -193,7 +193,7 @@ static void init_cdrom_registry( HANDLE 
     RtlFreeUnicodeString( &nameW );
     NtClose( targetKey );
 
-    snprintf(buffer,40,"Target Id %d", scsi_addr.TargetId);
+    snprintf(buffer,40,"Target Id %d", scsi_addr.PathId);
     attr.RootDirectory = busKey;
     if (!RtlCreateUnicodeStringFromAsciiz( &nameW, buffer ) ||
         NtCreateKey( &targetKey, KEY_ALL_ACCESS, &attr, 0,


More information about the wine-patches mailing list