Pass NTSTATUS return code from NtUser functions and use MmCopyFromCaller
authorGé van Geldorp <ge@gse.nl>
Tue, 18 Mar 2003 09:16:44 +0000 (09:16 +0000)
committerGé van Geldorp <ge@gse.nl>
Tue, 18 Mar 2003 09:16:44 +0000 (09:16 +0000)
to access pointer parameter

svn path=/trunk/; revision=4339

reactos/include/win32k/ntuser.h
reactos/lib/user32/windows/paint.c
reactos/subsys/win32k/ntuser/window.c

index aa44228..0f3ba01 100644 (file)
@@ -1087,7 +1087,7 @@ NtUserRealChildWindowFromPoint(
   DWORD Unknown1,
   DWORD Unknown2);
 
-BOOL STDCALL
+NTSTATUS STDCALL
 NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags);
 
 
index 0c319e7..924944c 100644 (file)
@@ -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: paint.c,v 1.9 2003/03/18 07:19:17 rcampbell Exp $
+/* $Id: paint.c,v 1.10 2003/03/18 09:16:44 gvg Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
@@ -30,6 +30,7 @@
 
 #include <windows.h>
 #include <user32.h>
+#define NDEBUG
 #include <debug.h>
 
 /* FUNCTIONS *****************************************************************/
@@ -96,6 +97,7 @@ InvalidateRgn(
 {
   return FALSE;
 }
+
 WINBOOL
 STDCALL
 RedrawWindow(
@@ -104,8 +106,17 @@ RedrawWindow(
   HRGN hrgnUpdate,
   UINT flags)
 {
-  return NtUserRedrawWindow(hWnd, lprcUpdate, hrgnUpdate, flags);
+  NTSTATUS Status;
+
+  Status = NtUserRedrawWindow(hWnd, lprcUpdate, hrgnUpdate, flags);
+  if (! NT_SUCCESS(Status))
+    {
+    SetLastError(RtlNtStatusToDosError(Status));
+    }
+
+  return NT_SUCCESS(Status);
 }
+
 WINBOOL
 STDCALL
 ScrollDC(
index 740f936..951bf40 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.33 2003/03/18 07:19:17 rcampbell Exp $
+/* $Id: window.c,v 1.34 2003/03/18 09:16:44 gvg Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -24,7 +24,7 @@
 #include <include/msgqueue.h>
 #include <include/rect.h>
 
-//#define NDEBUG
+#define NDEBUG
 #include <win32k/debug1.h>
 #include <debug.h>
 
@@ -897,10 +897,24 @@ NtUserRealChildWindowFromPoint(DWORD Unknown0,
   return 0;
 }
 
-BOOL STDCALL
+NTSTATUS STDCALL
 NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
 {
-  return PaintRedrawWindow(hWnd, lprcUpdate, hrgnUpdate, flags);
+  RECT SafeUpdateRect;
+  NTSTATUS Status;
+
+  if (NULL != lprcUpdate)
+    {
+      Status = MmCopyFromCaller(&SafeUpdateRect, lprcUpdate, sizeof(RECT));
+      if (! NT_SUCCESS(Status))
+       {
+         return Status;
+       }
+    }
+
+  return PaintRedrawWindow(hWnd, NULL == lprcUpdate ? NULL : &SafeUpdateRect, hrgnUpdate,
+                           flags, 0) ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER;
+;
 }
 
 UINT STDCALL