[ros-diffs] [jimtabor] 38343: - Check for same intput desktop with GetCursorPos. Cleanup GetCursorInfo.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Thu Dec 25 12:29:53 CET 2008


Author: jimtabor
Date: Thu Dec 25 05:29:53 2008
New Revision: 38343

URL: http://svn.reactos.org/svn/reactos?rev=38343&view=rev
Log:
- Check for same intput desktop with GetCursorPos. Cleanup GetCursorInfo.

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
    trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c?rev=38343&r1=38342&r2=38343&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Thu Dec 25 05:29:53 2008
@@ -778,39 +778,16 @@
    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 @@
 
    IntGetCursorLocation(WinSta, &SafeCi.ptScreenPos);
 
-   Status = MmCopyToCaller(pci, &SafeCi, sizeof(CURSORINFO));
-   if(!NT_SUCCESS(Status))
-   {
-      ObDereferenceObject(WinSta);
+   _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))
+   {
       SetLastNtError(Status);
-      RETURN( FALSE);
    }
 
    ObDereferenceObject(WinSta);
-   RETURN( TRUE);
+   RETURN(Ret);
 
 CLEANUP:
    DPRINT("Leave NtUserGetCursorInfo, ret=%i\n",_ret_);

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c?rev=38343&r1=38342&r2=38343&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Thu Dec 25 05:29:53 2008
@@ -404,6 +404,8 @@
       {
           BOOL Ret = TRUE;
           PPOINTL pptl;
+          PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+          if (pti->hDesktop != InputDesktopHandle) RETURN(FALSE);
           _SEH2_TRY
           {
              pptl = (PPOINTL)Param;



More information about the Ros-diffs mailing list