Author: tkreuzer
Date: Mon May 18 02:22:20 2009
New Revision: 40964
URL:
http://svn.reactos.org/svn/reactos?rev=40964&view=rev
Log:
UserPostMessage: when dealing with WM_QUIT, allow broadcasting like windows does and post
it to the window's message queue instead of the current thread's message queue.
Fixes a hang in user32_winetest msg. Patch by Giannis Adamopoulos.
See issue #4058 for more details.
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/message.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] Mon May 18
02:22:20 2009
@@ -1309,11 +1309,7 @@
PMSGMEMORY MsgMemoryEntry;
pti = PsGetCurrentThreadWin32Thread();
- if (WM_QUIT == Msg)
- {
- MsqPostQuitMessage(pti->MessageQueue, wParam);
- }
- else if (Wnd == HWND_BROADCAST)
+ if (Wnd == HWND_BROADCAST)
{
HWND *List;
PWINDOW_OBJECT DesktopWindow;
@@ -1345,24 +1341,31 @@
return FALSE;
}
- UserModeMsg.hwnd = Wnd;
- UserModeMsg.message = Msg;
- UserModeMsg.wParam = wParam;
- UserModeMsg.lParam = lParam;
- MsgMemoryEntry = FindMsgMemory(UserModeMsg.message);
- Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg, MsgMemoryEntry);
- if (! NT_SUCCESS(Status))
- {
- SetLastWin32Error(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
- IntGetCursorLocation(pti->Desktop->WindowStation,
- &KernelModeMsg.pt);
- KeQueryTickCount(&LargeTickCount);
- pti->timeLast = KernelModeMsg.time =
MsqCalculateMessageTime(&LargeTickCount);
- MsqPostMessage(Window->MessageQueue, &KernelModeMsg,
- NULL != MsgMemoryEntry && 0 != KernelModeMsg.lParam,
- QS_POSTMESSAGE);
+ if (WM_QUIT == Msg)
+ {
+ MsqPostQuitMessage(Window->MessageQueue, wParam);
+ }
+ else
+ {
+ UserModeMsg.hwnd = Wnd;
+ UserModeMsg.message = Msg;
+ UserModeMsg.wParam = wParam;
+ UserModeMsg.lParam = lParam;
+ MsgMemoryEntry = FindMsgMemory(UserModeMsg.message);
+ Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg,
MsgMemoryEntry);
+ if (! NT_SUCCESS(Status))
+ {
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ IntGetCursorLocation(pti->Desktop->WindowStation,
+ &KernelModeMsg.pt);
+ KeQueryTickCount(&LargeTickCount);
+ pti->timeLast = KernelModeMsg.time =
MsqCalculateMessageTime(&LargeTickCount);
+ MsqPostMessage(Window->MessageQueue, &KernelModeMsg,
+ NULL != MsgMemoryEntry && 0 != KernelModeMsg.lParam,
+ QS_POSTMESSAGE);
+ }
}
return TRUE;