From af2f0d64d509ccd5a9b6b25413d1f330d50da145 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Thu, 25 Dec 2008 11:29:53 +0000 Subject: [PATCH] - Check for same intput desktop with GetCursorPos. Cleanup GetCursorInfo. svn path=/trunk/; revision=38343 --- .../win32/win32k/ntuser/cursoricon.c | 54 ++++++++----------- .../win32/win32k/ntuser/simplecall.c | 2 + 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c index 70090cbd330..5d9b1683235 100644 --- a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c @@ -778,39 +778,16 @@ NtUserGetCursorInfo( CURSORINFO SafeCi; PSYSTEM_CURSORINFO CurInfo; PWINSTATION_OBJECT WinSta; - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS;; PCURICON_OBJECT CurIcon; - HDC hDC; + BOOL Ret = FALSE; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserGetCursorInfo\n"); UserEnterExclusive(); -#if 1 - - - /* FIXME - get the screen dc from the window station or desktop */ - if (!(hDC = IntGetScreenDC())) - { - RETURN( FALSE); - } -#endif - - Status = MmCopyFromCaller(&SafeCi.cbSize, pci, sizeof(DWORD)); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( FALSE); - } - - if(SafeCi.cbSize != sizeof(CURSORINFO)) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - RETURN( FALSE); - } - WinSta = IntGetWinStaObj(); - if(WinSta == NULL) + if (WinSta == NULL) { RETURN( FALSE); } @@ -823,16 +800,31 @@ NtUserGetCursorInfo( IntGetCursorLocation(WinSta, &SafeCi.ptScreenPos); - Status = MmCopyToCaller(pci, &SafeCi, sizeof(CURSORINFO)); - if(!NT_SUCCESS(Status)) + _SEH2_TRY + { + if (pci->cbSize == sizeof(CURSORINFO)) + { + ProbeForWrite(pci, sizeof(CURSORINFO), 1); + RtlCopyMemory(pci, &SafeCi, sizeof(CURSORINFO)); + Ret = TRUE; + } + else + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + if (!NT_SUCCESS(Status)) { - ObDereferenceObject(WinSta); SetLastNtError(Status); - RETURN( FALSE); } ObDereferenceObject(WinSta); - RETURN( TRUE); + RETURN(Ret); CLEANUP: DPRINT("Leave NtUserGetCursorInfo, ret=%i\n",_ret_); diff --git a/reactos/subsystems/win32/win32k/ntuser/simplecall.c b/reactos/subsystems/win32/win32k/ntuser/simplecall.c index 1b8f4aa9cac..19945949526 100644 --- a/reactos/subsystems/win32/win32k/ntuser/simplecall.c +++ b/reactos/subsystems/win32/win32k/ntuser/simplecall.c @@ -404,6 +404,8 @@ NtUserCallOneParam( { BOOL Ret = TRUE; PPOINTL pptl; + PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); + if (pti->hDesktop != InputDesktopHandle) RETURN(FALSE); _SEH2_TRY { pptl = (PPOINTL)Param;