mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
changed SetCursorPos() to use SendInput()
svn path=/trunk/; revision=9262
This commit is contained in:
parent
d490382a4f
commit
9900ed382e
4 changed files with 48 additions and 67 deletions
|
@ -177,6 +177,7 @@ NtUserCallNoParam(
|
|||
#define ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS 0x09
|
||||
#define ONEPARAM_ROUTINE_GETWINDOWINSTANCE 0x10
|
||||
#define ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO 0x0a
|
||||
#define ONEPARAM_ROUTINE_GETCURSORPOSITION 0x0b
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserCallOneParam(
|
||||
|
@ -203,7 +204,6 @@ NtUserCallOneParam(
|
|||
#define TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW 0x56
|
||||
#define TWOPARAM_ROUTINE_VALIDATERGN 0x57
|
||||
#define TWOPARAM_ROUTINE_SETWNDCONTEXTHLPID 0x58
|
||||
#define TWOPARAM_ROUTINE_CURSORPOSITION 0x59
|
||||
#define TWOPARAM_ROUTINE_SETCARETPOS 0x60
|
||||
#define TWOPARAM_ROUTINE_GETWINDOWINFO 0x61
|
||||
DWORD
|
||||
|
|
|
@ -40,12 +40,6 @@ void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);
|
|||
#define NtUserSetCaretPos(X, Y) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)X, (DWORD)Y, TWOPARAM_ROUTINE_SETCARETPOS)
|
||||
|
||||
#define NtUserGetCursorPos(lpPoint) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)lpPoint, (DWORD)FALSE, TWOPARAM_ROUTINE_CURSORPOSITION)
|
||||
|
||||
#define NtUserSetCursorPos(lpPoint) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)lpPoint, (DWORD)TRUE, TWOPARAM_ROUTINE_CURSORPOSITION)
|
||||
|
||||
#define NtUserSetGUIThreadHandle(field, hwnd) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)field, (DWORD)hwnd, TWOPARAM_ROUTINE_SETGUITHRDHANDLE)
|
||||
|
||||
|
@ -88,6 +82,9 @@ void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);
|
|||
#define NtUserGetWindowInstance(hwnd) \
|
||||
(HINSTANCE)NtUserCallOneParam((DWORD)hwnd, ONEPARAM_ROUTINE_GETWINDOWINSTANCE)
|
||||
|
||||
#define NtUserGetCursorPos(lpPoint) \
|
||||
(BOOL)NtUserCallOneParam((DWORD)lpPoint, ONEPARAM_ROUTINE_GETCURSORPOSITION)
|
||||
|
||||
LONG WINAPI RegCloseKey(HKEY);
|
||||
LONG WINAPI RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY);
|
||||
LONG WINAPI RegQueryValueExW(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
|
||||
|
|
|
@ -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: cursor.c,v 1.20 2004/04/09 20:03:14 navaraf Exp $
|
||||
/* $Id: cursor.c,v 1.21 2004/05/01 09:31:59 weiden Exp $
|
||||
*
|
||||
* PROJECT: ReactOS user32.dll
|
||||
* FILE: lib/user32/windows/cursor.c
|
||||
|
@ -260,10 +260,18 @@ BOOL STDCALL
|
|||
SetCursorPos(int X,
|
||||
int Y)
|
||||
{
|
||||
POINT pos;
|
||||
pos.x = (LONG)X;
|
||||
pos.y = (LONG)Y;
|
||||
return NtUserSetCursorPos(&pos);
|
||||
INPUT Input;
|
||||
|
||||
Input.type = INPUT_MOUSE;
|
||||
Input.mi.dx = (LONG)X;
|
||||
Input.mi.dy = (LONG)Y;
|
||||
Input.mi.mouseData = 0;
|
||||
Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
|
||||
Input.mi.time = 0;
|
||||
Input.mi.dwExtraInfo = 0;
|
||||
|
||||
NtUserSendInput(1, &Input, sizeof(INPUT));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: misc.c,v 1.64 2004/04/30 22:18:00 weiden Exp $
|
||||
/* $Id: misc.c,v 1.65 2004/05/01 09:31:59 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -185,6 +185,36 @@ NtUserCallOneParam(
|
|||
|
||||
case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO:
|
||||
return (DWORD)MsqSetMessageExtraInfo((LPARAM)Param);
|
||||
|
||||
case ONEPARAM_ROUTINE_GETCURSORPOSITION:
|
||||
{
|
||||
POINT Pos;
|
||||
|
||||
if(!Param)
|
||||
return (DWORD)FALSE;
|
||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return (DWORD)FALSE;
|
||||
|
||||
/* FIXME - check if process has WINSTA_READATTRIBUTES */
|
||||
Pos.x = WinStaObject->SystemCursor.x;
|
||||
Pos.y = WinStaObject->SystemCursor.y;
|
||||
|
||||
Status = MmCopyToCaller((PPOINT)Param, &Pos, sizeof(POINT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ObDereferenceObject(WinStaObject);
|
||||
|
||||
return (DWORD)TRUE;
|
||||
}
|
||||
}
|
||||
DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam()\n Param=0x%x\n",
|
||||
Routine, Param);
|
||||
|
@ -205,8 +235,6 @@ NtUserCallTwoParam(
|
|||
{
|
||||
NTSTATUS Status;
|
||||
PWINDOW_OBJECT WindowObject;
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
POINT Pos;
|
||||
|
||||
switch(Routine)
|
||||
{
|
||||
|
@ -316,58 +344,6 @@ NtUserCallTwoParam(
|
|||
IntReleaseWindowObject(WindowObject);
|
||||
return (DWORD)TRUE;
|
||||
|
||||
case TWOPARAM_ROUTINE_CURSORPOSITION:
|
||||
if(!Param1)
|
||||
return (DWORD)FALSE;
|
||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return (DWORD)FALSE;
|
||||
|
||||
if(Param2)
|
||||
{
|
||||
/* set cursor position */
|
||||
MOUSEINPUT mi;
|
||||
|
||||
Status = MmCopyFromCaller(&Pos, (PPOINT)Param1, sizeof(POINT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mi.dx = Pos.x;
|
||||
mi.dy = Pos.y;
|
||||
mi.mouseData = 0;
|
||||
mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
|
||||
mi.time = 0;
|
||||
mi.dwExtraInfo = 0;
|
||||
IntMouseInput(&mi);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get cursor position */
|
||||
/* FIXME - check if process has WINSTA_READATTRIBUTES */
|
||||
Pos.x = WinStaObject->SystemCursor.x;
|
||||
Pos.y = WinStaObject->SystemCursor.y;
|
||||
|
||||
Status = MmCopyToCaller((PPOINT)Param1, &Pos, sizeof(POINT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ObDereferenceObject(WinStaObject);
|
||||
|
||||
return (DWORD)TRUE;
|
||||
|
||||
case TWOPARAM_ROUTINE_SETCARETPOS:
|
||||
return (DWORD)IntSetCaretPos((int)Param1, (int)Param2);
|
||||
|
||||
|
|
Loading…
Reference in a new issue