[WS2_32] Create registry keys Protocol_Catalog9/NameSpace_Catalog5 if needed

This fixes networking in LiveCD and installation in 2nd stage.
CORE-17514
This commit is contained in:
Hervé Poussineau 2021-04-17 23:06:53 +02:00
parent 9e947e2b2b
commit af9df93274
2 changed files with 68 additions and 48 deletions

View file

@ -59,35 +59,45 @@ 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;
}
if (RegType != REG_SZ)
{
DPRINT1("Protocol catalog name is not a string (Type %d).\n", RegType);
return FALSE;
}
CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
/* 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);
}
CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
/* 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)
{

View file

@ -58,35 +58,45 @@ 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;
}
if (RegType != REG_SZ)
{
DPRINT1("Namespace catalog name is not a string (Type %d).\n", RegType);
return FALSE;
}
CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
/* 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);
}
CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
/* 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)
{