mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:52:59 +00:00
fixed passing pointers to win32k
svn path=/trunk/; revision=6127
This commit is contained in:
parent
987f34d8d3
commit
0ae09914df
3 changed files with 71 additions and 47 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: cursor.c,v 1.12 2003/08/29 08:46:20 weiden Exp $
|
/* $Id: cursor.c,v 1.13 2003/09/24 21:09:22 weiden Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/cursor.c
|
* FILE: lib/user32/windows/cursor.c
|
||||||
|
@ -94,20 +94,7 @@ DestroyCursor(HCURSOR hCursor)
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
GetClipCursor(LPRECT lpRect)
|
GetClipCursor(LPRECT lpRect)
|
||||||
{
|
{
|
||||||
RECT rc;
|
return NtUserGetClipCursor(lpRect);
|
||||||
WINBOOL res;
|
|
||||||
|
|
||||||
if(!lpRect)
|
|
||||||
{
|
|
||||||
SetLastError(ERROR_NOACCESS);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlCopyMemory(&rc, lpRect, sizeof(RECT));
|
|
||||||
res = NtUserGetClipCursor(&rc);
|
|
||||||
RtlCopyMemory(lpRect, &rc, sizeof(RECT));
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +126,6 @@ GetCursorInfo(PCURSORINFO pci)
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
GetCursorPos(LPPOINT lpPoint)
|
GetCursorPos(LPPOINT lpPoint)
|
||||||
{
|
{
|
||||||
POINT pos;
|
|
||||||
WINBOOL res;
|
WINBOOL res;
|
||||||
/* Windows doesn't check if lpPoint == NULL, we do */
|
/* Windows doesn't check if lpPoint == NULL, we do */
|
||||||
if(!lpPoint)
|
if(!lpPoint)
|
||||||
|
@ -148,13 +134,9 @@ GetCursorPos(LPPOINT lpPoint)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = (WINBOOL)NtUserCallTwoParam((DWORD)&pos, (DWORD)FALSE,
|
res = (WINBOOL)NtUserCallTwoParam((DWORD)lpPoint, (DWORD)FALSE,
|
||||||
TWOPARAM_ROUTINE_CURSORPOSITION);
|
TWOPARAM_ROUTINE_CURSORPOSITION);
|
||||||
if(res)
|
|
||||||
{
|
|
||||||
lpPoint->x = pos.x;
|
|
||||||
lpPoint->y = pos.y;
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: misc.c,v 1.17 2003/09/13 13:58:38 weiden Exp $
|
/* $Id: misc.c,v 1.18 2003/09/24 21:09:22 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
#include <ddk/ntddmou.h>
|
#include <ddk/ntddmou.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
#include <win32k/dc.h>
|
#include <win32k/dc.h>
|
||||||
|
#include <internal/safe.h>
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
#include <include/painting.h>
|
#include <include/painting.h>
|
||||||
|
@ -134,7 +135,7 @@ NtUserCallTwoParam(
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
PSYSTEM_CURSORINFO CurInfo;
|
PSYSTEM_CURSORINFO CurInfo;
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
PPOINT Pos;
|
POINT Pos;
|
||||||
|
|
||||||
switch(Routine)
|
switch(Routine)
|
||||||
{
|
{
|
||||||
|
@ -179,20 +180,26 @@ NtUserCallTwoParam(
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return (DWORD)FALSE;
|
return (DWORD)FALSE;
|
||||||
|
|
||||||
Pos = (PPOINT)Param1;
|
|
||||||
|
|
||||||
if(Param2)
|
if(Param2)
|
||||||
{
|
{
|
||||||
/* set cursor position */
|
/* set cursor position */
|
||||||
|
|
||||||
|
Status = MmCopyFromCaller(&Pos, (PPOINT)Param1, sizeof(POINT));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
CurInfo = &WinStaObject->SystemCursor;
|
CurInfo = &WinStaObject->SystemCursor;
|
||||||
/* FIXME - check if process has WINSTA_WRITEATTRIBUTES */
|
/* FIXME - check if process has WINSTA_WRITEATTRIBUTES */
|
||||||
|
|
||||||
//CheckClipCursor(&Pos->x, &Pos->y, CurInfo);
|
//CheckClipCursor(&Pos->x, &Pos->y, CurInfo);
|
||||||
if((Pos->x != CurInfo->x) || (Pos->y != CurInfo->y))
|
if((Pos.x != CurInfo->x) || (Pos.y != CurInfo->y))
|
||||||
{
|
{
|
||||||
MouseMoveCursor(Pos->x, Pos->y);
|
MouseMoveCursor(Pos.x, Pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -200,8 +207,17 @@ NtUserCallTwoParam(
|
||||||
{
|
{
|
||||||
/* get cursor position */
|
/* get cursor position */
|
||||||
/* FIXME - check if process has WINSTA_READATTRIBUTES */
|
/* FIXME - check if process has WINSTA_READATTRIBUTES */
|
||||||
Pos->x = WinStaObject->SystemCursor.x;
|
Pos.x = WinStaObject->SystemCursor.x;
|
||||||
Pos->y = WinStaObject->SystemCursor.y;
|
Pos.y = WinStaObject->SystemCursor.y;
|
||||||
|
|
||||||
|
Status = MmCopyToCaller((PPOINT)Param1, &Pos, sizeof(POINT));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
|
@ -235,6 +251,7 @@ NtUserSystemParametersInfo(
|
||||||
0, 0, DEFAULT_QUALITY, FF_MODERN, L"Bitstream Vera Sans Bold" };*/
|
0, 0, DEFAULT_QUALITY, FF_MODERN, L"Bitstream Vera Sans Bold" };*/
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
|
RECT Rect;
|
||||||
|
|
||||||
switch(uiAction)
|
switch(uiAction)
|
||||||
{
|
{
|
||||||
|
@ -271,19 +288,34 @@ NtUserSystemParametersInfo(
|
||||||
|
|
||||||
case SPI_GETWORKAREA:
|
case SPI_GETWORKAREA:
|
||||||
{
|
{
|
||||||
((PRECT)pvParam)->left = 0;
|
/* FIXME */
|
||||||
((PRECT)pvParam)->top = 0;
|
Rect.left = 0;
|
||||||
((PRECT)pvParam)->right = 640;
|
Rect.top = 0;
|
||||||
((PRECT)pvParam)->bottom = 480;
|
Rect.right = 640;
|
||||||
|
Rect.bottom = 480;
|
||||||
|
|
||||||
|
Status = MmCopyToCaller((PRECT)pvParam, &Rect, sizeof(RECT));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case SPI_GETICONTITLELOGFONT:
|
case SPI_GETICONTITLELOGFONT:
|
||||||
{
|
{
|
||||||
memcpy(pvParam, &CaptionFont, sizeof(CaptionFont));
|
Status = MmCopyToCaller(pvParam, &CaptionFont, sizeof(CaptionFont));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case SPI_GETNONCLIENTMETRICS:
|
case SPI_GETNONCLIENTMETRICS:
|
||||||
{
|
{
|
||||||
|
/* FIXME - use MmCopyToCaller() !!! */
|
||||||
LPNONCLIENTMETRICSW pMetrics = (LPNONCLIENTMETRICSW)pvParam;
|
LPNONCLIENTMETRICSW pMetrics = (LPNONCLIENTMETRICSW)pvParam;
|
||||||
|
|
||||||
if (pMetrics->cbSize != sizeof(NONCLIENTMETRICSW) ||
|
if (pMetrics->cbSize != sizeof(NONCLIENTMETRICSW) ||
|
||||||
|
|
|
@ -326,14 +326,16 @@ NtUserGetClipCursor(
|
||||||
/* FIXME - check if process has WINSTA_READATTRIBUTES */
|
/* FIXME - check if process has WINSTA_READATTRIBUTES */
|
||||||
|
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
|
RECT Rect;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
if(!lpRect)
|
if(!lpRect)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
NTSTATUS Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||||
|
@ -344,17 +346,25 @@ NtUserGetClipCursor(
|
||||||
|
|
||||||
if(WinStaObject->SystemCursor.CursorClipInfo.IsClipped)
|
if(WinStaObject->SystemCursor.CursorClipInfo.IsClipped)
|
||||||
{
|
{
|
||||||
lpRect->left = WinStaObject->SystemCursor.CursorClipInfo.Left;
|
Rect.left = WinStaObject->SystemCursor.CursorClipInfo.Left;
|
||||||
lpRect->top = WinStaObject->SystemCursor.CursorClipInfo.Top;
|
Rect.top = WinStaObject->SystemCursor.CursorClipInfo.Top;
|
||||||
lpRect->right = WinStaObject->SystemCursor.CursorClipInfo.Right;
|
Rect.right = WinStaObject->SystemCursor.CursorClipInfo.Right;
|
||||||
lpRect->bottom = WinStaObject->SystemCursor.CursorClipInfo.Bottom;
|
Rect.bottom = WinStaObject->SystemCursor.CursorClipInfo.Bottom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lpRect->left = 0;
|
Rect.left = 0;
|
||||||
lpRect->top = 0;
|
Rect.top = 0;
|
||||||
lpRect->right = NtUserGetSystemMetrics(SM_CXSCREEN);
|
Rect.right = NtUserGetSystemMetrics(SM_CXSCREEN);
|
||||||
lpRect->bottom = NtUserGetSystemMetrics(SM_CYSCREEN);
|
Rect.bottom = NtUserGetSystemMetrics(SM_CYSCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = MmCopyToCaller((PRECT)lpRect, &Rect, sizeof(RECT));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue