win32u: Move NtUserGetMouseMovePointsEx implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-11-17 12:48:53 +01:00 committed by Alexandre Julliard
parent dc03ca3baf
commit d60708a17f
7 changed files with 79 additions and 69 deletions

View File

@ -1217,73 +1217,6 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme)
return TRUE;
}
/***********************************************************************
* GetMouseMovePointsEx [USER32]
*
* RETURNS
* Success: count of point set in the buffer
* Failure: -1
*/
int WINAPI GetMouseMovePointsEx( UINT size, LPMOUSEMOVEPOINT ptin, LPMOUSEMOVEPOINT ptout, int count, DWORD resolution )
{
cursor_pos_t *pos, positions[64];
int copied;
unsigned int i;
TRACE( "%d, %p, %p, %d, %d\n", size, ptin, ptout, count, resolution );
if ((size != sizeof(MOUSEMOVEPOINT)) || (count < 0) || (count > ARRAY_SIZE( positions )))
{
SetLastError( ERROR_INVALID_PARAMETER );
return -1;
}
if (!ptin || (!ptout && count))
{
SetLastError( ERROR_NOACCESS );
return -1;
}
if (resolution != GMMP_USE_DISPLAY_POINTS)
{
FIXME( "only GMMP_USE_DISPLAY_POINTS is supported for now\n" );
SetLastError( ERROR_POINT_NOT_FOUND );
return -1;
}
SERVER_START_REQ( get_cursor_history )
{
wine_server_set_reply( req, &positions, sizeof(positions) );
if (wine_server_call_err( req )) return -1;
}
SERVER_END_REQ;
for (i = 0; i < ARRAY_SIZE( positions ); i++)
{
pos = &positions[i];
if (ptin->x == pos->x && ptin->y == pos->y && (!ptin->time || ptin->time == pos->time))
break;
}
if (i == ARRAY_SIZE( positions ))
{
SetLastError( ERROR_POINT_NOT_FOUND );
return -1;
}
for (copied = 0; copied < count && i < ARRAY_SIZE( positions ); copied++, i++)
{
pos = &positions[i];
ptout[copied].x = pos->x;
ptout[copied].y = pos->y;
ptout[copied].time = pos->time;
ptout[copied].dwExtraInfo = pos->info;
}
return copied;
}
/***********************************************************************
* EnableMouseInPointer (USER32.@)
*/

View File

@ -349,7 +349,7 @@
@ stdcall GetMessageW(ptr long long long)
@ stdcall GetMonitorInfoA(long ptr)
@ stdcall GetMonitorInfoW(long ptr)
@ stdcall GetMouseMovePointsEx(long ptr ptr long long)
@ stdcall GetMouseMovePointsEx(long ptr ptr long long) NtUserGetMouseMovePointsEx
@ stdcall GetNextDlgGroupItem(long long long)
@ stdcall GetNextDlgTabItem(long long long)
# @ stub GetNextQueueWindow

View File

@ -698,3 +698,67 @@ BOOL WINAPI NtUserUnregisterHotKey( HWND hwnd, INT id )
return ret;
}
/***********************************************************************
* NtUserGetMouseMovePointsEx (win32u.@)
*/
int WINAPI NtUserGetMouseMovePointsEx( UINT size, MOUSEMOVEPOINT *ptin, MOUSEMOVEPOINT *ptout,
int count, DWORD resolution )
{
cursor_pos_t *pos, positions[64];
int copied;
unsigned int i;
TRACE( "%d, %p, %p, %d, %d\n", size, ptin, ptout, count, resolution );
if ((size != sizeof(MOUSEMOVEPOINT)) || (count < 0) || (count > ARRAY_SIZE( positions )))
{
SetLastError( ERROR_INVALID_PARAMETER );
return -1;
}
if (!ptin || (!ptout && count))
{
SetLastError( ERROR_NOACCESS );
return -1;
}
if (resolution != GMMP_USE_DISPLAY_POINTS)
{
FIXME( "only GMMP_USE_DISPLAY_POINTS is supported for now\n" );
SetLastError( ERROR_POINT_NOT_FOUND );
return -1;
}
SERVER_START_REQ( get_cursor_history )
{
wine_server_set_reply( req, &positions, sizeof(positions) );
if (wine_server_call_err( req )) return -1;
}
SERVER_END_REQ;
for (i = 0; i < ARRAY_SIZE( positions ); i++)
{
pos = &positions[i];
if (ptin->x == pos->x && ptin->y == pos->y && (!ptin->time || ptin->time == pos->time))
break;
}
if (i == ARRAY_SIZE( positions ))
{
SetLastError( ERROR_POINT_NOT_FOUND );
return -1;
}
for (copied = 0; copied < count && i < ARRAY_SIZE( positions ); copied++, i++)
{
pos = &positions[i];
ptout[copied].x = pos->x;
ptout[copied].y = pos->y;
ptout[copied].time = pos->time;
ptout[copied].dwExtraInfo = pos->info;
}
return copied;
}

View File

@ -115,6 +115,7 @@ static void * const syscalls[] =
NtUserGetKeyboardLayout,
NtUserGetKeyboardState,
NtUserGetLayeredWindowAttributes,
NtUserGetMouseMovePointsEx,
NtUserGetObjectInformation,
NtUserGetOpenClipboardWindow,
NtUserGetProcessWindowStation,

View File

@ -956,7 +956,7 @@
@ stub NtUserGetMenuIndex
@ stub NtUserGetMenuItemRect
@ stub NtUserGetMessage
@ stub NtUserGetMouseMovePointsEx
@ stdcall -syscall NtUserGetMouseMovePointsEx(long ptr ptr long long)
@ stdcall -syscall NtUserGetObjectInformation(long long long long ptr)
@ stub NtUserGetOemBitmapSize
@ stdcall -syscall NtUserGetOpenClipboardWindow()

View File

@ -101,6 +101,7 @@
SYSCALL_ENTRY( NtUserGetKeyState ) \
SYSCALL_ENTRY( NtUserGetKeyboardState ) \
SYSCALL_ENTRY( NtUserGetLayeredWindowAttributes ) \
SYSCALL_ENTRY( NtUserGetMouseMovePointsEx ) \
SYSCALL_ENTRY( NtUserGetObjectInformation ) \
SYSCALL_ENTRY( NtUserGetOpenClipboardWindow ) \
SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \

View File

@ -263,3 +263,14 @@ NTSTATUS WINAPI wow64_NtUserSetKeyboardState( UINT *args )
return NtUserSetKeyboardState( state );
}
NTSTATUS WINAPI wow64_NtUserGetMouseMovePointsEx( UINT *args )
{
UINT size = get_ulong( &args );
MOUSEMOVEPOINT *ptin = get_ptr( &args );
MOUSEMOVEPOINT *ptout = get_ptr( &args );
int count = get_ulong( &args );
DWORD resolution = get_ulong( &args );
return NtUserGetMouseMovePointsEx( size, ptin, ptout, count, resolution );
}