Author: fireball
Date: Fri Dec 24 17:36:07 2010
New Revision: 50128
URL:
http://svn.reactos.org/svn/reactos?rev=50128&view=rev
Log:
- If RosGdiGetDC is called with a NULL (or non-existing) hwnd, restrict any drawing
operations on that DC.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Fri Dec 24
17:36:07 2010
@@ -635,7 +635,17 @@
pDC = DC_LockDc(physDev);
/* Get a pointer to this window */
- pDC->pWindow = SwmFindByHwnd(hwnd);
+ if (hwnd)
+ pDC->pWindow = SwmFindByHwnd(hwnd);
+
+ /* Handle situation when drawing is forbidden */
+ if (!hwnd || !pDC->pWindow)
+ {
+ /* Make up a dummy window object which will have empty visibility */
+ pDC->pWindow = ExAllocatePool(PagedPool, sizeof(SWM_WINDOW));
+ RtlZeroMemory(pDC->pWindow, sizeof(SWM_WINDOW));
+ pDC->pWindow->Visible = create_empty_region();
+ }
/* Release the object */
DC_UnlockDc(pDC);
@@ -650,6 +660,13 @@
/* Get a pointer to the DC */
pDC = DC_LockDc(physDev);
+
+ /* Check if it was a dummy window */
+ if (!pDC->pWindow->hwnd)
+ {
+ /* Free it */
+ ExFreePool(pDC->pWindow);
+ }
/* No window clipping is to be performed */
pDC->pWindow = NULL;