Author: jimtabor
Date: Fri Dec 3 18:02:02 2010
New Revision: 49935
URL:
http://svn.reactos.org/svn/reactos?rev=49935&view=rev
Log:
[Win32k]
- More fixes to In Send and Reply message support.
Modified:
trunk/reactos/subsystems/win32/win32k/include/msgqueue.h
trunk/reactos/subsystems/win32/win32k/include/win32.h
trunk/reactos/subsystems/win32/win32k/ntuser/message.c
trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsystems/win32/win32k/include/msgqueue.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] Fri Dec 3
18:02:02 2010
@@ -38,6 +38,7 @@
LRESULT* Result;
LRESULT lResult;
struct _USER_MESSAGE_QUEUE* SenderQueue;
+ struct _USER_MESSAGE_QUEUE* CallBackSenderQueue;
SENDASYNCPROC CompletionCallback;
ULONG_PTR CompletionCallbackContext;
/* entry in the dispatching list of the sender's message queue */
Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Fri Dec 3 18:02:02
2010
@@ -75,6 +75,7 @@
PCLIENTINFO pClientInfo;
FLONG TIF_flags;
PUNICODE_STRING pstrAppName;
+ struct _USER_SENT_MESSAGE *pusmCurrent;
LONG timeLast;
ULONG_PTR idLast;
INT exitCode;
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] Fri Dec 3
18:02:02 2010
@@ -1383,7 +1383,8 @@
Message->Result = 0;
Message->lResult = 0;
Message->QS_Flags = 0;
- Message->SenderQueue = NULL; // mjmartin, you are right! This is null.
Win32Thread->MessageQueue;
+ Message->SenderQueue = NULL; // mjmartin, you are right! This is null.
+ Message->CallBackSenderQueue = Win32Thread->MessageQueue;
IntReferenceMessageQueue(Window->head.pti->MessageQueue);
Message->CompletionCallback = CompletionCallback;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Fri Dec 3 18:02:02
2010
@@ -102,18 +102,13 @@
break;
case THREADSTATE_INSENDMESSAGE:
{
- PUSER_SENT_MESSAGE Message;
- PLIST_ENTRY Entry;
- PUSER_MESSAGE_QUEUE MessageQueue =
- ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->MessageQueue;
+ PUSER_SENT_MESSAGE Message =
+ ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->pusmCurrent;
DPRINT1("THREADSTATE_INSENDMESSAGE\n");
ret = ISMEX_NOSEND;
- if (!IsListEmpty(&MessageQueue->SentMessagesListHead))
+ if (Message)
{
- Entry = MessageQueue->SentMessagesListHead.Flink;
- Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry);
-
if (Message->SenderQueue)
ret = ISMEX_SEND;
else
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] Fri Dec 3
18:02:02 2010
@@ -418,7 +418,7 @@
BOOLEAN FASTCALL
co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
{
- PUSER_SENT_MESSAGE Message;
+ PUSER_SENT_MESSAGE SaveMsg, Message;
PLIST_ENTRY Entry;
LRESULT Result;
PTHREADINFO pti;
@@ -433,9 +433,14 @@
Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry);
pti = MessageQueue->Thread->Tcb.Win32Thread;
+
+ SaveMsg = pti->pusmCurrent;
+ pti->pusmCurrent = Message;
+
// Processing a message sent to it from another thread.
- if ( MessageQueue != Message->SenderQueue ) // most likely, but, to be sure.
- {
+ if ( ( Message->SenderQueue && MessageQueue != Message->SenderQueue) ||
+ ( Message->CallBackSenderQueue && MessageQueue !=
Message->CallBackSenderQueue ))
+ { // most likely, but, to be sure.
pti->pcti->CTI_flags |= CTI_INSENDMESSAGE; // Let the user know...
}
@@ -528,6 +533,7 @@
ExFreePoolWithTag(Message, TAG_USRMSG);
pti->pcti->CTI_flags &= ~CTI_INSENDMESSAGE;
+ pti->pusmCurrent = SaveMsg;
return(TRUE);
}
@@ -659,6 +665,7 @@
Message->lResult = 0;
Message->QS_Flags = 0;
Message->SenderQueue = ThreadQueue;
+ Message->CallBackSenderQueue = NULL;
IntReferenceMessageQueue(ThreadQueue);
Message->CompletionCallback = NULL;
Message->CompletionCallbackContext = 0;
@@ -1606,34 +1613,26 @@
return MessageQueue->ExtraInfo;
}
+// ReplyMessage is called by the thread receiving the window message.
BOOL FASTCALL
co_MsqReplyMessage( LRESULT lResult )
{
PUSER_SENT_MESSAGE Message;
- PLIST_ENTRY Entry;
PTHREADINFO pti;
- PUSER_MESSAGE_QUEUE MessageQueue;
pti = PsGetCurrentThreadWin32Thread();
- MessageQueue = pti->MessageQueue;
-
- if(!MessageQueue) return FALSE;
-
- if (IsListEmpty(&MessageQueue->SentMessagesListHead))
- {
- return(FALSE);
- }
- // Do we loop through all msgs or just set the first one?
- Entry = MessageQueue->SentMessagesListHead.Flink;
- Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry);
+ Message = pti->pusmCurrent;
+
+ if(!Message) return FALSE;
if (Message->QS_Flags & QS_SMRESULT) return FALSE;
+ // SendMessageXxx || Callback msg and not a notify msg
if (Message->SenderQueue || Message->CompletionCallback)
{
Message->lResult = lResult;
Message->QS_Flags |= QS_SMRESULT;
- MsqWakeQueue(MessageQueue, 0, TRUE); // Wake it up!? Bits?
+ // See co_MsqDispatchOneSentMessage, change bits already accounted for and cleared and
this msg is going away..
}
return TRUE;
}