WINSPOOL: fix port enumeration

Mike McCormack mike at codeweavers.com
Mon Oct 18 00:58:51 CDT 2004


ChangeLog:
* fix port enumeration
-------------- next part --------------
Index: dlls/winspool/info.c
===================================================================
RCS file: /home/wine/wine/dlls/winspool/info.c,v
retrieving revision 1.94
diff -u -r1.94 info.c
--- dlls/winspool/info.c	4 Oct 2004 20:40:44 -0000	1.94
+++ dlls/winspool/info.c	18 Oct 2004 04:15:36 -0000
@@ -3010,6 +3010,7 @@
                          NULL, OPEN_EXISTING, 0, NULL );
     if (handle == INVALID_HANDLE_VALUE)
         return FALSE;
+    TRACE("Checking %s exists\n", name );
     CloseHandle( handle );
     return TRUE;
 }
@@ -3040,6 +3041,7 @@
     DWORD info_size, ofs, i, printer_count, serial_count, count, n, r;
     const LPCSTR szPrinterPortKey = "Software\\Wine\\Wine\\Config\\spooler";
     HKEY hkey_printer;
+    BOOL retval = TRUE;
 
     TRACE("(%s,%ld,%p,%ld,%p,%p)\n",
           name,level,buffer,bufsize,bufneeded,bufreturned);
@@ -3088,6 +3090,8 @@
             portname[3] = '1' + i;
             if (!WINSPOOL_ComPortExists( portname ))
                 continue;
+
+            TRACE("Found %s\n", portname );
             vallen = strlen( portname );
         }
         else
@@ -3125,10 +3129,12 @@
             /* add the name of the port if we can fit it */
             if ( ofs < bufsize )
                 lstrcpynA(&buffer[ofs],portname,bufsize - ofs);
-        }
 
+            n++;
+        }
+        else
+            retval = FALSE;
         ofs += lstrlenA(portname)+1;
-        n++;
     }
 
     RegCloseKey(hkey_printer);
@@ -3137,9 +3143,9 @@
         *bufneeded = ofs;
 
     if(bufreturned)
-        *bufreturned = count;
+        *bufreturned = n;
 
-    return TRUE;
+    return retval;
 }
 
 


More information about the wine-patches mailing list