https://git.reactos.org/?p=reactos.git;a=commitdiff;h=af9df932748d3aaa2f334…
commit af9df932748d3aaa2f334e0f430d35723fa46651
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Sat Apr 17 23:06:53 2021 +0200
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Sat Apr 17 23:57:41 2021 +0200
[WS2_32] Create registry keys Protocol_Catalog9/NameSpace_Catalog5 if needed
This fixes networking in LiveCD and installation in 2nd stage.
CORE-17514
---
dll/win32/ws2_32/src/dcatalog.c | 54 ++++++++++++++++++++++++-----------------
dll/win32/ws2_32/src/nscatalo.c | 54 ++++++++++++++++++++++++-----------------
2 files changed, 64 insertions(+), 44 deletions(-)
diff --git a/dll/win32/ws2_32/src/dcatalog.c b/dll/win32/ws2_32/src/dcatalog.c
index c53e6c4faec..eb56765e40f 100644
--- a/dll/win32/ws2_32/src/dcatalog.c
+++ b/dll/win32/ws2_32/src/dcatalog.c
@@ -59,34 +59,44 @@ WsTcOpen(IN PTCATALOG Catalog,
&RegType,
NULL,
&RegSize);
- if (ErrorCode != ERROR_SUCCESS)
+ if (ErrorCode == ERROR_FILE_NOT_FOUND)
{
- DPRINT1("Failed to get protocol catalog name: %d.\n", ErrorCode);
- return FALSE;
+ static const CHAR DefaultCatalogName[] = "Protocol_Catalog9";
+ RegSize = sizeof(DefaultCatalogName);
+ CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
+ memcpy(CatalogKeyName, DefaultCatalogName, RegSize);
}
-
- if (RegType != REG_SZ)
+ else
{
- DPRINT1("Protocol catalog name is not a string (Type %d).\n",
RegType);
- return FALSE;
- }
+ if (ErrorCode != ERROR_SUCCESS)
+ {
+ DPRINT1("Failed to get protocol catalog name: %d.\n", ErrorCode);
+ return FALSE;
+ }
- CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
+ if (RegType != REG_SZ)
+ {
+ DPRINT1("Protocol catalog name is not a string (Type %d).\n",
RegType);
+ return FALSE;
+ }
- /* Read the catalog name */
- ErrorCode = RegQueryValueEx(ParentKey,
- "Current_Protocol_Catalog",
- 0,
- &RegType,
- (LPBYTE)CatalogKeyName,
- &RegSize);
+ CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
- /* Open the Catalog Key */
- ErrorCode = RegOpenKeyEx(ParentKey,
- CatalogKeyName,
- 0,
- MAXIMUM_ALLOWED,
- &CatalogKey);
+ /* Read the catalog name */
+ ErrorCode = RegQueryValueEx(ParentKey,
+ "Current_Protocol_Catalog",
+ 0,
+ &RegType,
+ (LPBYTE)CatalogKeyName,
+ &RegSize);
+
+ /* Open the Catalog Key */
+ ErrorCode = RegOpenKeyEx(ParentKey,
+ CatalogKeyName,
+ 0,
+ MAXIMUM_ALLOWED,
+ &CatalogKey);
+ }
/* If we didn't find the key, create it */
if (ErrorCode == ERROR_SUCCESS)
diff --git a/dll/win32/ws2_32/src/nscatalo.c b/dll/win32/ws2_32/src/nscatalo.c
index fe4d9cb28cf..32cee959c89 100644
--- a/dll/win32/ws2_32/src/nscatalo.c
+++ b/dll/win32/ws2_32/src/nscatalo.c
@@ -58,34 +58,44 @@ WsNcOpen(IN PNSCATALOG Catalog,
&RegType,
NULL,
&RegSize);
- if (ErrorCode != ERROR_SUCCESS)
+ if (ErrorCode == ERROR_FILE_NOT_FOUND)
{
- DPRINT1("Failed to get namespace catalog name: %d.\n", ErrorCode);
- return FALSE;
+ static const CHAR DefaultCatalogName[] = "NameSpace_Catalog5";
+ RegSize = sizeof(DefaultCatalogName);
+ CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
+ memcpy(CatalogKeyName, DefaultCatalogName, RegSize);
}
-
- if (RegType != REG_SZ)
+ else
{
- DPRINT1("Namespace catalog name is not a string (Type %d).\n",
RegType);
- return FALSE;
- }
+ if (ErrorCode != ERROR_SUCCESS)
+ {
+ DPRINT1("Failed to get namespace catalog name: %d.\n", ErrorCode);
+ return FALSE;
+ }
- CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
+ if (RegType != REG_SZ)
+ {
+ DPRINT1("Namespace catalog name is not a string (Type %d).\n",
RegType);
+ return FALSE;
+ }
- /* Read the catalog name */
- ErrorCode = RegQueryValueEx(ParentKey,
- "Current_NameSpace_Catalog",
- 0,
- &RegType,
- (LPBYTE)CatalogKeyName,
- &RegSize);
+ CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
- /* Open the Catalog Key */
- ErrorCode = RegOpenKeyEx(ParentKey,
- CatalogKeyName,
- 0,
- MAXIMUM_ALLOWED,
- &CatalogKey);
+ /* Read the catalog name */
+ ErrorCode = RegQueryValueEx(ParentKey,
+ "Current_NameSpace_Catalog",
+ 0,
+ &RegType,
+ (LPBYTE)CatalogKeyName,
+ &RegSize);
+
+ /* Open the Catalog Key */
+ ErrorCode = RegOpenKeyEx(ParentKey,
+ CatalogKeyName,
+ 0,
+ MAXIMUM_ALLOWED,
+ &CatalogKey);
+ }
/* If we didn't find the key, create it */
if (ErrorCode == ERROR_SUCCESS)