Author: hbelusca
Date: Sat Mar 4 01:09:28 2017
New Revision: 74045
URL: http://svn.reactos.org/svn/reactos?rev=74045&view=rev
Log:
[WS2_32]
- Turn the "!memcmp(ptr1, ptr2, sizeof(GUID))" into IsEqualGUID(ptr1, ptr2) macro calls (aka. make code readable);
this also allowed me to discover a logical bug in the GUID comparison in WsNcUpdateNamespaceList.
- Fix few comments, and rename some goto labels to make their meaning clearer (they are not only taken for error code paths,
but also on regular path, for cleanup before returning from the function).
CORE-12880
Modified:
trunk/reactos/dll/win32/ws2_32/src/dcatalog.c
trunk/reactos/dll/win32/ws2_32/src/nscatalo.c
trunk/reactos/dll/win32/ws2_32/src/nsquery.c
trunk/reactos/dll/win32/ws2_32/src/qshelpr.c
Modified: trunk/reactos/dll/win32/ws2_32/src/dcatalog.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/dcata…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/dcatalog.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/dcatalog.c [iso-8859-1] Sat Mar 4 01:09:28 2017
@@ -591,10 +591,8 @@
Provider = CatalogEntry->Provider;
/* Check for a match */
- if ((Provider) &&
- !(memcmp(&CatalogEntry->ProtocolInfo.ProviderId,
- ProviderId,
- sizeof(GUID))))
+ if (Provider &&
+ IsEqualGUID(&CatalogEntry->ProtocolInfo.ProviderId, ProviderId))
{
/* Found a match */
return Provider;
@@ -879,10 +877,8 @@
/* Get this entry */
CatalogEntry = CONTAINING_RECORD(Entry, TCATALOG_ENTRY, CatalogLink);
- /* Remove it */
+ /* Remove it and dereference it */
WsTcRemoveCatalogItem(Catalog, CatalogEntry);
-
- /* Dereference it */
WsTcEntryDereference(CatalogEntry);
/* Move to the next entry */
Modified: trunk/reactos/dll/win32/ws2_32/src/nscatalo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/nscat…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/nscatalo.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/nscatalo.c [iso-8859-1] Sat Mar 4 01:09:28 2017
@@ -459,9 +459,8 @@
Entry = Entry->Flink;
/* Check if they match */
- if (memcmp(&CatalogEntry->ProviderId,
- &OldCatalogEntry->ProviderId,
- sizeof(GUID)))
+ if (IsEqualGUID(&CatalogEntry->ProviderId,
+ &OldCatalogEntry->ProviderId))
{
/* We have a match, use the old item instead */
WsNcEntryDereference(CatalogEntry);
@@ -513,7 +512,7 @@
NextEntry = NextEntry->Flink;
/* Check if this is the Catalog Entry ID we want */
- if (!(memcmp(&Entry->ProviderId, ProviderId, sizeof(GUID))))
+ if (IsEqualGUID(&Entry->ProviderId, ProviderId))
{
/* Check if it doesn't already have a provider */
if (!Entry->Provider)
@@ -619,10 +618,8 @@
/* Get this entry */
CatalogEntry = CONTAINING_RECORD(Entry, NSCATALOG_ENTRY, CatalogLink);
- /* Remove it */
+ /* Remove it and dereference it */
WsNcRemoveCatalogItem(Catalog, CatalogEntry);
-
- /* Dereference it */
WsNcEntryDereference(CatalogEntry);
/* Move to the next entry */
Modified: trunk/reactos/dll/win32/ws2_32/src/nsquery.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/nsque…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/nsquery.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/nsquery.c [iso-8859-1] Sat Mar 4 01:09:28 2017
@@ -373,7 +373,7 @@
SetLastError(ErrorCode);
ErrorCode = SOCKET_ERROR;
NsQuery->TryAgain = FALSE;
- goto error;
+ goto Exit;
}
/* Cache the information for a restart */
@@ -384,17 +384,17 @@
/* Check if we have a specific ID */
if (Restrictions->lpNSProviderId)
{
- /* Get the provider */
+ /* Get the catalog entry */
ErrorCode = WsNcGetCatalogFromProviderId(Catalog,
Restrictions->lpNSProviderId,
&CatalogEntry);
- /* Check for success */
+ /* Check for failure */
if (ErrorCode != ERROR_SUCCESS)
{
/* Fail */
SetLastError(WSAEINVAL);
ErrorCode = SOCKET_ERROR;
- goto error;
+ goto Exit;
}
else
{
@@ -422,7 +422,7 @@
/* Fail */
SetLastError(WSAEINVAL);
ErrorCode = SOCKET_ERROR;
- goto error;
+ goto Exit;
}
}
@@ -447,7 +447,7 @@
/* We don't have any providers to handle this! */
ErrorCode = SOCKET_ERROR;
SetLastError(WSASERVICE_NOT_FOUND);
- goto error;
+ goto Exit;
}
/* Get the first provider and loop */
@@ -476,7 +476,7 @@
}
}
-error:
+Exit:
/* Check if we had an error somewhere */
if (ErrorCode == SOCKET_ERROR)
{
Modified: trunk/reactos/dll/win32/ws2_32/src/qshelpr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/qshel…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/qshelpr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/qshelpr.c [iso-8859-1] Sat Mar 4 01:09:28 2017
@@ -823,12 +823,12 @@
{
/* Fail, couldn't allocate memory */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Build the relative buffer version */
ErrorCode = WSABuildQuerySetBufferA(AnsiSet, AnsiSize, AnsiCopy);
- if (ErrorCode != ERROR_SUCCESS) goto error;
+ if (ErrorCode != ERROR_SUCCESS) goto Exit;
/* Re-use the ANSI version since the fields match */
UnicodeCopy = (LPWSAQUERYSETW)AnsiCopy;
@@ -842,7 +842,7 @@
{
/* Fail */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Set the new string pointer */
@@ -858,7 +858,7 @@
{
/* Fail */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Set the new string pointer */
@@ -874,7 +874,7 @@
{
/* Fail */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Set the new string pointer */
@@ -890,7 +890,7 @@
{
/* Fail */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Set the new string pointer */
@@ -904,13 +904,13 @@
/* The buffer wasn't large enough; return how much we need */
*SetSize = UnicodeSize;
ErrorCode = WSAEFAULT;
- goto error;
+ goto Exit;
}
/* Build the relative unicode buffer */
ErrorCode = WSABuildQuerySetBufferW(UnicodeCopy, *SetSize, UnicodeSet);
-error:
+Exit:
/* Free the Ansi copy if we had one */
if (AnsiCopy) HeapFree(WsSockHeap, 0, AnsiCopy);
@@ -944,12 +944,12 @@
{
/* Fail, couldn't allocate memory */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Build the relative buffer version */
ErrorCode = WSABuildQuerySetBufferW(UnicodeSet, UnicodeSize, UnicodeCopy);
- if (ErrorCode != ERROR_SUCCESS) goto error;
+ if (ErrorCode != ERROR_SUCCESS) goto Exit;
/* Re-use the Unicode version since the fields match */
AnsiCopy = (LPWSAQUERYSETA)UnicodeCopy;
@@ -963,7 +963,7 @@
{
/* Fail */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Set the new string pointer */
@@ -979,7 +979,7 @@
{
/* Fail */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Set the new string pointer */
@@ -995,7 +995,7 @@
{
/* Fail */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Set the new string pointer */
@@ -1011,7 +1011,7 @@
{
/* Fail */
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
- goto error;
+ goto Exit;
}
/* Set the new string pointer */
@@ -1025,13 +1025,13 @@
/* The buffer wasn't large enough; return how much we need */
*SetSize = AnsiSize;
ErrorCode = WSAEFAULT;
- goto error;
+ goto Exit;
}
/* Build the relative unicode buffer */
ErrorCode = WSABuildQuerySetBufferA(AnsiCopy, *SetSize, AnsiSet);
-error:
+Exit:
/* Free the Ansi copy if we had one */
if (UnicodeCopy) HeapFree(WsSockHeap, 0, UnicodeCopy);
Author: hbelusca
Date: Fri Mar 3 23:31:32 2017
New Revision: 74041
URL: http://svn.reactos.org/svn/reactos?rev=74041&view=rev
Log:
[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.
Modified:
trunk/reactos/dll/win32/ws2_32/src/async.c
trunk/reactos/dll/win32/ws2_32/src/dcatalog.c
trunk/reactos/dll/win32/ws2_32/src/nscatalo.c
trunk/reactos/dll/win32/ws2_32/src/nsquery.c
trunk/reactos/dll/win32/ws2_32/src/qshelpr.c
trunk/reactos/dll/win32/ws2_32/src/rnr.c
Modified: trunk/reactos/dll/win32/ws2_32/src/async.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/async…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/async.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/async.c [iso-8859-1] Fri Mar 3 23:31:32 2017
@@ -721,7 +721,7 @@
WsAsyncLock();
/* Process the queue */
- while (ListHead->Flink != ListHead)
+ while (!IsListEmpty(ListHead))
{
/* Remove this entry and get the async block */
Entry = RemoveHeadList(ListHead);
Modified: trunk/reactos/dll/win32/ws2_32/src/dcatalog.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/dcata…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/dcatalog.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/dcatalog.c [iso-8859-1] Fri Mar 3 23:31:32 2017
@@ -384,7 +384,7 @@
IN PTCATALOG_ENTRY *CatalogEntry)
{
INT ErrorCode = WSAEINVAL;
- PLIST_ENTRY NextEntry = Catalog->ProtocolList.Flink;
+ PLIST_ENTRY NextEntry;
PTCATALOG_ENTRY Entry;
/* Assume failure */
@@ -394,6 +394,7 @@
WsTcLock();
/* Match the Id with all the entries in the List */
+ NextEntry = Catalog->ProtocolList.Flink;
while (NextEntry != &Catalog->ProtocolList)
{
/* Get the Current Entry */
@@ -435,13 +436,14 @@
IN PTCATALOG_ENTRY *CatalogEntry)
{
INT ErrorCode = WSAEINVAL;
- PLIST_ENTRY NextEntry = Catalog->ProtocolList.Flink;
+ PLIST_ENTRY NextEntry;
PTCATALOG_ENTRY Entry;
/* Lock the catalog */
WsTcLock();
/* Match the Id with all the entries in the List */
+ NextEntry = Catalog->ProtocolList.Flink;
while (NextEntry != &Catalog->ProtocolList)
{
/* Get the Current Entry */
@@ -483,7 +485,7 @@
IN PTCATALOG_ENTRY *CatalogEntry)
{
INT ErrorCode = WSAEINVAL;
- PLIST_ENTRY NextEntry = Catalog->ProtocolList.Flink;
+ PLIST_ENTRY NextEntry;
PTCATALOG_ENTRY Entry;
DPRINT("WsTcGetEntryFromTriplet: %lx, %lx, %lx, %lx\n", af, type, protocol, StartId);
@@ -492,6 +494,8 @@
/* Lock the catalog */
WsTcLock();
+
+ NextEntry = Catalog->ProtocolList.Flink;
/* Check if we are starting past 0 */
if (StartId)
@@ -674,14 +678,14 @@
RemoveEntryList(&Catalog->ProtocolList);
InitializeListHead(&Catalog->ProtocolList);
- /* Loop every item on the list */
+ /* Loop every item in the list */
while (!IsListEmpty(List))
{
/* Get the catalog entry */
Entry = RemoveHeadList(List);
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;
while (Entry != &TempList)
{
@@ -709,7 +713,7 @@
Catalog->ItemCount++;
}
- /* If there's anything left on the temporary list */
+ /* If there's anything left in the temporary list */
while (!IsListEmpty(&TempList))
{
/* Get the entry */
Modified: trunk/reactos/dll/win32/ws2_32/src/nscatalo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/nscat…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/nscatalo.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/nscatalo.c [iso-8859-1] Fri Mar 3 23:31:32 2017
@@ -498,13 +498,14 @@
IN LPGUID ProviderId,
OUT PNSCATALOG_ENTRY *CatalogEntry)
{
- PLIST_ENTRY NextEntry = Catalog->CatalogList.Flink;
+ PLIST_ENTRY NextEntry;
PNSCATALOG_ENTRY Entry;
/* Lock the catalog */
WsNcLock();
/* Match the Id with all the entries in the List */
+ NextEntry = Catalog->CatalogList.Flink;
while (NextEntry != &Catalog->CatalogList)
{
/* Get the Current Entry */
Modified: trunk/reactos/dll/win32/ws2_32/src/nsquery.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/nsque…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/nsquery.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/nsquery.c [iso-8859-1] Fri Mar 3 23:31:32 2017
@@ -134,9 +134,9 @@
if (!(Provider = Entry->Provider))
{
/* 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;
}
@@ -145,7 +145,7 @@
}
/* Add it to the query */
- if (!(WsNqAddProvider(NsQuery, Provider)))
+ if (!WsNqAddProvider(NsQuery, Provider))
{
/* We failed */
EnumContext->ErrorCode = WSASYSCALLFAILURE;
@@ -194,157 +194,150 @@
OUT PDWORD BufferLength,
OUT LPWSAQUERYSETW Results)
{
+ INT ErrorCode = SOCKET_ERROR, OldErrorCode;
PNSQUERY_PROVIDER Provider, NextProvider;
- INT ErrorCode = SOCKET_ERROR, OldErrorCode;
PLIST_ENTRY Entry;
/* Make sure we're not shutting down */
- if (!NsQuery->ShuttingDown)
- {
- /* Acquire query lock */
+ if (NsQuery->ShuttingDown)
+ {
+ /* We are shutting down, fail */
+ SetLastError(WSAECANCELLED);
+ return ErrorCode;
+ }
+
+ /* Acquire query lock */
+ WsNqLock();
+
+ /* Check if we already have an active provider */
+ NextProvider = NsQuery->ActiveProvider;
+ if (!NextProvider)
+ {
+ /* Make sure we have a current provider */
+ if (!NsQuery->CurrentProvider)
+ {
+ /* We don't; fail */
+ WsNqUnlock();
+ SetLastError(WSA_E_NO_MORE);
+ return SOCKET_ERROR;
+ }
+
+ /* Get the last provider in 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 */
+ WsNqUnlock();
+
+ /* Restart and keep looping as long as there is an active provider */
+ while (NextProvider)
+ {
+ /* Call its routine */
+ 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();
- /* Check if we already have an active provider */
- NextProvider = NsQuery->ActiveProvider;
- if (!NextProvider)
- {
- /* Make sure we have a current provider */
- if (!NsQuery->CurrentProvider)
+ /* 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)
{
- /* We don't; fail */
- WsNqUnlock();
- SetLastError(WSA_E_NO_MORE);
- return SOCKET_ERROR;
+ /* Change our active provider to the new one */
+ NsQuery->ActiveProvider = NextProvider;
}
-
- /* Get the first provider on the list and start looping */
- Entry = NsQuery->ProviderList.Blink;
- NextProvider = CONTAINING_RECORD(Entry, NSQUERY_PROVIDER, QueryLink);
- while (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))
{
- /* Check if this is a new-style provider */
- if (NextProvider->Provider->Service.NSPIoctl)
+ /* It succeeded, so we'll delete the current state. */
+ while (!IsListEmpty(&NsQuery->ProviderList))
{
- /* 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;
+ /* Remove the entry and get its provider */
+ Entry = RemoveHeadList(&NsQuery->ProviderList);
+ Provider = CONTAINING_RECORD(Entry,
+ NSQUERY_PROVIDER,
+ QueryLink);
+
+ /* Reset it */
+ WsNqProvLookupServiceEnd(Provider);
+ WsNqProvDelete(Provider);
}
- /* Get the previous provider */
- NextProvider = WsNqPreviousProvider(NsQuery, NextProvider);
+ /* 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);
+ }
}
- }
-
- /* Release the lock */
+ else
+ {
+ /* Reset the error code */
+ SetLastError(OldErrorCode);
+ }
+ }
+
+ /* Release lock */
WsNqUnlock();
-
- /* Check if we have an active provider now */
- if (NextProvider)
- {
- /* Start loop */
- do
- {
- /* Call its routine */
- 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))
- {
- /* 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
- {
- /* We are shuting down; fail */
- SetLastError(WSAECANCELLED);
}
/* Return */
@@ -359,9 +352,8 @@
IN PNSCATALOG Catalog)
{
WSASERVICECLASSINFOW ClassInfo;
- PNSQUERY_PROVIDER Provider;
LPWSASERVICECLASSINFOW pClassInfo = &ClassInfo;
- PNSQUERY_PROVIDER NextProvider;
+ PNSQUERY_PROVIDER Provider, NextProvider;
PLIST_ENTRY Entry;
INT ErrorCode;
DWORD ClassInfoSize;
@@ -539,28 +531,28 @@
WsNqPreviousProvider(IN PNSQUERY Query,
IN PNSQUERY_PROVIDER Provider)
{
- PNSQUERY_PROVIDER NextProvider = NULL;
+ PNSQUERY_PROVIDER PrevProvider = NULL;
PLIST_ENTRY Entry;
- /* Get the first entry and get its provider */
+ /* Get the last entry and get its provider */
Entry = Provider->QueryLink.Blink;
if (Entry != &Query->ProviderList)
{
/* Get the current provider */
- NextProvider = CONTAINING_RECORD(Entry, NSQUERY_PROVIDER, QueryLink);
+ PrevProvider = CONTAINING_RECORD(Entry, NSQUERY_PROVIDER, QueryLink);
}
/* Return it */
- return NextProvider;
-}
-
-DWORD
+ return PrevProvider;
+}
+
+BOOL
WSAAPI
WsNqAddProvider(IN PNSQUERY Query,
IN PNS_PROVIDER Provider)
{
+ BOOL Success = TRUE;
PNSQUERY_PROVIDER QueryProvider;
- DWORD Return = TRUE;
/* Allocate a new Query Provider */
if ((QueryProvider = WsNqProvAllocate()))
@@ -575,11 +567,10 @@
{
/* We failed */
SetLastError(WSASYSCALLFAILURE);
- Return = FALSE;
+ Success = FALSE;
}
/* Return */
- return Return;
-}
-
-
+ return Success;
+}
+
Modified: trunk/reactos/dll/win32/ws2_32/src/qshelpr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/qshel…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/qshelpr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/qshelpr.c [iso-8859-1] Fri Mar 3 23:31:32 2017
@@ -926,9 +926,9 @@
INT
WSAAPI
-MapUnicodeQuerySetToAnsi(OUT LPWSAQUERYSETW UnicodeSet,
+MapUnicodeQuerySetToAnsi(IN LPWSAQUERYSETW UnicodeSet,
IN OUT PSIZE_T SetSize,
- IN LPWSAQUERYSETA AnsiSet)
+ OUT LPWSAQUERYSETA AnsiSet)
{
INT ErrorCode = ERROR_SUCCESS;
SIZE_T UnicodeSize, AnsiSize;
Modified: trunk/reactos/dll/win32/ws2_32/src/rnr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/rnr.c…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/rnr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/rnr.c [iso-8859-1] Fri Mar 3 23:31:32 2017
@@ -2,7 +2,7 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS WinSock 2 API
* FILE: dll/win32/ws2_32_new/src/rnr.c
- * PURPOSE: Registration n' Resolution Support
+ * PURPOSE: Registration and Resolution Support
* PROGRAMMER: Alex Ionescu (alex(a)relsoft.net)
*/
@@ -285,11 +285,6 @@
dwControlFlags,
lphLookup);
}
- else
- {
- /* Fail, conversion failed */
- SetLastError(ErrorCode);
- }
/* Free our buffer */
HeapFree(WsSockHeap, 0, UnicodeQuerySet);
@@ -297,14 +292,13 @@
else
{
/* No memory to allocate */
- SetLastError(WSAEFAULT);
+ ErrorCode = WSAEFAULT;
}
}
- else
- {
- /* We couldn't get the size for some reason */
+
+ /* Set the error in case of failure */
+ if (ErrorCode != ERROR_SUCCESS)
SetLastError(ErrorCode);
- }
/* Return to caller */
return ErrorCode == ERROR_SUCCESS ? ErrorCode : SOCKET_ERROR;
Author: gadamopoulos
Date: Fri Mar 3 14:35:19 2017
New Revision: 74038
URL: http://svn.reactos.org/svn/reactos?rev=74038&view=rev
Log:
[UXTHEME]: Use SendMessage to notify windows that the theme has changed. This needs a proper test. Makes it possible for SetWindowTheme with empty parameters to have effect immediately in the same way the tests for BCM_GETIDEALSIZE use it. Fixes the BCM_GETIDEALSIZE tests when run with an active theme.
Modified:
trunk/reactos/dll/win32/uxtheme/system.c
Modified: trunk/reactos/dll/win32/uxtheme/system.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/system.c…
==============================================================================
--- trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] Fri Mar 3 14:35:19 2017
@@ -57,7 +57,7 @@
static BOOL CALLBACK UXTHEME_broadcast_msg_enumchild (HWND hWnd, LPARAM msg)
{
- PostMessageW(hWnd, msg, 0, 0);
+ SendMessageW(hWnd, msg, 0, 0);
return TRUE;
}
@@ -70,7 +70,7 @@
}
else
{
- PostMessageW(hWnd, msg, 0, 0);
+ SendMessageW(hWnd, msg, 0, 0);
EnumChildWindows (hWnd, UXTHEME_broadcast_msg_enumchild, msg);
}
return TRUE;