2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
2003-10-15 20:48:19 +00:00
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: Caret functions
|
|
|
|
* FILE: subsys/win32k/ntuser/caret.c
|
|
|
|
* PROGRAMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
|
|
|
* REVISION HISTORY:
|
|
|
|
* 10/15/2003 Created
|
|
|
|
*/
|
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
2003-10-15 20:48:19 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
/* DEFINES *****************************************************************/
|
|
|
|
|
2003-11-22 11:49:09 +00:00
|
|
|
#define MIN_CARETBLINKRATE 100
|
|
|
|
#define MAX_CARETBLINKRATE 10000
|
|
|
|
#define DEFAULT_CARETBLINKRATE 530
|
|
|
|
#define CARET_REGKEY L"\\Registry\\User\\.Default\\Control Panel\\Desktop"
|
|
|
|
#define CARET_VALUENAME L"CursorBlinkRate"
|
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
|
|
|
static
|
2003-10-17 20:31:56 +00:00
|
|
|
BOOL FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntHideCaret(PTHRDCARETINFO CaretInfo)
|
2003-10-17 20:31:56 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
if(CaretInfo->hWnd && CaretInfo->Visible && CaretInfo->Showing)
|
|
|
|
{
|
|
|
|
co_IntSendMessage(CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
|
|
|
CaretInfo->Showing = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2003-10-17 20:31:56 +00:00
|
|
|
}
|
|
|
|
|
2003-10-16 22:07:37 +00:00
|
|
|
BOOL FASTCALL
|
2008-10-16 17:52:38 +00:00
|
|
|
co_IntDestroyCaret(PTHREADINFO Win32Thread)
|
2003-10-16 22:07:37 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
|
|
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)Win32Thread->MessageQueue;
|
|
|
|
|
|
|
|
if(!ThreadQueue || !ThreadQueue->CaretInfo)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
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;
|
|
|
|
return TRUE;
|
2003-10-16 22:07:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL FASTCALL
|
|
|
|
IntSetCaretBlinkTime(UINT uMSeconds)
|
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
/* Don't save the new value to the registry! */
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
2010-01-14 02:52:12 +00:00
|
|
|
PWINSTATION_OBJECT WinStaObject = pti->rpdesk->rpwinstaParent;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
/* windows doesn't do this check */
|
|
|
|
if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
ObDereferenceObject(WinStaObject);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
WinStaObject->CaretBlinkRate = uMSeconds;
|
2010-06-29 22:13:13 +00:00
|
|
|
gpsi->dtCaretBlink = uMSeconds;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return TRUE;
|
2003-11-22 11:49:09 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
static
|
2003-11-22 11:49:09 +00:00
|
|
|
UINT FASTCALL
|
|
|
|
IntQueryCaretBlinkRate(VOID)
|
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
UNICODE_STRING KeyName = RTL_CONSTANT_STRING(CARET_REGKEY);
|
|
|
|
UNICODE_STRING ValueName = RTL_CONSTANT_STRING(CARET_VALUENAME);
|
|
|
|
NTSTATUS Status;
|
|
|
|
HANDLE KeyHandle = NULL;
|
|
|
|
OBJECT_ATTRIBUTES KeyAttributes;
|
|
|
|
PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
|
|
|
|
ULONG Length = 0;
|
|
|
|
ULONG ResLength = 0;
|
|
|
|
ULONG Val = 0;
|
|
|
|
|
|
|
|
InitializeObjectAttributes(&KeyAttributes, &KeyName, OBJ_CASE_INSENSITIVE,
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
Status = ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
|
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = ZwQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation,
|
|
|
|
0, 0, &ResLength);
|
|
|
|
if((Status != STATUS_BUFFER_TOO_SMALL))
|
|
|
|
{
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ResLength += sizeof(KEY_VALUE_PARTIAL_INFORMATION);
|
|
|
|
KeyValuePartialInfo = ExAllocatePoolWithTag(PagedPool, ResLength, TAG_STRING);
|
|
|
|
Length = ResLength;
|
|
|
|
|
|
|
|
if(!KeyValuePartialInfo)
|
|
|
|
{
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = ZwQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation,
|
|
|
|
(PVOID)KeyValuePartialInfo, Length, &ResLength);
|
|
|
|
if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
|
|
|
|
{
|
|
|
|
NtClose(KeyHandle);
|
2008-11-03 13:26:03 +00:00
|
|
|
ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING);
|
2005-09-07 21:25:42 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ValueName.Length = KeyValuePartialInfo->DataLength;
|
|
|
|
ValueName.MaximumLength = KeyValuePartialInfo->DataLength;
|
|
|
|
ValueName.Buffer = (PWSTR)KeyValuePartialInfo->Data;
|
|
|
|
|
|
|
|
Status = RtlUnicodeStringToInteger(&ValueName, 0, &Val);
|
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
Val = 0;
|
|
|
|
}
|
|
|
|
|
2008-11-03 13:26:03 +00:00
|
|
|
ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING);
|
2005-09-07 21:25:42 +00:00
|
|
|
NtClose(KeyHandle);
|
|
|
|
|
|
|
|
return (UINT)Val;
|
2003-10-16 22:07:37 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
static
|
2003-11-22 01:51:05 +00:00
|
|
|
UINT FASTCALL
|
2003-10-16 22:07:37 +00:00
|
|
|
IntGetCaretBlinkTime(VOID)
|
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
PWINSTATION_OBJECT WinStaObject;
|
|
|
|
UINT Ret;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
2010-01-14 02:52:12 +00:00
|
|
|
WinStaObject = pti->rpdesk->rpwinstaParent;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
Ret = WinStaObject->CaretBlinkRate;
|
|
|
|
if(!Ret)
|
|
|
|
{
|
|
|
|
/* load it from the registry the first call only! */
|
|
|
|
Ret = WinStaObject->CaretBlinkRate = IntQueryCaretBlinkRate();
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
/* windows doesn't do this check */
|
|
|
|
if((Ret < MIN_CARETBLINKRATE) || (Ret > MAX_CARETBLINKRATE))
|
|
|
|
{
|
|
|
|
Ret = DEFAULT_CARETBLINKRATE;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return Ret;
|
2003-10-16 22:07:37 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
|
2003-10-16 22:07:37 +00:00
|
|
|
BOOL FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntSetCaretPos(int X, int Y)
|
2003-10-16 22:07:37 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
2008-10-16 17:52:38 +00:00
|
|
|
|
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if(ThreadQueue->CaretInfo->hWnd)
|
|
|
|
{
|
|
|
|
if(ThreadQueue->CaretInfo->Pos.x != X || ThreadQueue->CaretInfo->Pos.y != Y)
|
|
|
|
{
|
|
|
|
co_IntHideCaret(ThreadQueue->CaretInfo);
|
|
|
|
ThreadQueue->CaretInfo->Showing = 0;
|
|
|
|
ThreadQueue->CaretInfo->Pos.x = X;
|
|
|
|
ThreadQueue->CaretInfo->Pos.y = Y;
|
|
|
|
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
2010-05-15 19:40:33 +00:00
|
|
|
IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TMRF_SYSTEM);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-10-16 22:07:37 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return FALSE;
|
2003-10-16 22:07:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL FASTCALL
|
2003-10-17 20:31:56 +00:00
|
|
|
IntSwitchCaretShowing(PVOID Info)
|
2003-10-16 22:07:37 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
2008-10-16 17:52:38 +00:00
|
|
|
|
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if(ThreadQueue->CaretInfo->hWnd)
|
|
|
|
{
|
|
|
|
ThreadQueue->CaretInfo->Showing = (ThreadQueue->CaretInfo->Showing ? 0 : 1);
|
|
|
|
MmCopyToCaller(Info, ThreadQueue->CaretInfo, sizeof(THRDCARETINFO));
|
|
|
|
return TRUE;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return FALSE;
|
2003-10-16 22:07:37 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
#if 0 //unused
|
|
|
|
static
|
2003-10-17 20:31:56 +00:00
|
|
|
VOID FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntDrawCaret(HWND hWnd)
|
2003-10-17 20:31:56 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
2008-10-16 17:52:38 +00:00
|
|
|
|
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
|
|
|
if(ThreadQueue->CaretInfo->hWnd && ThreadQueue->CaretInfo->Visible &&
|
|
|
|
ThreadQueue->CaretInfo->Showing)
|
|
|
|
{
|
|
|
|
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
|
|
|
ThreadQueue->CaretInfo->Showing = 1;
|
|
|
|
}
|
2003-10-17 20:31:56 +00:00
|
|
|
}
|
2005-09-24 02:50:02 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-24 02:50:02 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
|
|
|
|
|
|
|
if (Window) ASSERT_REFS_CO(Window);
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window && Window->head.pti->pEThread != PsGetCurrentThread())
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-09-24 02:50:02 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ThreadQueue->CaretInfo->Visible)
|
|
|
|
{
|
|
|
|
IntKillTimer(ThreadQueue->CaretInfo->hWnd, IDCARETTIMER, TRUE);
|
|
|
|
|
|
|
|
co_IntHideCaret(ThreadQueue->CaretInfo);
|
|
|
|
ThreadQueue->CaretInfo->Visible = 0;
|
|
|
|
ThreadQueue->CaretInfo->Showing = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-24 02:50:02 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
|
|
|
|
|
|
|
if (Window) ASSERT_REFS_CO(Window);
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window && Window->head.pti->pEThread != PsGetCurrentThread())
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-09-24 02:50:02 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!ThreadQueue->CaretInfo->Visible)
|
|
|
|
{
|
|
|
|
ThreadQueue->CaretInfo->Visible = 1;
|
|
|
|
if(!ThreadQueue->CaretInfo->Showing)
|
|
|
|
{
|
|
|
|
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
|
|
|
}
|
2010-05-15 19:40:33 +00:00
|
|
|
IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TMRF_SYSTEM);
|
2005-09-24 02:50:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-10-17 20:31:56 +00:00
|
|
|
|
2003-10-16 22:07:37 +00:00
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
/* SYSCALLS *****************************************************************/
|
2003-10-16 22:07:37 +00:00
|
|
|
|
2003-10-15 20:48:19 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-10-15 20:48:19 +00:00
|
|
|
NtUserCreateCaret(
|
2005-09-07 21:25:42 +00:00
|
|
|
HWND hWnd,
|
|
|
|
HBITMAP hBitmap,
|
|
|
|
int nWidth,
|
|
|
|
int nHeight)
|
2003-10-15 20:48:19 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Window;
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
|
|
|
|
DPRINT("Enter NtUserCreateCaret\n");
|
|
|
|
UserEnterExclusive();
|
|
|
|
|
2005-09-08 16:18:51 +00:00
|
|
|
if(!(Window = UserGetWindowObject(hWnd)))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window->head.pti->pEThread != PsGetCurrentThread())
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
|
|
|
if (ThreadQueue->CaretInfo->Visible)
|
|
|
|
{
|
|
|
|
IntKillTimer(hWnd, IDCARETTIMER, TRUE);
|
|
|
|
co_IntHideCaret(ThreadQueue->CaretInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadQueue->CaretInfo->hWnd = hWnd;
|
|
|
|
if(hBitmap)
|
|
|
|
{
|
|
|
|
ThreadQueue->CaretInfo->Bitmap = hBitmap;
|
|
|
|
ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-31 17:11:21 +00:00
|
|
|
if (nWidth == 0)
|
|
|
|
{
|
|
|
|
nWidth = UserGetSystemMetrics(SM_CXBORDER);
|
|
|
|
}
|
|
|
|
if (nHeight == 0)
|
|
|
|
{
|
|
|
|
nHeight = UserGetSystemMetrics(SM_CYBORDER);
|
|
|
|
}
|
2005-09-07 21:25:42 +00:00
|
|
|
ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
|
|
|
|
ThreadQueue->CaretInfo->Size.cx = nWidth;
|
|
|
|
ThreadQueue->CaretInfo->Size.cy = nHeight;
|
|
|
|
}
|
|
|
|
ThreadQueue->CaretInfo->Visible = 0;
|
|
|
|
ThreadQueue->CaretInfo->Showing = 0;
|
|
|
|
|
|
|
|
RETURN(TRUE);
|
2005-09-05 21:19:23 +00:00
|
|
|
|
|
|
|
CLEANUP:
|
2005-09-07 21:25:42 +00:00
|
|
|
DPRINT("Leave NtUserCreateCaret, ret=%i\n",_ret_);
|
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
2003-10-15 20:48:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-10-15 20:48:19 +00:00
|
|
|
NtUserGetCaretBlinkTime(VOID)
|
|
|
|
{
|
2005-09-05 21:19:23 +00:00
|
|
|
DECLARE_RETURN(UINT);
|
|
|
|
|
|
|
|
DPRINT("Enter NtUserGetCaretBlinkTime\n");
|
2005-09-08 16:18:51 +00:00
|
|
|
UserEnterShared();
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
RETURN(IntGetCaretBlinkTime());
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
CLEANUP:
|
|
|
|
DPRINT("Leave NtUserGetCaretBlinkTime, ret=%i\n",_ret_);
|
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
2003-10-15 20:48:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-10-15 20:48:19 +00:00
|
|
|
NtUserGetCaretPos(
|
2005-09-07 21:25:42 +00:00
|
|
|
LPPOINT lpPoint)
|
2003-10-15 20:48:19 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
|
|
|
NTSTATUS Status;
|
|
|
|
DECLARE_RETURN(BOOL);
|
2005-09-05 21:19:23 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
DPRINT("Enter NtUserGetCaretPos\n");
|
|
|
|
UserEnterShared();
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos), sizeof(POINT));
|
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
RETURN(TRUE);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
CLEANUP:
|
2005-09-07 21:25:42 +00:00
|
|
|
DPRINT("Leave NtUserGetCaretPos, ret=%i\n",_ret_);
|
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
2003-10-15 20:48:19 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2007-07-30 15:08:14 +00:00
|
|
|
NtUserShowCaret(HWND hWnd OPTIONAL)
|
2005-09-05 21:19:23 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Window = NULL;
|
2005-10-15 13:22:13 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
2005-09-07 21:25:42 +00:00
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
DPRINT("Enter NtUserShowCaret\n");
|
|
|
|
UserEnterExclusive();
|
|
|
|
|
2005-09-09 00:25:52 +00:00
|
|
|
if(hWnd && !(Window = UserGetWindowObject(hWnd)))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
2005-10-15 13:22:13 +00:00
|
|
|
if (Window) UserRefObjectCo(Window, &Ref);
|
2007-07-30 15:08:14 +00:00
|
|
|
|
|
|
|
ret = co_UserShowCaret(Window);
|
|
|
|
|
2005-09-09 00:25:52 +00:00
|
|
|
if (Window) UserDerefObjectCo(Window);
|
2005-09-08 16:18:51 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
RETURN(ret);
|
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
CLEANUP:
|
2005-09-07 21:25:42 +00:00
|
|
|
DPRINT("Leave NtUserShowCaret, ret=%i\n",_ret_);
|
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
2003-10-15 20:48:19 +00:00
|
|
|
}
|
2007-07-30 15:08:14 +00:00
|
|
|
|
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2007-07-30 15:08:14 +00:00
|
|
|
NtUserHideCaret(HWND hWnd OPTIONAL)
|
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Window = NULL;
|
2007-07-30 15:08:14 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
DPRINT("Enter NtUserHideCaret\n");
|
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if(hWnd && !(Window = UserGetWindowObject(hWnd)))
|
|
|
|
{
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Window) UserRefObjectCo(Window, &Ref);
|
|
|
|
|
|
|
|
ret = co_UserHideCaret(Window);
|
|
|
|
|
|
|
|
if (Window) UserDerefObjectCo(Window);
|
|
|
|
|
|
|
|
RETURN(ret);
|
|
|
|
|
|
|
|
CLEANUP:
|
|
|
|
DPRINT("Leave NtUserHideCaret, ret=%i\n",_ret_);
|
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
|
|
|
}
|