- Simplify co_IntPeekMessage even more

svn path=/trunk/; revision=49580
This commit is contained in:
Giannis Adamopoulos 2010-11-14 09:01:17 +00:00
parent 31efb355c9
commit 4ac999a033
4 changed files with 40 additions and 39 deletions

View file

@ -127,7 +127,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN PWND Window,
IN UINT MsgFilterLow,
IN UINT MsgFilterHigh,
OUT PUSER_MESSAGE* Message);
OUT PMSG Message);
BOOLEAN FASTCALL
MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue);
VOID FASTCALL

View file

@ -11,8 +11,12 @@
#pragma once
#define INTERNAL_CALL APIENTRY
#ifndef _MSC_VER
#define PLACE_IN_SECTION(s) __attribute__((section(s)))
#define INIT_FUNCTION PLACE_IN_SECTION("INIT")
#else
#define INIT_FUNCTION
#endif
/* Internal Win32k Headers */
#include <include/accelerator.h>

View file

@ -887,7 +887,7 @@ BOOL ProcessHardwareMessage(MSG* Msg, BOOLEAN RemoveMessages)
* Internal version of PeekMessage() doing all the work
*/
BOOL FASTCALL
co_IntPeekMessage( PUSER_MESSAGE Msg,
co_IntPeekMessage( PMSG Msg,
PWND Window,
UINT MsgFilterMin,
UINT MsgFilterMax,
@ -896,7 +896,6 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
PTHREADINFO pti;
LARGE_INTEGER LargeTickCount;
PUSER_MESSAGE_QUEUE ThreadQueue;
PUSER_MESSAGE Message;
BOOL RemoveMessages;
pti = PsGetCurrentThreadWin32Thread();
@ -920,10 +919,10 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
{
/* According to the PSDK, WM_QUIT messages are always returned, regardless
of the filter specified */
Msg->Msg.hwnd = NULL;
Msg->Msg.message = WM_QUIT;
Msg->Msg.wParam = ThreadQueue->QuitExitCode;
Msg->Msg.lParam = 0;
Msg->hwnd = NULL;
Msg->message = WM_QUIT;
Msg->wParam = ThreadQueue->QuitExitCode;
Msg->lParam = 0;
if (RemoveMessages)
{
ThreadQueue->QuitPosted = FALSE;
@ -939,14 +938,9 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
Window,
MsgFilterMin,
MsgFilterMax,
&Message ))
Msg ))
{
RtlCopyMemory(Msg, Message, sizeof(USER_MESSAGE));
if (RemoveMessages)
{
MsqDestroyMessage(Message);
}
break;
return TRUE;
}
/* Check for hardware events. */
@ -956,18 +950,13 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
Window,
MsgFilterMin,
MsgFilterMax,
&Message ))
Msg ))
{
RtlCopyMemory(Msg, Message, sizeof(USER_MESSAGE));
if (RemoveMessages)
{
MsqDestroyMessage(Message);
}
if(!ProcessHardwareMessage(&Msg->Msg, RemoveMessages))
if(!ProcessHardwareMessage(Msg, RemoveMessages))
continue;
break;
return TRUE;
}
/* Check for sent messages again. */
@ -979,10 +968,10 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
MsgFilterMin,
MsgFilterMax,
pti,
&Msg->Msg,
Msg,
RemoveMessages))
{
break;
return TRUE;
}
if (PostTimerMessages(Window))
@ -1099,7 +1088,7 @@ co_IntWaitMessage( PWND Window,
PTHREADINFO pti;
PUSER_MESSAGE_QUEUE ThreadQueue;
NTSTATUS Status = STATUS_SUCCESS;
USER_MESSAGE Msg;
MSG Msg;
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
@ -1142,7 +1131,6 @@ co_IntGetPeekMessage( PMSG pMsg,
BOOL bGMSG )
{
PWND Window;
USER_MESSAGE Msg;
BOOL Present = FALSE;
if ( hWnd == HWND_TOPMOST || hWnd == HWND_BROADCAST )
@ -1170,19 +1158,15 @@ co_IntGetPeekMessage( PMSG pMsg,
MsgFilterMax = 0;
}
RtlZeroMemory(&Msg, sizeof(USER_MESSAGE));
do
{
Present = co_IntPeekMessage( &Msg,
Present = co_IntPeekMessage( pMsg,
Window,
MsgFilterMin,
MsgFilterMax,
RemoveMsg );
if (Present)
{
RtlCopyMemory( pMsg, &Msg.Msg, sizeof(MSG));
// The WH_GETMESSAGE hook enables an application to monitor messages about to
// be returned by the GetMessage or PeekMessage function.
@ -2764,7 +2748,7 @@ NtUserWaitForInputIdle( IN HANDLE hProcess,
case STATUS_WAIT_2:
{
USER_MESSAGE Msg;
MSG Msg;
co_IntPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE );
DPRINT1("WFII: WAIT 2\n");
}

View file

@ -535,7 +535,7 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT
BOOL APIENTRY
co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
UINT FilterLow, UINT FilterHigh, BOOL Remove,
PUSER_MESSAGE* Message)
PMSG Message)
{
KIRQL OldIrql;
POINT ScreenPoint;
@ -587,14 +587,15 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry);
if (Accept)
{
*Message = Current->Msg;
if (Remove)
{
RemoveEntryList(&Current->ListEntry);
MsqDestroyMessage(Current);
}
IntUnLockHardwareMessageQueue(MessageQueue);
IntUnLockSystemHardwareMessageQueueLock(FALSE);
*Message = Current;
if (Desk)
Desk->LastInputWasKbd = FALSE;
@ -604,13 +605,14 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
}
else
{
*Message = Current->Msg;
if (Remove)
{
RemoveEntryList(&Current->ListEntry);
MsqDestroyMessage(Current);
}
IntUnLockHardwareMessageQueue(MessageQueue);
IntUnLockSystemHardwareMessageQueueLock(FALSE);
*Message = Current;
RETURN(TRUE);
}
@ -693,7 +695,12 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
IntUnLockHardwareMessageQueue(MessageQueue);
}
IntUnLockSystemHardwareMessageQueueLock(FALSE);
*Message = Current;
*Message = Current->Msg;
if (Remove)
{
MsqDestroyMessage(Current);
}
RETURN(TRUE);
}
@ -1325,7 +1332,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN PWND Window,
IN UINT MsgFilterLow,
IN UINT MsgFilterHigh,
OUT PUSER_MESSAGE* Message)
OUT PMSG Message)
{
PLIST_ENTRY CurrentEntry;
PUSER_MESSAGE CurrentMessage;
@ -1359,7 +1366,13 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
RemoveEntryList(&CurrentMessage->ListEntry);
}
*Message = CurrentMessage;
*Message= CurrentMessage->Msg;
if (Remove)
{
MsqDestroyMessage(CurrentMessage);
}
return(TRUE);
}
CurrentEntry = CurrentEntry->Flink;