From 5c4c672600d672d91be0511db1abc71b3076138e Mon Sep 17 00:00:00 2001 From: hater <7element@mail.bg> Date: Wed, 4 Nov 2015 11:28:12 +0200 Subject: [PATCH] Read PackedCatalogItem from registry in CatalogEntry.ProtocolInfo --- reactos/dll/win32/ws2_32_new/src/dcatitem.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/ws2_32_new/src/dcatitem.c b/reactos/dll/win32/ws2_32_new/src/dcatitem.c index abd9c41..511cbf4 100644 --- a/reactos/dll/win32/ws2_32_new/src/dcatitem.c +++ b/reactos/dll/win32/ws2_32_new/src/dcatitem.c @@ -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; -- 1.9.5.msysgit.0