Author: tfaber
Date: Sat Oct 24 15:46:34 2015
New Revision: 69679
URL:
http://svn.reactos.org/svn/reactos?rev=69679&view=rev
Log:
[WIN32K:NTUSER]
- Make CaretInfo part of the USER_MESSAGE_QUEUE structure since the pointer can no longer
change
CORE-10395
Modified:
trunk/reactos/win32ss/user/ntuser/caret.c
trunk/reactos/win32ss/user/ntuser/input.c
trunk/reactos/win32ss/user/ntuser/misc.c
trunk/reactos/win32ss/user/ntuser/msgqueue.c
trunk/reactos/win32ss/user/ntuser/msgqueue.h
trunk/reactos/win32ss/user/ntuser/scrollex.c
trunk/reactos/win32ss/user/ntuser/window.c
Modified: trunk/reactos/win32ss/user/ntuser/caret.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/caret.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/caret.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/caret.c [iso-8859-1] Sat Oct 24 15:46:34 2015
@@ -101,7 +101,7 @@
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
- if (ThreadQueue->CaretInfo->hWnd != hwnd)
+ if (ThreadQueue->CaretInfo.hWnd != hwnd)
{
TRACE("Not the same caret window!\n");
return;
@@ -126,8 +126,8 @@
{
case IDCARETTIMER:
{
- ThreadQueue->CaretInfo->Showing = (ThreadQueue->CaretInfo->Showing ?
0 : 1);
- co_IntDrawCaret(pWnd, ThreadQueue->CaretInfo);
+ ThreadQueue->CaretInfo.Showing = (ThreadQueue->CaretInfo.Showing ? 0 :
1);
+ co_IntDrawCaret(pWnd, &ThreadQueue->CaretInfo);
}
}
return;
@@ -155,18 +155,18 @@
{
PUSER_MESSAGE_QUEUE ThreadQueue;
PWND pWnd;
- ThreadQueue = (PUSER_MESSAGE_QUEUE)Win32Thread->MessageQueue;
-
- if(!ThreadQueue || !ThreadQueue->CaretInfo)
- return FALSE;
-
- pWnd = ValidateHwndNoErr(ThreadQueue->CaretInfo->hWnd);
- co_IntHideCaret(ThreadQueue->CaretInfo);
- ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
- ThreadQueue->CaretInfo->hWnd = (HWND)0;
- ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
- ThreadQueue->CaretInfo->Showing = 0;
- ThreadQueue->CaretInfo->Visible = 0;
+ ThreadQueue = Win32Thread->MessageQueue;
+
+ if (!ThreadQueue)
+ return FALSE;
+
+ pWnd = ValidateHwndNoErr(ThreadQueue->CaretInfo.hWnd);
+ co_IntHideCaret(&ThreadQueue->CaretInfo);
+ ThreadQueue->CaretInfo.Bitmap = (HBITMAP)0;
+ ThreadQueue->CaretInfo.hWnd = (HWND)0;
+ ThreadQueue->CaretInfo.Size.cx = ThreadQueue->CaretInfo.Size.cy = 0;
+ ThreadQueue->CaretInfo.Showing = 0;
+ ThreadQueue->CaretInfo.Visible = 0;
if (pWnd)
{
IntNotifyWinEvent(EVENT_OBJECT_DESTROY, pWnd, OBJID_CARET, CHILDID_SELF, 0);
@@ -201,16 +201,16 @@
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
- if(ThreadQueue->CaretInfo->hWnd)
- {
- pWnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
- if(ThreadQueue->CaretInfo->Pos.x != X || ThreadQueue->CaretInfo->Pos.y
!= Y)
- {
- co_IntHideCaret(ThreadQueue->CaretInfo);
- ThreadQueue->CaretInfo->Showing = 1;
- ThreadQueue->CaretInfo->Pos.x = X;
- ThreadQueue->CaretInfo->Pos.y = Y;
- co_IntDrawCaret(pWnd, ThreadQueue->CaretInfo);
+ if(ThreadQueue->CaretInfo.hWnd)
+ {
+ pWnd = UserGetWindowObject(ThreadQueue->CaretInfo.hWnd);
+ if(ThreadQueue->CaretInfo.Pos.x != X || ThreadQueue->CaretInfo.Pos.y != Y)
+ {
+ co_IntHideCaret(&ThreadQueue->CaretInfo);
+ ThreadQueue->CaretInfo.Showing = 1;
+ ThreadQueue->CaretInfo.Pos.x = X;
+ ThreadQueue->CaretInfo.Pos.y = Y;
+ co_IntDrawCaret(pWnd, &ThreadQueue->CaretInfo);
IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc,
TMRF_SYSTEM);
IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_CARET, CHILDID_SELF,
0);
@@ -237,20 +237,20 @@
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
- if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h)
+ if(Window && ThreadQueue->CaretInfo.hWnd != Window->head.h)
{
EngSetLastError(ERROR_ACCESS_DENIED);
return FALSE;
}
- if(ThreadQueue->CaretInfo->Visible)
- {
- PWND pwnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
+ if(ThreadQueue->CaretInfo.Visible)
+ {
+ PWND pwnd = UserGetWindowObject(ThreadQueue->CaretInfo.hWnd);
IntKillTimer(pwnd, IDCARETTIMER, TRUE);
- co_IntHideCaret(ThreadQueue->CaretInfo);
- ThreadQueue->CaretInfo->Visible = 0;
- ThreadQueue->CaretInfo->Showing = 0;
+ co_IntHideCaret(&ThreadQueue->CaretInfo);
+ ThreadQueue->CaretInfo.Visible = 0;
+ ThreadQueue->CaretInfo.Showing = 0;
}
return TRUE;
@@ -273,17 +273,17 @@
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
- if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h)
+ if(Window && ThreadQueue->CaretInfo.hWnd != Window->head.h)
{
EngSetLastError(ERROR_ACCESS_DENIED);
return FALSE;
}
- if (!ThreadQueue->CaretInfo->Visible)
- {
- ThreadQueue->CaretInfo->Visible = 1;
- pWnd = ValidateHwndNoErr(ThreadQueue->CaretInfo->hWnd);
- if (!ThreadQueue->CaretInfo->Showing && pWnd)
+ if (!ThreadQueue->CaretInfo.Visible)
+ {
+ ThreadQueue->CaretInfo.Visible = 1;
+ pWnd = ValidateHwndNoErr(ThreadQueue->CaretInfo.hWnd);
+ if (!ThreadQueue->CaretInfo.Showing && pWnd)
{
IntNotifyWinEvent(EVENT_OBJECT_SHOW, pWnd, OBJID_CARET, OBJID_CARET, 0);
}
@@ -324,17 +324,17 @@
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
- if (ThreadQueue->CaretInfo->Visible)
+ if (ThreadQueue->CaretInfo.Visible)
{
IntKillTimer(Window, IDCARETTIMER, TRUE);
- co_IntHideCaret(ThreadQueue->CaretInfo);
- }
-
- ThreadQueue->CaretInfo->hWnd = hWnd;
+ co_IntHideCaret(&ThreadQueue->CaretInfo);
+ }
+
+ ThreadQueue->CaretInfo.hWnd = hWnd;
if(hBitmap)
{
- ThreadQueue->CaretInfo->Bitmap = hBitmap;
- ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
+ ThreadQueue->CaretInfo.Bitmap = hBitmap;
+ ThreadQueue->CaretInfo.Size.cx = ThreadQueue->CaretInfo.Size.cy = 0;
}
else
{
@@ -346,12 +346,12 @@
{
nHeight = UserGetSystemMetrics(SM_CYBORDER);
}
- ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
- ThreadQueue->CaretInfo->Size.cx = nWidth;
- ThreadQueue->CaretInfo->Size.cy = nHeight;
- }
- ThreadQueue->CaretInfo->Visible = 0;
- ThreadQueue->CaretInfo->Showing = 0;
+ ThreadQueue->CaretInfo.Bitmap = (HBITMAP)0;
+ ThreadQueue->CaretInfo.Size.cx = nWidth;
+ ThreadQueue->CaretInfo.Size.cy = nHeight;
+ }
+ ThreadQueue->CaretInfo.Visible = 0;
+ ThreadQueue->CaretInfo.Showing = 0;
IntSetTimer( Window, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc,
TMRF_SYSTEM );
@@ -396,7 +396,7 @@
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
- Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos),
sizeof(POINT));
+ Status = MmCopyToCaller(lpPoint, &ThreadQueue->CaretInfo.Pos, sizeof(POINT));
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
Modified: trunk/reactos/win32ss/user/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/input.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] Sat Oct 24 15:46:34 2015
@@ -524,9 +524,9 @@
ptiTo->MessageQueue->spwndFocus =
ptiFrom->MessageQueue->spwndFocus;
ptiTo->MessageQueue->spwndCapture =
ptiFrom->MessageQueue->spwndCapture;
ptiTo->MessageQueue->QF_flags ^=
((ptiTo->MessageQueue->QF_flags ^ ptiFrom->MessageQueue->QF_flags) &
QF_CAPTURELOCKED);
- RtlCopyMemory(ptiTo->MessageQueue->CaretInfo,
- ptiFrom->MessageQueue->CaretInfo,
- sizeof(*ptiTo->MessageQueue->CaretInfo));
+ RtlCopyMemory(&ptiTo->MessageQueue->CaretInfo,
+ &ptiFrom->MessageQueue->CaretInfo,
+ sizeof(ptiTo->MessageQueue->CaretInfo));
IntSetFocusMessageQueue(NULL);
IntSetFocusMessageQueue(ptiTo->MessageQueue);
gptiForeground = ptiTo;
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] Sat Oct 24 15:46:34 2015
@@ -394,7 +394,7 @@
if ( Desktop ) MsgQueue = Desktop->ActiveMessageQueue;
}
- CaretInfo = MsgQueue->CaretInfo;
+ CaretInfo = &MsgQueue->CaretInfo;
SafeGui.flags = (CaretInfo->Visible ? GUI_CARETBLINKING : 0);
/*
Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgque…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] Sat Oct 24 15:46:34 2015
@@ -2080,7 +2080,6 @@
BOOLEAN FASTCALL
MsqInitializeMessageQueue(PTHREADINFO pti, PUSER_MESSAGE_QUEUE MessageQueue)
{
- MessageQueue->CaretInfo = (PTHRDCARETINFO)(MessageQueue + 1);
InitializeListHead(&MessageQueue->HardwareMessagesListHead); // Keep here!
MessageQueue->spwndFocus = NULL;
MessageQueue->iCursorLevel = 0;
@@ -2269,16 +2268,16 @@
{
PUSER_MESSAGE_QUEUE MessageQueue;
- MessageQueue = (PUSER_MESSAGE_QUEUE)ExAllocatePoolWithTag(NonPagedPool,
- sizeof(USER_MESSAGE_QUEUE) + sizeof(THRDCARETINFO),
- USERTAG_Q);
+ MessageQueue = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(*MessageQueue),
+ USERTAG_Q);
if (!MessageQueue)
{
return NULL;
}
- RtlZeroMemory(MessageQueue, sizeof(USER_MESSAGE_QUEUE) + sizeof(THRDCARETINFO));
+ RtlZeroMemory(MessageQueue, sizeof(*MessageQueue));
/* hold at least one reference until it'll be destroyed */
IntReferenceMessageQueue(MessageQueue);
/* initialize the queue */
@@ -2406,9 +2405,8 @@
MessageQueue->MoveSize = hWnd;
return Prev;
case MSQ_STATE_CARET:
- ASSERT(MessageQueue->CaretInfo);
- Prev = MessageQueue->CaretInfo->hWnd;
- MessageQueue->CaretInfo->hWnd = hWnd;
+ Prev = MessageQueue->CaretInfo.hWnd;
+ MessageQueue->CaretInfo.hWnd = hWnd;
return Prev;
}
Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgque…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/msgqueue.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/msgqueue.h [iso-8859-1] Sat Oct 24 15:46:34 2015
@@ -67,8 +67,6 @@
HWND MenuOwner;
/* Identifes the menu state */
BYTE MenuState;
- /* Caret information for this queue */
- PTHRDCARETINFO CaretInfo;
/* Message Queue Flags */
DWORD QF_flags;
DWORD cThreads; // Shared message queue counter.
@@ -85,6 +83,8 @@
/* Cursor object */
PCURICON_OBJECT CursorObject;
+ /* Caret information for this queue */
+ THRDCARETINFO CaretInfo;
} USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE;
#define QF_UPDATEKEYSTATE 0x00000001
Modified: trunk/reactos/win32ss/user/ntuser/scrollex.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/scroll…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/scrollex.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/scrollex.c [iso-8859-1] Sat Oct 24 15:46:34 2015
@@ -27,7 +27,7 @@
Desktop = pti->rpdesk;
ActiveMessageQueue = Desktop->ActiveMessageQueue;
if (!ActiveMessageQueue) return 0;
- CaretInfo = ActiveMessageQueue->CaretInfo;
+ CaretInfo = &ActiveMessageQueue->CaretInfo;
hWndCaret = CaretInfo->hWnd;
WndCaret = ValidateHwndNoErr(hWndCaret);
Modified: trunk/reactos/win32ss/user/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Sat Oct 24 15:46:34 2015
@@ -417,7 +417,7 @@
}
}
- if (ti->MessageQueue->CaretInfo->hWnd == UserHMGetHandle(Window))
+ if (ti->MessageQueue->CaretInfo.hWnd == UserHMGetHandle(Window))
{
co_IntDestroyCaret(ti);
}