Author: pschweitzer
Date: Fri Jun 23 19:21:29 2017
New Revision: 75172
URL: 
http://svn.reactos.org/svn/reactos?rev=75172&view=rev
Log:
[MPR]
Import Wine commit:
- 51b4a42969366cc409808aded23d3602a34206e2, Properly handle the count set to -1 when
enumerating connections.
This fixes 'net use' not being able to enumerate multiple connections served by
multiple network providers.
CORE-13475
Modified:
    trunk/reactos/dll/win32/mpr/wnet.c
Modified: trunk/reactos/dll/win32/mpr/wnet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mpr/wnet.c?rev=7…
==============================================================================
--- trunk/reactos/dll/win32/mpr/wnet.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mpr/wnet.c  [iso-8859-1] Fri Jun 23 19:21:29 2017
@@ -1400,7 +1400,7 @@
 static DWORD _enumerateConnectedW(PWNetEnumerator enumerator, DWORD* user_count,
                                   void* user_buffer, DWORD* user_size)
 {
-    DWORD ret, index, count, size, i, left;
+    DWORD ret, index, count, total_count, size, i, left;
     void* end;
     NETRESOURCEW* curr, * buffer;
     HANDLE* handles;
@@ -1424,6 +1424,7 @@
     curr = user_buffer;
     end = (char *)user_buffer + size;
     count = *user_count;
+    total_count = 0;
     ret = WN_NO_MORE_ENTRIES;
     for (index = 0; index < providerTable->numProviders; index++)
@@ -1443,6 +1444,7 @@
             ret = providerTable->table[index].enumResource(handles[index],
                                                            &count, buffer,
                                                            &size);
+            total_count += count;
             if (ret == WN_MORE_DATA)
                 break;
@@ -1477,19 +1479,22 @@
                     ++curr;
                 }
-                count = *user_count - count;
+                if (*user_count != -1)
+                    count = *user_count - total_count;
+                else
+                    count = *user_count;
                 size = left;
             }
-            if (ret != WN_SUCCESS || count == 0)
+            if (ret != WN_SUCCESS || total_count == 0)
                 break;
         }
     }
-    if (count == 0)
+    if (total_count == 0)
         ret = WN_NO_MORE_ENTRIES;
-    *user_count = *user_count - count;
+    *user_count = total_count;
     if (ret != WN_MORE_DATA && ret != WN_NO_MORE_ENTRIES)
         ret = WN_SUCCESS;