Author: mjmartin
Date: Sat Jun 26 09:15:32 2010
New Revision: 47849
URL:
http://svn.reactos.org/svn/reactos?rev=47849&view=rev
Log:
[win32k]
- co_IntSendMessageWithCallBack is called for two reasons; for messages that originate
from win32k and from user mode when using Callbacks.
For both cases do not do anything with the sendqueue member of message struct and do not
add the message to the senders dispatch message list.
- In msgqueue related functions, check if the message is a nowait messages before
attempting to remove and entry from the dispatch message list as it doesnt exist.
- Fixes a NonPagedPool corruption that was occurring on regtest bootcd. Thanks Caemyr for
testing.
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/message.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Sat Jun 26
09:15:32 2010
@@ -1646,8 +1646,8 @@
Message->Msg.lParam = lParamPacked;
Message->CompletionEvent = NULL;
Message->Result = 0;
- Message->SenderQueue = Win32Thread->MessageQueue;
- IntReferenceMessageQueue(Message->SenderQueue);
+ Message->SenderQueue = NULL; //Win32Thread->MessageQueue;
+
IntReferenceMessageQueue(Window->pti->MessageQueue);
Message->CompletionCallback = CompletionCallback;
Message->CompletionCallbackContext = CompletionCallbackContext;
@@ -1655,9 +1655,7 @@
Message->HasPackedLParam = (lParamBufferSize > 0);
InsertTailList(&Window->pti->MessageQueue->SentMessagesListHead,
&Message->ListEntry);
- InsertTailList(&Win32Thread->MessageQueue->DispatchingMessagesHead,
&Message->DispatchingListEntry);
IntDereferenceMessageQueue(Window->pti->MessageQueue);
- IntDereferenceMessageQueue(Message->SenderQueue);
RETURN(TRUE);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Sat Jun 26
09:15:32 2010
@@ -936,12 +936,15 @@
to be cleaned up on thread termination anymore */
RemoveEntryList(&Message->ListEntry);
- /* remove the message from the dispatching list, so lock the sender's message
queue */
- SenderReturned = (Message->DispatchingListEntry.Flink == NULL);
- if (!SenderReturned)
- {
- /* only remove it from the dispatching list if not already removed by a timeout */
- RemoveEntryList(&Message->DispatchingListEntry);
+ /* remove the message from the dispatching list if needed, so lock the sender's
message queue */
+ if (!(Message->HookMessage & MSQ_SENTNOWAIT))
+ {
+ SenderReturned = (Message->DispatchingListEntry.Flink == NULL);
+ if (!SenderReturned)
+ {
+ /* only remove it from the dispatching list if not already removed by a timeout
*/
+ RemoveEntryList(&Message->DispatchingListEntry);
+ }
}
/* still keep the sender's message queue locked, so the sender can't exit the
MsqSendMessage() function (if timed out) */
@@ -974,7 +977,6 @@
Result);
}
-
/* Only if it is not a no wait message */
if (!(Message->HookMessage & MSQ_SENTNOWAIT))
{
@@ -1033,8 +1035,9 @@
RemoveEntryList(&SentMessage->ListEntry);
- /* remove the message from the dispatching list */
- if(SentMessage->DispatchingListEntry.Flink != NULL)
+ /* remove the message from the dispatching list if neede */
+ if ((!(SentMessage->HookMessage & MSQ_SENTNOWAIT))
+ && (SentMessage->DispatchingListEntry.Flink != NULL))
{
RemoveEntryList(&SentMessage->DispatchingListEntry);
}
@@ -1453,8 +1456,9 @@
DPRINT("Notify the sender and remove a message from the queue that had not
been dispatched\n");
- /* remove the message from the dispatching list */
- if(CurrentSentMessage->DispatchingListEntry.Flink != NULL)
+ /* remove the message from the dispatching list if needed */
+ if ((!(CurrentSentMessage->HookMessage & MSQ_SENTNOWAIT))
+ && (CurrentSentMessage->DispatchingListEntry.Flink != NULL))
{
RemoveEntryList(&CurrentSentMessage->DispatchingListEntry);
}
@@ -1526,6 +1530,7 @@
IntDereferenceMessageQueue(MessageQueue);
IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue);
}
+
/* free the message */
ExFreePool(CurrentSentMessage);
}