[ros-diffs] [tkreuzer] 32110: - simplify a check - fix a check - fix a region leak - don't abuse GDIOBJ_LockObj to validate a handle, use GDIOBJ_ValidateHandle instead - add some additional debug output

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Mon Feb 4 04:22:27 CET 2008


Author: tkreuzer
Date: Mon Feb  4 06:22:27 2008
New Revision: 32110

URL: http://svn.reactos.org/svn/reactos?rev=32110&view=rev
Log:
- simplify a check
- fix a check
- fix a region leak
- don't abuse GDIOBJ_LockObj to validate a handle, use GDIOBJ_ValidateHandle instead
- add some additional debug output

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
    trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/windc.c?rev=32110&r1=32109&r2=32110&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Mon Feb  4 06:22:27 2008
@@ -485,7 +485,7 @@
    else
    {
       Dce = Window->Dce;
-      if (NULL != Dce && Dce->hwndCurrent == (Window ? Window->hSelf : NULL))
+      if (Dce->hwndCurrent == Window->hSelf)
       {
          UpdateVisRgn = FALSE; /* updated automatically, via DCHook() */
       }
@@ -511,7 +511,7 @@
 
    if (0 == (Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) && NULL != ClipRegion)
    {
-      if (Flags & DCX_KEEPCLIPRGN)
+      if (!(Flags & DCX_KEEPCLIPRGN))
          NtGdiDeleteObject(ClipRegion);
       ClipRegion = NULL;
    }
@@ -520,7 +520,6 @@
    if (NULL != Dce->hClipRgn)
    {
       DceDeleteClipRgn(Dce);
-      Dce->hClipRgn = NULL;
    }
 #endif
 
@@ -541,6 +540,7 @@
       {
          Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect);
       }
+      Dce->DCXFlags &= ~DCX_KEEPCLIPRGN;
    }
    else if (ClipRegion != NULL)
    {
@@ -715,8 +715,8 @@
             }
          }
 
-         dc = DC_LockDc(pDCE->hDC);
-         if (dc == NULL)
+         if (!GDIOBJ_ValidateHandle(pDCE->hDC, GDI_OBJECT_TYPE_DC) ||
+             (dc = DC_LockDc(pDCE->hDC)) == NULL)
          {
             pDCE = (PDCE) pDCE->List.Flink;
             continue;

Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c?rev=32110&r1=32109&r2=32110&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Mon Feb  4 06:22:27 2008
@@ -857,6 +857,12 @@
    /* Check for invalid owner. */
    if (ProcessId != HandleProcessId && HandleProcessId != NULL)
    {
+        DPRINT1("Tried to lock object (0x%p) of wrong owner! ProcessId = %p, HandleProcessId = %p\n", hObj, ProcessId, HandleProcessId);
+#ifdef GDI_DEBUG
+        KeRosDumpStackFrames(NULL, 20);
+//        DPRINT1("Handle allocator:\n");
+//        KeRosDumpStackFrames(GDIHandleAllocator[GDI_HANDLE_GET_INDEX(hObj)], GDI_STACK_LEVELS);
+#endif
       return NULL;
    }
 




More information about the Ros-diffs mailing list