fixed NtGdiCreatePenIndirect()

svn path=/trunk/; revision=6956
This commit is contained in:
Thomas Bluemel 2003-12-11 14:48:55 +00:00
parent f11644a0f7
commit 8e00d905ca

View file

@ -16,11 +16,13 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: pen.c,v 1.11 2003/08/19 11:48:50 weiden Exp $ */ /* $Id: pen.c,v 1.12 2003/12/11 14:48:55 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <win32k/pen.h> #include <win32k/pen.h>
#include <include/error.h>
#include <internal/safe.h>
#define NDEBUG #define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
@ -44,9 +46,18 @@ STDCALL
NtGdiCreatePenIndirect(CONST PLOGPEN lgpn) NtGdiCreatePenIndirect(CONST PLOGPEN lgpn)
{ {
PPENOBJ penPtr; PPENOBJ penPtr;
LOGPEN Safelgpn;
HPEN hpen; HPEN hpen;
NTSTATUS Status;
if (lgpn->lopnStyle > PS_INSIDEFRAME) return 0; Status = MmCopyFromCaller(&Safelgpn, lgpn, sizeof(LOGPEN));
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return 0;
}
if (Safelgpn.lopnStyle > PS_INSIDEFRAME) return 0;
hpen = PENOBJ_AllocPen(); hpen = PENOBJ_AllocPen();
if (!hpen) return 0; if (!hpen) return 0;
@ -54,9 +65,9 @@ NtGdiCreatePenIndirect(CONST PLOGPEN lgpn)
penPtr = PENOBJ_LockPen( hpen ); penPtr = PENOBJ_LockPen( hpen );
ASSERT( penPtr ); ASSERT( penPtr );
penPtr->logpen.lopnStyle = lgpn->lopnStyle; penPtr->logpen.lopnStyle = Safelgpn.lopnStyle;
penPtr->logpen.lopnWidth = lgpn->lopnWidth; penPtr->logpen.lopnWidth = Safelgpn.lopnWidth;
penPtr->logpen.lopnColor = lgpn->lopnColor; penPtr->logpen.lopnColor = Safelgpn.lopnColor;
PENOBJ_UnlockPen( hpen ); PENOBJ_UnlockPen( hpen );
return hpen; return hpen;
} }