Commit in reactos on MAIN
lib/user32/windows/paint.c+7-81.22 -> 1.23
subsys/win32k/ntuser/painting.c+36-111.77 -> 1.78
+43-19
2 modified files
Implement GetUpdateRect() and harden NtUserGetUpdateRect()

reactos/lib/user32/windows
paint.c 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- paint.c	26 Jan 2004 08:44:51 -0000	1.22
+++ paint.c	23 Mar 2004 11:20:58 -0000	1.23
@@ -16,10 +16,10 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: paint.c,v 1.22 2004/01/26 08:44:51 weiden Exp $
+/* $Id: paint.c,v 1.23 2004/03/23 11:20:58 gvg Exp $
  *
  * PROJECT:         ReactOS user32.dll
- * FILE:            lib/user32/windows/input.c
+ * FILE:            lib/user32/windows/paint.c
  * PURPOSE:         Input
  * PROGRAMMER:      Casper S. Hornstrup (chorns@users.sourceforge.net)
  * UPDATE HISTORY:
@@ -120,17 +120,16 @@
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL
 STDCALL
 GetUpdateRect(
-  HWND hWnd,
-  LPRECT lpRect,
-  BOOL bErase)
+  HWND Wnd,
+  LPRECT Rect,
+  BOOL Erase)
 {
-  UNIMPLEMENTED;
-  return FALSE;
+  return NtUserGetUpdateRect(Wnd, Rect, Erase);
 }
 
 

reactos/subsys/win32k/ntuser
painting.c 1.77 -> 1.78
diff -u -r1.77 -r1.78
--- painting.c	22 Mar 2004 20:14:29 -0000	1.77
+++ painting.c	23 Mar 2004 11:20:58 -0000	1.78
@@ -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: painting.c,v 1.77 2004/03/22 20:14:29 weiden Exp $
+ *  $Id: painting.c,v 1.78 2004/03/23 11:20:58 gvg Exp $
  *
  *  COPYRIGHT:        See COPYING in the top level directory
  *  PROJECT:          ReactOS kernel
@@ -892,21 +892,46 @@
  */
 
 BOOL STDCALL
-NtUserGetUpdateRect(HWND hWnd, LPRECT lpRect, BOOL fErase)
+NtUserGetUpdateRect(HWND Wnd, LPRECT UnsafeRect, BOOL Erase)
 {
-   HRGN hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
+  RECT Rect;
+  HRGN Rgn;
+  PROSRGNDATA RgnData;
+  NTSTATUS Status;
 
-   if (!lpRect)
-   {
-      SetLastWin32Error(ERROR_INVALID_PARAMETER);
+  Rgn = NtGdiCreateRectRgn(0, 0, 0, 0);
+  if (NULL == Rgn)
+    {
+      NtGdiDeleteObject(Rgn);
+      SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
       return FALSE;
-   }
+    }
+  NtUserGetUpdateRgn(Wnd, Rgn, Erase);
+  RgnData = RGNDATA_LockRgn(Rgn);
+  if (NULL == RgnData)
+    {
+      NtGdiDeleteObject(Rgn);
+      SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
+      return FALSE;
+    }
+  if (ERROR == UnsafeIntGetRgnBox(RgnData, &Rect))
+    {
+      RGNDATA_UnlockRgn(Rgn);
+      NtGdiDeleteObject(Rgn);
+      SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
+      return FALSE;
+    }
+  RGNDATA_UnlockRgn(Rgn);
+  NtGdiDeleteObject(Rgn);
 
-   NtUserGetUpdateRgn(hWnd, hRgn, fErase);
-   NtGdiGetRgnBox(hRgn, lpRect);
-   NtGdiDeleteObject(hRgn);
+  Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECT));
+  if (! NT_SUCCESS(Status))
+    {
+      SetLastWin32Error(ERROR_INVALID_PARAMETER);
+      return FALSE;
+    }
 
-   return lpRect->left < lpRect->right && lpRect->top < lpRect->bottom;
+  return Rect.left < Rect.right && Rect.top < Rect.bottom;
 }
 
 /*
CVSspam 0.2.8