[WS2_32] The current ws2_32 served us well, but it's time for ws2_32_new to shine...
[reactos.git] / reactos / dll / win32 / ws2_32 / src / dcatitem.c
similarity index 79%
rename from reactos/dll/win32/ws2_32_new/src/dcatitem.c
rename to reactos/dll/win32/ws2_32/src/dcatitem.c
index abd9c41..511cbf4 100644 (file)
@@ -67,6 +67,8 @@ WsTcEntryInitializeFromRegistry(IN PTCATALOG_ENTRY CatalogEntry,
     DWORD RegType = REG_BINARY;
     HKEY EntryKey;
     DWORD Return;
+    LPBYTE Buf;
+    DWORD index;
 
     /* Convert to a 00000xxx string */
     sprintf(CatalogEntryName, "%0""12""lu", UniqueId);
@@ -79,21 +81,34 @@ WsTcEntryInitializeFromRegistry(IN PTCATALOG_ENTRY CatalogEntry,
                           &EntryKey);
 
     /* Get Size of Catalog Entry Structure */
-    Return = RegQueryValueExW(EntryKey, 
-                              L"PackedCatalogItem",
+    Return = RegQueryValueEx(EntryKey, 
+                              "PackedCatalogItem",
                               0,
                               NULL,
                               NULL,
                               &RegSize);
     
+    if(!(Buf = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, RegSize)))
+        return ERROR_NOT_ENOUGH_MEMORY;
+
     /* Read the Whole Catalog Entry Structure */
-    Return = RegQueryValueExW(EntryKey, 
-                              L"PackedCatalogItem",
+    Return = RegQueryValueEx(EntryKey, 
+                              "PackedCatalogItem",
                               0,
                               &RegType,
-                              (LPBYTE)&CatalogEntry->DllPath,
+                              Buf,
                               &RegSize);
 
+
+    memcpy(CatalogEntry->DllPath, (LPCSTR)Buf, sizeof(CatalogEntry->DllPath));
+    index = sizeof(CatalogEntry->DllPath);
+    if(index < RegSize)
+    {
+        memcpy(&CatalogEntry->ProtocolInfo, &Buf[index], sizeof(WSAPROTOCOL_INFOW));
+        index += sizeof(WSAPROTOCOL_INFOW);
+    }
+    HeapFree(WsSockHeap, 0, Buf);
+
     /* Done */
     RegCloseKey(EntryKey);
     return Return;