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.

svn path=/trunk/; revision=40964
This commit is contained in:
Timo Kreuzer 2009-05-17 22:22:20 +00:00
parent 6bdda5357f
commit 05a7fd23a3

View file

@ -1309,11 +1309,7 @@ UserPostMessage(HWND Wnd,
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 @@ UserPostMessage(HWND Wnd,
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))
if (WM_QUIT == Msg)
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
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);
}
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;