[MPR] Import Wine commit: 93fb279f4f3e150eee329b02ca5fb0251d8a239d
authorPierre Schweitzer <pierre@reactos.org>
Fri, 14 Sep 2018 20:30:41 +0000 (22:30 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 14 Sep 2018 20:34:02 +0000 (22:34 +0200)
Properly handle device-less connections.

CORE-15012

dll/win32/mpr/wnet.c

index 80375b8..162b41f 100644 (file)
@@ -2652,6 +2652,7 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
 DWORD WINAPI WNetClearConnections ( HWND owner )
 {
     HANDLE connected;
+    PWSTR connection;
     DWORD ret, size, count;
     NETRESOURCEW * resources, * iter;
 
@@ -2685,7 +2686,14 @@ DWORD WINAPI WNetClearConnections ( HWND owner )
         if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
         {
             for (iter = resources; count; count--, iter++)
-                WNetCancelConnection2W(iter->lpLocalName, 0, TRUE);
+            {
+                if (iter->lpLocalName && iter->lpLocalName[0])
+                    connection = iter->lpLocalName;
+                else
+                    connection = iter->lpRemoteName;
+
+                WNetCancelConnection2W(connection, 0, TRUE);
+            }
         }
         else
             break;