[PATCH] wnaspi32: Fix Controller -> H/C mapping. This fixes device enumeration in apps such as CDSpeed and Alchohol 120% (using Win98 and ASPI).

Rok Mandeljc rok.mandeljc at email.si
Thu Nov 1 02:09:10 CDT 2007


---
 dlls/wnaspi32/aspi.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/wnaspi32/aspi.c b/dlls/wnaspi32/aspi.c
index 46a4763..d46f809 100644
--- a/dlls/wnaspi32/aspi.c
+++ b/dlls/wnaspi32/aspi.c
@@ -181,7 +181,8 @@ DWORD ASPI_GetHCforController( int controller )
     HKEY hkeyScsi, hkeyPort;
     DWORD i = 0, numPorts;
     int num_ha = controller + 1;
-    WCHAR wPortName[11];
+    WCHAR wPortName[15];
+    WCHAR wBusName[15];
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wDevicemapScsi, 0,
         KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &hkeyScsi) != ERROR_SUCCESS )
@@ -212,7 +213,7 @@ DWORD ASPI_GetHCforController( int controller )
         return 0xFFFFFFFF;
     }
 
-    if (RegEnumKeyW(hkeyPort, -num_ha, wPortName, sizeof(wPortName)) != ERROR_SUCCESS)
+    if (RegEnumKeyW(hkeyPort, -num_ha, wBusName, sizeof(wBusName)) != ERROR_SUCCESS)
     {
         ERR("Failed to enumerate keys\n");
         RegCloseKey(hkeyPort);
@@ -220,7 +221,7 @@ DWORD ASPI_GetHCforController( int controller )
     }
     RegCloseKey(hkeyPort);
 
-    return ((--i) << 16) + atoiW(&wPortName[9]);
+    return (atoiW(&wPortName[9]) << 16) + atoiW(&wBusName[9]);
 }
 
 int SCSI_OpenDevice( int h, int c, int t, int d )
-- 
1.5.3.3


--------------050408080801090008030902--



More information about the wine-patches mailing list