[NETSHELL]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 14 Dec 2013 18:19:30 +0000 (18:19 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 14 Dec 2013 18:19:30 +0000 (18:19 +0000)
CORE-4949
Fix the network adapter name retrieval code. Adapter names should be visible again. Retest please.

svn path=/trunk/; revision=61272

reactos/dll/win32/netshell/connectmanager.cpp

index f3f9e51..d2ec7b5 100644 (file)
@@ -604,12 +604,15 @@ CNetConnectionManager::EnumerateINetConnections()
             }
             RegCloseKey(hSubKey);
         }
-        if (SetupDiGetDeviceRegistryPropertyW(hInfo, &DevInfo, SPDRP_DEVICEDESC, NULL, (PBYTE)szNetCfg, sizeof(szNetCfg)/sizeof(WCHAR), &dwSize))
+
+        /* Get the adapter device description */
+        dwSize = 0;
+        SetupDiGetDeviceRegistryPropertyW(hInfo, &DevInfo, SPDRP_DEVICEDESC, NULL, NULL, 0, &dwSize);
+        if (dwSize != 0)
         {
-            szNetCfg[(sizeof(szNetCfg)/sizeof(WCHAR))-1] = L'\0';
-            pNew->Props.pszwDeviceName = (LPWSTR)CoTaskMemAlloc((wcslen(szNetCfg)+1) * sizeof(WCHAR));
+            pNew->Props.pszwDeviceName = (LPWSTR)CoTaskMemAlloc(dwSize);
             if (pNew->Props.pszwDeviceName)
-                wcscpy(pNew->Props.pszwDeviceName, szNetCfg);
+                SetupDiGetDeviceRegistryPropertyW(hInfo, &DevInfo, SPDRP_DEVICEDESC, NULL, (PBYTE)pNew->Props.pszwDeviceName, dwSize, &dwSize);
         }
 
         if (pCurrent)