12 modified files
reactos/include/win32k
diff -u -r1.143 -r1.144
--- ntuser.h 24 Dec 2004 17:45:57 -0000 1.143
+++ ntuser.h 25 Dec 2004 22:59:09 -0000 1.144
@@ -156,14 +156,15 @@
WPARAM wParam,
LPARAM lParam);
-#define NOPARAM_ROUTINE_REGISTER_PRIMITIVE 0xffff0001 /* Private ROS */
-#define NOPARAM_ROUTINE_DESTROY_CARET 0xffff0002
-#define NOPARAM_ROUTINE_UNINIT_MESSAGE_PUMP 0xffff0003
-#define NOPARAM_ROUTINE_INIT_MESSAGE_PUMP 0xffff0004
-#define NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO 0xffff0005
-#define NOPARAM_ROUTINE_ANYPOPUP 0xffff0006
-#define NOPARAM_ROUTINE_CSRSS_INITIALIZED 0xffff0007
-#define NOPARAM_ROUTINE_GDI_QUERY_TABLE 0xffff0008
+#define NOPARAM_ROUTINE_MSQCLEARWAKEMASK 0x3
+#define NOPARAM_ROUTINE_REGISTER_PRIMITIVE 0xffff0001 /* Private ROS */
+#define NOPARAM_ROUTINE_DESTROY_CARET 0xffff0002
+#define NOPARAM_ROUTINE_UNINIT_MESSAGE_PUMP 0xffff0003
+#define NOPARAM_ROUTINE_INIT_MESSAGE_PUMP 0xffff0004
+#define NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO 0xffff0005
+#define NOPARAM_ROUTINE_ANYPOPUP 0xffff0006
+#define NOPARAM_ROUTINE_CSRSS_INITIALIZED 0xffff0007
+#define NOPARAM_ROUTINE_GDI_QUERY_TABLE 0xffff0008
DWORD
STDCALL
NtUserCallNoParam(
@@ -178,11 +179,12 @@
#define ONEPARAM_ROUTINE_GETCARETINFO 0x07
#define ONEPARAM_ROUTINE_SWITCHCARETSHOWING 0x08
#define ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS 0x09
-#define ONEPARAM_ROUTINE_GETWINDOWINSTANCE 0x10
#define ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO 0x0a
#define ONEPARAM_ROUTINE_GETCURSORPOSITION 0x0b
#define ONEPARAM_ROUTINE_ISWINDOWINDESTROY 0x0c
#define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0x0d
+#define ONEPARAM_ROUTINE_GETWINDOWINSTANCE 0x10
+#define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0x27
DWORD
STDCALL
NtUserCallOneParam(
reactos/lib/user32/include
diff -u -r1.32 -r1.33
--- user32.h 12 Dec 2004 01:40:36 -0000 1.32
+++ user32.h 25 Dec 2004 22:59:10 -0000 1.33
@@ -35,6 +35,12 @@
VOID DeleteFrameBrushes(VOID);
void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);
+#define NtUserMsqSetWakeMask(dwWaitMask) \
+ (HANDLE)NtUserCallOneParam(dwWaitMask, ONEPARAM_ROUTINE_MSQSETWAKEMASK)
+
+#define NtUserMsqClearWakeMask() \
+ NtUserCallNoParam(NOPARAM_ROUTINE_MSQCLEARWAKEMASK)
+
LONG WINAPI RegCloseKey(HKEY);
LONG WINAPI RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY);
LONG WINAPI RegQueryValueExW(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
reactos/lib/user32/misc
diff -u -r1.70 -r1.71
--- stubs.c 16 Dec 2004 03:57:35 -0000 1.70
+++ stubs.c 25 Dec 2004 22:59:10 -0000 1.71
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.70 2004/12/16 03:57:35 rcampbell Exp $
+/* $Id: stubs.c,v 1.71 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@@ -129,23 +129,6 @@
/*
* @unimplemented
*/
-DWORD
-STDCALL
-RealMsgWaitForMultipleObjectsEx(
- DWORD nCount,
- LPHANDLE pHandles,
- DWORD dwMilliseconds,
- DWORD dwWakeMask,
- DWORD dwFlags)
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-
-/*
- * @unimplemented
- */
BOOL
STDCALL
TrackMouseEvent(
reactos/lib/user32/windows
diff -u -r1.46 -r1.47
--- message.c 25 Dec 2004 20:30:49 -0000 1.46
+++ message.c 25 Dec 2004 22:59:10 -0000 1.47
@@ -1,4 +1,4 @@
-/* $Id: message.c,v 1.46 2004/12/25 20:30:49 navaraf Exp $
+/* $Id: message.c,v 1.47 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@@ -1919,6 +1919,8 @@
if(!gfMessagePumpHook)
return FALSE;
+ /* This code checks for WOW16. */
+#if 0
/* Since our TEB doesnt match that of real windows, testing this value is useless until we know what it does
PUCHAR NtTeb = (PUCHAR)NtCurrentTeb();
@@ -1927,6 +1929,7 @@
if(**(PLONG*)&NtTeb[0x708] <= 0)
return FALSE;*/
+#endif
return TRUE;
}
@@ -1999,6 +2002,79 @@
return IsInsideMessagePumpHook() ? gmph.RealGetQueueStatus(flags) : RealGetQueueStatus(flags);
}
+/**
+ * @name RealMsgWaitForMultipleObjectsEx
+ *
+ * Wait either for either message arrival or for one of the passed events
+ * to be signalled.
+ *
+ * @param nCount
+ * Number of handles in the pHandles array.
+ * @param pHandles
+ * Handles of events to wait for.
+ * @param dwMilliseconds
+ * Timeout interval.
+ * @param dwWakeMask
+ * Mask specifying on which message events we should wakeup.
+ * @param dwFlags
+ * Wait type (see MWMO_* constants).
+ *
+ * @implemented
+ */
+
+DWORD STDCALL
+RealMsgWaitForMultipleObjectsEx(
+ DWORD nCount,
+ const HANDLE *pHandles,
+ DWORD dwMilliseconds,
+ DWORD dwWakeMask,
+ DWORD dwFlags)
+{
+ LPHANDLE RealHandles;
+ HANDLE MessageQueueHandle;
+ DWORD Result;
+
+ if (dwFlags & ~(MWMO_WAITALL | MWMO_ALERTABLE | MWMO_INPUTAVAILABLE))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return WAIT_FAILED;
+ }
+
+/*
+ if (dwFlags & MWMO_INPUTAVAILABLE)
+ {
+ RealGetQueueStatus(dwWakeMask);
+ }
+ */
+
+ MessageQueueHandle = NtUserMsqSetWakeMask(dwWakeMask);
+ if (MessageQueueHandle == NULL)
+ {
+ SetLastError(0); /* ? */
+ return WAIT_FAILED;
+ }
+
+ RealHandles = HeapAlloc(GetProcessHeap(), 0, (nCount + 1) * sizeof(HANDLE));
+ if (RealHandles == NULL)
+ {
+ NtUserMsqClearWakeMask();
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return WAIT_FAILED;
+ }
+
+ RtlCopyMemory(RealHandles, pHandles, nCount);
+ RealHandles[nCount] = MessageQueueHandle;
+
+ Result = WaitForMultipleObjectsEx(nCount + 1, RealHandles,
+ dwFlags & MWMO_WAITALL,
+ dwMilliseconds, dwFlags & MWMO_ALERTABLE);
+
+ HeapFree(GetProcessHeap(), 0, RealHandles);
+ NtUserMsqClearWakeMask();
+
+ return Result;
+}
+
DWORD WINAPI MsgWaitForMultipleObjectsEx(DWORD nCount, CONST HANDLE *lpHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)
{
return IsInsideMessagePumpHook() ? gmph.RealMsgWaitForMultipleObjectsEx(nCount, lpHandles, dwMilliseconds, dwWakeMask, dwFlags) : RealMsgWaitForMultipleObjectsEx(nCount, lpHandles,dwMilliseconds, dwWakeMask, dwFlags);
reactos/subsys/win32k/include
diff -u -r1.43 -r1.44
--- msgqueue.h 12 Dec 2004 23:08:11 -0000 1.43
+++ msgqueue.h 25 Dec 2004 22:59:10 -0000 1.44
@@ -65,8 +65,10 @@
BOOLEAN QuitPosted;
/* The quit exit code. */
ULONG QuitExitCode;
- /* Set if there are new messages in any of the queues. */
- KEVENT NewMessages;
+ /* Set if there are new messages specified by WakeMask in any of the queues. */
+ PKEVENT NewMessages;
+ /* Handle for the above event (in the context of the process owning the queue). */
+ HANDLE NewMessagesHandle;
/* Last time PeekMessage() was called. */
ULONG LastMsgRead;
/* Current window with focus (ie. receives keyboard input) for this queue. */
@@ -92,10 +94,9 @@
PHOOKTABLE Hooks;
/* queue state tracking */
- WORD WakeBits;
WORD WakeMask;
+ WORD QueueBits;
WORD ChangedBits;
- WORD ChangedMask;
/* extra message information */
LPARAM ExtraInfo;
@@ -121,7 +122,7 @@
MsqDestroyMessage(PUSER_MESSAGE Message);
VOID FASTCALL
MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue,
- MSG* Msg, BOOLEAN FreeLParam);
+ MSG* Msg, BOOLEAN FreeLParam, DWORD MessageBits);
VOID FASTCALL
MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode);
BOOLEAN STDCALL
@@ -132,7 +133,7 @@
IN UINT MsgFilterLow,
IN UINT MsgFilterHigh,
OUT PUSER_MESSAGE* Message);
-VOID FASTCALL
+BOOLEAN FASTCALL
MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue);
VOID FASTCALL
MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
@@ -225,14 +226,12 @@
if(InterlockedDecrement(&(MsgQueue)->References) == 0) \
{ \
DPRINT("Free message queue 0x%x\n", (MsgQueue)); \
+ if ((MsgQueue)->NewMessagesHandle != NULL) \
+ ZwClose((MsgQueue)->NewMessagesHandle); \
ExFreePool((MsgQueue)); \
} \
} while(0)
-/* check the queue status */
-#define MsqIsSignaled(MsgQueue) \
- (((MsgQueue)->WakeBits & (MsgQueue)->WakeMask) || ((MsgQueue)->ChangedBits & (MsgQueue)->ChangedMask))
-
#define IS_BTN_MESSAGE(message,code) \
((message) == WM_LBUTTON##code || \
(message) == WM_MBUTTON##code || \
@@ -243,6 +242,12 @@
(message) == WM_NCRBUTTON##code || \
(message) == WM_NCXBUTTON##code )
+HANDLE FASTCALL
+IntMsqSetWakeMask(DWORD WakeMask);
+
+BOOL FASTCALL
+IntMsqClearWakeMask(VOID);
+
#endif /* _WIN32K_MSGQUEUE_H */
/* EOF */
reactos/subsys/win32k/ntuser
diff -u -r1.15 -r1.16
--- caret.c 20 Nov 2004 16:46:06 -0000 1.15
+++ caret.c 25 Dec 2004 22:59:10 -0000 1.16
@@ -1,4 +1,4 @@
-/* $Id: caret.c,v 1.15 2004/11/20 16:46:06 weiden Exp $
+/* $Id: caret.c,v 1.16 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -315,7 +315,7 @@
}
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
-
+
if(ThreadQueue->CaretInfo->hWnd != hWnd)
{
IntReleaseWindowObject(WindowObject);
reactos/subsys/win32k/ntuser
diff -u -r1.33 -r1.34
--- keyboard.c 15 Nov 2004 16:36:28 -0000 1.33
+++ keyboard.c 25 Dec 2004 22:59:10 -0000 1.34
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: keyboard.c,v 1.33 2004/11/15 16:36:28 ekohl Exp $
+/* $Id: keyboard.c,v 1.34 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -660,14 +660,14 @@
NewMsg.wParam = dead_char;
NewMsg.lParam = lpMsg->lParam;
dead_char = 0;
- MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE);
+ MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
}
NewMsg.hwnd = lpMsg->hwnd;
NewMsg.wParam = wp[0];
NewMsg.lParam = lpMsg->lParam;
DPRINT( "CHAR='%c' %04x %08x\n", wp[0], wp[0], lpMsg->lParam );
- MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE);
+ MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
Result = TRUE;
}
else if (UState == -1)
@@ -678,7 +678,7 @@
NewMsg.wParam = wp[0];
NewMsg.lParam = lpMsg->lParam;
dead_char = wp[0];
- MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE);
+ MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
Result = TRUE;
}
reactos/subsys/win32k/ntuser
diff -u -r1.57 -r1.58
--- menu.c 13 Dec 2004 15:38:19 -0000 1.57
+++ menu.c 25 Dec 2004 22:59:10 -0000 1.58
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: menu.c,v 1.57 2004/12/13 15:38:19 navaraf Exp $
+/* $Id: menu.c,v 1.58 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -717,6 +717,16 @@
}
if(lpmii->fMask & (MIIM_FTYPE | MIIM_TYPE))
{
+ /*
+ * Delete the menu item type when changing type from
+ * MF_STRING.
+ */
+ if (MenuItem->fType != lpmii->fType &&
+ MENU_ITEM_TYPE(MenuItem->fType) == MF_STRING)
+ {
+ FreeMenuText(MenuItem);
+ RtlInitUnicodeString(&MenuItem->Text, NULL);
+ }
MenuItem->fType = lpmii->fType;
}
if(lpmii->fMask & MIIM_ID)
@@ -747,9 +757,11 @@
}
}
}
- if((lpmii->fMask & (MIIM_TYPE | MIIM_STRING)) &&
- (MENU_ITEM_TYPE(lpmii->fType) == MF_STRING))
+ if ((lpmii->fMask & (MIIM_TYPE | MIIM_STRING)) &&
+ (MENU_ITEM_TYPE(lpmii->fType) == MF_STRING))
{
+ FreeMenuText(MenuItem);
+
if(lpmii->dwTypeData && lpmii->cch)
{
UNICODE_STRING Source;
@@ -758,7 +770,6 @@
Source.MaximumLength = lpmii->cch * sizeof(WCHAR);
Source.Buffer = lpmii->dwTypeData;
- FreeMenuText(MenuItem);
MenuItem->Text.Buffer = (PWSTR)ExAllocatePoolWithTag(
PagedPool, Source.Length + sizeof(WCHAR), TAG_STRING);
if(MenuItem->Text.Buffer != NULL)
@@ -770,9 +781,7 @@
}
else
{
- MenuItem->Text.Length = 0;
- MenuItem->Text.MaximumLength = 0;
- MenuItem->Text.Buffer = NULL;
+ RtlInitUnicodeString(&MenuItem->Text, NULL);
}
}
else
@@ -781,10 +790,6 @@
RtlInitUnicodeString(&MenuItem->Text, NULL);
}
}
- else
- {
- RtlInitUnicodeString(&MenuItem->Text, NULL);
- }
if (sizeof(ROSMENUITEMINFO) == lpmii->cbSize)
{
reactos/subsys/win32k/ntuser
diff -u -r1.77 -r1.78
--- message.c 25 Dec 2004 20:30:50 -0000 1.77
+++ message.c 25 Dec 2004 22:59:10 -0000 1.78
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: message.c,v 1.77 2004/12/25 20:30:50 navaraf Exp $
+/* $Id: message.c,v 1.78 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -525,7 +525,9 @@
Msg->hwnd = Wnd->Self;
if(!(Wnd->Status & WINDOWSTATUS_DESTROYING))
{
- MsqPostMessage(Wnd->MessageQueue, Msg, FALSE);
+ MsqPostMessage(Wnd->MessageQueue, Msg, FALSE,
+ Msg->message == WM_MOUSEMOVE ? QS_MOUSEMOVE :
+ QS_MOUSEBUTTON);
}
/* eat the message */
@@ -1146,7 +1148,8 @@
KeQueryTickCount(&LargeTickCount);
KernelModeMsg.time = LargeTickCount.u.LowPart;
MsqPostMessage(Window->MessageQueue, &KernelModeMsg,
- NULL != MsgMemoryEntry && 0 != KernelModeMsg.lParam);
+ NULL != MsgMemoryEntry && 0 != KernelModeMsg.lParam,
+ QS_POSTMESSAGE);
IntReleaseWindowObject(Window);
}
@@ -1188,7 +1191,8 @@
return FALSE;
}
MsqPostMessage(pThread->MessageQueue, &KernelModeMsg,
- NULL != MsgMemoryEntry && 0 != KernelModeMsg.lParam);
+ NULL != MsgMemoryEntry && 0 != KernelModeMsg.lParam,
+ QS_POSTMESSAGE);
ObDereferenceObject( peThread );
return TRUE;
} else {
@@ -1614,7 +1618,7 @@
IntLockMessageQueue(Queue);
- Result = MAKELONG(Queue->ChangedBits, Queue->WakeBits);
+ Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits);
if (ClearChanges)
{
Queue->ChangedBits = 0;
reactos/subsys/win32k/ntuser
diff -u -r1.94 -r1.95
--- misc.c 24 Dec 2004 17:45:58 -0000 1.94
+++ misc.c 25 Dec 2004 22:59:10 -0000 1.95
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.94 2004/12/24 17:45:58 weiden Exp $
+/* $Id: misc.c,v 1.95 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -135,6 +135,9 @@
Result = (DWORD)GDI_MapHandleTable(NtCurrentProcess());
break;
+ case NOPARAM_ROUTINE_MSQCLEARWAKEMASK:
+ return (DWORD)IntMsqClearWakeMask();
+
default:
DPRINT1("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
@@ -333,6 +336,9 @@
return FALSE;
}
+
+ case ONEPARAM_ROUTINE_MSQSETWAKEMASK:
+ return (DWORD)IntMsqSetWakeMask(Param);
}
DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
Routine, Param);
reactos/subsys/win32k/ntuser
diff -u -r1.110 -r1.111
--- msgqueue.c 11 Dec 2004 19:39:18 -0000 1.110
+++ msgqueue.c 25 Dec 2004 22:59:10 -0000 1.111
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: msgqueue.c,v 1.110 2004/12/11 19:39:18 weiden Exp $
+/* $Id: msgqueue.c,v 1.111 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -65,19 +65,42 @@
/* FUNCTIONS *****************************************************************/
-/* set some queue bits */
-inline VOID MsqSetQueueBits( PUSER_MESSAGE_QUEUE Queue, WORD Bits )
+HANDLE FASTCALL
+IntMsqSetWakeMask(DWORD WakeMask)
{
- Queue->WakeBits |= Bits;
- Queue->ChangedBits |= Bits;
- if (MsqIsSignaled( Queue )) KeSetEvent(&Queue->NewMessages, IO_NO_INCREMENT, FALSE);
+ PW32THREAD Win32Thread;
+ PUSER_MESSAGE_QUEUE MessageQueue;
+ HANDLE MessageEventHandle;
+
+ Win32Thread = PsGetWin32Thread();
+ if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
+ return 0;
+
+ MessageQueue = Win32Thread->MessageQueue;
+ IntLockMessageQueue(MessageQueue);
+ MessageQueue->WakeMask = WakeMask;
+ MessageEventHandle = MessageQueue->NewMessagesHandle;
+ IntUnLockMessageQueue(MessageQueue);
+
+ return MessageEventHandle;
}
-/* clear some queue bits */
-inline VOID MsqClearQueueBits( PUSER_MESSAGE_QUEUE Queue, WORD Bits )
+BOOL FASTCALL
+IntMsqClearWakeMask(VOID)
{
- Queue->WakeBits &= ~Bits;
- Queue->ChangedBits &= ~Bits;
+ PW32THREAD Win32Thread;
+ PUSER_MESSAGE_QUEUE MessageQueue;
+
+ Win32Thread = PsGetWin32Thread();
+ if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
+ return FALSE;
+
+ MessageQueue = Win32Thread->MessageQueue;
+ IntLockMessageQueue(MessageQueue);
+ MessageQueue->WakeMask = ~0;
+ IntUnLockMessageQueue(MessageQueue);
+
+ return TRUE;
}
VOID FASTCALL
@@ -86,7 +109,10 @@
IntLockMessageQueue(Queue);
Queue->PaintCount++;
Queue->PaintPosted = TRUE;
- KeSetEvent(&Queue->NewMessages, IO_NO_INCREMENT, FALSE);
+ Queue->QueueBits |= QS_PAINT;
+ Queue->ChangedBits |= QS_PAINT;
+ if (Queue->WakeMask & QS_PAINT)
+ KeSetEvent(Queue->NewMessages, IO_NO_INCREMENT, FALSE);
IntUnLockMessageQueue(Queue);
}
@@ -305,10 +331,21 @@
}
/* save the pointer to the WM_MOUSEMOVE message in the new queue */
Window->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);
+ }
+ 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);
}
IntUnLockHardwareMessageQueue(Window->MessageQueue);
- KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
*Freed = FALSE;
IntReleaseWindowObject(Window);
return(FALSE);
@@ -416,7 +453,7 @@
return FALSE;
}
- WaitObjects[1] = &MessageQueue->NewMessages;
+ WaitObjects[1] = MessageQueue->NewMessages;
WaitObjects[0] = &HardwareMessageQueueLock;
do
{
@@ -585,7 +622,7 @@
FocusMessageQueue = IntGetFocusMessageQueue();
if( !IntGetScreenDC() ) {
if( W32kGetPrimitiveMessageQueue() ) {
- MsqPostMessage(W32kGetPrimitiveMessageQueue(), &Msg, FALSE);
+ MsqPostMessage(W32kGetPrimitiveMessageQueue(), &Msg, FALSE, QS_KEY);
}
} else {
if (FocusMessageQueue == NULL)
@@ -598,7 +635,7 @@
{
Msg.hwnd = FocusMessageQueue->FocusWindow;
DPRINT("Msg.hwnd = %x\n", Msg.hwnd);
- MsqPostMessage(FocusMessageQueue, &Msg, FALSE);
+ MsqPostMessage(FocusMessageQueue, &Msg, FALSE, QS_KEY);
}
else
{
@@ -647,14 +684,14 @@
// Mesg.pt.y = PsGetWin32Process()->WindowStation->SystemCursor.y;
// KeQueryTickCount(&LargeTickCount);
// Mesg.time = LargeTickCount.u.LowPart;
- MsqPostMessage(Window->MessageQueue, &Mesg, FALSE);
+ MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY);
ObmDereferenceObject(Window);
ObDereferenceObject (Thread);
// IntLockMessageQueue(pThread->MessageQueue);
// InsertHeadList(&pThread->MessageQueue->PostedMessagesListHead,
// &Message->ListEntry);
-// KeSetEvent(&pThread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
+// KeSetEvent(pThread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
// IntUnLockMessageQueue(pThread->MessageQueue);
}
@@ -894,7 +931,10 @@
IntLockMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->NotifyMessagesListHead,
&NotifyMessage->ListEntry);
- KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
+ MessageQueue->QueueBits |= QS_SENDMESSAGE;
+ MessageQueue->ChangedBits |= QS_SENDMESSAGE;
+ if (MessageQueue->WakeMask & QS_SENDMESSAGE)
+ KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
IntUnLockMessageQueue(MessageQueue);
}
@@ -949,7 +989,10 @@
InsertTailList(&MessageQueue->SentMessagesListHead, &Message->ListEntry);
IntUnLockMessageQueue(MessageQueue);
- KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
+ MessageQueue->QueueBits |= QS_SENDMESSAGE;
+ MessageQueue->ChangedBits |= QS_SENDMESSAGE;
+ if (MessageQueue->WakeMask & QS_SENDMESSAGE)
+ KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
/* we can't access the Message anymore since it could have already been deleted! */
@@ -1010,7 +1053,7 @@
PVOID WaitObjects[2];
WaitObjects[0] = &CompletionEvent;
- WaitObjects[1] = &ThreadQueue->NewMessages;
+ WaitObjects[1] = ThreadQueue->NewMessages;
do
{
WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, UserRequest,
@@ -1073,7 +1116,8 @@
}
VOID FASTCALL
-MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg, BOOLEAN FreeLParam)
+MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg, BOOLEAN FreeLParam,
+ DWORD MessageBits)
{
PUSER_MESSAGE Message;
@@ -1084,7 +1128,10 @@
IntLockMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->PostedMessagesListHead,
&Message->ListEntry);
- KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
+ MessageQueue->QueueBits |= MessageBits;
+ MessageQueue->ChangedBits |= MessageBits;
+ if (MessageQueue->WakeMask & MessageBits)
+ KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
IntUnLockMessageQueue(MessageQueue);
}
@@ -1094,7 +1141,10 @@
IntLockMessageQueue(MessageQueue);
MessageQueue->QuitPosted = TRUE;
MessageQueue->QuitExitCode = ExitCode;
- KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
+ MessageQueue->QueueBits |= QS_POSTMESSAGE;
+ MessageQueue->ChangedBits |= QS_POSTMESSAGE;
+ if (MessageQueue->WakeMask & QS_POSTMESSAGE)
+ KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
IntUnLockMessageQueue(MessageQueue);
}
@@ -1147,7 +1197,7 @@
NTSTATUS FASTCALL
MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue)
{
- PVOID WaitObjects[2] = {&MessageQueue->NewMessages, &HardwareMessageEvent};
+ PVOID WaitObjects[2] = {MessageQueue->NewMessages, &HardwareMessageEvent};
return(KeWaitForMultipleObjects(2,
WaitObjects,
WaitAny,
@@ -1167,10 +1217,11 @@
return ((LargeTickCount.u.LowPart - MessageQueue->LastMsgRead) > MSQ_HUNG);
}
-VOID FASTCALL
+BOOLEAN FASTCALL
MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue)
{
LARGE_INTEGER LargeTickCount;
+ NTSTATUS Status;
MessageQueue->Thread = Thread;
MessageQueue->CaretInfo = (PTHRDCARETINFO)(MessageQueue + 1);
@@ -1183,12 +1234,32 @@
ExInitializeFastMutex(&MessageQueue->Lock);
MessageQueue->QuitPosted = FALSE;
MessageQueue->QuitExitCode = 0;
- KeInitializeEvent(&MessageQueue->NewMessages, SynchronizationEvent, FALSE);
KeQueryTickCount(&LargeTickCount);
MessageQueue->LastMsgRead = LargeTickCount.u.LowPart;
MessageQueue->FocusWindow = NULL;
MessageQueue->PaintPosted = FALSE;
MessageQueue->PaintCount = 0;
+ MessageQueue->WakeMask = ~0;
+ MessageQueue->NewMessagesHandle = NULL;
+
+ Status = ZwCreateEvent(&MessageQueue->NewMessagesHandle, EVENT_ALL_ACCESS,
+ NULL, SynchronizationEvent, FALSE);
+ if (!NT_SUCCESS(Status))
+ {
+ return FALSE;
+ }
+
+ Status = ObReferenceObjectByHandle(MessageQueue->NewMessagesHandle, 0,
+ ExEventObjectType, KernelMode,
+ (PVOID*)&MessageQueue->NewMessages, NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ ZwClose(MessageQueue->NewMessagesHandle);
+ MessageQueue->NewMessagesHandle = NULL;
+ return FALSE;
+ }
+
+ return TRUE;
}
VOID FASTCALL
@@ -1298,7 +1369,11 @@
/* hold at least one reference until it'll be destroyed */
IntReferenceMessageQueue(MessageQueue);
/* initialize the queue */
- MsqInitializeMessageQueue(Thread, MessageQueue);
+ if (!MsqInitializeMessageQueue(Thread, MessageQueue))
+ {
+ IntDereferenceMessageQueue(MessageQueue);
+ return NULL;
+ }
return MessageQueue;
}
reactos/subsys/win32k/ntuser
diff -u -r1.36 -r1.37
--- timer.c 28 Sep 2004 15:02:30 -0000 1.36
+++ timer.c 25 Dec 2004 22:59:10 -0000 1.37
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: timer.c,v 1.36 2004/09/28 15:02:30 weiden Exp $
+/* $Id: timer.c,v 1.37 2004/12/25 22:59:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -405,7 +405,8 @@
continue;
}
- MsqPostMessage(Thread->Tcb.Win32Thread->MessageQueue, &MsgTimer->Msg, FALSE);
+ MsqPostMessage(Thread->Tcb.Win32Thread->MessageQueue, &MsgTimer->Msg,
+ FALSE, QS_TIMER);
ThreadsToDereference[ThreadsToDereferencePos] = Thread;
++ThreadsToDereferencePos;
CVSspam 0.2.8