mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 02:25:40 +00:00
[WS2_32]: Cosmetic changes first, before real fixes - CORE-12880 :
- Use IsListEmpty where needed; - Initialize NextEntry using Catalog->ProtocolList after the lock on the catalog has been acquired; - Rearrange WsNqLookupServiceNext to reduce the code indent level; also, convert the construct "if (var) { do { ... } while (var); }" into a mere "while (var) { ... }"; - WsNqPreviousProvider: the "next" provider is the previous one...; - WsNqAddProvider: Use a more standard name for the boolean return value; - Fix the annotation of MapUnicodeQuerySetToAnsi; - Factor out setting the SetLastError WSALookupServiceBeginA. svn path=/trunk/; revision=74041
This commit is contained in:
parent
800e1d3803
commit
019a8d2be6
6 changed files with 160 additions and 170 deletions
|
@ -721,7 +721,7 @@ WsAsyncThread(IN PVOID ThreadContext)
|
||||||
WsAsyncLock();
|
WsAsyncLock();
|
||||||
|
|
||||||
/* Process the queue */
|
/* Process the queue */
|
||||||
while (ListHead->Flink != ListHead)
|
while (!IsListEmpty(ListHead))
|
||||||
{
|
{
|
||||||
/* Remove this entry and get the async block */
|
/* Remove this entry and get the async block */
|
||||||
Entry = RemoveHeadList(ListHead);
|
Entry = RemoveHeadList(ListHead);
|
||||||
|
|
|
@ -384,7 +384,7 @@ WsTcGetEntryFromAf(IN PTCATALOG Catalog,
|
||||||
IN PTCATALOG_ENTRY *CatalogEntry)
|
IN PTCATALOG_ENTRY *CatalogEntry)
|
||||||
{
|
{
|
||||||
INT ErrorCode = WSAEINVAL;
|
INT ErrorCode = WSAEINVAL;
|
||||||
PLIST_ENTRY NextEntry = Catalog->ProtocolList.Flink;
|
PLIST_ENTRY NextEntry;
|
||||||
PTCATALOG_ENTRY Entry;
|
PTCATALOG_ENTRY Entry;
|
||||||
|
|
||||||
/* Assume failure */
|
/* Assume failure */
|
||||||
|
@ -394,6 +394,7 @@ WsTcGetEntryFromAf(IN PTCATALOG Catalog,
|
||||||
WsTcLock();
|
WsTcLock();
|
||||||
|
|
||||||
/* Match the Id with all the entries in the List */
|
/* Match the Id with all the entries in the List */
|
||||||
|
NextEntry = Catalog->ProtocolList.Flink;
|
||||||
while (NextEntry != &Catalog->ProtocolList)
|
while (NextEntry != &Catalog->ProtocolList)
|
||||||
{
|
{
|
||||||
/* Get the Current Entry */
|
/* Get the Current Entry */
|
||||||
|
@ -435,13 +436,14 @@ WsTcGetEntryFromCatalogEntryId(IN PTCATALOG Catalog,
|
||||||
IN PTCATALOG_ENTRY *CatalogEntry)
|
IN PTCATALOG_ENTRY *CatalogEntry)
|
||||||
{
|
{
|
||||||
INT ErrorCode = WSAEINVAL;
|
INT ErrorCode = WSAEINVAL;
|
||||||
PLIST_ENTRY NextEntry = Catalog->ProtocolList.Flink;
|
PLIST_ENTRY NextEntry;
|
||||||
PTCATALOG_ENTRY Entry;
|
PTCATALOG_ENTRY Entry;
|
||||||
|
|
||||||
/* Lock the catalog */
|
/* Lock the catalog */
|
||||||
WsTcLock();
|
WsTcLock();
|
||||||
|
|
||||||
/* Match the Id with all the entries in the List */
|
/* Match the Id with all the entries in the List */
|
||||||
|
NextEntry = Catalog->ProtocolList.Flink;
|
||||||
while (NextEntry != &Catalog->ProtocolList)
|
while (NextEntry != &Catalog->ProtocolList)
|
||||||
{
|
{
|
||||||
/* Get the Current Entry */
|
/* Get the Current Entry */
|
||||||
|
@ -483,7 +485,7 @@ WsTcGetEntryFromTriplet(IN PTCATALOG Catalog,
|
||||||
IN PTCATALOG_ENTRY *CatalogEntry)
|
IN PTCATALOG_ENTRY *CatalogEntry)
|
||||||
{
|
{
|
||||||
INT ErrorCode = WSAEINVAL;
|
INT ErrorCode = WSAEINVAL;
|
||||||
PLIST_ENTRY NextEntry = Catalog->ProtocolList.Flink;
|
PLIST_ENTRY NextEntry;
|
||||||
PTCATALOG_ENTRY Entry;
|
PTCATALOG_ENTRY Entry;
|
||||||
DPRINT("WsTcGetEntryFromTriplet: %lx, %lx, %lx, %lx\n", af, type, protocol, StartId);
|
DPRINT("WsTcGetEntryFromTriplet: %lx, %lx, %lx, %lx\n", af, type, protocol, StartId);
|
||||||
|
|
||||||
|
@ -493,6 +495,8 @@ WsTcGetEntryFromTriplet(IN PTCATALOG Catalog,
|
||||||
/* Lock the catalog */
|
/* Lock the catalog */
|
||||||
WsTcLock();
|
WsTcLock();
|
||||||
|
|
||||||
|
NextEntry = Catalog->ProtocolList.Flink;
|
||||||
|
|
||||||
/* Check if we are starting past 0 */
|
/* Check if we are starting past 0 */
|
||||||
if (StartId)
|
if (StartId)
|
||||||
{
|
{
|
||||||
|
@ -674,14 +678,14 @@ WsTcUpdateProtocolList(IN PTCATALOG Catalog,
|
||||||
RemoveEntryList(&Catalog->ProtocolList);
|
RemoveEntryList(&Catalog->ProtocolList);
|
||||||
InitializeListHead(&Catalog->ProtocolList);
|
InitializeListHead(&Catalog->ProtocolList);
|
||||||
|
|
||||||
/* Loop every item on the list */
|
/* Loop every item in the list */
|
||||||
while (!IsListEmpty(List))
|
while (!IsListEmpty(List))
|
||||||
{
|
{
|
||||||
/* Get the catalog entry */
|
/* Get the catalog entry */
|
||||||
Entry = RemoveHeadList(List);
|
Entry = RemoveHeadList(List);
|
||||||
CatalogEntry = CONTAINING_RECORD(Entry, TCATALOG_ENTRY, CatalogLink);
|
CatalogEntry = CONTAINING_RECORD(Entry, TCATALOG_ENTRY, CatalogLink);
|
||||||
|
|
||||||
/* Check if this item is already on our list */
|
/* Check if this item is already in our list */
|
||||||
Entry = TempList.Flink;
|
Entry = TempList.Flink;
|
||||||
while (Entry != &TempList)
|
while (Entry != &TempList)
|
||||||
{
|
{
|
||||||
|
@ -709,7 +713,7 @@ WsTcUpdateProtocolList(IN PTCATALOG Catalog,
|
||||||
Catalog->ItemCount++;
|
Catalog->ItemCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's anything left on the temporary list */
|
/* If there's anything left in the temporary list */
|
||||||
while (!IsListEmpty(&TempList))
|
while (!IsListEmpty(&TempList))
|
||||||
{
|
{
|
||||||
/* Get the entry */
|
/* Get the entry */
|
||||||
|
|
|
@ -498,13 +498,14 @@ WsNcGetCatalogFromProviderId(IN PNSCATALOG Catalog,
|
||||||
IN LPGUID ProviderId,
|
IN LPGUID ProviderId,
|
||||||
OUT PNSCATALOG_ENTRY *CatalogEntry)
|
OUT PNSCATALOG_ENTRY *CatalogEntry)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY NextEntry = Catalog->CatalogList.Flink;
|
PLIST_ENTRY NextEntry;
|
||||||
PNSCATALOG_ENTRY Entry;
|
PNSCATALOG_ENTRY Entry;
|
||||||
|
|
||||||
/* Lock the catalog */
|
/* Lock the catalog */
|
||||||
WsNcLock();
|
WsNcLock();
|
||||||
|
|
||||||
/* Match the Id with all the entries in the List */
|
/* Match the Id with all the entries in the List */
|
||||||
|
NextEntry = Catalog->CatalogList.Flink;
|
||||||
while (NextEntry != &Catalog->CatalogList)
|
while (NextEntry != &Catalog->CatalogList)
|
||||||
{
|
{
|
||||||
/* Get the Current Entry */
|
/* Get the Current Entry */
|
||||||
|
|
|
@ -134,9 +134,9 @@ WsNqBeginEnumerationProc(PVOID Context,
|
||||||
if (!(Provider = Entry->Provider))
|
if (!(Provider = Entry->Provider))
|
||||||
{
|
{
|
||||||
/* None was loaded, load it */
|
/* None was loaded, load it */
|
||||||
if ((WsNcLoadProvider(EnumContext->Catalog, Entry) != ERROR_SUCCESS))
|
if (WsNcLoadProvider(EnumContext->Catalog, Entry) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
/* return TRUE to continue enumerating */
|
/* Return TRUE to continue enumerating */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ WsNqBeginEnumerationProc(PVOID Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add it to the query */
|
/* Add it to the query */
|
||||||
if (!(WsNqAddProvider(NsQuery, Provider)))
|
if (!WsNqAddProvider(NsQuery, Provider))
|
||||||
{
|
{
|
||||||
/* We failed */
|
/* We failed */
|
||||||
EnumContext->ErrorCode = WSASYSCALLFAILURE;
|
EnumContext->ErrorCode = WSASYSCALLFAILURE;
|
||||||
|
@ -194,157 +194,150 @@ WsNqLookupServiceNext(IN PNSQUERY NsQuery,
|
||||||
OUT PDWORD BufferLength,
|
OUT PDWORD BufferLength,
|
||||||
OUT LPWSAQUERYSETW Results)
|
OUT LPWSAQUERYSETW Results)
|
||||||
{
|
{
|
||||||
PNSQUERY_PROVIDER Provider, NextProvider;
|
|
||||||
INT ErrorCode = SOCKET_ERROR, OldErrorCode;
|
INT ErrorCode = SOCKET_ERROR, OldErrorCode;
|
||||||
|
PNSQUERY_PROVIDER Provider, NextProvider;
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
|
|
||||||
/* Make sure we're not shutting down */
|
/* Make sure we're not shutting down */
|
||||||
if (!NsQuery->ShuttingDown)
|
if (NsQuery->ShuttingDown)
|
||||||
{
|
{
|
||||||
/* Acquire query lock */
|
/* We are shutting down, fail */
|
||||||
WsNqLock();
|
SetLastError(WSAECANCELLED);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if we already have an active provider */
|
/* Acquire query lock */
|
||||||
NextProvider = NsQuery->ActiveProvider;
|
WsNqLock();
|
||||||
if (!NextProvider)
|
|
||||||
|
/* Check if we already have an active provider */
|
||||||
|
NextProvider = NsQuery->ActiveProvider;
|
||||||
|
if (!NextProvider)
|
||||||
|
{
|
||||||
|
/* Make sure we have a current provider */
|
||||||
|
if (!NsQuery->CurrentProvider)
|
||||||
{
|
{
|
||||||
/* Make sure we have a current provider */
|
/* We don't; fail */
|
||||||
if (!NsQuery->CurrentProvider)
|
WsNqUnlock();
|
||||||
{
|
SetLastError(WSA_E_NO_MORE);
|
||||||
/* We don't; fail */
|
return SOCKET_ERROR;
|
||||||
WsNqUnlock();
|
|
||||||
SetLastError(WSA_E_NO_MORE);
|
|
||||||
return SOCKET_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the first provider on the list and start looping */
|
|
||||||
Entry = NsQuery->ProviderList.Blink;
|
|
||||||
NextProvider = CONTAINING_RECORD(Entry, NSQUERY_PROVIDER, QueryLink);
|
|
||||||
while (NextProvider)
|
|
||||||
{
|
|
||||||
/* Check if this is a new-style provider */
|
|
||||||
if (NextProvider->Provider->Service.NSPIoctl)
|
|
||||||
{
|
|
||||||
/* Remove it and re-add it on top */
|
|
||||||
RemoveEntryList(&NextProvider->QueryLink);
|
|
||||||
InsertHeadList(&NsQuery->ProviderList, &NextProvider->QueryLink);
|
|
||||||
|
|
||||||
/* Set it as the active provider and exit the loop */
|
|
||||||
NsQuery->ActiveProvider = NextProvider;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the previous provider */
|
|
||||||
NextProvider = WsNqPreviousProvider(NsQuery, NextProvider);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the lock */
|
/* Get the last provider in the list and start looping */
|
||||||
WsNqUnlock();
|
Entry = NsQuery->ProviderList.Blink;
|
||||||
|
NextProvider = CONTAINING_RECORD(Entry, NSQUERY_PROVIDER, QueryLink);
|
||||||
/* Check if we have an active provider now */
|
while (NextProvider)
|
||||||
if (NextProvider)
|
|
||||||
{
|
{
|
||||||
/* Start loop */
|
/* Check if this is a new-style provider */
|
||||||
do
|
if (NextProvider->Provider->Service.NSPIoctl)
|
||||||
{
|
{
|
||||||
/* Call its routine */
|
/* Remove it and re-add it on top */
|
||||||
ErrorCode = WsNqProvLookupServiceNext(NextProvider,
|
RemoveEntryList(&NextProvider->QueryLink);
|
||||||
ControlFlags,
|
InsertHeadList(&NsQuery->ProviderList, &NextProvider->QueryLink);
|
||||||
BufferLength,
|
|
||||||
Results);
|
|
||||||
/* Check for error or shutdown */
|
|
||||||
if ((ErrorCode == ERROR_SUCCESS) ||
|
|
||||||
(GetLastError() == WSAEFAULT) || (NsQuery->ShuttingDown))
|
|
||||||
{
|
|
||||||
/* Get out */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Acquire Query Lock */
|
/* Set it as the active provider and exit the loop */
|
||||||
WsNqLock();
|
NsQuery->ActiveProvider = NextProvider;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Save the current active provider */
|
/* Get the previous provider */
|
||||||
Provider = NsQuery->ActiveProvider;
|
NextProvider = WsNqPreviousProvider(NsQuery, NextProvider);
|
||||||
|
|
||||||
/* Check if one exists */
|
|
||||||
if (Provider)
|
|
||||||
{
|
|
||||||
/* Get the next one */
|
|
||||||
NextProvider = WsNqNextProvider(NsQuery,
|
|
||||||
NsQuery->ActiveProvider);
|
|
||||||
|
|
||||||
/* Was the old provider our active? */
|
|
||||||
if (Provider == NsQuery->ActiveProvider)
|
|
||||||
{
|
|
||||||
/* Change our active provider to the new one */
|
|
||||||
NsQuery->ActiveProvider = NextProvider;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* No next provider */
|
|
||||||
NextProvider = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if we failed and if we can try again */
|
|
||||||
if (!(NextProvider) &&
|
|
||||||
(ErrorCode == SOCKET_ERROR) &&
|
|
||||||
(NsQuery->TryAgain))
|
|
||||||
{
|
|
||||||
/* Save the error code so RAS doesn't overwrite it */
|
|
||||||
OldErrorCode = GetLastError();
|
|
||||||
|
|
||||||
/* Make sure we won't try for a 3rd time */
|
|
||||||
NsQuery->TryAgain = FALSE;
|
|
||||||
|
|
||||||
/* Call the helper to auto-dial */
|
|
||||||
if (WSAttemptAutodialName(NsQuery->QuerySet))
|
|
||||||
{
|
|
||||||
/* It succeeded, so we'll delete the current state. */
|
|
||||||
while (!IsListEmpty(&NsQuery->ProviderList))
|
|
||||||
{
|
|
||||||
/* Remove the entry and get its provider */
|
|
||||||
Entry = RemoveHeadList(&NsQuery->ProviderList);
|
|
||||||
Provider = CONTAINING_RECORD(Entry,
|
|
||||||
NSQUERY_PROVIDER,
|
|
||||||
QueryLink);
|
|
||||||
|
|
||||||
/* Reset it */
|
|
||||||
WsNqProvLookupServiceEnd(Provider);
|
|
||||||
WsNqProvDelete(Provider);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start a new query */
|
|
||||||
if (!WsNqLookupServiceBegin(NsQuery,
|
|
||||||
NsQuery->QuerySet,
|
|
||||||
NsQuery->ControlFlags,
|
|
||||||
NsQuery->Catalog))
|
|
||||||
{
|
|
||||||
/* New query succeeded, set active provider now */
|
|
||||||
NsQuery->ActiveProvider =
|
|
||||||
WsNqNextProvider(NsQuery,
|
|
||||||
NsQuery->ActiveProvider);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Reset the error code */
|
|
||||||
SetLastError(OldErrorCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Release lock */
|
|
||||||
WsNqUnlock();
|
|
||||||
|
|
||||||
/* Keep looping as long as there is a provider */
|
|
||||||
} while (NextProvider);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
/* Release the lock */
|
||||||
|
WsNqUnlock();
|
||||||
|
|
||||||
|
/* Restart and keep looping as long as there is an active provider */
|
||||||
|
while (NextProvider)
|
||||||
{
|
{
|
||||||
/* We are shuting down; fail */
|
/* Call its routine */
|
||||||
SetLastError(WSAECANCELLED);
|
ErrorCode = WsNqProvLookupServiceNext(NextProvider,
|
||||||
|
ControlFlags,
|
||||||
|
BufferLength,
|
||||||
|
Results);
|
||||||
|
/* Check for error or shutdown */
|
||||||
|
if ((ErrorCode == ERROR_SUCCESS) ||
|
||||||
|
(GetLastError() == WSAEFAULT) || (NsQuery->ShuttingDown))
|
||||||
|
{
|
||||||
|
/* Get out */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Acquire Query Lock */
|
||||||
|
WsNqLock();
|
||||||
|
|
||||||
|
/* Save the current active provider */
|
||||||
|
Provider = NsQuery->ActiveProvider;
|
||||||
|
|
||||||
|
/* Check if one exists */
|
||||||
|
if (Provider)
|
||||||
|
{
|
||||||
|
/* Get the next one */
|
||||||
|
NextProvider = WsNqNextProvider(NsQuery,
|
||||||
|
NsQuery->ActiveProvider);
|
||||||
|
|
||||||
|
/* Was the old provider our active? */
|
||||||
|
if (Provider == NsQuery->ActiveProvider)
|
||||||
|
{
|
||||||
|
/* Change our active provider to the new one */
|
||||||
|
NsQuery->ActiveProvider = NextProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No next provider */
|
||||||
|
NextProvider = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if we failed and if we can try again */
|
||||||
|
if (!(NextProvider) &&
|
||||||
|
(ErrorCode == SOCKET_ERROR) &&
|
||||||
|
(NsQuery->TryAgain))
|
||||||
|
{
|
||||||
|
/* Save the error code so RAS doesn't overwrite it */
|
||||||
|
OldErrorCode = GetLastError();
|
||||||
|
|
||||||
|
/* Make sure we won't try for a 3rd time */
|
||||||
|
NsQuery->TryAgain = FALSE;
|
||||||
|
|
||||||
|
/* Call the helper to auto-dial */
|
||||||
|
if (WSAttemptAutodialName(NsQuery->QuerySet))
|
||||||
|
{
|
||||||
|
/* It succeeded, so we'll delete the current state. */
|
||||||
|
while (!IsListEmpty(&NsQuery->ProviderList))
|
||||||
|
{
|
||||||
|
/* Remove the entry and get its provider */
|
||||||
|
Entry = RemoveHeadList(&NsQuery->ProviderList);
|
||||||
|
Provider = CONTAINING_RECORD(Entry,
|
||||||
|
NSQUERY_PROVIDER,
|
||||||
|
QueryLink);
|
||||||
|
|
||||||
|
/* Reset it */
|
||||||
|
WsNqProvLookupServiceEnd(Provider);
|
||||||
|
WsNqProvDelete(Provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Start a new query */
|
||||||
|
if (WsNqLookupServiceBegin(NsQuery,
|
||||||
|
NsQuery->QuerySet,
|
||||||
|
NsQuery->ControlFlags,
|
||||||
|
NsQuery->Catalog) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
/* New query succeeded, set active provider now */
|
||||||
|
NsQuery->ActiveProvider =
|
||||||
|
WsNqNextProvider(NsQuery,
|
||||||
|
NsQuery->ActiveProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Reset the error code */
|
||||||
|
SetLastError(OldErrorCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release lock */
|
||||||
|
WsNqUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return */
|
/* Return */
|
||||||
|
@ -359,9 +352,8 @@ WsNqLookupServiceBegin(IN PNSQUERY NsQuery,
|
||||||
IN PNSCATALOG Catalog)
|
IN PNSCATALOG Catalog)
|
||||||
{
|
{
|
||||||
WSASERVICECLASSINFOW ClassInfo;
|
WSASERVICECLASSINFOW ClassInfo;
|
||||||
PNSQUERY_PROVIDER Provider;
|
|
||||||
LPWSASERVICECLASSINFOW pClassInfo = &ClassInfo;
|
LPWSASERVICECLASSINFOW pClassInfo = &ClassInfo;
|
||||||
PNSQUERY_PROVIDER NextProvider;
|
PNSQUERY_PROVIDER Provider, NextProvider;
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
INT ErrorCode;
|
INT ErrorCode;
|
||||||
DWORD ClassInfoSize;
|
DWORD ClassInfoSize;
|
||||||
|
@ -539,28 +531,28 @@ WSAAPI
|
||||||
WsNqPreviousProvider(IN PNSQUERY Query,
|
WsNqPreviousProvider(IN PNSQUERY Query,
|
||||||
IN PNSQUERY_PROVIDER Provider)
|
IN PNSQUERY_PROVIDER Provider)
|
||||||
{
|
{
|
||||||
PNSQUERY_PROVIDER NextProvider = NULL;
|
PNSQUERY_PROVIDER PrevProvider = NULL;
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
|
|
||||||
/* Get the first entry and get its provider */
|
/* Get the last entry and get its provider */
|
||||||
Entry = Provider->QueryLink.Blink;
|
Entry = Provider->QueryLink.Blink;
|
||||||
if (Entry != &Query->ProviderList)
|
if (Entry != &Query->ProviderList)
|
||||||
{
|
{
|
||||||
/* Get the current provider */
|
/* Get the current provider */
|
||||||
NextProvider = CONTAINING_RECORD(Entry, NSQUERY_PROVIDER, QueryLink);
|
PrevProvider = CONTAINING_RECORD(Entry, NSQUERY_PROVIDER, QueryLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return it */
|
/* Return it */
|
||||||
return NextProvider;
|
return PrevProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
BOOL
|
||||||
WSAAPI
|
WSAAPI
|
||||||
WsNqAddProvider(IN PNSQUERY Query,
|
WsNqAddProvider(IN PNSQUERY Query,
|
||||||
IN PNS_PROVIDER Provider)
|
IN PNS_PROVIDER Provider)
|
||||||
{
|
{
|
||||||
|
BOOL Success = TRUE;
|
||||||
PNSQUERY_PROVIDER QueryProvider;
|
PNSQUERY_PROVIDER QueryProvider;
|
||||||
DWORD Return = TRUE;
|
|
||||||
|
|
||||||
/* Allocate a new Query Provider */
|
/* Allocate a new Query Provider */
|
||||||
if ((QueryProvider = WsNqProvAllocate()))
|
if ((QueryProvider = WsNqProvAllocate()))
|
||||||
|
@ -575,11 +567,10 @@ WsNqAddProvider(IN PNSQUERY Query,
|
||||||
{
|
{
|
||||||
/* We failed */
|
/* We failed */
|
||||||
SetLastError(WSASYSCALLFAILURE);
|
SetLastError(WSASYSCALLFAILURE);
|
||||||
Return = FALSE;
|
Success = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return */
|
/* Return */
|
||||||
return Return;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -926,9 +926,9 @@ error:
|
||||||
|
|
||||||
INT
|
INT
|
||||||
WSAAPI
|
WSAAPI
|
||||||
MapUnicodeQuerySetToAnsi(OUT LPWSAQUERYSETW UnicodeSet,
|
MapUnicodeQuerySetToAnsi(IN LPWSAQUERYSETW UnicodeSet,
|
||||||
IN OUT PSIZE_T SetSize,
|
IN OUT PSIZE_T SetSize,
|
||||||
IN LPWSAQUERYSETA AnsiSet)
|
OUT LPWSAQUERYSETA AnsiSet)
|
||||||
{
|
{
|
||||||
INT ErrorCode = ERROR_SUCCESS;
|
INT ErrorCode = ERROR_SUCCESS;
|
||||||
SIZE_T UnicodeSize, AnsiSize;
|
SIZE_T UnicodeSize, AnsiSize;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS WinSock 2 API
|
* PROJECT: ReactOS WinSock 2 API
|
||||||
* FILE: dll/win32/ws2_32_new/src/rnr.c
|
* FILE: dll/win32/ws2_32_new/src/rnr.c
|
||||||
* PURPOSE: Registration n' Resolution Support
|
* PURPOSE: Registration and Resolution Support
|
||||||
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -285,11 +285,6 @@ WSALookupServiceBeginA(IN LPWSAQUERYSETA lpqsRestrictions,
|
||||||
dwControlFlags,
|
dwControlFlags,
|
||||||
lphLookup);
|
lphLookup);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Fail, conversion failed */
|
|
||||||
SetLastError(ErrorCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free our buffer */
|
/* Free our buffer */
|
||||||
HeapFree(WsSockHeap, 0, UnicodeQuerySet);
|
HeapFree(WsSockHeap, 0, UnicodeQuerySet);
|
||||||
|
@ -297,14 +292,13 @@ WSALookupServiceBeginA(IN LPWSAQUERYSETA lpqsRestrictions,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No memory to allocate */
|
/* No memory to allocate */
|
||||||
SetLastError(WSAEFAULT);
|
ErrorCode = WSAEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
/* Set the error in case of failure */
|
||||||
/* We couldn't get the size for some reason */
|
if (ErrorCode != ERROR_SUCCESS)
|
||||||
SetLastError(ErrorCode);
|
SetLastError(ErrorCode);
|
||||||
}
|
|
||||||
|
|
||||||
/* Return to caller */
|
/* Return to caller */
|
||||||
return ErrorCode == ERROR_SUCCESS ? ErrorCode : SOCKET_ERROR;
|
return ErrorCode == ERROR_SUCCESS ? ErrorCode : SOCKET_ERROR;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue