diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index 9a8035cbf47..637e236c087 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -139,7 +139,7 @@ BOOLEAN APIENTRY co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, IN BOOLEAN Hardware, IN BOOLEAN Remove, - IN HWND Wnd, + IN PWINDOW_OBJECT Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, OUT PUSER_MESSAGE* Message); @@ -158,7 +158,7 @@ MsqInitializeImpl(VOID); BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue); NTSTATUS FASTCALL -co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, HWND WndFilter, +co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT WndFilter, UINT MsgFilterMin, UINT MsgFilterMax); VOID FASTCALL MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue, @@ -262,11 +262,11 @@ MsqKillTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd, UINT_PTR IDEvent, UINT Msg); BOOLEAN FASTCALL MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue, - HWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax, + PWINDOW_OBJECT WindowFilter, UINT MsgFilterMin, UINT MsgFilterMax, MSG *Msg, BOOLEAN Restart); BOOLEAN FASTCALL MsqGetFirstTimerExpiry(PUSER_MESSAGE_QUEUE MessageQueue, - HWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax, + PWINDOW_OBJECT WndFilter, UINT MsgFilterMin, UINT MsgFilterMax, PLARGE_INTEGER FirstTimerExpiry); VOID FASTCALL MsqRemoveTimersWindow(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd); diff --git a/reactos/subsystems/win32/win32k/include/painting.h b/reactos/subsystems/win32/win32k/include/painting.h index 26928656bde..d75d24ebc34 100644 --- a/reactos/subsystems/win32/win32k/include/painting.h +++ b/reactos/subsystems/win32/win32k/include/painting.h @@ -10,7 +10,7 @@ co_UserRedrawWindow(PWINDOW_OBJECT Wnd, const RECTL* UpdateRect, HRGN UpdateRgn, VOID FASTCALL IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags); BOOL FASTCALL -IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread, +IntGetPaintMessage(PWINDOW_OBJECT Window, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread, MSG *Message, BOOL Remove); INT FASTCALL UserRealizePalette(HDC); INT FASTCALL co_UserGetUpdateRgn(PWINDOW_OBJECT, HRGN, BOOL); diff --git a/reactos/subsystems/win32/win32k/include/timer.h b/reactos/subsystems/win32/win32k/include/timer.h index 283f18ae104..128bf0febab 100644 --- a/reactos/subsystems/win32/win32k/include/timer.h +++ b/reactos/subsystems/win32/win32k/include/timer.h @@ -33,7 +33,7 @@ PTIMER FASTCALL FindSystemTimer(PMSG); BOOL FASTCALL ValidateTimerCallback(PTHREADINFO,PWINDOW_OBJECT,WPARAM,LPARAM); VOID CALLBACK SystemTimerProc(HWND,UINT,UINT_PTR,DWORD); UINT_PTR FASTCALL SetSystemTimer(PWINDOW_OBJECT,UINT_PTR,UINT,TIMERPROC); -BOOL FASTCALL PostTimerMessages(HWND); +BOOL FASTCALL PostTimerMessages(PWINDOW_OBJECT); VOID FASTCALL ProcessTimers(VOID); VOID FASTCALL StartTheTimers(VOID); diff --git a/reactos/subsystems/win32/win32k/include/winsta.h b/reactos/subsystems/win32/win32k/include/winsta.h index dbb061027a0..c2933c47d83 100644 --- a/reactos/subsystems/win32/win32k/include/winsta.h +++ b/reactos/subsystems/win32/win32k/include/winsta.h @@ -1,7 +1,7 @@ #ifndef _WIN32K_WINSTA_H #define _WIN32K_WINSTA_H -#include "msgqueue.h" +#include "window.h" #include "clipboard.h" #define WINSTA_ROOT_NAME L"\\Windows\\WindowStations" diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index e888f34f853..45ff2b8ed90 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -739,7 +739,7 @@ co_IntTranslateMouseMessage(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg, USHORT * */ BOOL FASTCALL co_IntPeekMessage(PUSER_MESSAGE Msg, - HWND hWnd, + PWINDOW_OBJECT Window, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg) @@ -796,7 +796,7 @@ CheckMessages: Present = co_MsqFindMessage(ThreadQueue, FALSE, RemoveMessages, - hWnd, + Window, MsgFilterMin, MsgFilterMax, &Message); @@ -814,7 +814,7 @@ CheckMessages: Present = co_MsqFindMessage(ThreadQueue, TRUE, RemoveMessages, - hWnd, + Window, MsgFilterMin, MsgFilterMax, &Message); @@ -833,19 +833,19 @@ CheckMessages: ; /* Check for paint messages. */ - if (IntGetPaintMessage(hWnd, MsgFilterMin, MsgFilterMax, pti, &Msg->Msg, RemoveMessages)) + if (IntGetPaintMessage(Window, MsgFilterMin, MsgFilterMax, pti, &Msg->Msg, RemoveMessages)) { Msg->FreeLParam = FALSE; goto MsgExit; } if (ThreadQueue->WakeMask & QS_TIMER) - if (PostTimerMessages(hWnd)) // If there are timers ready, + if (PostTimerMessages(Window)) // If there are timers ready, goto CheckMessages; // go back and process them. // LOL! Polling Timer Queue? How much time is spent doing this? /* Check for WM_(SYS)TIMER messages */ - Present = MsqGetTimerMessage(ThreadQueue, hWnd, MsgFilterMin, MsgFilterMax, + Present = MsqGetTimerMessage(ThreadQueue, Window, MsgFilterMin, MsgFilterMax, &Msg->Msg, RemoveMessages); if (Present) { @@ -989,14 +989,21 @@ NtUserPeekMessage(PNTUSERGETMESSAGEINFO UnsafeInfo, DPRINT("Enter NtUserPeekMessage\n"); UserEnterExclusive(); + if (hWnd == (HWND)-1 || hWnd == (HWND)0x0000FFFF || hWnd == (HWND)0xFFFFFFFF) + hWnd = (HWND)1; + /* Validate input */ - if (hWnd && hWnd != INVALID_HANDLE_VALUE) + if (hWnd && hWnd != (HWND)1) { if (!(Window = UserGetWindowObject(hWnd))) { RETURN(-1); } } + else + { + Window = (PWINDOW_OBJECT)hWnd; + } if (MsgFilterMax < MsgFilterMin) { @@ -1004,7 +1011,7 @@ NtUserPeekMessage(PNTUSERGETMESSAGEINFO UnsafeInfo, MsgFilterMax = 0; } - Present = co_IntPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg); + Present = co_IntPeekMessage(&Msg, Window, MsgFilterMin, MsgFilterMax, RemoveMsg); if (Present) { @@ -1063,7 +1070,7 @@ CLEANUP: } static BOOL FASTCALL -co_IntWaitMessage(HWND Wnd, +co_IntWaitMessage(PWINDOW_OBJECT Window, UINT MsgFilterMin, UINT MsgFilterMax) { @@ -1077,13 +1084,13 @@ co_IntWaitMessage(HWND Wnd, do { - if (co_IntPeekMessage(&Msg, Wnd, MsgFilterMin, MsgFilterMax, PM_NOREMOVE)) + if (co_IntPeekMessage(&Msg, Window, MsgFilterMin, MsgFilterMax, PM_NOREMOVE)) { return TRUE; } /* Nothing found. Wait for new messages. */ - Status = co_MsqWaitForNewMessages(ThreadQueue, Wnd, MsgFilterMin, MsgFilterMax); + Status = co_MsqWaitForNewMessages(ThreadQueue, Window, MsgFilterMin, MsgFilterMax); } while ((STATUS_WAIT_0 <= Status && Status <= STATUS_WAIT_63) || STATUS_TIMEOUT == Status); @@ -1139,7 +1146,7 @@ NtUserGetMessage(PNTUSERGETMESSAGEINFO UnsafeInfo, do { - GotMessage = co_IntPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE); + GotMessage = co_IntPeekMessage(&Msg, Window, MsgFilterMin, MsgFilterMax, PM_REMOVE); if (GotMessage) { Info.Msg = Msg.Msg; @@ -1188,7 +1195,7 @@ NtUserGetMessage(PNTUSERGETMESSAGEINFO UnsafeInfo, RETURN( (BOOL) -1); } } - else if (! co_IntWaitMessage(hWnd, MsgFilterMin, MsgFilterMax)) + else if (! co_IntWaitMessage(Window, MsgFilterMin, MsgFilterMax)) { RETURN( (BOOL) -1); } diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 65d030ec2a6..828671afabc 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -296,12 +296,12 @@ MsqIsDblClk(LPMSG Msg, BOOL Remove) } static BOOL APIENTRY -co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT FilterLow, UINT FilterHigh, +co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Window, UINT FilterLow, UINT FilterHigh, PUSER_MESSAGE Message, BOOL Remove, PBOOL Freed, PWINDOW_OBJECT ScopeWin, PPOINT ScreenPoint, BOOL FromGlobalQueue, PLIST_ENTRY *Next) { USHORT Msg = Message->Msg.message; - PWINDOW_OBJECT Window = NULL; + PWINDOW_OBJECT CaptureWindow = NULL; HWND hCaptureWin; ASSERT_REFS_CO(ScopeWin); @@ -315,18 +315,18 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT Fi hCaptureWin = IntGetCaptureWindow(); if (hCaptureWin == NULL) { - if(Msg == WM_MOUSEWHEEL) + if (Msg == WM_MOUSEWHEEL) { - Window = UserGetWindowObject(IntGetFocusWindow()); - if (Window) UserReferenceObject(Window); + CaptureWindow = UserGetWindowObject(IntGetFocusWindow()); + if (CaptureWindow) UserReferenceObject(CaptureWindow); } else { - co_WinPosWindowFromPoint(ScopeWin, NULL, &Message->Msg.pt, &Window); - if(Window == NULL) + co_WinPosWindowFromPoint(ScopeWin, NULL, &Message->Msg.pt, &CaptureWindow); + if(CaptureWindow == NULL) { - Window = ScopeWin; - if (Window) UserReferenceObject(Window); + CaptureWindow = ScopeWin; + if (CaptureWindow) UserReferenceObject(CaptureWindow); } else { @@ -339,13 +339,13 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT Fi { /* FIXME - window messages should go to the right window if no buttons are pressed */ - Window = UserGetWindowObject(hCaptureWin); - if (Window) UserReferenceObject(Window); + CaptureWindow = UserGetWindowObject(hCaptureWin); + if (CaptureWindow) UserReferenceObject(CaptureWindow); } - if (Window == NULL) + if (CaptureWindow == NULL) { if(!FromGlobalQueue) { @@ -361,7 +361,7 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT Fi return(FALSE); } - if (Window->MessageQueue != MessageQueue) + if (CaptureWindow->MessageQueue != MessageQueue) { if (! FromGlobalQueue) { @@ -384,37 +384,37 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT Fi /* lock the destination message queue, so we don't get in trouble with other threads, messing with it at the same time */ - IntLockHardwareMessageQueue(Window->MessageQueue); - InsertTailList(&Window->MessageQueue->HardwareMessagesListHead, + IntLockHardwareMessageQueue(CaptureWindow->MessageQueue); + InsertTailList(&CaptureWindow->MessageQueue->HardwareMessagesListHead, &Message->ListEntry); if(Message->Msg.message == WM_MOUSEMOVE) { - if(Window->MessageQueue->MouseMoveMsg) + if(CaptureWindow->MessageQueue->MouseMoveMsg) { /* remove the old WM_MOUSEMOVE message, we're processing a more recent one */ - RemoveEntryList(&Window->MessageQueue->MouseMoveMsg->ListEntry); - ExFreePool(Window->MessageQueue->MouseMoveMsg); + RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry); + ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg); } /* save the pointer to the WM_MOUSEMOVE message in the new queue */ - Window->MessageQueue->MouseMoveMsg = Message; + CaptureWindow->MessageQueue->MouseMoveMsg = Message; - Window->MessageQueue->QueueBits |= QS_MOUSEMOVE; - Window->MessageQueue->ChangedBits |= QS_MOUSEMOVE; - if (Window->MessageQueue->WakeMask & QS_MOUSEMOVE) - KeSetEvent(Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + CaptureWindow->MessageQueue->QueueBits |= QS_MOUSEMOVE; + CaptureWindow->MessageQueue->ChangedBits |= QS_MOUSEMOVE; + if (CaptureWindow->MessageQueue->WakeMask & QS_MOUSEMOVE) + KeSetEvent(CaptureWindow->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); } else { - Window->MessageQueue->QueueBits |= QS_MOUSEBUTTON; - Window->MessageQueue->ChangedBits |= QS_MOUSEBUTTON; - if (Window->MessageQueue->WakeMask & QS_MOUSEBUTTON) - KeSetEvent(Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + CaptureWindow->MessageQueue->QueueBits |= QS_MOUSEBUTTON; + CaptureWindow->MessageQueue->ChangedBits |= QS_MOUSEBUTTON; + if (CaptureWindow->MessageQueue->WakeMask & QS_MOUSEBUTTON) + KeSetEvent(CaptureWindow->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); } - IntUnLockHardwareMessageQueue(Window->MessageQueue); + IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue); *Freed = FALSE; - UserDereferenceObject(Window); + UserDereferenceObject(CaptureWindow); return(FALSE); } @@ -422,7 +422,7 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT Fi *ScreenPoint = Message->Msg.pt; - if((hWnd != NULL && Window->hSelf != hWnd) || + if((Window != NULL && (int)Window != 1 && CaptureWindow->hSelf != Window->hSelf) || ((FilterLow != 0 || FilterHigh != 0) && (Msg < FilterLow || Msg > FilterHigh))) { /* Reject the message because it doesn't match the filter */ @@ -432,21 +432,21 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT Fi /* Lock the message queue so no other thread can mess with it. Our own message queue is not locked while fetching from the global queue, so we have to make sure nothing interferes! */ - IntLockHardwareMessageQueue(Window->MessageQueue); + IntLockHardwareMessageQueue(CaptureWindow->MessageQueue); /* if we're from the global queue, we need to add our message to our private queue so we don't loose it! */ - InsertTailList(&Window->MessageQueue->HardwareMessagesListHead, + InsertTailList(&CaptureWindow->MessageQueue->HardwareMessagesListHead, &Message->ListEntry); } if (Message->Msg.message == WM_MOUSEMOVE) { - if(Window->MessageQueue->MouseMoveMsg && - (Window->MessageQueue->MouseMoveMsg != Message)) + if(CaptureWindow->MessageQueue->MouseMoveMsg && + (CaptureWindow->MessageQueue->MouseMoveMsg != Message)) { /* delete the old message */ - RemoveEntryList(&Window->MessageQueue->MouseMoveMsg->ListEntry); - ExFreePool(Window->MessageQueue->MouseMoveMsg); + RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry); + ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg); if (!FromGlobalQueue) { // We might have deleted the next one in our queue, so fix next @@ -455,20 +455,20 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT Fi } /* always save a pointer to this WM_MOUSEMOVE message here because we're sure that the message is in the private queue */ - Window->MessageQueue->MouseMoveMsg = Message; + CaptureWindow->MessageQueue->MouseMoveMsg = Message; } if(FromGlobalQueue) { - IntUnLockHardwareMessageQueue(Window->MessageQueue); + IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue); } - UserDereferenceObject(Window); + UserDereferenceObject(CaptureWindow); *Freed = FALSE; return(FALSE); } /* FIXME - only assign if removing? */ - Message->Msg.hwnd = Window->hSelf; + Message->Msg.hwnd = CaptureWindow->hSelf; Message->Msg.message = Msg; Message->Msg.lParam = MAKELONG(Message->Msg.pt.x, Message->Msg.pt.y); @@ -482,32 +482,32 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT Fi /* Lock the message queue so no other thread can mess with it. Our own message queue is not locked while fetching from the global queue, so we have to make sure nothing interferes! */ - IntLockHardwareMessageQueue(Window->MessageQueue); - if(Window->MessageQueue->MouseMoveMsg) + IntLockHardwareMessageQueue(CaptureWindow->MessageQueue); + if(CaptureWindow->MessageQueue->MouseMoveMsg) { /* delete the WM_(NC)MOUSEMOVE message in the private queue, we're dealing with one that's been sent later */ - RemoveEntryList(&Window->MessageQueue->MouseMoveMsg->ListEntry); - ExFreePool(Window->MessageQueue->MouseMoveMsg); + RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry); + ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg); /* our message is not in the private queue so we can remove the pointer instead of setting it to the current message we're processing */ - Window->MessageQueue->MouseMoveMsg = NULL; + CaptureWindow->MessageQueue->MouseMoveMsg = NULL; } - IntUnLockHardwareMessageQueue(Window->MessageQueue); + IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue); } - else if(Window->MessageQueue->MouseMoveMsg == Message) + else if (CaptureWindow->MessageQueue->MouseMoveMsg == Message) { - Window->MessageQueue->MouseMoveMsg = NULL; + CaptureWindow->MessageQueue->MouseMoveMsg = NULL; } } - UserDereferenceObject(Window); + UserDereferenceObject(CaptureWindow); *Freed = FALSE; return(TRUE); } BOOL APIENTRY -co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, +co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Window, UINT FilterLow, UINT FilterHigh, BOOL Remove, PUSER_MESSAGE* Message) { @@ -563,7 +563,7 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, { - Accept = co_MsqTranslateMouseMessage(MessageQueue, hWnd, FilterLow, FilterHigh, + Accept = co_MsqTranslateMouseMessage(MessageQueue, Window, FilterLow, FilterHigh, Current, Remove, &Freed, DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry); if (Accept) @@ -663,7 +663,7 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, { const ULONG ActiveStamp = HardwareMessageQueueStamp; /* Translate the message. */ - Accept = co_MsqTranslateMouseMessage(MessageQueue, hWnd, FilterLow, FilterHigh, + Accept = co_MsqTranslateMouseMessage(MessageQueue, Window, FilterLow, FilterHigh, Current, Remove, &Freed, DesktopWindow, &ScreenPoint, TRUE, NULL); if (Accept) @@ -1326,7 +1326,7 @@ BOOLEAN APIENTRY co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, IN BOOLEAN Hardware, IN BOOLEAN Remove, - IN HWND Wnd, + IN PWINDOW_OBJECT Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, OUT PUSER_MESSAGE* Message) @@ -1337,7 +1337,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, if (Hardware) { - return(co_MsqPeekHardwareMessage(MessageQueue, Wnd, + return(co_MsqPeekHardwareMessage(MessageQueue, Window, MsgFilterLow, MsgFilterHigh, Remove, Message)); } @@ -1348,7 +1348,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, { CurrentMessage = CONTAINING_RECORD(CurrentEntry, USER_MESSAGE, ListEntry); - if ((Wnd == 0 || Wnd == CurrentMessage->Msg.hwnd) && + if ((!Window || (int)Window == 1 || Window->hSelf == CurrentMessage->Msg.hwnd) && ((MsgFilterLow == 0 && MsgFilterHigh == 0) || (MsgFilterLow <= CurrentMessage->Msg.message && MsgFilterHigh >= CurrentMessage->Msg.message))) @@ -1368,7 +1368,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, } NTSTATUS FASTCALL -co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, HWND WndFilter, +co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT WndFilter, UINT MsgFilterMin, UINT MsgFilterMax) { PVOID WaitObjects[2] = {MessageQueue->NewMessages, &HardwareMessageEvent}; @@ -1833,7 +1833,7 @@ MsqKillTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd, BOOLEAN FASTCALL MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue, - HWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax, + PWINDOW_OBJECT WindowFilter, UINT MsgFilterMin, UINT MsgFilterMax, MSG *Msg, BOOLEAN Restart) { PTIMER_ENTRY Timer; @@ -1857,7 +1857,7 @@ MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue, DPRINT("Checking timer %p wnd %x expiry %I64d\n", Timer, Timer->Wnd, Timer->ExpiryTime.QuadPart); EnumEntry = EnumEntry->Flink; - if ((NULL == WndFilter || Timer->Wnd == WndFilter) && + if ((NULL == WindowFilter || Timer->Wnd == WindowFilter->hSelf) && ((MsgFilterMin == 0 && MsgFilterMax == 0) || (MsgFilterMin <= Timer->Msg && Timer->Msg <= MsgFilterMax))) @@ -1877,7 +1877,7 @@ MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue, else { DPRINT("timer %p (wnd %x msg %d) failed filter wnd %x msgmin %d msgmax %d\n", - Timer, Timer->Wnd, Timer->Msg, WndFilter, MsgFilterMin, MsgFilterMax); + Timer, Timer->Wnd, Timer->Msg, WindowFilter->hSelf, MsgFilterMin, MsgFilterMax); } } @@ -1947,7 +1947,7 @@ MsqRemoveTimersWindow(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd) BOOLEAN FASTCALL MsqGetFirstTimerExpiry(PUSER_MESSAGE_QUEUE MessageQueue, - HWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax, + PWINDOW_OBJECT WndFilter, UINT MsgFilterMin, UINT MsgFilterMax, PLARGE_INTEGER FirstTimerExpiry) { PTIMER_ENTRY Timer; @@ -1962,7 +1962,7 @@ MsqGetFirstTimerExpiry(PUSER_MESSAGE_QUEUE MessageQueue, Timer = CONTAINING_RECORD(MessageQueue->TimerListHead.Flink, TIMER_ENTRY, ListEntry); EnumEntry = EnumEntry->Flink; - if ((NULL == WndFilter || Timer->Wnd == WndFilter) && + if ((NULL == WndFilter || (int)WndFilter == 1 || Timer->Wnd == WndFilter->hSelf) && ((MsgFilterMin == 0 && MsgFilterMax == 0) || (MsgFilterMin <= Timer->Msg && Timer->Msg <= MsgFilterMax))) diff --git a/reactos/subsystems/win32/win32k/ntuser/painting.c b/reactos/subsystems/win32/win32k/ntuser/painting.c index 1bea638910c..d260e01b785 100644 --- a/reactos/subsystems/win32/win32k/ntuser/painting.c +++ b/reactos/subsystems/win32/win32k/ntuser/painting.c @@ -679,7 +679,7 @@ IntFindWindowToRepaint(PWINDOW_OBJECT Window, PTHREADINFO Thread) } BOOL FASTCALL -IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, +IntGetPaintMessage(PWINDOW_OBJECT Window, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread, MSG *Message, BOOL Remove) { PUSER_MESSAGE_QUEUE MessageQueue = (PUSER_MESSAGE_QUEUE)Thread->MessageQueue; @@ -701,7 +701,7 @@ IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, return FALSE; } - if (hWnd != NULL && Message->hwnd != hWnd) + if (Window != NULL && Message->hwnd != Window->hSelf) return FALSE; Message->message = WM_PAINT; diff --git a/reactos/subsystems/win32/win32k/ntuser/timer.c b/reactos/subsystems/win32/win32k/ntuser/timer.c index 19830732ec1..69966ad1753 100644 --- a/reactos/subsystems/win32/win32k/ntuser/timer.c +++ b/reactos/subsystems/win32/win32k/ntuser/timer.c @@ -280,21 +280,19 @@ SetSystemTimer( PWINDOW_OBJECT Window, BOOL FASTCALL -PostTimerMessages(HWND hWnd) +PostTimerMessages(PWINDOW_OBJECT Window) { PUSER_MESSAGE_QUEUE ThreadQueue; MSG Msg; PTHREADINFO pti; - PWINDOW_OBJECT pWnd = NULL; BOOL Hit = FALSE; PTIMER pTmr = FirstpTmr; if (!pTmr) return FALSE; - if (hWnd) + if (Window && (int)Window != 1) { - pWnd = UserGetWindowObject(hWnd); - if (!pWnd || !pWnd->Wnd) return FALSE; + if (!Window->Wnd) return FALSE; } pti = PsGetCurrentThreadWin32Thread(); @@ -305,9 +303,9 @@ PostTimerMessages(HWND hWnd) { if ( (pTmr->flags & TMRF_READY) && (pTmr->pti == pti) && - (pTmr->pWnd == pWnd)) + (pTmr->pWnd == Window)) { - Msg.hwnd = hWnd; + Msg.hwnd = Window->hSelf; Msg.message = (pTmr->flags & TMRF_SYSTEM) ? WM_SYSTIMER : WM_TIMER; Msg.wParam = (WPARAM) pTmr->nID; Msg.lParam = (LPARAM) pTmr->pfn;