Author: tfaber
Date: Tue Feb 17 08:08:04 2015
New Revision: 66331
URL:
http://svn.reactos.org/svn/reactos?rev=66331&view=rev
Log:
[WIN32K:NTUSER]
- Remove unneeded casts, fix format specifiers, and clarify some logic in
co_MsqSendMessage
Modified:
trunk/reactos/win32ss/user/ntuser/msgqueue.c
Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgque…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] Tue Feb 17 08:08:04 2015
@@ -99,7 +99,7 @@
if (MessageQueue->iCursorLevel < 0)
return OldCursor;
- // Fixes the error message "Not the same cursor!".
+ // Fixes the error message "Not the same cursor!".
if (gpqCursor == NULL)
{
gpqCursor = MessageQueue;
@@ -446,7 +446,7 @@
}
if (MessageBits & QS_MOUSEMOVE)
{ // Account for tracking mouse moves..
- if (pti->nCntsQBits[QSRosMouseMove])
+ if (pti->nCntsQBits[QSRosMouseMove])
{
pti->nCntsQBits[QSRosMouseMove] = 0; // Throttle down count. Up to > 3:1
entries are ignored.
ClrMask |= QS_MOUSEMOVE;
@@ -1062,11 +1062,11 @@
if (pti->TIF_flags & TIF_INCLEANUP && !(ptirec->TIF_flags &
TIF_INCLEANUP))
{
// Parent notify is the big one. Fire and forget!
- TRACE("Send message from dying thread %d\n",Msg);
+ TRACE("Send message from dying thread %u\n", Msg);
co_MsqSendMessageAsync(ptirec, Wnd, Msg, wParam, lParam, NULL, 0, FALSE,
HookMessage);
}
if (uResult) *uResult = -1;
- TRACE("MsqSM: Msg %d Current pti %lu or Rec pti %lu\n", Msg,
pti->TIF_flags & TIF_INCLEANUP, ptirec->TIF_flags & TIF_INCLEANUP);
+ TRACE("MsqSM: Msg %u Current pti %lu or Rec pti %lu\n", Msg,
pti->TIF_flags & TIF_INCLEANUP, ptirec->TIF_flags & TIF_INCLEANUP);
return STATUS_UNSUCCESSFUL;
}
@@ -1112,7 +1112,7 @@
if(!(Message = ExAllocatePoolWithTag(PagedPool, sizeof(USER_SENT_MESSAGE),
TAG_USRMSG)))
{
- ERR("MsqSendMessage(): Not enough memory to allocate a message");
+ ERR("MsqSendMessage(): Not enough memory to allocate a message\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -1171,8 +1171,7 @@
Entry = ptirec->SentMessagesListHead.Flink;
while (Entry != &ptirec->SentMessagesListHead)
{
- if ((PUSER_SENT_MESSAGE) CONTAINING_RECORD(Entry, USER_SENT_MESSAGE,
ListEntry)
- == Message)
+ if (CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry) == Message)
{
/* We can access Message here, it's secure because the message queue
is locked
and the message is still hasn't been dispatched */
@@ -1187,17 +1186,16 @@
Entry = Entry->Flink;
}
- TRACE("MsqSendMessage (blocked) timed out 1 Status %p\n",WaitStatus);
+ TRACE("MsqSendMessage (blocked) timed out 1 Status %lx\n",
WaitStatus);
}
// Receiving thread passed on and left us hanging with issues still pending.
- if ( WaitStatus == STATUS_WAIT_1 )
+ else if (WaitStatus == STATUS_WAIT_1)
{
ERR("Bk Receiving Thread woken up dead!\n");
Entry = pti->DispatchingMessagesHead.Flink;
while (Entry != &pti->DispatchingMessagesHead)
{
- if ((PUSER_SENT_MESSAGE) CONTAINING_RECORD(Entry, USER_SENT_MESSAGE,
DispatchingListEntry)
- == Message)
+ if (CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, DispatchingListEntry) ==
Message)
{
Message->CompletionEvent = NULL;
Message->Result = NULL;
@@ -1235,8 +1233,7 @@
Entry = ptirec->SentMessagesListHead.Flink;
while (Entry != &ptirec->SentMessagesListHead)
{
- if ((PUSER_SENT_MESSAGE) CONTAINING_RECORD(Entry, USER_SENT_MESSAGE,
ListEntry)
- == Message)
+ if (CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry) == Message)
{
/* We can access Message here, it's secure because the message
queue is locked
and the message is still hasn't been dispatched */
@@ -1251,19 +1248,18 @@
Entry = Entry->Flink;
}
- TRACE("MsqSendMessage timed out 2 Status %p\n",WaitStatus);
-
+ TRACE("MsqSendMessage timed out 2 Status %lx\n", WaitStatus);
+
break;
}
// Receiving thread passed on and left us hanging with issues still pending.
- if ( WaitStatus == STATUS_WAIT_2 )
+ else if (WaitStatus == STATUS_WAIT_2)
{
ERR("NB Receiving Thread woken up dead!\n");
Entry = pti->DispatchingMessagesHead.Flink;
while (Entry != &pti->DispatchingMessagesHead)
{
- if ((PUSER_SENT_MESSAGE) CONTAINING_RECORD(Entry, USER_SENT_MESSAGE,
DispatchingListEntry)
- == Message)
+ if (CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, DispatchingListEntry) ==
Message)
{
Message->CompletionEvent = NULL;
Message->Result = NULL;
@@ -1279,11 +1275,10 @@
while (co_MsqDispatchOneSentMessage(pti))
;
- }
- while (NT_SUCCESS(WaitStatus) && WaitStatus == STATUS_WAIT_1);
- }
-
- if ( WaitStatus == STATUS_USER_APC )
+ } while (WaitStatus == STATUS_WAIT_1);
+ }
+
+ if (WaitStatus == STATUS_USER_APC)
{
// The current thread is dying!
TRACE("User APC\n");
@@ -1291,7 +1286,7 @@
ERR("User APC Returned\n"); // Should not see this message.
}
- if ( WaitStatus != STATUS_TIMEOUT )
+ if (WaitStatus != STATUS_TIMEOUT)
{
if (uResult)
{