Dag Nygren wrote:

> Hi,
>
> just taking a look at the ASPI-stuff in Wine (from CVS)
> as I have problems with the ASPI layer not seeing my
> CD-ROM:s on host adapter #2.
>
> But the code is not very much commented and I have no experience
> in Windows registry handling.... So I need a little help.
>
> I looked at the trace from the ASPI layer and this indicates that
> all the SCSI devices are seen when read from Linux, but the update
> of number of controllers still sets the number to 1.
>
> I am a bit confused about the fact that ASPI_GetNumControllers()
> returns the registry value for \\HKEY_DYN_DATA\\WinScsi\\ControllerMap
> but SCSI_GetProcinfo() seems to setup a completely different
> entry with the number os host adapters.
> Could you enlighten me ?
>

Yes, I believe what happened was I got most of the code to map each channel
of each scsi host to an aspi controller.  Unfortunately I seem to have
misunderstood the usage of RegEnumValueA when reading back from my
controller map.  Attached is a patch that has been in my tree for some time
now.  I did not write the patch, I don't exactly remember who did, but
you'll find it (or something similar) in the wine-devel archives.

Looking at this patch, basically my code had a problem in that it didn't
account for a change in cbIdStr (4th parameter to RegEnumValueA) atlhough
I am sure the documentation says it will be changed (my bad).  I was also
not being very careful about parsing with sscanf and did not even check the
return value, which this patch also does.

This patch should certainly go into the wine tree.

I think this should fix your problem.  I now have two "scsi" controllers on
my system.  One real aic7xxx and I now use ide-scsi to access my DVD which
is now visible as the second ASPI controller which is the first channel
(0) on the second linux scsi host (1).  What would be very helpful is the
output of your /proc/scsi/scsi and maybe a registry export of the
HKDD\\WineScsi heirarchy which will only be visible if WNASPI32.DLL gets
loaded (so you must run an ASPI program and while it is running open up
regedit to see the key).

I have also attached my /proc/scsi/scsi so you can compare your setup to
mine.  Notice that I do not have any scsi controllers with multiple channels
which means that each aspi controller in this case is exactly one linux scsi
host.  However, if someone had a linux scsi host with two channels then each
channel would be mapped as a seperate ASPI controller (theoretically).
Hopefully someone can test this after applying this patch (and before if you
really want to).

-Dave
Index: dlls/winaspi/aspi.c
===================================================================
RCS file: /home/wine/wine/dlls/winaspi/aspi.c,v
retrieving revision 1.9
diff -u -r1.9 aspi.c
--- dlls/winaspi/aspi.c 2000/11/30 01:17:55     1.9
+++ dlls/winaspi/aspi.c 2001/01/07 18:01:59
@@ -459,7 +459,7 @@
        DWORD disposition;
 
        char idstr[20];
-       DWORD cbIdStr = 20;
+       DWORD cbIdStr;
        int i = 0;
        DWORD type = 0;
        DWORD error;
@@ -487,9 +487,15 @@
                return;
        }
        
-       for( i=0; (error=RegEnumValueA( hkeyScsi, i, idstr, &cbIdStr, NULL, &type, 
NULL, NULL )) == ERROR_SUCCESS; i++ )
+       for( i=0; cbIdStr = sizeof(idstr), (error=RegEnumValueA( hkeyScsi, i, idstr, 
+&cbIdStr, NULL, &type, NULL, NULL )) == ERROR_SUCCESS; i++ )
        {
-               sscanf(idstr, "h%02dc%02dt%*02dd%*02d", &ha, &chan);
+               if(idstr[0] == '\0') continue; /* skip the default value */
+
+               if(sscanf(idstr, "h%02dc%02dt%*02dd%*02d", &ha, &chan) != 2) {
+                       ERR("incorrect reg. value %s\n", debugstr_a(idstr));
+                       continue;
+               }
+
                if( last_ha < ha )
                {       /* Next HA */
                        last_ha = ha;
Attached devices: 
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: SEAGATE  Model: ST34555N         Rev: 0930
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 03 Lun: 00
  Vendor: ULTIMA   Model: AT12             Rev: 2.10
  Type:   Scanner                          ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 04 Lun: 00
  Vendor: MATSHITA Model: CD-ROM CR-508    Rev: XS03
  Type:   CD-ROM                           ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 05 Lun: 00
  Vendor: IOMEGA   Model: ZIP 100          Rev: D.08
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 06 Lun: 00
  Vendor: MATSHITA Model: CD-R   CW-7501   Rev: 2.00
  Type:   CD-ROM                           ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: CREATIVE Model: DVD5240E-1       Rev: 1.20
  Type:   CD-ROM                           ANSI SCSI revision: 02

Reply via email to