From c306d43c24cc57d1df16a35a97c5fc25163254f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Tue, 18 Mar 2003 09:16:44 +0000 Subject: [PATCH] Pass NTSTATUS return code from NtUser functions and use MmCopyFromCaller to access pointer parameter svn path=/trunk/; revision=4339 --- reactos/include/win32k/ntuser.h | 2 +- reactos/lib/user32/windows/paint.c | 15 +++++++++++++-- reactos/subsys/win32k/ntuser/window.c | 22 ++++++++++++++++++---- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/reactos/include/win32k/ntuser.h b/reactos/include/win32k/ntuser.h index aa442285a63..0f3ba01faf6 100644 --- a/reactos/include/win32k/ntuser.h +++ b/reactos/include/win32k/ntuser.h @@ -1087,7 +1087,7 @@ NtUserRealChildWindowFromPoint( DWORD Unknown1, DWORD Unknown2); -BOOL STDCALL +NTSTATUS STDCALL NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags); diff --git a/reactos/lib/user32/windows/paint.c b/reactos/lib/user32/windows/paint.c index 0c319e7dbc6..924944c525d 100644 --- a/reactos/lib/user32/windows/paint.c +++ b/reactos/lib/user32/windows/paint.c @@ -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 #include +#define NDEBUG #include /* 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( diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 740f936978e..951bf406496 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -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 -//#define NDEBUG +#define NDEBUG #include #include @@ -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