mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[WS2_32]: Fix the crash in ws2_32 reported in CORE-12852, that happens when opening e.g. Word 2010 for the first time (when it asks for registration):
- Check whether WsNcLoadProvider really succeeded in loading a provider in WsNcGetCatalogFromProviderId, and return appropriate error code. - In WsNqLookupServiceBegin, initialize CatalogEntry to NULL prior to calling WsNcGetCatalogFromProviderId, and check for success or failure of WsNqAddProvider (and fail in accordance). svn path=/trunk/; revision=74067
This commit is contained in:
parent
0989caed38
commit
abc2d4d228
2 changed files with 20 additions and 17 deletions
|
@ -497,6 +497,7 @@ WsNcGetCatalogFromProviderId(IN PNSCATALOG Catalog,
|
|||
IN LPGUID ProviderId,
|
||||
OUT PNSCATALOG_ENTRY *CatalogEntry)
|
||||
{
|
||||
INT ErrorCode = WSAEINVAL;
|
||||
PLIST_ENTRY NextEntry;
|
||||
PNSCATALOG_ENTRY Entry;
|
||||
|
||||
|
@ -514,25 +515,24 @@ WsNcGetCatalogFromProviderId(IN PNSCATALOG Catalog,
|
|||
/* Check if this is the Catalog Entry ID we want */
|
||||
if (IsEqualGUID(&Entry->ProviderId, ProviderId))
|
||||
{
|
||||
/* Check if it doesn't already have a provider */
|
||||
/* If it doesn't already have a provider, load the provider */
|
||||
if (!Entry->Provider)
|
||||
{
|
||||
/* Match, load the Provider */
|
||||
WsNcLoadProvider(Catalog, Entry);
|
||||
}
|
||||
ErrorCode = WsNcLoadProvider(Catalog, Entry);
|
||||
|
||||
/* Reference the entry and return it */
|
||||
InterlockedIncrement(&Entry->RefCount);
|
||||
*CatalogEntry = Entry;
|
||||
break;
|
||||
/* If we succeeded, reference the entry and return it */
|
||||
if (Entry->Provider /* || ErrorCode == ERROR_SUCCESS */)
|
||||
{
|
||||
InterlockedIncrement(&Entry->RefCount);
|
||||
*CatalogEntry = Entry;
|
||||
ErrorCode = ERROR_SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Release the catalog */
|
||||
/* Release the lock and return */
|
||||
WsNcUnlock();
|
||||
|
||||
/* Return */
|
||||
return ERROR_SUCCESS;
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
|
|
@ -355,7 +355,7 @@ WsNqLookupServiceBegin(IN PNSQUERY NsQuery,
|
|||
PLIST_ENTRY Entry;
|
||||
INT ErrorCode;
|
||||
DWORD ClassInfoSize;
|
||||
PNSCATALOG_ENTRY CatalogEntry;
|
||||
PNSCATALOG_ENTRY CatalogEntry = NULL;
|
||||
ENUM_CONTEXT EnumContext;
|
||||
BOOLEAN TryAgain;
|
||||
|
||||
|
@ -396,10 +396,13 @@ WsNqLookupServiceBegin(IN PNSQUERY NsQuery,
|
|||
ErrorCode = SOCKET_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
else
|
||||
/* We succeeded, add this provider */
|
||||
else if (!WsNqAddProvider(NsQuery, CatalogEntry->Provider))
|
||||
{
|
||||
/* Add this provider */
|
||||
WsNqAddProvider(NsQuery, CatalogEntry->Provider);
|
||||
/* Fail */
|
||||
SetLastError(WSA_NOT_ENOUGH_MEMORY);
|
||||
ErrorCode = SOCKET_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue