diff --git a/reactos/subsys/win32k/ntuser/class.c b/reactos/subsys/win32k/ntuser/class.c index c77048b118d..3ca58ca4748 100644 --- a/reactos/subsys/win32k/ntuser/class.c +++ b/reactos/subsys/win32k/ntuser/class.c @@ -1,4 +1,4 @@ -/* $Id: class.c,v 1.14 2002/10/31 00:03:31 dwelch Exp $ +/* $Id: class.c,v 1.15 2003/05/03 14:12:14 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -20,7 +20,7 @@ #include #include -//#define NDEBUG +#define NDEBUG #include /* FUNCTIONS *****************************************************************/ diff --git a/reactos/subsys/win32k/ntuser/windc.c b/reactos/subsys/win32k/ntuser/windc.c index 67f31854398..1d78b10bc69 100644 --- a/reactos/subsys/win32k/ntuser/windc.c +++ b/reactos/subsys/win32k/ntuser/windc.c @@ -1,4 +1,4 @@ -/* $Id: windc.c,v 1.8 2003/03/08 13:16:51 gvg Exp $ +/* $Id: windc.c,v 1.9 2003/05/03 14:12:14 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -249,9 +249,7 @@ NtUserReleaseDC(HWND hWnd, HDC hDc) HDC STDCALL NtUserGetDC(HWND hWnd) { - if (!hWnd) - return NtUserGetDCEx(0, 0, DCX_CACHE | DCX_WINDOW); - return NtUserGetDCEx(hWnd, 0, DCX_USESTYLE); + return NtUserGetDCEx(hWnd, NULL, NULL == hWnd ? DCX_CACHE | DCX_WINDOW : DCX_USESTYLE); } DCE* DceAllocDCE(HWND hWnd, DCE_TYPE Type) @@ -331,16 +329,24 @@ NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags) BOOL UpdateClipOrigin = FALSE; HANDLE hRgnVisible = NULL; - if ((Window = W32kGetWindowObject(hWnd)) == NULL) +if (NULL == hWnd) +__asm__("int $3\n"); + if (NULL == hWnd) + { + Flags &= ~DCX_USESTYLE; + Window = NULL; + } + else if (NULL == (Window = W32kGetWindowObject(hWnd))) { return(0); } - if (Window->Dce == NULL) + if (NULL == Window || NULL == Window->Dce) { Flags |= DCX_CACHE; } + if (Flags & DCX_USESTYLE) { Flags &= ~(DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS | DCX_PARENTCLIP); @@ -380,7 +386,7 @@ NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags) Flags = (Flags & ~DCX_CLIPCHILDREN) | DCX_CACHE; } - if (!(Window->Style & WS_CHILD) || Window->Parent == NULL) + if (NULL == Window || !(Window->Style & WS_CHILD) || NULL == Window->Parent) { Flags &= ~DCX_PARENTCLIP; } @@ -444,7 +450,7 @@ NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags) DbgBreakPoint(); } - if (Dce == NULL) + if (NULL == Dce && NULL != Window) { W32kReleaseWindowObject(Window); return(NULL); @@ -525,7 +531,11 @@ NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags) { W32kDeleteObject(hRgnVisible); } - W32kReleaseWindowObject(Window); + if (NULL != Window) + { + W32kReleaseWindowObject(Window); + } + return(Dce->hDC); }