Author: dquintana
Date: Sun Dec 13 06:08:12 2015
New Revision: 70338
URL:
http://svn.reactos.org/svn/reactos?rev=70338&view=rev
Log:
[WIN32K]
* GetGUIThreadInfo: When they said "foreground thread", they meant the one with
the keyboard focus, not the currently running one.
NOTE: This needs verification, as I have no idea how to properly handle
IntGetFocusMessageQueue() returning NULL.
[MAGNIFY]
* Make use of the new-found ability to call GetGUIThreadInfo with 0 as the threadId.
CORE-10691
Modified:
trunk/reactos/base/applications/magnify/magnifier.c
trunk/reactos/win32ss/user/ntuser/misc.c
Modified: trunk/reactos/base/applications/magnify/magnifier.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/magnify/…
==============================================================================
--- trunk/reactos/base/applications/magnify/magnifier.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/magnify/magnifier.c [iso-8859-1] Sun Dec 13 06:08:12
2015
@@ -350,12 +350,11 @@
case WM_TIMER:
{
BOOL hasMoved = FALSE;
- HWND hwndForeground = GetForegroundWindow ();
- DWORD threadId = GetWindowThreadProcessId(hwndForeground, NULL);
+
GUITHREADINFO guiInfo;
guiInfo.cbSize = sizeof(guiInfo);
- GetGUIThreadInfo(threadId, &guiInfo);
+ GetGUIThreadInfo(0, &guiInfo);
if (bFollowMouse)
{
@@ -374,7 +373,7 @@
}
}
- if (bFollowCaret && hwndForeground && guiInfo.hwndCaret)
+ if (bFollowCaret && guiInfo.hwndCaret)
{
POINT ptCaret;
ptCaret.x = (guiInfo.rcCaret.left + guiInfo.rcCaret.right) / 2;
@@ -394,7 +393,7 @@
}
}
- if (bFollowFocus && hwndForeground && guiInfo.hwndFocus)
+ if (bFollowFocus && guiInfo.hwndFocus)
{
POINT ptFocus;
RECT activeRect;
Modified: trunk/reactos/win32ss/user/ntuser/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/misc.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/misc.c [iso-8859-1] Sun Dec 13 06:08:12 2015
@@ -371,27 +371,31 @@
}
W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread;
Desktop = W32Thread->rpdesk;
+
+ if (!Thread || !Desktop )
+ {
+ if(Thread)
+ ObDereferenceObject(Thread);
+ EngSetLastError(ERROR_ACCESS_DENIED);
+ RETURN( FALSE);
+ }
+
+ if ( W32Thread->MessageQueue )
+ MsgQueue = W32Thread->MessageQueue;
+ else
+ {
+ if ( Desktop ) MsgQueue = Desktop->ActiveMessageQueue;
+ }
}
else
{ /* Get the foreground thread */
- Thread = PsGetCurrentThread();
- W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread;
- Desktop = W32Thread->rpdesk;
- }
-
- if (!Thread || !Desktop )
- {
- if(idThread && Thread)
- ObDereferenceObject(Thread);
- EngSetLastError(ERROR_ACCESS_DENIED);
- RETURN( FALSE);
- }
-
- if ( W32Thread->MessageQueue )
- MsgQueue = W32Thread->MessageQueue;
- else
- {
- if ( Desktop ) MsgQueue = Desktop->ActiveMessageQueue;
+ /* FIXME: Handle NULL queue properly? */
+ MsgQueue = IntGetFocusMessageQueue();
+ if(!MsgQueue)
+ {
+ EngSetLastError(ERROR_ACCESS_DENIED);
+ RETURN( FALSE);
+ }
}
CaretInfo = &MsgQueue->CaretInfo;