- Add comment explaining the primitive message queue and fix
IntTranslateKbdMessage to work with it.
- Fix one windows locking case in IntPeekMessage.
- Zero memory allocated for HOOKs, MENU_OBJECTs and MONITORs to avoid
accessing uninitialized variables.
- Add check for hWnd == NULL to IntGetWindowObject. We mustn't access
the window station in that case (it can happen to be call from the
primitive message queue thread).
Modified: branches/win32k rewrite attempt/win32k/ntuser/focus.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/hook.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/keyboard.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/menu.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/message.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/monitor.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/window.c
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/focus.c
--- branches/win32k rewrite attempt/win32k/ntuser/focus.c
2005-08-03 11:10:21 UTC (rev 16994)
+++ branches/win32k rewrite attempt/win32k/ntuser/focus.c
2005-08-03 12:42:50 UTC (rev 16995)
@@ -250,7 +250,7 @@
// TopWindow = Window;
// }
- /* TMN: Check return valud from this function? */
+ /* TMN: Check return value from this function? */
IntSetForegroundAndFocusWindow(TopWnd, Window, TRUE);
return TRUE;
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/hook.c
--- branches/win32k rewrite attempt/win32k/ntuser/hook.c
2005-08-03 11:10:21 UTC (rev 16994)
+++ branches/win32k rewrite attempt/win32k/ntuser/hook.c
2005-08-03 12:42:50 UTC (rev 16995)
@@ -405,6 +405,7 @@
mem = ExAllocatePool(PagedPool, sizeof(HOOK));
if (!mem) return NULL;
+ RtlZeroMemory(mem, sizeof(HOOK));
WinSta = UserGetCurrentWinSta();
*hHook = UserAllocHandle(&WinSta->HandleTable, mem, USER_HOOK_PROC);
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/keyboard.c
--- branches/win32k rewrite attempt/win32k/ntuser/keyboard.c
2005-08-03 11:10:21 UTC (rev 16994)
+++ branches/win32k rewrite attempt/win32k/ntuser/keyboard.c
2005-08-03 12:42:50 UTC (rev 16995)
@@ -665,7 +665,8 @@
IntLockQueueState;
/* All messages have to contain the cursor point. */
- UserGetCursorLocation(UserGetCurrentWinSta(), &NewMsg.pt);
+ if (UserGetCurrentQueue() != W32kGetPrimitiveMessageQueue())
+ UserGetCursorLocation(UserGetCurrentWinSta(), &NewMsg.pt);
UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff,
QueueKeyStateTable, wp, 2, 0,
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/menu.c
--- branches/win32k rewrite attempt/win32k/ntuser/menu.c
2005-08-03 11:10:21 UTC (rev 16994)
+++ branches/win32k rewrite attempt/win32k/ntuser/menu.c
2005-08-03 12:42:50 UTC (rev 16995)
@@ -246,6 +246,7 @@
mem = ExAllocatePool(PagedPool, sizeof(MENU_OBJECT));
if (!mem) return NULL;
+ RtlZeroMemory(mem, sizeof(MENU_OBJECT));
WinSta = UserGetCurrentWinSta();
*h = UserAllocHandle(&WinSta->HandleTable, mem, USER_MENU);
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/message.c
--- branches/win32k rewrite attempt/win32k/ntuser/message.c
2005-08-03 11:10:21 UTC (rev 16994)
+++ branches/win32k rewrite attempt/win32k/ntuser/message.c
2005-08-03 12:42:50 UTC (rev 16995)
@@ -774,11 +774,13 @@
{
PWINDOW_OBJECT MsgWindow = NULL;
- if(Msg->Msg.hwnd && (MsgWindow =
IntGetWindowObject(Msg->Msg.hwnd)) &&
- Msg->Msg.message >= WM_MOUSEFIRST && Msg->Msg.message
<=
WM_MOUSELAST)
+ if(Msg->Msg.hwnd &&
+ Msg->Msg.message >= WM_MOUSEFIRST && Msg->Msg.message <=
WM_MOUSELAST)
{
USHORT HitTest;
+ MsgWindow = IntGetWindowObject(Msg->Msg.hwnd);
+ ASSERT(MsgWindow != NULL);
if(IntTranslateMouseMessage(ThreadQueue, &Msg->Msg,
&HitTest, TRUE))
/* FIXME - check message filter again, if the message
doesn't match anymore,
search again */
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/monitor.c
--- branches/win32k rewrite attempt/win32k/ntuser/monitor.c
2005-08-03 11:10:21 UTC (rev 16994)
+++ branches/win32k rewrite attempt/win32k/ntuser/monitor.c
2005-08-03 12:42:50 UTC (rev 16995)
@@ -85,6 +85,8 @@
mem = ExAllocatePool(PagedPool, sizeof(MONITOR_OBJECT));
if (!mem) return NULL;
+ RtlZeroMemory(mem, sizeof(MONITOR_OBJECT));
+
WinSta = UserGetCurrentWinSta();
*h = UserAllocHandle(&WinSta->HandleTable, mem, USER_MONITOR);
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c
--- branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c
2005-08-03 11:10:21 UTC (rev 16994)
+++ branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c
2005-08-03 12:42:50 UTC (rev 16995)
@@ -712,7 +712,18 @@
FocusMessageQueue = UserGetFocusMessageQueue();
- //FIXME: whats the point of this call????
+ /*
+ * FIXME: whats the point of this call???? -- Gunnar
+ *
+ * There's a dedicated thread in CSRSS that processes input messages
for
+ * consoles and it's message queue is marked as "primitive message
queue".
+ * We can assume that if there is no screen DC then we're in console
mode
+ * and the keyboard messages should go to this queue.
+ *
+ * This behaviour should eventually be removed.
+ *
+ * -- Filip
+ */
if( !IntGetScreenDC() )
{
/* FIXME: What to do about Msg.pt here? */
@@ -1659,7 +1670,7 @@
Timer = UserFindExpiredTimer(
Queue,
- GetWnd(WndFilter),
+ GetWnd(WndFilter),
MsgFilterMin,
MsgFilterMax,
Restart
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/window.c
--- branches/win32k rewrite attempt/win32k/ntuser/window.c
2005-08-03 11:10:21 UTC (rev 16994)
+++ branches/win32k rewrite attempt/win32k/ntuser/window.c
2005-08-03 12:42:50 UTC (rev 16995)
@@ -106,6 +106,8 @@
PWINDOW_OBJECT FASTCALL IntGetWindowObject(HWND hWnd)
{
PWINSTATION_OBJECT WinSta;
+ if (hWnd == NULL)
+ return NULL;
WinSta = UserGetCurrentWinSta();
ASSERT(WinSta);
return (PWINDOW_OBJECT)UserGetObject(&WinSta->HandleTable, hWnd,
USER_WINDOW );
@@ -590,10 +592,10 @@
while (!IsListEmpty(&Win32Thread->WindowListHead))
{
- Current = RemoveHeadList(&Win32Thread->WindowListHead);
+ Current = Win32Thread->WindowListHead.Flink;
Wnd = CONTAINING_RECORD(Current, WINDOW_OBJECT, ThreadListEntry);
/* window removes itself from the list */
- UserDestroyWindow(Wnd);
+ ASSERT(UserDestroyWindow(Wnd));
}
#if 0